/* =====================================================================
   SISTEM SANKSI PERUSAHAAN — DLH PROVINSI JAMBI
   Design system "Batanghari": petrol sungai + kuning lumpur (silt),
   permukaan dingin netral, garis kontur topografi sebagai motif.
   Urutan: tokens → dasar → layout → komponen → halaman → responsif
   ===================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  color-scheme: light;

  /* merek */
  --ink-950: #0b1a2d;
  --ink-900: #11253f;
  --ink-800: #173459;
  --brand-700: #1d4a85;
  --brand-600: #2457a0;
  --brand-500: #3a72b8;
  --brand-300: #9dbde3;
  --brand-100: #e1ebf8;
  --brand-50: #eff4fb;
  --silt-500: #8db4e6;   /* kuning lumpur: hanya untuk penanda, bukan latar besar */
  --silt-300: #bcd4f1;

  /* permukaan & garis */
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #ebeff5;
  --line: #dde4ed;
  --line-strong: #c6d1de;

  /* teks */
  --text: #141f30;
  --text-2: #435269;
  --muted: #5a6a7f;
  --on-brand: #ffffff;
  --link: #1f58a3;

  /* status — selalu dipasangkan dengan ikon/label, tidak hanya warna */
  --green: #137a52;  --green-bg: #e2f4eb;  --green-line: #b9e3cf;
  --amber: #8f5500;  --amber-bg: #fcf0d9;  --amber-line: #f1d9a6;
  --red:   #b3261e;  --red-bg:   #fce9e7;  --red-line:   #f2c5c0;

  --shadow-sm: 0 1px 2px rgba(17, 37, 63, .06), 0 1px 1px rgba(17, 37, 63, .04);
  --shadow: 0 2px 4px rgba(17, 37, 63, .04), 0 8px 24px rgba(17, 37, 63, .07);
  --shadow-lg: 0 4px 8px rgba(17, 37, 63, .06), 0 24px 56px rgba(17, 37, 63, .16);
  --ring: 0 0 0 3px rgba(58, 114, 184, .32);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.76, 0, .24, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 150ms;
  --t-med: 280ms;
  --t-slow: 560ms;

  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 76px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1320;
  --surface: #101c2e;
  --surface-2: #142238;
  --surface-3: #1a2b44;
  --line: #243650;
  --line-strong: #34496a;

  --text: #e6edf7;
  --text-2: #b3c1d6;
  --muted: #8fa1ba;
  --link: #7fb0ea;
  --brand-100: #182c4a;
  --brand-50: #13233b;

  --green: #5fd3a0;  --green-bg: #0f3a2b;  --green-line: #1b5a43;
  --amber: #f0bb62;  --amber-bg: #3a2a0c;  --amber-line: #5f4616;
  --red:   #ff9b92;  --red-bg:   #421a17;  --red-line:   #6a2b27;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(127, 176, 234, .40);
}

