/* =========================================================
   GOLDVAULT — Reseller Monitoring Dashboard
   Design system: dark vault metal + true gold accent

   TEMA: dikendalikan lewat atribut [data-theme] pada elemen <html>,
   diatur oleh public/assets/js/theme.js. Dua nilai yang dipakai:
   'dark' (default, palet vault-emas asli) dan 'light'. Kalau atribut
   belum ada sama sekali (JS belum sempat jalan), :root di bawah ini
   dipakai sebagai fallback dark — supaya tidak ada flash tema salah
   sebelum JS mengatur data-theme, karena set-nya dieksekusi di
   <head> sebelum body dirender (lihat urutan <script> di layout).
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root,
:root[data-theme="dark"] {
  /* --- Core palette (DARK — default) --- */
  --ink:        #0F1210;   /* deep vault green-black */
  --ink-raised: #161B17;   /* panel surface */
  --ink-line:   #262E28;   /* hairline / border */
  --ink-line-2: #333D35;   /* stronger border */
  --cream:      #EDE7D9;   /* primary text on dark */
  --cream-dim:  #A7A497;   /* secondary text */
  --cream-faint:#6E6C62;   /* tertiary / placeholder */

  --gold:       #C9A44C;   /* true gold accent */
  --gold-bright:#E4C876;   /* hover / emphasis gold */
  --gold-dim:   #8A723A;   /* muted gold, borders */
  --gold-wash:  rgba(201, 164, 76, 0.09);

  --up:         #7FA875;   /* price up / positive */
  --down:       #C46B5C;   /* price down / negative */
  --down-wash:  rgba(196, 107, 92, 0.12);
  --up-wash:    rgba(127, 168, 117, 0.12);

  --tooltip-bg: #0B0D0B;
  --sidebar-bg: #0B0D0B;
  --scrollbar-track: var(--ink);
  color-scheme: dark;
}

:root[data-theme="light"] {
  /* --- Core palette (LIGHT) ---
     Bukan sekadar invert warna dark: kontras teks & hierarki
     panel/border dirancang ulang supaya tetap terbaca nyaman di
     latar terang, dan emas sedikit digelapkan karena --gold-bright
     versi dark (#E4C876) kontrasnya lemah di atas latar putih. */
  --ink:        #F7F5EF;   /* latar utama, krem hangat pucat (bukan putih polos) */
  --ink-raised: #FFFFFF;   /* panel surface, putih bersih supaya "naik" dari --ink */
  --ink-line:   #E4DFD2;   /* hairline / border */
  --ink-line-2: #D1CABA;   /* stronger border */
  --cream:      #221F19;   /* primary text — nyaris hitam, hangat */
  --cream-dim:  #5C574C;   /* secondary text */
  --cream-faint:#94897A;   /* tertiary / placeholder */

  --gold:       #A9813A;   /* accent emas digelapkan untuk kontras di latar terang */
  --gold-bright:#8A6425;   /* emphasis gold — LEBIH gelap dari --gold di light mode (kebalikan dark) */
  --gold-dim:   #C9A44C;   /* muted gold / border — pakai gold asli versi dark di sini */
  --gold-wash:  rgba(169, 129, 58, 0.10);

  --up:         #3F7A34;   /* positive, digelapkan untuk kontras */
  --down:       #B23D2B;   /* negative, digelapkan untuk kontras */
  --down-wash:  rgba(178, 61, 43, 0.09);
  --up-wash:    rgba(63, 122, 52, 0.09);

  --tooltip-bg: #221F19;
  --sidebar-bg: #EDE8DC;
  --scrollbar-track: var(--ink);
  color-scheme: light;
}

:root {

  /* --- Type --- */
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  'IBM Plex Mono', 'SF Mono', monospace;

  /* --- Scale --- */
  --radius-sm: 3px;
  --radius-md: 5px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold-dim); color: var(--ink); }

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink-line-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   LAYOUT SHELL
   ========================================================= */

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--ink-line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding: 0 4px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cream);
}

.brand-name em {
  font-style: normal;
  color: var(--gold);
}

