/* ============================================================
   REACHER — design system
   Token diturunkan dari Stitch "Lumina Ledger" (DESIGN.md)
   ============================================================ */

:root {
  --surface:              #f8f9ff;
  --surface-dim:          #cbdbf5;
  --surface-lowest:       #ffffff;
  --surface-low:          #eff4ff;
  --surface-container:    #e5eeff;
  --surface-high:         #dce9ff;
  --surface-highest:      #d3e4fe;
  --on-surface:           #0b1c30;
  --on-surface-variant:   #45464d;
  --outline:              #76777d;
  --outline-variant:      #c6c6cd;

  --primary:              #000000;
  --on-primary:           #ffffff;
  --primary-container:    #131b2e;
  --primary-fixed:        #dae2fd;
  --primary-fixed-dim:    #bec6e0;

  --secondary:            #006c49;
  --on-secondary:         #ffffff;
  --secondary-container:  #6cf8bb;
  --on-secondary-container:#00714d;
  --secondary-fixed-dim:  #4edea3;

  --tertiary:             #b87500;
  --tertiary-container:   #ffddb8;
  --on-tertiary-container: #653e00;

  --error:                #ba1a1a;
  --error-container:      #ffdad6;
  --on-error-container:   #93000a;

  --radius-sm: .25rem;
  --radius:    .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  --xs: 4px; --sm: 8px; --md: 16px; --lg: 24px; --xl: 32px;

  --shadow-1: 0 4px 16px rgba(11, 28, 48, .05);
  --shadow-2: 0 8px 24px rgba(11, 28, 48, .10);

  --sidebar-w: 256px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

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

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  user-select: none;
}
.icon-fill { font-variation-settings: 'FILL' 1; }

/* ------------------------------------------------------------ typography */
.display-lg { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; }
.headline-md { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
.headline-sm { font-size: 20px; line-height: 28px; font-weight: 600; }
.body-lg { font-size: 16px; line-height: 24px; }
.body-md { font-size: 14px; line-height: 20px; }
.data-lg { font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: .01em; }
.label-sm {
  font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .05em;
}
.label-up { text-transform: uppercase; }
.muted  { color: var(--on-surface-variant); }
.dim    { color: var(--outline); }
.pos    { color: var(--secondary); }
.neg    { color: var(--error); }
.warn   { color: var(--on-tertiary-container); }
.bold   { font-weight: 600; }
.right  { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono-num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface-lowest);
  border-right: 1px solid var(--outline-variant);
  height: 100vh;
  position: sticky;
  top: 0;
  padding: var(--lg) var(--md);
  display: flex;
  flex-direction: column;
  gap: var(--sm);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--sm) var(--lg);
}
.brand .material-symbols-outlined { font-size: 26px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--outline); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 2px; }
.nav-item {
  display: flex; align-items: center; gap: var(--md);
  padding: 10px var(--md);
  border-radius: var(--radius);
  color: var(--on-surface-variant);
  font-size: 13px; font-weight: 500;
  min-height: 44px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-container); color: var(--on-surface); }
.nav-item.active {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 600;
}
.nav-item.active .material-symbols-outlined { font-variation-settings: 'FILL' 1; }
.nav-sep { height: 1px; background: var(--outline-variant); margin: var(--sm) var(--sm); }

.sidebar-foot {
  border-top: 1px solid var(--outline-variant);
  padding-top: var(--md);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 38px; height: 38px; border-radius: var(--radius-full);
  background: var(--surface-highest); color: var(--on-surface-variant);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: 0 0 38px;
}
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; padding: var(--xl); display: flex; flex-direction: column; gap: var(--lg); }
.main > * { min-width: 0; max-width: 100%; }

/* ------------------------------------------------------------ topbar */
.topbar { display: none; }

.page-head {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: var(--md);
}
.page-head h1 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--on-surface-variant); }
.head-actions { display: flex; gap: var(--sm); flex-wrap: wrap; align-items: center; min-width: 0; }
.head-actions form { display: flex; gap: var(--sm); flex-wrap: wrap; align-items: center; min-width: 0; }
.head-actions input, .head-actions select { min-width: 0; }