/* ---------- 2. DASAR ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num, .stat-number, td.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }
[data-theme="dark"] :focus-visible { outline-color: var(--brand-300); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 3000;
  background: var(--ink-900); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  transition: top var(--t-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }

::selection { background: var(--brand-300); color: var(--ink-950); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg); }

/* ---------- 3. LAYOUT ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--ink-900);
  color: #cdd9ea;
  overflow: hidden;
  transition: width var(--t-med) var(--ease-out);
  z-index: 40;
}
.sidebar::before {            /* kontur topografi sebagai tekstur */
  content: ""; position: absolute; inset: auto -40% -18% -40%; aspect-ratio: 1;
  background: url('../images/topo.svg') center / contain no-repeat;
  opacity: .16; pointer-events: none;
  animation: topo-drift 90s linear infinite;
}
.sidebar-top { position: relative; z-index: 1; padding: 22px 16px 12px; overflow-y: auto; flex: 1; }
.sidebar-foot {
  position: relative; z-index: 1; padding: 14px 18px 18px;
  font-size: 11.5px; color: #8aa0bf; border-top: 1px solid rgba(255, 255, 255, .08);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; margin-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.brand-logo { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.brand-logo svg { width: 42px; height: 42px; display: block; }
.brand-text { font-size: 12.5px; font-weight: 800; letter-spacing: .01em; color: #fff; line-height: 1.35; }
.brand-text .sub { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; color: var(--silt-300); }

.nav-section-label { padding: 8px 12px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7f95b3; }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 11px;
  color: #bccbe0; font-size: 14px; font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-med) var(--ease-out);
}
.sidebar nav a i { font-size: 17px; width: 20px; text-align: center; flex: none; transition: transform var(--t-med) var(--ease-spring); }
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a:hover i { transform: scale(1.14) rotate(-4deg); }
.sidebar nav a.active { background: rgba(255, 255, 255, .11); color: #fff; }
.sidebar nav a.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--silt-500);
  animation: bar-in var(--t-slow) var(--ease-out) both;
}
.sidebar nav a:focus-visible { outline-color: var(--silt-300); }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--ink-950); background: var(--silt-500);
}

.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .brand { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-foot span { display: none; }
.sidebar-collapsed .sidebar nav a { justify-content: center; padding: 12px; }
.sidebar-collapsed .sidebar nav a .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
.sidebar-collapsed .sidebar nav a.active::before { left: -16px; }
.sidebar-collapsed .sidebar nav a:hover::after {   /* tooltip saat ciut */
  content: attr(data-label); position: fixed; left: 84px; z-index: 100;
  padding: 6px 10px; border-radius: 8px; background: var(--ink-950); color: #fff;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow);
}

.sidebar-overlay { display: none; }

/* konten utama */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-content { flex: 1; padding: 8px 36px 32px; width: 100%; max-width: 1480px; margin-inline: auto; }

/* topbar */
.global-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 36px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med), box-shadow var(--t-med);
}
.global-topbar.is-stuck { border-bottom-color: var(--line); box-shadow: 0 6px 20px -14px rgba(17, 37, 63, .35); }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-date { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-name { font-size: 16px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  display: inline-grid; place-items: center; font-size: 17px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { color: var(--brand-600); border-color: var(--brand-300); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
[data-theme="dark"] .icon-btn:hover { color: var(--brand-300); }
.icon-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; color: #fff; background: var(--red);
  border: 2px solid var(--bg);
}
.icon-btn.has-alert .bi-bell { animation: bell-ring 2.4s var(--ease-out) 1.2s 2; transform-origin: 50% 0; }

.theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-sun-fill { display: inline; }
[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }

/* dropdown umum */
.notif-wrap, .user-menu-wrap { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.96); transform-origin: top right;
  transition: opacity var(--t-fast), transform var(--t-med) var(--ease-spring), visibility var(--t-fast);
}
.dropdown.open { opacity: 1; visibility: visible; transform: none; }
.notif-dropdown { width: 360px; max-width: calc(100vw - 24px); }
.user-dropdown { width: 248px; padding: 6px; }

.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: var(--brand-600); background: var(--brand-100); }
[data-theme="dark"] .pill { color: var(--brand-300); }
.notif-list { max-height: 330px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; flex: none; background: var(--muted); }
.notif-dot.status-kuning { background: var(--amber); }
.notif-dot.status-merah { background: var(--red); }
.notif-item-title { font-weight: 700; font-size: 13.5px; }
.notif-item-desc { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.notif-empty i { display: block; margin-bottom: 8px; font-size: 26px; color: var(--green); }
.dd-foot { display: block; padding: 12px 16px; text-align: center; font-size: 13px; font-weight: 700; border-top: 1px solid var(--line); background: var(--surface-2); }
.dd-foot:hover { background: var(--brand-50); }

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  text-align: left; transition: border-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.user-chip:hover, .user-chip.open { border-color: var(--brand-300); }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff; background: var(--brand-600);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 700; font-size: 13.5px; }
.user-role { font-size: 11.5px; color: var(--muted); }
.user-caret { font-size: 11px; color: var(--muted); transition: transform var(--t-med) var(--ease-out); }
.user-chip.open .user-caret { transform: rotate(180deg); }
.user-dropdown-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.user-dropdown form { margin: 0; }
.dd-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 0; border-radius: 10px; background: transparent; text-align: left;
  font-size: 13.5px; font-weight: 600; color: var(--text); transition: background var(--t-fast);
}
.dd-item.danger { color: var(--red); }
.dd-item:hover { background: var(--surface-3); }
.dd-item.danger:hover { background: var(--red-bg); }

