/* =====================================================================
   style.css — Juragan Sembako 24 Jam
   Tata letak: kanvas 3D memenuhi layar; HUD di atas, menu di kiri,
   panel kelola di kanan, kontrol simulasi & kamera di bawah.
   Palet: hijau pandan (utama), kuning kunyit (aksen), merah cabai (peringatan).
   ===================================================================== */
:root {
  --pandan: #2f7a5c;
  --pandan-deep: #1d5641;
  --pandan-soft: #e3f1ea;
  --kunyit: #ffcf33;
  --kunyit-soft: #fff4cc;
  --cabai: #d63e35;
  --ink: #18222c;
  --ink-2: #55616c;
  --ink-3: #8a959d;
  --paper: #ffffff;
  --paper-2: #f3f6f4;
  --line: #dde5e0;
  --good: #24864d;
  --good-soft: #e1f3e8;
  --warn: #b26a00;
  --warn-soft: #fff0d6;
  --bad: #c9352d;
  --bad-soft: #fde5e3;
  --chart: #2f7a5c;
  --glass: rgba(255, 255, 255, 0.92);
  --shadow: 0 10px 30px rgba(15, 35, 28, 0.18), 0 2px 6px rgba(15, 35, 28, 0.08);
  --radius: 14px;
  --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #8dcbf3;
  color: var(--ink);
  font: 14px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--kunyit); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: 100%; display: grid; grid-template-rows: auto 1fr; }

/* ---------- HUD atas ---------- */
#hud {
  display: flex; gap: 8px; align-items: stretch;
  padding: 8px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin;
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; padding-right: 8px; min-width: 190px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--pandan); color: var(--kunyit);
  font: 800 16px/1 var(--font-display); letter-spacing: 0.02em;
}
.brand-title { font: 800 17px/1.1 var(--font-display); white-space: nowrap; }
.brand-sub { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.hud-chip {
  display: grid; grid-template-rows: auto auto auto; text-align: left;
  min-width: 128px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper-2);
  position: relative;
}
.hud-chip:hover { border-color: var(--pandan); }
.hud-chip::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: transparent; }
.hud-chip.good::before { background: var(--good); }
.hud-chip.warn::before { background: var(--warn); }
.hud-chip.bad::before { background: var(--bad); }
.hud-chip.bad { background: var(--bad-soft); }
.hud-label { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; white-space: nowrap; }
.hud-value { font: 800 17px/1.2 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-sub { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hud-bar { display: block; height: 4px; background: var(--line); border-radius: 4px; margin: 2px 0 1px; overflow: hidden; }
.hud-bar i { display: block; height: 100%; background: var(--pandan); border-radius: 4px; }

/* ---------- Panggung 3D ---------- */
#stage { position: relative; overflow: hidden; min-height: 0; }
#scene { position: absolute; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.scene-tooltip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px; white-space: nowrap;
}
.webgl-error { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; background: var(--paper-2); }
.webgl-error p { max-width: 46ch; color: var(--ink-2); }

/* ---------- Menu kiri ---------- */
#menu {
  position: absolute; left: 12px; top: 12px; z-index: 4;
  display: flex; flex-direction: column; gap: 4px;
  width: 182px; padding: 8px;
  background: var(--glass); backdrop-filter: blur(8px);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: calc(100% - 300px); overflow-y: auto;
}
.menu-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  font-weight: 600; text-align: left;
}
.menu-btn:hover { background: var(--pandan-soft); }
.menu-btn[aria-pressed="true"] { background: var(--pandan); color: #fff; }
.menu-btn.small { padding: 6px 10px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.menu-btn.small svg { width: 16px; height: 16px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- Panel kanan (laci) ---------- */
#drawer {
  position: absolute; right: 12px; top: 12px; bottom: 84px; z-index: 4;
  width: min(440px, 46vw);
  display: flex; flex-direction: column;
  background: var(--paper-2); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 16px 12px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font: 800 22px/1.15 var(--font-display); text-wrap: balance; }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--pandan); }