/* ------------------------------------------------------------ filter bar */
.filterbar {
  display: flex; flex-wrap: wrap; gap: var(--sm); align-items: center;
  background: var(--surface-lowest);
  border: 1px solid var(--surface-container);
  border-radius: var(--radius-md);
  padding: 10px var(--md);
  box-shadow: var(--shadow-1);
}
.filterbar .grp { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filterbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-full);
  background: var(--surface-high); color: var(--on-surface-variant);
  border: 1px solid transparent;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .15s;
}
.chip:hover { background: var(--surface-highest); }
.chip.active { background: var(--primary); color: var(--on-primary); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px var(--md);
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--surface-lowest); color: var(--on-surface-variant);
  border-color: var(--outline-variant);
  transition: background .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-container); }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: #1a1a1a; }
.btn-secondary { background: transparent; color: var(--secondary); border-color: var(--secondary); }
.btn-secondary:hover { background: rgba(0, 108, 73, .07); }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-container); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-container); }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--surface-lowest);
  border: 1px solid var(--surface-container);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--md);
}
.card.pad-lg { padding: var(--lg); }
.card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: var(--sm); margin-bottom: var(--md); min-width: 0;
}
.card-head > * { min-width: 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.card-body-flush { margin: 0 calc(var(--md) * -1) calc(var(--md) * -1); }

.grid { display: grid; gap: 12px; }
/* tanpa ini, tabel lebar memaksa track grid melebar dan halaman ikut melar */
.grid > *, .stack > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--lg); }
.g-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--lg); }
.stack { display: flex; flex-direction: column; gap: var(--lg); }
.row { display: flex; gap: var(--sm); align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ KPI */
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface-lowest);
  border: 1px solid var(--surface-container);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--md);
  min-height: 132px;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--sm);
  transition: box-shadow .2s;
}
.kpi:hover { box-shadow: var(--shadow-2); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sm); position: relative; z-index: 1; }
.kpi-label { font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--on-surface-variant); }
.kpi-ico {
  background: var(--surface-container); color: var(--on-surface-variant);
  border-radius: var(--radius-full); padding: 6px; display: flex;
}
.kpi-val { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.02em; position: relative; z-index: 1; }
.kpi-sub { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 4px; position: relative; z-index: 1; }
.kpi-sub .material-symbols-outlined { font-size: 14px; }
.kpi-blob {
  position: absolute; top: -48px; right: -48px; width: 96px; height: 96px;
  background: var(--surface-high); border-radius: var(--radius-full); opacity: .5;
}
.kpi-dark {
  background: linear-gradient(135deg, #000 0%, var(--primary-container) 100%);
  border-color: var(--primary-container); color: var(--on-primary);
}
.kpi-dark .kpi-label { color: var(--surface-dim); }
.kpi-dark .kpi-ico { background: rgba(190, 198, 224, .18); color: #fff; }
.kpi-dark .pos { color: var(--secondary-fixed-dim); }
.kpi-dark .neg { color: #ffb4ab; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--on-surface-variant);
  padding: 10px 12px; border-bottom: 1px solid var(--outline-variant);
  white-space: nowrap; background: var(--surface-low);
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--surface-container); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-low); }
table.tbl tfoot td {
  font-weight: 700; border-top: 2px solid var(--outline-variant);
  background: var(--surface-low); border-bottom: 0;
}
table.tbl th.right, table.tbl td.right { text-align: right; }
table.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl-compact td, .tbl-compact th { padding: 8px 10px; }

.empty {
  padding: 48px var(--md); text-align: center; color: var(--outline);
}
.empty .material-symbols-outlined { font-size: 40px; opacity: .5; display: block; margin: 0 auto 8px; }