.nav-section-label {
  font-size: 11px;
  color: var(--cream-faint);
  padding: 0 10px;
  margin: 22px 0 8px;
  letter-spacing: 0.03em;
}

.nav-section-label:first-of-type { margin-top: 0; }

.nav-list { list-style: none; margin: 0; padding: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--cream-dim);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }

.nav-link:hover {
  background: var(--ink-raised);
  color: var(--cream);
}

.nav-link.active {
  background: var(--gold-wash);
  color: var(--gold-bright);
  border-left-color: var(--gold);
}

.nav-link.active svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--ink-line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-wash);
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11.5px;
  color: var(--cream-faint);
}

.btn-logout {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--ink-line-2);
  color: var(--cream-dim);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-logout:hover { border-color: var(--down); color: var(--down); }
.btn-logout svg { width: 13px; height: 13px; }

.btn-theme-toggle {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--ink-line-2);
  color: var(--cream-dim);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.15s ease, color 0.15s ease;
  font-family: inherit;
  cursor: pointer;
}
.btn-theme-toggle:hover { border-color: var(--gold-dim); color: var(--gold-bright); }
.btn-theme-toggle .theme-toggle-icon { display: flex; align-items: center; }
.btn-theme-toggle .theme-toggle-icon svg { width: 13px; height: 13px; }

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.main {
  padding: 32px 40px 60px;
  min-width: 0;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink-line);
}

.page-eyebrow {
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 6px;
  font-weight: 600;
}

.page-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.01em;
}

.page-sub {
  font-size: 13.5px;
  color: var(--cream-dim);
  margin-top: 5px;
}

.head-actions { display: flex; gap: 10px; align-items: center; }

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn-gold {
  background: var(--gold);
  color: #14170F;
}
.btn-gold:hover { background: var(--gold-bright); }

.btn-outline {
  background: transparent;
  border-color: var(--ink-line-2);
  color: var(--cream);
}
.btn-outline:hover { border-color: var(--gold-dim); color: var(--gold-bright); }

.btn-ghost {
  background: transparent;
  color: var(--cream-dim);
}
.btn-ghost:hover { color: var(--cream); background: var(--ink-raised); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* =========================================================
   PANELS / CARDS
   ========================================================= */

.panel {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-md);
}

.panel-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--ink-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--cream);
}

.panel-note {
  font-size: 12px;
  color: var(--cream-faint);
  margin-top: 2px;
}

.panel-body { padding: 20px 22px; }
.panel-body-flush { padding: 0; }

/* Chart tren harga — batang & tooltip custom */
.chart-bar { transition: filter 0.12s ease; cursor: default; }
.chart-bar-wrap:hover .chart-bar { filter: brightness(1.15); }

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--tooltip-bg);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.1s ease, transform 0.1s ease;
  z-index: 20;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.chart-tooltip.show { opacity: 1; transform: translateY(0); }

.chart-tooltip strong {
  display: block;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
}

.chart-tooltip span {
  display: block;
  color: var(--cream-dim);
  font-size: 11px;
  margin-top: 2px;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--ink-line);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.stat-cell {
  background: var(--ink-raised);
  padding: 20px 22px;
}

.stat-label {
  font-size: 12px;
  color: var(--cream-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.01em;
}

.stat-value .unit {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--cream-faint);
  font-weight: 500;
  margin-left: 4px;
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

.stat-delta svg { width: 12px; height: 12px; }
.stat-delta.up { color: var(--up); }
.stat-delta.down { color: var(--down); }
.stat-delta.flat { color: var(--cream-faint); }

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  text-align: left;
  padding: 12px 22px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cream-faint);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--ink-line);
  white-space: nowrap;
}

thead th.num, td.num { text-align: right; }

tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--ink-line);
  color: var(--cream);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(201, 164, 76, 0.035); }

.mono { font-family: var(--mono); font-size: 12.5px; color: var(--cream-dim); }

.cell-primary { font-weight: 600; color: var(--cream); }
.cell-sub { font-size: 12px; color: var(--cream-faint); margin-top: 2px; }