.icon-btn { border: 0; background: var(--paper-2); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--line); }
.drawer-body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; position: relative; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card.flush { padding: 12px 0 0; }
.card.flush > h3, .card.flush .table-head { padding: 0 14px; }
.card h3 { margin: 0 0 8px; font: 700 15px/1.25 var(--font-display); }
.card h4 { margin: 10px 0 4px; font-size: 13px; }
.card p { margin: 0 0 6px; }
.card.empty { text-align: center; padding: 28px 18px; }
.muted { color: var(--ink-2); font-size: 12.5px; }
.lock { color: var(--warn); font-size: 12px; font-weight: 600; margin-top: 2px !important; }
.good-txt { color: var(--good); }
.bad-txt { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-top: 8px; }
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.table-head h3 { margin: 0; }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); font-weight: 700; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--pandan); }
.btn.primary { background: var(--pandan); border-color: var(--pandan); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--pandan-deep); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.big { padding: 11px 20px; font-size: 15px; background: var(--kunyit); border-color: #e8b400; color: var(--ink); }
.btn.big:hover:not(:disabled) { background: #ffc300; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn small { display: block; font-weight: 500; font-size: 12px; opacity: 0.85; white-space: normal; }
.tiny { border: 1px solid var(--line); background: var(--paper-2); border-radius: 7px; padding: 3px 8px; font-weight: 700; font-size: 12px; }
.tiny:hover { border-color: var(--pandan); }
.link { border: 0; background: none; padding: 0; color: var(--pandan); font-weight: 700; text-align: left; }
.link:hover { text-decoration: underline; }
.link.small { font-size: 12px; }

input[type="number"], input:not([type]), select {
  border: 1px solid var(--line); background: var(--paper); border-radius: 8px;
  padding: 6px 8px; min-width: 0;
}
input[type="number"] { width: 92px; font-variant-numeric: tabular-nums; }
input:focus, select:focus { border-color: var(--pandan); outline: 2px solid var(--pandan-soft); }
.card .row input:not([type]) { flex: 1; }

/* Pil status */
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* Meter stok */
.meter { position: relative; display: block; height: 7px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; margin: 4px 0; min-width: 60px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--good); }
.meter.low i { background: var(--warn); }
.meter.empty i { background: var(--bad); }
.meter.ok i { background: var(--good); }
.meter b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: 0.55; }