/* ------------------------------------------------------------ status */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  background: var(--surface-high); color: var(--on-surface-variant);
}
.tag-ok      { background: rgba(108, 248, 187, .45); color: #00543a; }
.tag-warn    { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.tag-danger  { background: var(--error-container); color: var(--on-error-container); }
.tag-info    { background: var(--surface-highest); color: #274060; }
.tag-muted   { background: var(--surface-container); color: var(--outline); }

/* alert list (low stock) */
.alert-row {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sm);
  padding: 10px 12px; border-left: 4px solid var(--outline-variant);
  background: var(--surface-lowest); border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 8px;
}
.alert-row.menipis { border-left-color: var(--tertiary); background: rgba(255, 221, 184, .25); }
.alert-row.kritis  { border-left-color: #e07800; background: rgba(255, 221, 184, .45); }
.alert-row.habis   { border-left-color: var(--error); background: rgba(255, 218, 214, .45); }

/* usage bars */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-row .nm { flex: 0 0 40%; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; background: var(--surface-container); border-radius: var(--radius-full); overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: var(--radius-full); }
.bar-row .vl { flex: 0 0 auto; font-size: 12px; font-weight: 600; min-width: 74px; text-align: right; }

/* ------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--md); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--on-surface-variant); }
.field .hint { font-size: 11px; color: var(--outline); }

input[type=text], input[type=number], input[type=date], input[type=email],
input[type=password], input[type=tel], select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--on-surface);
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 11px 12px; width: 100%; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 88px; resize: vertical; line-height: 20px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2345464d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 34px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--secondary);
  box-shadow: 0 0 0 1px var(--secondary);
}
input.err, select.err { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
input[readonly] { background: var(--surface-low); color: var(--on-surface-variant); }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 32px; }
.check input { width: 16px; height: 16px; min-height: 0; accent-color: var(--secondary); }

.form-actions {
  display: flex; justify-content: flex-end; gap: var(--sm);
  padding-top: var(--md); margin-top: var(--md);
  border-top: 1px solid var(--surface-container);
}
fieldset { border: 0; margin: 0; padding: 0; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; margin: var(--lg) 0 var(--sm);
  padding-top: var(--md); border-top: 1px solid var(--surface-container);
}
.section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.section-title .material-symbols-outlined { color: var(--secondary); font-size: 20px; }

.callout {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-container); color: #27405f;
  border-radius: var(--radius); padding: 12px var(--md); font-size: 13px; line-height: 19px;
}
.callout .material-symbols-outlined { font-size: 20px; flex: 0 0 auto; }
.callout-warn { background: rgba(255, 221, 184, .5); color: var(--on-tertiary-container); }
.callout-danger { background: var(--error-container); color: var(--on-error-container); }

.total-strip {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-container); border-radius: var(--radius);
  padding: 12px var(--md); font-weight: 600;
}
.total-strip .val { font-size: 18px; font-weight: 700; }

/* ------------------------------------------------------------ flash */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--md); border-radius: var(--radius); font-size: 13px; font-weight: 500;
}
.flash-success { background: rgba(108, 248, 187, .35); color: #00543a; }
.flash-error   { background: var(--error-container); color: var(--on-error-container); }
.flash-info    { background: var(--surface-container); color: #27405f; }
.flash-warning { background: var(--tertiary-container); color: var(--on-tertiary-container); }

/* ------------------------------------------------------------ chart */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 260px; padding: var(--md) 0 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; height: 100%; min-width: 0; }
.chart-bars { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; position: relative; }
.chart-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart-bar.omzet { background: var(--primary); }
.chart-bar.hpp { background: var(--primary-fixed-dim); }
.chart-x { font-size: 10px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart-col:hover .chart-tip { display: block; }
.chart-tip {
  display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--primary-container); color: #fff; border-radius: var(--radius);
  padding: 6px 8px; font-size: 11px; white-space: nowrap; z-index: 5; box-shadow: var(--shadow-2);
  margin-bottom: 6px; line-height: 15px;
}
.legend { display: flex; gap: var(--md); justify-content: center; padding-top: 10px; font-size: 12px; color: var(--on-surface-variant); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }
.dot-omzet { background: var(--primary); }
.dot-hpp { background: var(--primary-fixed-dim); }
.dot-profit { background: var(--secondary); }

/* ------------------------------------------------------------ P&L */
.pnl { width: 100%; border-collapse: collapse; font-size: 14px; }
.pnl td { padding: 11px 12px; border-bottom: 1px solid var(--surface-container); }
.pnl td.right { text-align: right; font-variant-numeric: tabular-nums; }
.pnl tr.sum td { font-weight: 700; background: var(--surface-low); }
.pnl tr.grand td { font-weight: 700; font-size: 16px; background: var(--surface-container); border-bottom: 0; }
.pnl tr.sub td:first-child { padding-left: 28px; color: var(--on-surface-variant); }
.pnl .pctcol { width: 78px; text-align: right; color: var(--on-surface-variant); font-size: 12px; }

/* ------------------------------------------------------------ wizard */
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--lg); }
.step {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: var(--radius-full); background: var(--surface-container);
  color: var(--on-surface-variant); font-size: 12px; font-weight: 600;
}
.step .n {
  width: 20px; height: 20px; border-radius: var(--radius-full);
  background: var(--surface-lowest); display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.step.done { background: rgba(108, 248, 187, .4); color: #00543a; }
.step.current { background: var(--primary); color: #fff; }
.step.current .n { background: rgba(255, 255, 255, .2); color: #fff; }

/* repeatable line rows */
.lines { display: flex; flex-direction: column; gap: 8px; }
.line {
  display: grid; gap: 8px; align-items: center;
  background: var(--surface-low); border-radius: var(--radius); padding: 8px;
}
.line-del {
  border: 0; background: transparent; color: var(--outline); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius); flex: 0 0 36px;
}
.line-del:hover { background: var(--error-container); color: var(--on-error-container); }

/* outlet cards */
.outlet-card { display: flex; flex-direction: column; gap: 12px; }
.outlet-card .oc-head { display: flex; align-items: center; gap: 10px; }
.oc-ico {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  background: var(--surface-container); display: flex; align-items: center; justify-content: center;
  flex: 0 0 42px;
}
.oc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.oc-stat { background: var(--surface-low); border-radius: var(--radius); padding: 10px; }
.oc-stat .lbl { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--on-surface-variant); }
.oc-stat .vl { font-size: 16px; font-weight: 700; margin-top: 2px; }
.oc-actions { display: flex; gap: 8px; border-top: 1px solid var(--surface-container); padding-top: 12px; }
.oc-actions .btn { flex: 1; }
.add-card {
  border: 2px dashed var(--primary-fixed-dim); background: var(--surface-low);
  border-radius: var(--radius-lg); min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--on-surface); font-weight: 600; cursor: pointer;
}
.add-card:hover { background: var(--surface-container); }
.add-card .plus {
  width: 48px; height: 48px; border-radius: var(--radius-full); background: var(--surface-lowest);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1);
}