.gold-figure {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--gold-bright);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-dot { width: 5px; height: 5px; border-radius: 50%; }

.badge-available { background: var(--up-wash); color: var(--up); border-color: rgba(127,168,117,0.25); }
.badge-available .badge-dot { background: var(--up); }

.badge-sold { background: rgba(255,255,255,0.04); color: var(--cream-faint); border-color: var(--ink-line-2); }
.badge-sold .badge-dot { background: var(--cream-faint); }

.badge-reserved { background: rgba(228,200,118,0.1); color: var(--gold); border-color: rgba(201,164,76,0.3); }
.badge-reserved .badge-dot { background: var(--gold); }

.badge-profit { background: var(--up-wash); color: var(--up); }
.badge-loss { background: var(--down-wash); color: var(--down); }

/* Chip / weight tag */
.weight-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cream);
  background: var(--ink);
  border: 1px solid var(--ink-line-2);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cream-dim);
}

.input, select.input, textarea.input {
  background: var(--ink);
  border: 1px solid var(--ink-line-2);
  color: var(--cream);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
}

.input::placeholder { color: var(--cream-faint); }
.input:focus { border-color: var(--gold-dim); outline: none; }

.search-input-wrap { position: relative; }
.search-input-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--cream-faint);
}
.search-input-wrap .input { padding-left: 34px; }

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ink-line);
}

.filter-bar .input, .filter-bar select { width: auto; min-width: 160px; }
.filter-bar .search-input-wrap { flex: 1; min-width: 200px; }

/* =========================================================
   AUTH PAGE (index.html)
   ========================================================= */

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-visual {
  background:
    radial-gradient(circle at 30% 20%, rgba(201,164,76,0.14), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(201,164,76,0.08), transparent 50%),
    var(--sidebar-bg);
  border-right: 1px solid var(--ink-line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px;
  position: relative;
  overflow: hidden;
}

.auth-visual-top { position: relative; z-index: 2; }

.auth-visual-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 60px;
}

.auth-visual-brand .brand-mark { width: 34px; height: 34px; }
.auth-visual-brand .brand-name { font-size: 21px; }

.auth-headline {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--cream);
  max-width: 460px;
  letter-spacing: -0.01em;
}

.auth-headline .accent { color: var(--gold); }

.auth-sub {
  font-size: 14.5px;
  color: var(--cream-dim);
  max-width: 400px;
  margin-top: 16px;
  line-height: 1.6;
}

.auth-ticker {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-line);
}

.ticker-item { }
.ticker-label { font-size: 11.5px; color: var(--cream-faint); margin-bottom: 6px; }
.ticker-value { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--gold-bright); }
.ticker-value .unit { font-family: var(--sans); font-size: 11px; color: var(--cream-faint); font-weight: 500; }

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-form-box { width: 100%; max-width: 360px; }

.auth-form-title {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 6px;
}

.auth-form-sub {
  font-size: 13.5px;
  color: var(--cream-dim);
  margin-bottom: 28px;
}

.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.role-option {
  border: 1px solid var(--ink-line-2);
  background: var(--ink-raised);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  transition: all 0.15s ease;
}

.role-option svg { width: 18px; height: 18px; margin-bottom: 6px; color: var(--cream-dim); }
.role-option-label { font-size: 12.5px; font-weight: 600; color: var(--cream-dim); }
.role-option-sub { font-size: 10.5px; color: var(--cream-faint); margin-top: 2px; }

.role-option.selected {
  border-color: var(--gold-dim);
  background: var(--gold-wash);
}
.role-option.selected svg,
.role-option.selected .role-option-label { color: var(--gold-bright); }

.auth-form .field { margin-bottom: 16px; }

.btn-block { width: 100%; justify-content: center; padding: 12px; margin-top: 6px; }

.auth-hint {
  margin-top: 22px;
  padding: 12px 14px;
  background: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--cream-faint);
  line-height: 1.6;
}
.auth-hint strong { color: var(--cream-dim); }