/* Statistik */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--paper-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; border-left: 3px solid transparent; }
.stat.good { border-left-color: var(--good); }
.stat.warn { border-left-color: var(--warn); }
.stat.bad { border-left-color: var(--bad); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--ink-2); }
.stat-value { font: 800 18px/1.25 var(--font-display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; color: var(--ink-2); }

/* Tabel */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.card.flush .tbl th:first-child, .card.flush .tbl td:first-child { padding-left: 14px; }
.tbl td small { display: block; color: var(--ink-2); font-size: 11.5px; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl.compact td { padding: 5px 4px; }
.tbl tr.total td { font-weight: 800; border-top: 2px solid var(--line); }
.qty { display: flex; gap: 4px; align-items: center; }
.qty input { width: 70px; }
.min-edit { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.min-edit input { width: 58px; padding: 2px 6px; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 3px; }
.stepper input { width: 84px; text-align: right; }

/* Pemasok */
.suppliers { display: grid; gap: 6px; }
.supplier { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.supplier input { grid-row: span 3; margin-top: 3px; accent-color: var(--pandan); }
.supplier:has(input:checked) { border-color: var(--pandan); background: var(--pandan-soft); }
.supplier.locked { opacity: 0.55; cursor: not-allowed; }
.sup-name { font-weight: 700; }
.sup-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sup-tags em { font-style: normal; font-size: 11px; background: var(--paper-2); border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }
.supplier:has(input:checked) .sup-tags em { background: #fff; }
.sup-note { font-size: 12px; color: var(--ink-2); }

.buy-bar {
  position: sticky; bottom: -12px; margin: 0 -12px -12px; padding: 10px 14px;
  background: var(--paper); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
}
.buy-total-row { font-size: 13px; }
.buy-total-row b { font: 800 19px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.buy-warn { font-size: 12px; color: var(--ink-2); }
.buy-warn.bad { color: var(--bad); font-weight: 700; }
.buy-warn.good { color: var(--good); }
.quick { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.quick label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.quick select { width: 100%; }
.quick-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.quick-total.bad { color: var(--bad); }

ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.plain li { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
ul.facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
ul.tips, ol.howto { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }

.mini-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.mini-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 0 8px; border: 0; background: none; padding: 4px 2px; text-align: left; border-radius: 8px; }
.mini-item:hover { background: var(--paper-2); }
.mini-item span { font-weight: 600; font-size: 13px; }
.mini-item em { font-style: normal; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; grid-row: 1; grid-column: 2; }
.mini-item .meter { grid-column: 1 / -1; }

.facilities, .promos { display: flex; flex-direction: column; gap: 8px; }
.facility, .promo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.facility p, .promo p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.facility.owned { background: var(--good-soft); border-color: transparent; }
.facility.locked { background: var(--paper-2); }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 6px; color: var(--ink-2); font-weight: 600; }

/* Karyawan */
.shifts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.shift { border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 12.5px; border-top: 3px solid var(--line); min-width: 0; }
.shift.good { border-top-color: var(--good); }
.shift.warn { border-top-color: var(--warn); }
.shift.bad { border-top-color: var(--bad); background: var(--bad-soft); }
.shift-head { display: flex; justify-content: space-between; align-items: center; gap: 4px; flex-wrap: wrap; }
.shift small { color: var(--ink-2); }
.shift-cap { font-size: 11.5px; color: var(--ink-2); margin: 3px 0; }
.shift-crew { font-weight: 600; }
.people { display: flex; flex-direction: column; gap: 8px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.person-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.person-head b { font: 700 15px/1.2 var(--font-display); }
.person-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.person-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.morale { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }

/* Target */
.targets { display: flex; flex-direction: column; gap: 10px; }
.target { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.target:last-child { border-bottom: 0; padding-bottom: 0; }
.target.off { opacity: 0.6; }
.tgt-check { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.tgt-check input { accent-color: var(--pandan); width: 16px; height: 16px; }
.tgt-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tgt-row input { width: 150px; }
.tgt-prog { font-size: 12px; font-variant-numeric: tabular-nums; }
.rewards { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rewards li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); flex-wrap: wrap; }
.rewards li.done { color: var(--ink); }
.rewards li.next { color: var(--ink); font-weight: 700; }
.step { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 12px; font-weight: 800; flex: none; }
.rewards li.done .step { background: var(--good); color: #fff; }
.rewards li.next .step { background: var(--kunyit); }

/* Laporan */
.charts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.chart { margin: 0; }
.chart figcaption { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.chart canvas { width: 100%; height: 150px; display: block; }
.chart-tip { position: absolute; z-index: 5; background: var(--ink); color: #fff; padding: 4px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.report-head, .report-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 6px; align-items: center; }
.report-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); padding: 0 8px 4px; font-weight: 700; }
.report-row { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 7px 8px; font-variant-numeric: tabular-nums; font-size: 13px; }
.report-row:hover { border-color: var(--pandan); }
.reports li { display: block; }

/* ---------- Catatan aktivitas ---------- */
#activity {
  position: absolute; left: 12px; bottom: 84px; z-index: 3;
  width: min(360px, calc(100% - 24px)); max-height: 210px; overflow: hidden;
  background: rgba(24, 34, 44, 0.82); color: #f2f5f3; backdrop-filter: blur(6px);
  border-radius: var(--radius); padding: 10px 12px;
}
#activity h2 { margin: 0 0 6px; font: 700 12px/1 var(--font-body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--kunyit); }
#activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
#activity-list li { display: grid; grid-template-columns: 62px 1fr; gap: 6px; }
#activity-list li:not(:has(time)) { grid-template-columns: 1fr; }
#activity-list time { color: #a9b6b0; font-variant-numeric: tabular-nums; font-size: 11.5px; padding-top: 1px; }
#activity-list .log-good span { color: #9fe0b8; }
#activity-list .log-bad span { color: #ffb4ad; }
#activity-list .log-warn span { color: #ffe08a; }
#activity-list .log-day span { color: #fff; font-weight: 600; }

/* ---------- Dok bawah ---------- */
#dock {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 24px);
}
.dock-group {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  background: var(--glass); backdrop-filter: blur(8px);
  padding: 6px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.speed { display: flex; align-items: center; gap: 2px; background: var(--paper-2); border-radius: 10px; padding: 3px; }
.speed span { font-size: 11px; font-weight: 700; color: var(--ink-2); padding: 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.speed button, .cams button {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.speed button[aria-pressed="true"], .cams button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.speed button:hover:not([aria-pressed="true"]), .cams button:hover:not([aria-pressed="true"]) { background: var(--line); }
.cams svg { width: 15px; height: 15px; }

#fp-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13px; text-align: center; max-width: calc(100% - 24px);
}

@media (min-width: 861px) {
  body.drawer-open #dock { left: calc((100% - min(440px, 46vw) - 24px) / 2); }
  body.drawer-open #activity { display: none; }
  body.drawer-open #toasts { left: calc((100% - min(440px, 46vw) - 24px) / 2); }
}

/* ---------- Notifikasi ---------- */
#toasts { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(460px, calc(100% - 24px)); }
.toast {
  background: var(--paper); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow); border-left: 4px solid var(--pandan);
  animation: toast-in 0.25s ease-out; transition: opacity 0.35s, transform 0.35s;
}
.toast.good { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 20; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 28, 24, 0.45); display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow);
  width: min(520px, 100%); max-height: calc(100% - 16px); overflow-y: auto;
  padding: 22px 24px 18px; position: relative;
  border-top: 6px solid var(--pandan);
}
.modal.wide { width: min(920px, 100%); }
.modal.bad { border-top-color: var(--bad); }
.modal.warn { border-top-color: var(--warn); }
.modal.good { border-top-color: var(--good); }
.modal-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--pandan); }
.modal h2 { margin: 2px 0 10px; font: 800 26px/1.15 var(--font-display); text-wrap: balance; }
.modal h3 { font: 700 15px/1.25 var(--font-display); margin: 14px 0 6px; }
.modal h4 { margin: 10px 0 4px; font-size: 13px; }
.modal p { margin: 0 0 8px; max-width: 68ch; }
.modal .lead { font-size: 15px; }
.modal .impact { background: var(--paper-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; position: sticky; bottom: -18px; background: var(--paper); padding: 10px 0 4px; }
.modal-actions .btn.choice { flex: 1 1 200px; flex-direction: column; align-items: flex-start; text-align: left; padding: 10px 14px; }
.modal-actions .btn.choice:hover:not(:disabled) { background: var(--pandan-soft); }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; }
.report-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-cols > section { min-width: 0; }
.modal .charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal .chart-tip { position: absolute; }
.delta { font-weight: 700; font-size: 11.5px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.month-eval { border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.month-eval h3 { margin: 0 0 4px; }
.month-eval.good { background: var(--good-soft); }
.month-eval.bad { background: var(--warn-soft); }
.strategies { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 6px; }
.strategy { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.strategy:has(input:checked) { border-color: var(--pandan); background: var(--pandan-soft); }
.strategy input { accent-color: var(--pandan); margin-top: 3px; }
.strategy small { display: block; color: var(--ink-2); font-size: 12px; }

/* ---------- Layar kecil ---------- */
@media (max-width: 860px) {
  #menu {
    top: auto; bottom: 106px; left: 8px; right: 8px; width: auto; max-height: none;
    flex-direction: row; overflow-x: auto; padding: 4px; gap: 2px;
  }
  .menu-btn { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; white-space: nowrap; min-width: max-content; align-items: center; text-align: center; }
  .menu-btn.small { font-size: 11px; }
  .menu-sep { width: 1px; height: auto; margin: 4px 2px; }
  #drawer { left: 8px; right: 8px; width: auto; top: 30%; bottom: 170px; height: auto; }
  #activity { display: none; }
  #dock { bottom: 8px; gap: 6px; width: calc(100% - 16px); }
  .dock-group { padding: 4px; }
  .cams button { padding: 5px 7px; font-size: 12px; }
  .speed button { padding: 5px 7px; }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cols, .modal .charts { grid-template-columns: 1fr; }
  .shifts { grid-template-columns: 1fr; }
  .brand { min-width: 160px; }
}
@media (max-width: 520px) {
  .speed span { display: none; }
  .btn.big { padding: 9px 14px; font-size: 14px; }
  .mini-list { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px 14px; }
  .modal h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; transition: none; }
}

/* =====================================================================
   Halaman awal (nama toko & username) dan papan 10 Besar
   ===================================================================== */
body.setup-page { overflow: auto; background: linear-gradient(180deg, #8dcbf3 0%, #d9eefb 55%, var(--paper-2) 100%); min-height: 100%; }
.setup-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.setup-card { width: min(440px, 100%); background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 6px solid var(--pandan); padding: 24px 22px; display: grid; gap: 14px; }
.setup-card h1 { margin: 0; font: 800 28px/1.1 var(--font-display); }
.setup-card .muted { margin: 0; font-size: 14px; }
.setup-field { display: grid; gap: 5px; font-weight: 700; font-size: 13px; }
.setup-field input { width: 100%; font-size: 15px; padding: 10px 12px; }
.setup-field small { font-weight: 500; color: var(--ink-2); font-size: 12px; }
.setup-error { margin: 0; background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.setup-card .btn.big { justify-content: center; width: 100%; }
.setup-link { text-align: center; color: var(--pandan-deep); font-weight: 700; font-size: 13px; }

.lb-wrap { width: min(1180px, 100%); margin: 0 auto; padding: 24px 16px 40px; }
.lb-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.lb-head h1 { margin: 2px 0 4px; font: 800 30px/1.1 var(--font-display); }
.lb-head .muted { margin: 0; }
a.btn { text-decoration: none; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.lb-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.lb-card h2, .lb-card h3 { margin: 0; font: 700 16px/1.25 var(--font-display); }
.lb-desc { margin: 2px 0 8px; font-size: 12px; color: var(--ink-2); }
.lb-empty { margin: 8px 0; font-size: 13px; color: var(--ink-3); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.lb-list li:first-child { border-top: 0; }
.lb-list li.me { background: var(--kunyit-soft); border-radius: 8px; }
.lb-rank { font-weight: 800; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.lb-list li:nth-child(1) .lb-rank { color: #b8860b; }
.lb-who { min-width: 0; }
.lb-who b, .lb-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-who small { color: var(--ink-2); font-size: 11.5px; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.modal .lb-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }

/* =====================================================================
   Papan reklame: form sewa (iklan.php), admin, modal di dalam game
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ad-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
@media (max-width: 820px) { .ad-layout { grid-template-columns: minmax(0, 1fr); } .ad-side { order: -1; } }
.ad-form { display: grid; gap: 12px; }
.ad-form .setup-field input:not([type="radio"]):not([type="file"]), .ad-form select { width: 100%; font-size: 15px; padding: 9px 11px; }
.ad-form em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.field-error { color: var(--bad) !important; font-weight: 700 !important; }
.ad-colors { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ad-colors legend { padding: 0; margin-bottom: 5px; }
.swatch { cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 38px; height: 38px; border-radius: 10px; border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--kunyit), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--pandan); outline-offset: 3px; }
.ad-side { position: sticky; top: 16px; }
.ad-side h3 { margin: 0 0 8px; font: 700 15px/1.25 var(--font-display); }
.ad-side canvas, .ad-item canvas, .ad-modal-canvas { width: 100%; height: auto; aspect-ratio: 2 / 1; border-radius: 10px; display: block; box-shadow: var(--shadow); }
.ad-done { border-left: 6px solid var(--good); margin-bottom: 14px; }
.ad-flash { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.ad-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ad-admin-list { display: grid; gap: 12px; }
.ad-item { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; }
@media (max-width: 700px) { .ad-item { grid-template-columns: minmax(0, 1fr); } }
.ad-meta dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0 0 10px; font-size: 13px; }
.ad-meta dt { color: var(--ink-2); font-weight: 700; }
.ad-meta dd { margin: 0; overflow-wrap: anywhere; }
.ad-meta .row input { flex: 1 1 180px; }
.ad-modal-canvas { margin-bottom: 12px; }
