/* =====================================================================
   APC Athalia — tampilan aplikasi (Laravel 12, Bootstrap 5.3)
   Warna diambil dari logo Athalia Parent Community:
   biru (keluarga), hijau daun (anak), merah (kasih).
   Satu file untuk semua halaman: layout, komponen, tabel, form,
   halaman masuk, form orang tua, dan tampilan HP.
   ===================================================================== */

/* ---------- huruf: Plus Jakarta Sans (huruf buatan Indonesia, disimpan lokal) ---------- */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-style: normal; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

:root {
  /* merek (dari logo) */
  --brand: #0A4C86;          /* biru keluarga: aksi utama */
  --brand-hover: #083D6C;
  --brand-ink: #072C4D;      /* sidebar & pita periode */
  --brand-soft: #E8F0F9;     /* sorotan lembut */
  --sky: #9CC0E8;            /* lengkung biru muda di logo */
  --leaf: #3D8C27;           /* hijau anak: berhasil / sudah */
  --leaf-soft: #E9F5E3;
  --berry: #C62F2A;          /* merah kasih: gagal / hapus */
  --berry-soft: #FCEBEA;
  --amber: #9A5B06;          /* perhatian */
  --amber-soft: #FDF2DF;
  --triad: linear-gradient(90deg, #0A4C86 0 33.4%, #4E9F2F 33.4% 66.7%, #DA2D27 66.7% 100%);

  /* permukaan & teks */
  --paper: #F2F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #DBE2EB;
  --line-strong: #C2CDDA;
  --text: #13263A;
  --text-2: #4D6074;
  --text-3: #7F91A4;

  /* nama lama yang masih dipakai inline di beberapa view */
  --ink: var(--brand);
  --ink-soft: var(--brand-soft);
  --ink-deep: var(--brand-ink);
  --ok: var(--leaf);       --ok-soft: var(--leaf-soft);
  --bad: var(--berry);     --bad-soft: var(--berry-soft);
  --warn: var(--amber);    --warn-soft: var(--amber-soft);
  --gold: #E3A21A;         --gold-soft: var(--amber-soft);
  --ground: var(--paper);

  /* bentuk: panel lebih bulat dari kontrol, kontrol lebih bulat dari chip */
  --r-panel: 14px;
  --r-control: 9px;
  --r-chip: 999px;
  --focus: 0 0 0 3px rgba(10, 76, 134, .25);
  --shadow-pop: 0 18px 50px rgba(7, 44, 77, .18);

  --sidebar-w: 260px;
  --sidebar-rail: 72px;
  --topbar-h: 62px;

  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 10, 76, 134;
  --bs-primary-rgb: 10, 76, 134;
}

/* =====================================================================
   Dasar
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  font-family: var(--bs-body-font-family);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--text); font-family: inherit; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
b, strong { font-weight: 700; }
.tnum, td, .table td { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: rgba(10, 76, 134, .16); }
.text-muted { color: var(--text-2) !important; }
.text-body { color: var(--text) !important; }
.text-red, .text-danger { color: var(--berry) !important; }
.text-warning { color: var(--amber) !important; }
.text-link { color: var(--brand); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.muted-dash { color: var(--text-3); }

/* =====================================================================
   Kerangka aplikasi: sidebar + bar atas + isi
   ===================================================================== */
.app { min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: var(--sidebar-w);
  background: var(--brand-ink);
  color: #fff;
  display: flex; flex-direction: column;
  transition: width .2s ease, transform .25s ease;
}
.app-sidebar::before { /* pita tiga warna logo di tepi atas */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--triad);
}
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 18px; color: #fff; text-decoration: none;
  min-height: 76px;
}
.sb-brand:hover { color: #fff; }
.sb-brand img { width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; background: #fff; border-radius: 11px; padding: 4px; }
.sb-brand .sb-name { font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
.sb-brand .sb-name small { display: block; font-size: 12px; font-weight: 500; color: rgba(255,255,255,.6); letter-spacing: 0; }

.sb-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 0 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.sb-section { padding: 16px 22px 6px; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.5); white-space: nowrap; }
.sb-nav { list-style: none; margin: 0; padding: 0; }
.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin: 2px 12px; padding: 9px 12px; min-height: 40px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.3;
  color: rgba(255,255,255,.78); text-decoration: none;
}
.sb-link i { width: 20px; flex: 0 0 20px; text-align: center; font-size: 15px; color: rgba(255,255,255,.55); }
.sb-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sb-link:hover i { color: #fff; }
.sb-link.active { color: #fff; background: rgba(156,192,232,.16); font-weight: 600; }
.sb-link.active i { color: var(--sky); }
.sb-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sky); }
.sb-label { overflow: hidden; text-overflow: ellipsis; }

.sb-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: rgba(255,255,255,.45); white-space: nowrap; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; min-width: 0; }

.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-2);
  font-size: 17px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.tb-brand { display: none; align-items: center; gap: 8px; font-weight: 800; color: var(--brand-ink); text-decoration: none; font-size: 15px; }
.tb-brand img { width: 30px; height: 30px; object-fit: contain; }
.tb-date { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.tb-spacer { flex: 1; }

.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px; border-radius: var(--r-chip); border: 1px solid transparent;
  color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.2;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.user-chip::after { display: none; }
.avatar-initial {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}
.user-chip .user-role { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); }
.user-chip .fa-chevron-down { font-size: 11px; color: var(--text-3); }

.app-content { flex: 1; width: 100%; max-width: none; padding: 28px 32px 48px; }
.app-footer { padding: 16px 32px 22px; font-size: 12.5px; color: var(--text-3); }

.app-backdrop { display: none; }

/* Desktop: sidebar bisa diciutkan jadi rel ikon */
@media (min-width: 992px) {
  body.sb-mini .app-sidebar { width: var(--sidebar-rail); }
  body.sb-mini .app-main { margin-left: var(--sidebar-rail); }
  body.sb-mini .sb-brand { padding-left: 16px; padding-right: 16px; }
  body.sb-mini .sb-brand .sb-name,
  body.sb-mini .sb-section,
  body.sb-mini .sb-label,
  body.sb-mini .sb-foot { display: none; }
  body.sb-mini .sb-link { justify-content: center; margin: 2px 10px; padding: 10px; }
  body.sb-mini .sb-link.active::before { left: -10px; }
  body.sb-mini .sb-nav + .sb-nav { border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; padding-top: 8px; }
}