/* login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--md);
  background: radial-gradient(1000px 600px at 15% 0%, #e5eeff 0%, var(--surface) 55%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface-lowest);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  border: 1px solid var(--surface-container); padding: var(--xl);
}
.login-card .brand { justify-content: center; padding-bottom: var(--md); }

/* misc */
.hide { display: none !important; }
.only-mobile { display: none; }
.pill-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.pill-scroll::-webkit-scrollbar { height: 0; }
.divider { height: 1px; background: var(--surface-container); margin: var(--md) 0; }
.crumbs { font-size: 12px; color: var(--on-surface-variant); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs .material-symbols-outlined { font-size: 14px; }
.scope-note {
  font-size: 11px; color: var(--outline); display: flex; align-items: center; gap: 4px;
}
.scope-note .material-symbols-outlined { font-size: 14px; }

.bottom-nav { display: none; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-2-1, .g-1-1 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .only-mobile { display: block; }
  .main { padding: var(--md) var(--md) 88px; gap: var(--md); }

  .topbar {
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 40;
    background: var(--surface-lowest); border-bottom: 1px solid var(--outline-variant);
    padding: 10px var(--md); margin: calc(var(--md) * -1) calc(var(--md) * -1) 0;
  }
  .topbar .brand { padding: 0; }
  .topbar .brand-name { font-size: 17px; }

  .page-head h1 { font-size: 24px; line-height: 32px; }
  .g-2, .g-3, .g-4, .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .head-actions form { width: 100%; }
  .head-actions form input[type=text],
  .head-actions form input[type=date] { flex: 1 1 130px; width: auto; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface-lowest); border-top: 1px solid var(--outline-variant);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(11, 28, 48, .06);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border-radius: var(--radius); color: var(--outline);
    font-size: 10px; font-weight: 600; min-height: 48px; justify-content: center;
  }
  .bn-item.active { color: var(--on-secondary-container); background: var(--secondary-container); }
  .bn-item.active .material-symbols-outlined { font-variation-settings: 'FILL' 1; }
  .bn-item .material-symbols-outlined { font-size: 22px; }

  .chart { height: 200px; }
  .oc-stats { grid-template-columns: 1fr 1fr; }

  /* baris input berulang: susun ke bawah, tombol hapus di pojok kanan atas.
     !important dipakai karena lebar kolomnya diset inline per jenis baris. */
  .line { grid-template-columns: minmax(0, 1fr) 36px !important; align-items: start; }
  .line > * { grid-column: 1; }
  .line > .line-del { grid-column: 2; grid-row: 1; }
}

@media (max-width: 560px) {
  .g-2, .g-3, .g-4, .g-5 { grid-template-columns: 1fr; }
  .kpi { min-height: 0; }
  .kpi-val { font-size: 24px; line-height: 30px; }
  .card { padding: 12px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

/* ------------------------------------------------------------ print */
@media print {
  .sidebar, .bottom-nav, .topbar, .head-actions, .filterbar, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