.auth-error {
  display: none;
  background: var(--down-wash);
  border: 1px solid rgba(196,107,92,0.3);
  color: var(--down);
  font-size: 12.5px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.auth-error.show { display: block; }

/* =========================================================
   UTILITIES
   ========================================================= */

.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-24 { margin-top: 24px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--cream-faint);
}
.empty-state svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 14px; color: var(--cream-dim); font-weight: 600; margin-bottom: 4px; }
.empty-state-sub { font-size: 12.5px; }

.divider-label {
  font-size: 11px;
  color: var(--cream-faint);
  letter-spacing: 0.03em;
  margin: 4px 0 12px;
}

.certificate-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gold);
  background: var(--gold-wash);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(201,164,76,0.2);
}

.avatar-tiny {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink-line);
  border: 1px solid var(--ink-line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cream-dim);
}

.role-scope-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--gold-wash);
  border: 1px solid rgba(201,164,76,0.25);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--gold-bright);
  margin-bottom: 22px;
}
.role-scope-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.role-scope-banner strong { color: var(--gold-bright); }

/* Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--ink-line);
  font-size: 12.5px;
  color: var(--cream-faint);
}
.pager-btns { display: flex; gap: 6px; }
.pager-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--ink-line-2);
  border-radius: var(--radius-sm);
  color: var(--cream-dim);
  font-size: 12px;
}
.pager-btn:hover { border-color: var(--gold-dim); color: var(--gold-bright); }
.pager-btn.active { background: var(--gold-wash); border-color: var(--gold-dim); color: var(--gold-bright); }

/* =========================================================
   MODAL (form tambah data)
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 6, 0.72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line-2);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--ink-line);
}

.modal-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--cream);
}

.modal-sub {
  font-size: 12.5px;
  color: var(--cream-dim);
  margin-top: 4px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--cream-faint);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--ink-line); color: var(--cream); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 20px 22px; }

.modal-body .field { margin-bottom: 15px; }
.modal-body .field:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--ink-line);
}

.field-error {
  font-size: 12px;
  color: var(--down);
  margin-top: 5px;
  display: none;
}
.field-error.show { display: block; }

.form-error-banner {
  display: none;
  background: var(--down-wash);
  border: 1px solid rgba(196,107,92,0.3);
  color: var(--down);
  font-size: 12.5px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.form-error-banner.show { display: block; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-raised);
  border: 1px solid var(--gold-dim);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast svg { width: 16px; height: 16px; color: var(--up); flex-shrink: 0; }

.select-keping-option {
  display: flex;
  justify-content: space-between;
}

.helper-text {
  font-size: 11.5px;
  color: var(--cream-faint);
  margin-top: 4px;
}

/* =========================================================
   ALERT BANNER (flash message CI4 — pengganti toast di versi HTML,
   karena create/edit sekarang halaman penuh dengan redirect,
   bukan modal SPA)
   ========================================================= */

.alert-banner {
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 22px;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--up-wash);
  color: var(--up);
  border-color: rgba(127,168,117,0.3);
}

.alert-error {
  background: var(--down-wash);
  color: var(--down);
  border-color: rgba(196,107,92,0.3);
}

/* =========================================================
   FORM PAGE (halaman create/edit penuh, bukan modal)
   ========================================================= */

.form-page {
  max-width: 560px;
}

.form-page .field { margin-bottom: 17px; }
.form-page .field:last-child { margin-bottom: 0; }

.form-page-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-line);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--cream-dim);
  margin-bottom: 18px;
}
.back-link:hover { color: var(--gold-bright); }
.back-link svg { width: 14px; height: 14px; }

.confirm-delete-btn {
  background: transparent;
  border: 1px solid var(--ink-line-2);
  color: var(--down);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}
.confirm-delete-btn:hover { border-color: var(--down); background: var(--down-wash); }

.action-cell { display: flex; gap: 8px; align-items: center; }
.action-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--cream-dim);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-line-2);
}
.action-link:hover { color: var(--gold-bright); border-color: var(--gold-dim); }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }
  .main { padding: 22px 18px 40px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 24px; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .input, .filter-bar select { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .modal-box { max-width: 100%; }
}