/* footer */
.app-footer { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 18px 36px 26px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- 4. KOMPONEN ---------- */

/* kepala halaman */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-head h2 { display: flex; align-items: center; gap: 12px; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); font-weight: 800; letter-spacing: -.02em; }
.page-head h2 .ph-icon { width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 19px; color: var(--brand-600); background: var(--brand-100); flex: none; }
[data-theme="dark"] .page-head h2 .ph-icon { color: var(--brand-300); }
.page-head .subtitle { margin-top: 6px; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.page-actions form { margin: 0; }

/* kartu */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 24px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; }
.card-title i { color: var(--brand-500); font-size: 17px; }
.card-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.card-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; font-weight: 700; }
.card-link i { transition: transform var(--t-med) var(--ease-out); }
.card-link:hover i { transform: translateX(4px); }

/* tombol */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 11px; border: 1.5px solid transparent;
  font-size: 14px; font-weight: 700; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-med), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn i { font-size: 15px; transition: transform var(--t-med) var(--ease-spring); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(17, 37, 63, .25); }
.btn-primary:hover { background: var(--brand-700); box-shadow: 0 6px 14px -6px rgba(29, 74, 133, .55); color: #fff; }
.btn-primary:hover i.bi-plus-lg, .btn-primary:hover i.bi-arrow-right { transform: rotate(90deg); }
.btn-primary:hover i.bi-arrow-right { transform: translateX(3px); }
[data-theme="dark"] .btn-primary { background: var(--brand-500); }
[data-theme="dark"] .btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--brand-500); color: var(--brand-600); background: var(--brand-50); }
[data-theme="dark"] .btn-ghost:hover { color: var(--brand-300); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { box-shadow: 0 10px 22px -8px rgba(179, 38, 30, .6); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading > i, .btn.is-loading > .btn-label { opacity: .0; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-ghost.is-loading::after { border-color: var(--line-strong); border-top-color: var(--brand-600); }
.btn.is-loading { color: transparent; }

.btn-icon {
  width: 36px; height: 36px; border-radius: 10px; border: 0; display: inline-grid; place-items: center; font-size: 15px;
  background: var(--surface-3); color: var(--text-2);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast), color var(--t-fast);
}
.btn-icon:hover { transform: translateY(-2px); }
.btn-icon:active { transform: scale(.92); }
.btn-icon.is-edit:hover, .btn-icon.is-view:hover { background: var(--brand-100); color: var(--brand-600); }
[data-theme="dark"] .btn-icon.is-edit:hover, [data-theme="dark"] .btn-icon.is-view:hover { color: var(--brand-300); }
.btn-icon.is-delete:hover { background: var(--red-bg); color: var(--red); }
.btn-icon.is-ok:hover { background: var(--green-bg); color: var(--green); }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }

/* form */
.field { margin-bottom: 18px; }
.label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; color: var(--text); }
.label .req { color: var(--red); margin-left: 2px; }
.label .opt { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 11px;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 14.5px; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder { color: var(--muted); opacity: .85; }
.input:hover { border-color: var(--brand-300); }
.input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
textarea.input { min-height: 96px; resize: vertical; }
select.input {
  appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2343585f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
[data-theme="dark"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23b4c8ce' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); }
.input[aria-invalid="true"], .input.is-invalid { border-color: var(--red); }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.field-error { margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; font-weight: 600; color: var(--red); animation: rise-sm var(--t-med) var(--ease-out) both; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.col-full { grid-column: 1 / -1; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color var(--t-fast); }
.input-icon .input { padding-left: 42px; }
.input-icon:focus-within > i { color: var(--brand-500); }

.form-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.form-section { padding-bottom: 8px; margin-bottom: 22px; border-bottom: 1px dashed var(--line-strong); }
.form-section:last-of-type { border-bottom: 0; margin-bottom: 0; }
.form-section > h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14.5px; font-weight: 800; }
.form-section > h3 .step { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; color: #fff; background: var(--brand-600); }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  margin: 24px -24px -24px; padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.tips { position: sticky; top: 84px; background: var(--brand-50); }
.tips h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14.5px; font-weight: 800; }
.tips h3 i { color: var(--silt-500); }
.tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tips li { display: flex; gap: 10px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.tips li i { color: var(--brand-500); margin-top: 2px; flex: none; }
.tips li b { color: var(--text); }

.repeat-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; animation: rise-sm var(--t-med) var(--ease-out) both; }
.repeat-row .input { flex: 1; }
.repeat-row .w-days { flex: 0 0 150px; }
.repeat-row.is-leaving { animation: row-out var(--t-fast) ease-in forwards; }

/* dropzone */
.dropzone {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 20px;
  border: 2px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-med) var(--ease-out);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone.has-file { border-style: solid; border-color: var(--green-line); background: var(--green-bg); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 21px; color: var(--brand-600); background: var(--brand-100); }
.dropzone.has-file .dz-icon { color: var(--green); background: var(--surface); }
.dz-title { font-weight: 700; font-size: 14px; }
.dz-sub { font-size: 12.5px; color: var(--muted); }
.ai-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.ai-status { font-size: 13px; color: var(--muted); flex: 1 1 240px; }
.ai-status.ok { color: var(--green); }
.ai-status.err { color: var(--red); }
.btn-ai i { color: var(--silt-500); }
.btn-ai.is-working i { animation: spin 1.1s linear infinite; }

/* badge status */
.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.status-hijau  { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.badge.status-kuning { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge.status-merah  { color: var(--red);   background: var(--red-bg);   border-color: var(--red-line); }
.badge.status-merah::before { animation: pulse-dot 1.8s ease-out infinite; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-3); }
.chip i { font-size: 12px; color: var(--muted); }

/* tabel */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table thead th {
  position: sticky; top: 0; z-index: 1; padding: 12px 16px; text-align: left; white-space: nowrap;
  font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-3); border-bottom: 1px solid var(--line-strong);
}
.table th:not(:last-child), .table td:not(:last-child) { border-right: 1px solid var(--line); }
.table tbody td { padding: 15px 16px; font-size: 14px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { white-space: nowrap; }
.cell-strong { font-weight: 700; }
.cell-muted { color: var(--muted); font-size: 12.5px; }
.co { display: flex; align-items: center; gap: 12px; }
.co-avatar { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--brand-600); background: var(--brand-100); }
[data-theme="dark"] .co-avatar { color: var(--brand-300); }
.time-left { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-left.t-merah { color: var(--red); }
.time-left.t-kuning { color: var(--amber); }
.time-left.t-hijau { color: var(--green); }

/* meter sisa waktu */
.meter { width: 100%; min-width: 90px; height: 6px; margin-top: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: currentColor; transform-origin: left; animation: meter-in 1s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + .35s); }
.meter.t-merah { color: var(--red); } .meter.t-kuning { color: var(--amber); } .meter.t-hijau { color: var(--green); }

/* empty state */
.empty { display: grid; place-items: center; gap: 6px; text-align: center; padding: 54px 20px; color: var(--muted); }
.empty-art { width: 92px; height: 92px; margin-bottom: 10px; border-radius: 26px; display: grid; place-items: center; font-size: 38px; color: var(--brand-600); background: var(--brand-100); animation: float 5s ease-in-out infinite; }
.empty-art.ok { color: var(--green); background: var(--green-bg); }
.empty h4 { color: var(--text); font-size: 16px; font-weight: 800; }
.empty p { max-width: 380px; font-size: 14px; }
.empty .btn { margin-top: 12px; }

/* toast */
.toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast-item {
  pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px;
  width: 380px; max-width: calc(100vw - 32px); padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: toast-in var(--t-slow) var(--ease-spring) both;
}
.toast-item.leaving { animation: toast-out var(--t-med) var(--ease-in-out) forwards; }
.toast-icon { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 16px; }
.toast-success .toast-icon { color: var(--green); background: var(--green-bg); }
.toast-error .toast-icon { color: var(--red); background: var(--red-bg); }
.toast-text { flex: 1; font-size: 13.5px; font-weight: 600; padding-top: 5px; }
.toast-close { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; animation: toast-bar 5.2s linear forwards; }
.toast-success .toast-bar { background: var(--green); } .toast-error .toast-bar { background: var(--red); }
.toast-item:hover .toast-bar { animation-play-state: paused; }

/* dialog (modal & konfirmasi) */
dialog.dlg {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; margin: auto;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); overflow: auto;
}
dialog.dlg[open] { animation: dlg-in var(--t-slow) var(--ease-spring) both; }
dialog.dlg::backdrop { background: rgba(11, 26, 45, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
dialog.dlg[open]::backdrop { animation: fade-in var(--t-med) ease both; }
.dlg-body { padding: 26px 26px 8px; }
.dlg-icon { width: 52px; height: 52px; margin-bottom: 16px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; color: var(--brand-600); background: var(--brand-100); }
.dlg-icon.danger { color: var(--red); background: var(--red-bg); }
.dlg-title { font-size: 18px; font-weight: 800; }
.dlg-text { margin-top: 8px; color: var(--text-2); font-size: 14px; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 20px 26px 24px; }

/* timeline riwayat */
.timeline { position: relative; display: grid; gap: 18px; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color var(--t-fast), box-shadow var(--t-med); }
.tl-item:hover { border-color: var(--brand-300); box-shadow: var(--shadow); }
.tl-dot { position: absolute; left: -34px; top: 18px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; border: 3px solid var(--bg); }
.tl-dot.status-hijau { background: var(--green); } .tl-dot.status-kuning { background: var(--amber); } .tl-dot.status-merah { background: var(--red); }
.tl-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.tl-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.diff { width: 100%; margin-top: 12px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.diff th { text-align: left; padding: 6px 10px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.diff td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.diff th:not(:last-child), .diff td:not(:last-child) { border-right: 1px solid var(--line); }
.diff .old { color: var(--amber); background: var(--amber-bg); }
.diff .new { color: var(--green); background: var(--green-bg); font-weight: 600; }
.diff td.none { color: var(--muted); background: transparent; }
.diff th:first-child, .diff td:first-child { width: 24%; }
.diff td:first-child { font-weight: 700; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.pager-info { font-size: 13px; color: var(--muted); }
.pager-list { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pager-list a, .pager-list span.pg {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center;
  font-size: 13.5px; font-weight: 700; color: var(--text-2); background: var(--surface); border: 1px solid var(--line);
  transition: all var(--t-fast) var(--ease-out);
}
.pager-list a:hover { border-color: var(--brand-500); color: var(--brand-600); transform: translateY(-1px); }
.pager-list .active span.pg { color: #fff; background: var(--brand-600); border-color: var(--brand-600); }
.pager-list .disabled span.pg { opacity: .4; }

/* toolbar pencarian/filter */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.toolbar .input-icon { flex: 1 1 280px; max-width: 380px; }
.toolbar select.input { flex: 0 1 210px; width: auto; }
.toolbar .field { margin: 0; }

/* ---------- 5. HALAMAN ---------- */

/* dashboard: hero */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 28px; align-items: center;
  margin: 14px 0 22px; padding: 34px 40px; border-radius: 26px; color: #e6eef9;
  background: var(--ink-800);
  box-shadow: var(--shadow);
}
.hero-topo { position: absolute; right: -12%; top: -45%; width: 78%; aspect-ratio: 1; background: url('../images/topo.svg') center / contain no-repeat; opacity: .22; animation: topo-drift 120s linear infinite; pointer-events: none; }
.hero-wave { position: absolute; inset: auto 0 0 0; height: 70px; opacity: .1; pointer-events: none; }
.hero-wave path { fill: #fff; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--silt-300); background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16); }
.hero h1 { margin-top: 16px; font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; color: #fff; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--silt-300); }
.hero p { margin-top: 14px; max-width: 520px; font-size: 14.5px; color: #bccde5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero .btn-ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; }
.hero .btn-light { background: #fff; color: var(--ink-900); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .5); }
.hero .btn-light:hover { color: var(--brand-700); }

.donut-card { position: relative; z-index: 1; display: flex; align-items: center; gap: 22px; padding: 20px 22px; border-radius: 20px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .13); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.donut { position: relative; width: 140px; height: 140px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 11; }
.donut .trk { stroke: rgba(255, 255, 255, .1); }
.donut .seg { stroke-linecap: butt; animation: ring-draw 1.2s var(--ease-out) .35s both; }
.donut .seg.g { stroke: #5fd3a0; } .donut .seg.y { stroke: #f0bb62; } .donut .seg.r { stroke: #ff8f84; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-size: 30px; font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.donut-center span { margin-top: 4px; font-size: 11.5px; color: #a3b8d6; font-weight: 600; }
.legend { display: grid; gap: 11px; font-size: 13px; min-width: 0; }
.legend div { display: flex; align-items: center; gap: 9px; color: #d6e1f0; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; padding-left: 14px; color: #fff; font-variant-numeric: tabular-nums; }

/* statistik */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med), border-color var(--t-fast);
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; transition: transform var(--t-med) var(--ease-spring); }
.stat:hover .stat-icon { transform: scale(1.1) rotate(-6deg); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-number { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.stat-note { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.stat-total .stat-icon { color: var(--brand-600); background: var(--brand-100); }
.stat-hijau .stat-icon { color: var(--green); background: var(--green-bg); }
.stat-kuning .stat-icon { color: var(--amber); background: var(--amber-bg); }
.stat-merah .stat-icon { color: var(--red); background: var(--red-bg); }
[data-theme="dark"] .stat-total .stat-icon { color: var(--brand-300); }
.stat-hijau .stat-number { color: var(--green); }
.stat-kuning .stat-number { color: var(--amber); }
.stat-merah .stat-number { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.summary-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary-row:last-of-type { border-bottom: 0; }
.summary-row .label { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-2); }
.summary-row .label i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; color: var(--brand-600); background: var(--brand-100); }
[data-theme="dark"] .summary-row .label i { color: var(--brand-300); }
.summary-row .value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-period { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--muted); }

/* sanksi: kartu surat */
.surat { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color var(--t-fast), box-shadow var(--t-med); }
.surat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.surat-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.surat-title { font-size: 16px; font-weight: 800; }
.surat-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.surat .table-wrap { margin: 16px 18px 18px; }
.v-note { margin-top: 5px; font-size: 12px; color: var(--muted); max-width: 280px; }

/* pengaturan */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row h4 { font-size: 14.5px; font-weight: 700; }
.setting-row p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.seg-control { display: inline-flex; padding: 4px; gap: 4px; border-radius: 13px; background: var(--surface-3); }
.seg-control button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--text-2); background: transparent; transition: all var(--t-med) var(--ease-out); }
.seg-control button[aria-pressed="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background var(--t-med); }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-med) var(--ease-spring); }
.switch input:checked + span { background: var(--brand-600); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- 6. RESPONSIF ---------- */
@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .dashboard-grid, .form-shell { grid-template-columns: 1fr; }
  .tips { position: static; }
}

@media (max-width: 900px) {
  .app-wrapper { display: block; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(11, 26, 45, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity var(--t-med), visibility var(--t-med); }
  .sidebar, .sidebar-collapsed .sidebar {
    position: fixed; top: 0; left: 0; width: min(84vw, 300px); max-width: 300px; z-index: 1000;
    transform: translateX(-102%); transition: transform var(--t-med) var(--ease-out); box-shadow: 16px 0 48px rgba(0, 0, 0, .35);
  }
  .sidebar-collapsed .brand-text, .sidebar-collapsed .nav-section-label, .sidebar-collapsed .nav-text, .sidebar-collapsed .sidebar-foot span { display: revert; }
  .sidebar-collapsed .brand { justify-content: flex-start; padding-inline: 6px; }
  .sidebar-collapsed .sidebar nav a { justify-content: flex-start; padding: 11px 14px; }
  .sidebar-collapsed .sidebar nav a .nav-badge { position: static; min-width: 20px; height: 20px; font-size: 11px; padding: 0 6px; }
  .sidebar-collapsed .sidebar nav a:hover::after { display: none; }
  .sidebar-mobile-open .sidebar { transform: none; }
  .sidebar-mobile-open .sidebar-overlay { opacity: 1; visibility: visible; }
  .sidebar-mobile-open { overflow: hidden; }

  .global-topbar { padding: 10px 16px; }
  .page-content { padding: 4px 16px 24px; }
  .app-footer { padding: 16px; }
  .user-chip { padding: 3px; border-color: transparent; background: transparent; box-shadow: none; }
  .user-chip .user-meta, .user-chip .user-caret { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .notif-dropdown { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-width: none; }

  .hero { padding: 24px 22px; border-radius: 20px; }
  .donut-card { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .form-actions { margin: 20px -18px -18px; padding: 14px 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-actions form { flex: 1 1 auto; display: flex; }
  .page-actions form .btn { flex: 1; }
  .toolbar .input-icon { max-width: none; flex-basis: 100%; }
  .toolbar select.input { flex: 1 1 100%; width: 100%; }
  .toolbar .btn { flex: 1; }
  .setting-row { flex-direction: column; align-items: flex-start; }
  .toast-wrap { left: 12px; right: 12px; bottom: 14px; align-items: stretch; }
  .toast-item { width: auto; max-width: none; }
  .repeat-row { flex-wrap: wrap; }
  .repeat-row .w-days { flex: 1 1 120px; }

  /* tabel → kartu bertumpuk */
  .table-wrap:has(.table-stack) { border: 0; background: transparent; overflow: visible; }
  .table-stack th:not(:last-child), .table-stack td:not(:last-child) { border-right: 0; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody tr { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .table-stack tbody tr:hover { background: var(--surface); }
  .table-stack tbody td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  .table-stack tbody td:last-child { border-bottom: 0; }
  .table-stack tbody td::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table-stack tbody td[data-label=""]::before { display: none; }
  .table-stack tbody td > .co, .table-stack tbody td > div { text-align: left; }
  .table-stack tbody td.td-wide { flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; }
  .surat .table-wrap { margin: 12px; }
  .surat .table-stack tbody tr { background: var(--surface-2); }
  .table-stack .meter { min-width: 120px; }
  .table-stack .row-actions { justify-content: flex-end; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 15px; }
  .stat-number { font-size: 30px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .stat-grid > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .legend { width: 100%; }
}

@media print {
  .sidebar, .global-topbar, .toast-wrap, .app-footer, .page-actions { display: none !important; }
  body { background: #fff; }
  .card, .surat { box-shadow: none; }
}