/* =====================================================================
   Judul halaman
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.025em; margin: 0; line-height: 1.2; color: var(--text); }
.page-desc { margin: 6px 0 0; color: var(--text-2); max-width: 70ch; font-size: 14.5px; }
.page-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); text-decoration: none; margin-bottom: 10px; font-weight: 600;
  padding: 4px 10px 4px 8px; border-radius: var(--r-chip); background: var(--surface); border: 1px solid var(--line);
}
.page-back:hover { color: var(--brand); border-color: var(--line-strong); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-intro {
  position: relative;
  background: var(--brand-soft); border-radius: var(--r-control);
  padding: 12px 16px 12px 44px; margin-bottom: 18px; font-size: 14px; color: var(--text-2);
}
.page-intro::before { content: "\f05a"; position: absolute; left: 16px; top: 12px; font-family: "Font Awesome 6 Free"; font-weight: 900; color: var(--brand); font-size: 15px; line-height: 1.4; }
.page-intro b { color: var(--text); }

/* =====================================================================
   Panel
   ===================================================================== */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(7, 44, 77, .04);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.panel-sub { font-size: 13px; color: var(--text-2); margin: 2px 0 0; }
.panel-body { padding: 20px 22px; }
.panel-foot {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 22px; border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--r-panel) var(--r-panel);
}
.card-body { padding: 20px 22px; }
.form-panel { max-width: 800px; }

.empty-state { padding: 32px 22px; text-align: center; color: var(--text-2); }
.empty-state p { margin: 0; }

/* =====================================================================
   Tab
   ===================================================================== */
.apc-tabs {
  display: inline-flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; max-width: 100%;
  padding: 4px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  scrollbar-width: none;
}
.apc-tabs::-webkit-scrollbar { display: none; }
.apc-tabs .nav-link {
  border: 0; border-radius: 9px; padding: 8px 16px; white-space: nowrap;
  color: var(--text-2); font-weight: 600; font-size: 14px; background: none;
}
.apc-tabs .nav-link:hover { color: var(--text); background: var(--surface-2); }
.apc-tabs .nav-link.active { color: #fff; background: var(--brand); }
.apc-tabs .nav-link .count { margin-left: 6px; font-size: 12px; opacity: .8; }

/* =====================================================================
   Filter di atas tabel
   ===================================================================== */
.filter-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; align-items: end;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.filter-bar .field label { display: block; }
.filter-bar .field-actions { display: flex; gap: 8px; align-items: end; }
.filter-bar .mb-3, .filter-bar .mb-2 { margin-bottom: 0 !important; }
.panel .table-wrap { padding: 6px 22px 18px; }

/* =====================================================================
   Angka ringkasan
   ===================================================================== */
.figures, .stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  margin-bottom: 20px; overflow: hidden;
}
.figure, .stat-card { padding: 16px 22px; border-left: 1px solid var(--line); min-width: 0; position: relative; }
.figure:first-child, .stat-card:first-child { border-left: 0; }
.figure .label, .stat-card .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); }
.figure .value, .stat-card .value {
  display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin-top: 4px;
  color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.figure .note, .stat-card .note { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.figure.ok .value, .stat-card.success .value { color: var(--leaf); }
.figure.bad .value, .stat-card.danger .value { color: var(--berry); }
.figure.warn .value, .stat-card.warning .value { color: var(--amber); }
.stat-card.muted .value { color: var(--text-2); }
.figure.ok::before, .stat-card.success::before { content: ""; position: absolute; left: 22px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--leaf); }
.figure.bad::before, .stat-card.danger::before { content: ""; position: absolute; left: 22px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--berry); }
.stat-card.warning::before { content: ""; position: absolute; left: 22px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.stat-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.modal .stat-row { margin-bottom: 16px; }

/* =====================================================================
   Dashboard
   ===================================================================== */
.greeting { margin-bottom: 22px; }
.greeting .page-title { font-size: 28px; }
.greeting .today { color: var(--text-2); margin: 4px 0 0; font-size: 14.5px; }

.period-band {
  position: relative; overflow: hidden;
  background: var(--brand-ink); color: #fff;
  border-radius: 18px; padding: 26px 30px 24px; margin-bottom: 22px;
}
.period-band::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--triad); }
.period-band::after { /* lengkung biru muda dari logo, samar di pojok */
  content: ""; position: absolute; right: -120px; top: -140px; width: 420px; height: 300px;
  border: 26px solid rgba(156,192,232,.10); border-radius: 50%; transform: rotate(-22deg); pointer-events: none;
}
.period-band > * { position: relative; z-index: 1; }
.period-band .pb-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.period-band .pb-kicker { font-size: 13.5px; color: rgba(255,255,255,.72); font-weight: 500; margin: 0; }
.period-band .pb-name { font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 4px 0 0; color: #fff; }
.period-band .pb-deadline { text-align: right; }
.period-band .pb-deadline .days { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; color: #fff; font-variant-numeric: tabular-nums; }
.period-band .pb-deadline .days.closed { font-size: 20px; opacity: .85; }
.period-band .pb-deadline small { font-size: 13px; color: rgba(255,255,255,.7); }
.period-band .pb-progress { margin-top: 24px; }
.period-band .pb-bar { height: 14px; border-radius: var(--r-chip); background: rgba(255,255,255,.13); overflow: hidden; display: flex; }
.period-band .pb-bar .filled { background: #6CC04A; border-radius: var(--r-chip); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.period-band .pb-legend { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: rgba(255,255,255,.85); }
.period-band .pb-legend b { color: #fff; font-size: 16px; font-variant-numeric: tabular-nums; }
.period-band .pb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.period-band .btn-gold { background: #fff; border-color: #fff; color: var(--brand-ink); }
.period-band .btn-gold:hover { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-ink); }
.period-band .btn-on-dark { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.3); color: #fff; }
.period-band .btn-on-dark:hover { background: rgba(255,255,255,.16); color: #fff; }
.period-band.empty { background: var(--surface); color: var(--text); border: 1px dashed var(--line-strong); }
.period-band.empty::after { display: none; }
.period-band.empty .pb-name { color: var(--text); font-size: 22px; }
.period-band.empty .pb-kicker { color: var(--text-2); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-grid > *, .dash-grid .d-grid > * { min-width: 0; }
.dash-grid .panel { margin-bottom: 0; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }
.mini-list .ml-main { min-width: 0; }
.mini-list .ml-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .ml-sub { font-size: 12.5px; color: var(--text-2); }

.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 16px 22px 20px; }
.quick-link {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); background: var(--surface);
}
.quick-link:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.quick-link i {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 15px;
}
.quick-link:hover i { background: var(--brand); color: #fff; }
.quick-link b { display: block; font-weight: 700; font-size: 14px; }
.quick-link span { font-size: 12.5px; color: var(--text-2); line-height: 1.4; display: block; margin-top: 1px; }

.month-bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding: 18px 22px 0; }
.month-bars .mb-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.month-bars .mb-bar { width: 100%; max-width: 44px; background: var(--brand-soft); border-radius: 8px 8px 2px 2px; min-height: 3px; }
.month-bars .mb-col.current .mb-bar { background: var(--brand); }
.month-bars .mb-val { font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.month-axis { display: flex; gap: 10px; padding: 8px 22px 18px; border-top: 1px solid var(--line); }
.month-axis span { flex: 1; text-align: center; font-size: 12px; color: var(--text-3); }

/* =====================================================================
   Langkah kirim email (urutan nyata 1-2-3)
   ===================================================================== */
.steps { display: flex; flex-wrap: wrap; counter-reset: step; margin-bottom: 20px; gap: 10px; }
.steps .step {
  flex: 1 1 200px; position: relative; counter-increment: step;
  padding: 12px 16px 12px 56px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-3);
}
.steps .step::before {
  content: counter(step); position: absolute; left: 16px; top: 13px;
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-weight: 700; font-size: 13px;
}
.steps .step b { display: block; font-size: 14px; color: var(--text-2); font-weight: 700; }
.steps .step.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); color: var(--text-2); }
.steps .step.active b { color: var(--brand); }
.steps .step.active::before { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps .step.done b { color: var(--leaf); }
.steps .step.done::before { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 12px; background: var(--leaf-soft); border-color: var(--leaf); color: var(--leaf); }

/* progres kirim email */
.send-progress { height: 14px; background: var(--paper); border-radius: var(--r-chip); overflow: hidden; display: flex; margin-bottom: 12px; border: 1px solid var(--line); }
.send-progress .bar-success { background: var(--leaf); transition: width .4s ease; }
.send-progress .bar-danger { background: var(--berry); transition: width .4s ease; }
.send-progress .bar-muted { background: var(--line-strong); transition: width .4s ease; }
.send-status-text { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

/* =====================================================================
   Status
   ===================================================================== */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--r-chip);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
/* status panjang (mis. "Terkirim 26 Oktober 2026 (No. ...)") boleh turun baris supaya tabel tidak melebar */
td .status-pill { white-space: normal; max-width: 240px; align-items: baseline; }
td .status-pill::before { flex: 0 0 7px; transform: translateY(-1px); }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-PENDING { background: #EDF1F6; color: #4D6074; }
.status-PROSES { background: var(--brand-soft); color: var(--brand); }
.status-PROSES::before { animation: apc-pulse 1s ease-in-out infinite; }
.status-TERKIRIM, .status-SUDAH, .status-AKTIF { background: var(--leaf-soft); color: #2F7019; }
.status-GAGAL, .status-BELUM { background: var(--berry-soft); color: var(--berry); }
.status-DILEWATI { background: #F1ECF8; color: #61308A; }
.status-DIBATALKAN, .status-NONAKTIF { background: #EDF1F6; color: #5E6E80; }
.status-PERLU_DICEK { background: var(--amber-soft); color: var(--amber); }
.row-active-send, .row-active-send > *, .row-active, .row-active > * { background-color: var(--brand-soft) !important; }
@keyframes apc-pulse { 50% { opacity: .3; } }

.check-list { max-height: 220px; overflow-y: auto; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-control); padding: 8px 12px 8px 28px; }
.check-list li { margin-bottom: 4px; }

.prev-value { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.prev-value.changed { color: var(--amber); font-weight: 600; }

/* hak akses */
.perm-group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.perm-group-head .form-check-label { font-weight: 700; }
.perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; padding: 10px 16px; }
.perm-items .form-check { margin: 4px 0; }

/* daftar label : nilai */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kv > div { padding: 14px 22px; border-left: 1px solid var(--line); min-width: 0; }
.kv > div:first-child { border-left: 0; }
.kv dt, .kv .k { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 0; }
.kv dd, .kv .v { font-size: 15px; font-weight: 600; margin: 2px 0 0; overflow-wrap: anywhere; }

.contact-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; font-weight: 500; }
.contact-link i { color: var(--text-3); font-size: 13px; }
.contact-link:hover, .contact-link:hover i { color: var(--brand); }

/* editor template */
.placeholder-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.placeholder-chip {
  border: 1px solid var(--line-strong); color: var(--brand); background: var(--surface);
  border-radius: var(--r-chip); font-size: 12.5px; font-weight: 600; padding: 4px 12px; cursor: pointer; font-family: inherit;
}
.placeholder-chip:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.placeholder-help { font-size: 12.5px; color: var(--text-3); }
.note-editor.note-frame { background: #fff; border: 1px solid var(--line-strong) !important; border-radius: var(--r-control); overflow: hidden; }
.note-editor .note-toolbar { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.note-editor .note-editable { font-size: 14px; line-height: 1.6; }
.note-editor .note-btn { border-radius: 7px; }
.sign-preview { max-width: 160px; max-height: 140px; border: 1px solid var(--line); border-radius: var(--r-control); padding: 6px; background: #fff; }
.email-preview-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--r-control); background: #fff; }

/* =====================================================================
   Form
   ===================================================================== */
label, .form-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-check-label { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 0; }
.form-control, .form-select, select.form-control {
  font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  padding: 9px 12px; min-height: 42px; background-color: var(--surface); box-shadow: none;
  transition: border-color .12s, box-shadow .12s;
}
select.form-control {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234D6074' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 10px;
}
select[multiple].form-control { background-image: none; padding-right: 12px; }
.form-control:hover { border-color: var(--text-3); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: var(--focus); }
.form-control::placeholder { color: var(--text-3); }
.form-control[readonly], .form-control:disabled, fieldset:disabled .form-control { background-color: var(--surface-2); color: var(--text-2); }
.form-control.datepicker[readonly], .form-control.datepicker-min[readonly] {
  background-color: var(--surface); color: var(--text); cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3e%3cpath fill='%230A4C86' d='M128 0c17.7 0 32 14.3 32 32v32h128V32c0-17.7 14.3-32 32-32s32 14.3 32 32v32h48c26.5 0 48 21.5 48 48v48H0v-48c0-26.5 21.5-48 48-48h48V32c0-17.7 14.3-32 32-32zM0 192h448v272c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192z'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 14px 14px;
}
input.form-control.is-invalid, textarea.form-control.is-invalid { background-image: none; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--berry); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(198, 47, 42, .2); }
textarea.form-control { min-height: 96px; resize: vertical; }
.form-check-input { border-color: var(--line-strong); width: 1.15em; height: 1.15em; margin-top: .18em; cursor: pointer; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: var(--focus); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.3em; }
.input-group-text { background: var(--surface-2); border-color: var(--line-strong); color: var(--text-2); border-radius: var(--r-control); font-weight: 600; }
.input-group > .form-control:focus { z-index: 3; }
.form-text, .help { font-size: 12.5px; color: var(--text-3); margin-top: 5px; display: block; }
.required::after { content: " *"; color: var(--berry); }
.text-error, .error.text-error { color: var(--berry); font-size: 12.5px; font-weight: 600; display: block; margin-top: 5px; }
.text-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .mb-3, .form-grid .mb-2 { margin-bottom: 0 !important; }
.amount-input { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; max-width: 190px; margin-left: auto; }
.pass-wrap { position: relative; }
.pass-wrap .form-control { padding-right: 46px; }
.pass-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-3); width: 38px; height: 38px; border-radius: 7px; }
.pass-toggle:hover { color: var(--brand); background: var(--surface-2); }

/* =====================================================================
   Tombol
   ===================================================================== */
.btn {
  --btn-spin: var(--brand);
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: var(--r-control); padding: 9px 16px; min-height: 42px; line-height: 1.35;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; text-transform: none; letter-spacing: 0;
  transition: background-color .12s, border-color .12s, color .12s, transform .06s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn i { font-size: .95em; }
.btn:focus-visible { box-shadow: var(--focus); }
.btn-blue, .btn-primary { --btn-spin: #fff; background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.btn-blue:hover, .btn-blue:focus, .btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-gray, .btn-secondary, .btn-outline { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); }
.btn-gray:hover, .btn-gray:focus, .btn-outline:hover { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }
.btn-red, .btn-danger { --btn-spin: #fff; background: var(--berry); border: 1px solid var(--berry); color: #fff; }
.btn-red:hover, .btn-danger:hover { background: #A8251F; border-color: #A8251F; color: #fff; }
.btn-gold, .btn-yellow { background: var(--gold); border: 1px solid var(--gold); color: var(--brand-ink); }
.btn-gold:hover, .btn-yellow:hover { background: #CB8E12; border-color: #CB8E12; color: var(--brand-ink); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--brand); min-height: 36px; padding: 6px 12px; }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn-modal { min-width: 100px; }
.btn-auto { width: auto !important; }
.btn-disabled, .btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }

/* tombol kecil di dalam tabel */
.btn-yellow-mini, .btn-blue-mini, .btn-gray-mini, .btn-red-mini {
  --btn-spin: var(--brand);
  display: inline-flex; align-items: center; gap: 6px; width: auto !important;
  padding: 5px 11px; min-height: 32px; margin: 2px 4px 2px 0;
  font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; text-decoration: none;
  border-radius: 8px; cursor: pointer; font-family: inherit;
}
.btn-yellow-mini { background: var(--surface); border: 1px solid var(--line-strong); color: var(--brand); }
.btn-yellow-mini:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.btn-blue-mini { --btn-spin: #fff; background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.btn-blue-mini:hover { background: var(--brand-hover); color: #fff; }
.btn-gray-mini { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); }
.btn-gray-mini:hover { background: var(--surface-2); color: var(--text); }
.btn-red-mini, .button-delete { --btn-spin: var(--berry); background: var(--surface); border: 1px solid #EBB9B5; color: var(--berry); }
.btn-red-mini:hover, .button-delete:hover { background: var(--berry-soft); color: var(--berry); }
.btn-yellow-mini.btn-fit, .btn-blue-mini.btn-fit, .btn-gray-mini.btn-fit { white-space: nowrap; }

/* =====================================================================
   Tabel
   ===================================================================== */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--surface-2); color: var(--text); margin-bottom: 0; font-size: 14px; }
.table > :not(caption) > * > * { padding: 11px 12px; border-bottom-color: var(--line); background-color: transparent; box-shadow: none; }
.table thead th, table.dataTable thead th, table.dataTable thead td {
  font-size: 12.5px; font-weight: 700; color: var(--text-2); background: var(--surface-2);
  border-bottom: 1px solid var(--line) !important; border-top: 0; white-space: nowrap; vertical-align: bottom;
}
.table thead th:first-child { border-top-left-radius: 10px; }
.table thead th:last-child { border-top-right-radius: 10px; }
.table tbody tr:hover > * { background-color: #F6F9FD; }
.table td { vertical-align: middle; }
.table .form-check .form-check-input { float: none; margin-left: 0; }
td.num, th.num, .text-end-num { text-align: right; font-variant-numeric: tabular-nums; }
.total-row td { font-weight: 800; background: var(--surface-2) !important; }
.table-sm > :not(caption) > * > * { padding: 8px 10px; }

/* DataTables */
.dataTables_wrapper { font-size: 13.5px; color: var(--text-2); position: relative; }
.dataTables_wrapper::after { content: ""; display: table; clear: both; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info { float: left; }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_paginate { float: right; text-align: right; }
.dataTables_wrapper .dataTables_scroll, .dataTables_wrapper > table { clear: both; }
.dataTables_wrapper .dataTables_paginate .paginate_button { text-decoration: none !important; cursor: pointer; font-size: 14px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.previous, .dataTables_wrapper .dataTables_paginate .paginate_button.next { font-size: 18px; line-height: 1; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin: 10px 0 12px; }
.dataTables_wrapper .dataTables_length label, .dataTables_wrapper .dataTables_filter label { font-weight: 500; color: var(--text-2); font-size: 13.5px; margin: 0; }
.dataTables_wrapper .dataTables_length select, .dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line-strong); border-radius: var(--r-control); padding: 6px 10px; min-height: 36px;
  background-color: #fff; color: var(--text); margin: 0 6px; font-family: inherit;
}
.dataTables_wrapper .dataTables_filter input { margin-right: 0; width: 240px; }
.dataTables_wrapper .dataTables_filter input:focus, .dataTables_wrapper .dataTables_length select:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.dataTables_wrapper .dataTables_info { padding-top: 16px; color: var(--text-2); font-size: 13px; }
.dataTables_wrapper .dataTables_paginate { padding-top: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 36px; height: 36px; display: inline-flex !important; align-items: center; justify-content: center;
  border: 1px solid transparent !important; border-radius: 9px !important; background: transparent !important;
  color: var(--text-2) !important; padding: 0 10px !important; margin-left: 3px; font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--line) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover { color: var(--text-3) !important; background: transparent !important; border-color: transparent !important; }
.dataTables_wrapper .dataTables_paginate .ellipsis { padding: 0 6px; }
table.dataTable { border-collapse: collapse !important; margin: 0 !important; width: 100% !important; }
table.dataTable.no-footer { border-bottom: 1px solid var(--line); }
table.dataTable tbody td { padding: 11px 12px; border-top: 0; border-bottom: 1px solid var(--line); }
table.dataTable tbody tr:last-child td { border-bottom: 0; }
table.dataTable tbody tr.selected > * { box-shadow: none !important; color: inherit !important; }
.dataTables_empty { padding: 36px 12px !important; color: var(--text-3); text-align: center; }
table.dataTable thead > tr > th.sorting, table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc { padding-right: 28px !important; cursor: pointer; position: relative; }
table.dataTable thead > tr > th.sorting::before, table.dataTable thead > tr > th.sorting_asc::before, table.dataTable thead > tr > th.sorting_desc::before { display: none !important; }
table.dataTable thead > tr > th.sorting::after, table.dataTable thead > tr > th.sorting_asc::after, table.dataTable thead > tr > th.sorting_desc::after {
  position: absolute; right: 10px; bottom: 12px; top: auto !important; font-size: 11px; line-height: 1; opacity: 1 !important;
  font-family: "Font Awesome 6 Free"; font-weight: 900; color: var(--text-3); content: "\f0dc" !important;
}
table.dataTable thead > tr > th.sorting_asc::after { content: "\f0de" !important; color: var(--brand); }
table.dataTable thead > tr > th.sorting_desc::after { content: "\f0dd" !important; color: var(--brand); }
div.dataTables_wrapper div.dataTables_processing {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 5;
  width: auto; height: auto; margin: 0; padding: 8px 18px 8px 40px;
  background: var(--surface) !important; border: 1px solid var(--line); border-radius: var(--r-chip);
  box-shadow: var(--shadow-pop); color: var(--text); font-size: 13px; font-weight: 600; text-align: left;
}
div.dataTables_wrapper div.dataTables_processing > div:not(:empty) { display: none; }
div.dataTables_wrapper div.dataTables_processing > div:last-child { display: none; }
div.dataTables_wrapper div.dataTables_processing::before {
  content: ""; position: absolute; left: 15px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px;
  border-radius: 50%; border: 2px solid var(--brand-soft); border-top-color: var(--brand); animation: apc-spin .7s linear infinite;
}
.dataTables_wrapper.is-processing table.dataTable tbody { opacity: .55; transition: opacity .15s; }
div.dt-buttons { display: none; }

/* =====================================================================
   Pesan, modal, dropdown, popup
   ===================================================================== */
.alert { border-radius: 11px; border: 1px solid transparent; padding: 12px 16px; font-size: 14px; font-weight: 500; }
.alert-danger { background: var(--berry-soft); border-color: #F1C5C2; color: #8F221E; }
.alert-success { background: var(--leaf-soft); border-color: #C6E3B9; color: #2C6719; }
.alert-info { background: var(--brand-soft); border-color: #C9DAEE; color: #0A3E6E; }
.alert-warning { background: var(--amber-soft); border-color: #F2D6A6; color: #7A4704; }
.alert .fa-solid, .alert .fa-regular { margin-right: 6px; }

.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-pop); }
.modal-header { border-bottom: 1px solid var(--line); padding: 18px 22px; }
.modal-title { font-size: 17px !important; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-footer { border-top: 1px solid var(--line); padding: 14px 22px; gap: 8px; background: var(--surface-2); border-radius: 0 0 18px 18px; }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-bg: #061E36; --bs-backdrop-opacity: .45; }

.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; font-size: 14px; min-width: 220px; }
.dropdown-item { border-radius: 8px; padding: 9px 12px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.dropdown-item i { width: 18px; text-align: center; color: var(--text-2); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-header { font-size: 12px; color: var(--text-3); padding: 6px 12px 4px; }

/* SweetAlert */
.swal-overlay { background-color: rgba(6, 30, 54, .45); }
.swal-modal { border-radius: 18px; font-family: var(--bs-body-font-family); width: 440px; max-width: calc(100% - 32px); }
.swal-title { font-size: 19px; font-weight: 800; color: var(--text); padding: 8px 22px 0; letter-spacing: -.01em; }
.swal-title:not(:last-child) { margin-bottom: 8px; }
.swal-text { font-size: 14px; color: var(--text-2); text-align: center; line-height: 1.6; padding: 0 24px; max-width: none; display: block; }
.swal-footer { text-align: center; padding: 12px 22px 22px; margin-top: 12px; }
.swal-button { font-family: inherit; font-size: 14px; font-weight: 600; border-radius: var(--r-control); padding: 10px 22px; background: var(--brand); }
.swal-button:not([disabled]):hover { background: var(--brand-hover); }
.swal-button:focus { box-shadow: var(--focus); }
.swal-button--cancel { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.swal-button--cancel:not([disabled]):hover { background: var(--surface-2); }
.swal-button--danger { background: var(--berry); }
.swal-button--danger:not([disabled]):hover { background: #A8251F; }
.swal-icon { transform: scale(.8); margin: 20px auto 2px; }
.swal-icon--success__ring { border-color: rgba(61, 140, 39, .25); }
.swal-icon--success__line { background-color: var(--leaf); }
.swal-icon--warning { border-color: var(--gold); }
.swal-icon--warning__body, .swal-icon--warning__dot { background-color: var(--gold); }
.swal-icon--error { border-color: var(--berry); }
.swal-icon--error__line { background-color: var(--berry); }
.swal-icon--info { border-color: var(--brand); }
.swal-icon--info::before, .swal-icon--info::after { background-color: var(--brand); }

/* jQuery UI datepicker (tanpa tema bawaan jQuery UI) */
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px, 1px, 1px, 1px); width: 1px; height: 1px; overflow: hidden; }
.ui-datepicker {
  display: none; width: 296px; z-index: 1065 !important; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
  font-family: var(--bs-body-font-family); font-size: 13.5px;
}
.ui-datepicker-header { position: relative; display: flex; align-items: center; justify-content: center; height: 40px; margin-bottom: 6px; }
.ui-datepicker-title { font-weight: 700; color: var(--text); }
.ui-datepicker-prev, .ui-datepicker-next {
  position: absolute; top: 2px; width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-2); text-decoration: none;
}
.ui-datepicker-prev { left: 0; } .ui-datepicker-next { right: 0; }
.ui-datepicker-prev:hover, .ui-datepicker-next:hover { background: var(--surface-2); color: var(--brand); }
.ui-datepicker-prev span, .ui-datepicker-next span { display: none; }
.ui-datepicker-prev::before, .ui-datepicker-next::before { font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 12px; }
.ui-datepicker-prev::before { content: "\f053"; } .ui-datepicker-next::before { content: "\f054"; }
.ui-datepicker-prev.ui-state-disabled, .ui-datepicker-next.ui-state-disabled { opacity: .3; pointer-events: none; }
.ui-datepicker-calendar { width: 100%; border-collapse: collapse; }
.ui-datepicker-calendar th { font-size: 12px; font-weight: 600; color: var(--text-3); text-align: center; padding: 4px 0 6px; }
.ui-datepicker-calendar td { padding: 1px; text-align: center; }
.ui-datepicker-calendar td a, .ui-datepicker-calendar td span {
  display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 9px;
  color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums;
}
.ui-datepicker-calendar td a:hover { background: var(--brand-soft); color: var(--brand); }
.ui-datepicker-calendar .ui-state-highlight { box-shadow: inset 0 0 0 1px var(--brand); font-weight: 700; }
.ui-datepicker-calendar .ui-state-active { background: var(--brand) !important; color: #fff !important; font-weight: 700; }
.ui-datepicker-calendar .ui-state-disabled span, .ui-datepicker-unselectable span { color: var(--line-strong); }
.ui-datepicker-other-month span { visibility: hidden; }

/* =====================================================================
   Tanda "sedang memproses"
   ===================================================================== */
@keyframes apc-spin { to { transform: rotate(360deg); } }
@keyframes apc-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* 1. bar tipis tiga warna di atas layar (setiap Ajax & pindah halaman) */
#apc-topbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; opacity: 0; z-index: 3000; pointer-events: none;
  background: var(--triad); background-size: 100vw 100%;
  box-shadow: 0 0 10px rgba(10, 76, 134, .45);
  transition: width .25s ease, opacity .35s ease;
}
#apc-topbar.on { opacity: 1; }

/* 2. tombol yang diklik: putaran kecil di depan teks, tombol tidak bisa diklik dua kali */
.is-loading { position: relative; pointer-events: none !important; cursor: progress; opacity: .85; }
.is-loading > i { display: none !important; }
.is-loading::before {
  content: ""; display: inline-block; flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; opacity: .9;
  animation: apc-spin .7s linear infinite;
}
.btn-yellow-mini.is-loading::before, .btn-gray-mini.is-loading::before, .btn-red-mini.is-loading::before { width: 12px; height: 12px; }

/* 3. pesan melayang bila proses berjalan lebih dari 1 detik */
#apc-busy {
  position: fixed; left: 50%; bottom: 22px; z-index: 3001; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 10px 18px 10px 14px; border-radius: var(--r-chip);
  background: var(--brand-ink); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#apc-busy.on { opacity: 1; transform: translate(-50%, 0); }
#apc-busy .spin { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: apc-spin .7s linear infinite; }

/* 4. layar diblokir saat menyimpan (show_loading) */
.overlay {
  position: fixed; inset: 0; z-index: 2000; display: none;
  background: rgba(242, 245, 249, .6); backdrop-filter: blur(2px); cursor: progress;
}
.overlay .ov-card {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 240px; padding: 22px 22px 18px; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop);
}
.overlay .ov-text { font-weight: 700; color: var(--text); font-size: 14px; }
.overlay .ov-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.overlay .ov-bar { position: relative; height: 4px; margin-top: 14px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; }
.overlay .ov-bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 40%; border-radius: 4px; background: var(--triad); animation: apc-indeterminate 1.1s ease-in-out infinite; }

/* =====================================================================
   Halaman masuk / lupa password
   ===================================================================== */
.auth-body { min-height: 100vh; display: flex; background: var(--paper); }
.auth-side {
  flex: 0 0 44%; position: relative; overflow: hidden;
  background: var(--brand-ink); color: #fff;
  padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--triad); }
.auth-side::after {
  content: ""; position: absolute; right: -180px; bottom: -160px; width: 560px; height: 380px;
  border: 34px solid rgba(156,192,232,.10); border-radius: 50%; transform: rotate(-24deg);
}
.auth-side > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; color: #fff; }
.auth-brand img { width: 48px; height: 48px; background: #fff; border-radius: 12px; padding: 5px; object-fit: contain; }
.auth-side h1 { color: #fff; font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: 1.12; margin: 0 0 16px; max-width: 15ch; }
.auth-side p { color: rgba(255,255,255,.75); font-size: 15.5px; max-width: 42ch; margin: 0; }
.auth-side .auth-foot { font-size: 12.5px; color: rgba(255,255,255,.5); }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.auth-card .auth-lead { color: var(--text-2); margin: 0 0 26px; font-size: 14.5px; }
.auth-card .form-control { min-height: 46px; }
.auth-card .btn-blue { width: 100%; min-height: 46px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .code-input { letter-spacing: .5em; font-size: 24px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.auth-mobile-brand { display: none; }

/* =====================================================================
   Form pengkinian data untuk orang tua (halaman publik)
   ===================================================================== */
.parent-page { background: var(--paper); min-height: 100vh; }
.parent-head { position: relative; background: var(--brand-ink); color: #fff; padding: 26px 20px 30px; overflow: hidden; }
.parent-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--triad); }
.parent-head-inner { position: relative; max-width: 860px; margin: 0 auto; display: flex; gap: 14px; align-items: center; }
.parent-head img { width: 52px; height: 52px; background: #fff; border-radius: 12px; padding: 5px; object-fit: contain; }
.parent-head h1 { color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.parent-head p { color: rgba(255,255,255,.75); margin: 2px 0 0; font-size: 14px; }
.parent-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 56px; }
.q-block { padding: 18px 22px; border-top: 1px solid var(--line); }
.q-block:first-of-type { border-top: 0; }
.q-num {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 28px;
  width: 28px; height: 28px; border-radius: 50%; margin-right: 10px;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px;
}
.q-label { display: flex; align-items: flex-start; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.45; }
.q-block .form-text[style] { margin-left: 38px !important; }
.parent-submit {
  position: sticky; bottom: 0; z-index: 10; margin-top: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: rgba(242, 245, 249, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.img-file, .img-file-preview { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-control); }
.box-image { position: relative; display: inline-block; }

/* Halaman persetujuan GBK (orang tua) */
.approval-done {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px;
  background: var(--leaf-soft); border: 1px solid #BFDDB1; border-radius: var(--r-panel);
}
.approval-done-icon { font-size: 30px; line-height: 1; color: var(--leaf); }
.approval-done h2 { font-size: 18px; font-weight: 800; color: #24611A; margin: 0 0 4px; }
.approval-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.approval-student { border: 1px solid var(--line); border-radius: var(--r-control); padding: 10px 14px; background: var(--surface-2); }
.approval-amount { font-weight: 800; color: var(--brand); margin-top: 4px; font-variant-numeric: tabular-nums; }
.approval-amount span { font-weight: 500; color: var(--text-2); font-size: 13px; }
.approval-form .form-check-label { line-height: 1.5; }
.letter-paper {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-control);
  padding: 24px 28px; font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.4; color: #000;
  overflow-x: auto;
}
.letter-paper p { margin: 0 0 12px; }
.letter-paper table { font-size: inherit; }
.letter-paper td { vertical-align: top; }
.letter-paper img[alt="ttd"] { width: 90px; height: auto; }
.letter-isi > table { margin-bottom: 12px; }
.letter-kop { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid #000; padding-bottom: 8px; margin-bottom: 16px; }
.letter-kop-logo { flex: 0 0 72px; text-align: center; }
.letter-kop-logo img { max-width: 68px; max-height: 68px; }
.letter-kop-teks { flex: 1; text-align: center; font-family: var(--font, "Plus Jakarta Sans", sans-serif); }
.letter-kop-nama { font-weight: 800; font-size: 15px; }
.letter-kop-alamat { font-size: 12px; line-height: 1.35; }
@media (max-width: 575.98px) {
  .letter-paper { padding: 16px 14px; font-size: 14px; }
  .letter-kop-logo { flex-basis: 44px; }
  .letter-kop-logo img { max-width: 42px; max-height: 42px; }
  .letter-kop-nama { font-size: 13px; }
  .letter-kop-alamat { font-size: 10.5px; }
  .letter-paper td[style*="width: 260px"] { width: auto !important; padding-right: 16px !important; }
  .letter-paper .tabel-rincian { font-size: 12.5px; }
  .letter-paper .tabel-rincian th, .letter-paper .tabel-rincian td { width: auto !important; padding: 5px 5px !important; }
  .letter-paper .tabel-rincian td { white-space: normal !important; }
}

/* Template surat: tombol simpan per tab */
.save-bar { position: sticky; bottom: 12px; z-index: 5; box-shadow: 0 8px 30px rgba(16, 22, 79, .12); }
.save-bar .panel-body { padding-top: 12px; padding-bottom: 12px; }
.apc-tabs .tab-dirty { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: 7px; vertical-align: middle; }
.apc-tabs .nav-link.is-dirty .tab-dirty { display: inline-block; }

/* Laporan persetujuan: baris aksi massal */
.bulk-bar { padding: 10px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.row-actions { display: inline-flex; flex-direction: column; align-items: stretch; gap: 6px; }
.row-actions > a { margin: 0 !important; justify-content: center; white-space: nowrap; }
table.is-cards .row-actions { flex-direction: row; flex-wrap: wrap; }

/* Status persetujuan di laporan */
.status-pill.status-SETUJU { background: var(--leaf-soft); color: #24611A; }
.status-pill.status-BELUM { background: var(--amber-soft); color: var(--amber); }

/* =====================================================================
   Halaman error
   ===================================================================== */
.err-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--paper); }
.err { max-width: 480px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px 32px 30px; position: relative; overflow: hidden; }
.err::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--triad); }
.err .err-code { display: inline-block; font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 3px 12px; border-radius: var(--r-chip); margin-bottom: 14px; }
.err h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.err p { color: var(--text-2); margin: 0 0 22px; }

/* =====================================================================
   Layar kecil
   ===================================================================== */
@media (max-width: 1199.98px) {
  .dash-grid { grid-template-columns: 1fr; }
  .app-content { padding: 24px 24px 40px; }
}

@media (max-width: 991.98px) {
  /* sidebar jadi laci dari kiri */
  .app-sidebar { transform: translateX(-100%); box-shadow: none; }
  body.sb-open .app-sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(6, 30, 54, .4); }
  .app-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(6, 30, 54, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.sb-open .app-backdrop { opacity: 1; pointer-events: auto; }
  body.sb-open { overflow: hidden; }
  .app-main { margin-left: 0; }
  .app-topbar { padding: 0 16px; }
  .tb-brand { display: inline-flex; }
  .tb-date { display: none; }
  .app-content { padding: 20px 16px 36px; }
  .app-footer { padding: 12px 16px 20px; }

  .auth-side { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; margin-bottom: 30px; color: var(--brand-ink); }
  .auth-mobile-brand img { width: 44px; height: 44px; object-fit: contain; }
}

@media (max-width: 767.98px) {
  body { font-size: 14.5px; }
  .page-head { align-items: stretch; margin-bottom: 18px; }
  .page-title, .greeting .page-title { font-size: 23px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-head > div[style*="min-width"] { min-width: 0 !important; width: 100%; }
  .user-chip .user-meta { display: none; }

  .panel-head, .panel-body, .panel-foot { padding-left: 16px; padding-right: 16px; }
  .panel-foot .btn { flex: 1 1 auto; }
  .panel .table-wrap { padding: 4px 12px 14px; }
  .filter-bar { grid-template-columns: 1fr 1fr; padding: 14px 16px; }
  .filter-bar .field-actions { grid-column: 1 / -1; }
  .filter-bar .field-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .apc-tabs { display: flex; }
  .apc-tabs .nav-link { flex: 1 0 auto; }

  .figures, .stat-row { grid-template-columns: 1fr 1fr; }
  .figure, .stat-card { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px; }
  .figure:nth-child(-n+2), .stat-card:nth-child(-n+2) { border-top: 0; }
  .figure:nth-child(even), .stat-card:nth-child(even) { border-left: 1px solid var(--line); }
  .figure .value, .stat-card .value { font-size: 21px; }
  .figure.ok::before, .figure.bad::before, .stat-card.success::before, .stat-card.danger::before, .stat-card.warning::before { left: 16px; }

  .period-band { padding: 22px 18px 20px; border-radius: 16px; }
  .period-band .pb-name, .period-band .pb-deadline .days { font-size: 25px; }
  .period-band .pb-deadline { text-align: left; }
  .period-band .pb-actions .btn { flex: 1 1 auto; }
  .kv > div { border-left: 0; border-top: 1px solid var(--line); padding: 12px 16px; }
  .kv > div:first-child { border-top: 0; }
  .steps { gap: 6px; }
  .steps .step { flex-basis: 100%; }
  .modal-footer .btn { flex: 1; }
  .q-block { padding: 16px; }
  .q-block .form-text[style] { margin-left: 0 !important; }
  .amount-input { max-width: none; }
  .mini-list li { padding: 12px 16px; }
  .quick-links { padding: 14px 16px 16px; }
  .email-preview-frame { height: 420px; }

  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { float: none; text-align: left !important; }
  .dataTables_wrapper .dataTables_filter label { width: 100%; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; margin: 6px 0 0; }
  .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { float: none; text-align: center !important; }

  /* Tabel jadi kartu: setiap baris satu kartu, setiap kolom satu baris "label : isi" */
  .table-responsive:has(table.is-cards) { overflow: visible; }
  .panel > .table-responsive:has(table.is-cards), .panel > form > .table-responsive:has(table.is-cards) { padding: 12px 12px 2px; }
  table.is-cards tfoot td { font-size: 15px; }
  table.is-cards { border: 0 !important; }
  table.is-cards thead { display: none; }
  table.is-cards, table.is-cards tbody, table.is-cards tfoot, table.is-cards tr, table.is-cards td { display: block; width: 100% !important; }
  table.is-cards tbody tr, table.is-cards tfoot tr {
    position: relative; margin: 0 0 10px; padding: 6px 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  }
  table.is-cards tbody tr:hover > * { background: transparent; }
  table.is-cards tbody td, table.is-cards tfoot td {
    display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; align-items: start;
    padding: 8px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--line) !important;
    text-align: left !important; overflow-wrap: anywhere;
  }
  table.is-cards td:last-child { border-bottom: 0 !important; }
  table.is-cards td::before { content: attr(data-label); font-size: 12.5px; font-weight: 600; color: var(--text-3); line-height: 1.5; }
  table.is-cards td[data-label=""] { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding-top: 10px !important; }
  table.is-cards td[data-label=""] > * { margin: 0 !important; }
  .panel-head .btn-ghost { padding-left: 0; padding-right: 0; }
  table.is-cards td[data-label=""]::before { display: none; }
  table.is-cards td.num { text-align: left !important; }
  table.is-cards td .amount-input, table.is-cards td .input-group { max-width: none !important; margin-left: 0 !important; }
  table.is-cards td.dataTables_empty { display: block; text-align: center !important; border: 0 !important; }
  table.is-cards td.dataTables_empty::before { display: none; }
  table.is-cards tr.total-row td { background: transparent !important; }
  table.is-cards td.dt-check { position: absolute; top: 10px; right: 12px; width: auto !important; border: 0 !important; padding: 0 !important; display: block; }
  table.is-cards td.dt-check::before { display: none; }
  table.is-cards tr.has-check { padding-right: 46px; }
  table.is-cards td > .status-pill, table.is-cards td > .btn-yellow-mini { justify-self: start; }
}

@media (max-width: 575.98px) {
  .filter-bar { grid-template-columns: 1fr; }
  .figures, .stat-row { grid-template-columns: 1fr 1fr; }
  .month-bars, .month-axis { gap: 4px; padding-left: 12px; padding-right: 12px; }
  .month-bars .mb-val { font-size: 10.5px; }
  .auth-card h2 { font-size: 24px; }
  .swal-footer { display: flex; flex-direction: column-reverse; gap: 8px; }
  .swal-button-container { margin: 0; width: 100%; }
  .swal-button { width: 100%; }
  #apc-busy { bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .is-loading::before, #apc-busy .spin, div.dataTables_wrapper div.dataTables_processing::before { animation: apc-spin 1.4s linear infinite !important; animation-iteration-count: infinite !important; }
}

@media print {
  .app-sidebar, .app-topbar, .app-footer, .page-actions, .no-print, #apc-topbar, #apc-busy { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0; }
  body { background: #fff; }
}

@media (min-width: 768px) {
  td.num { white-space: nowrap; }
}
