/* Lead Analytics — tema "light clean" */
:root {
  color-scheme: light;
  --page: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --surface-3: #ececf0;
  --border: rgba(11, 11, 11, 0.08);
  --border-strong: rgba(11, 11, 11, 0.15);
  --text: #191919;
  --text-2: #666666;
  --text-3: #8b8b93;
  --accent: #257de0;
  --accent-hover: #1b64be;
  --accent-soft: #eaf3fd;
  --accent-ring: rgba(37, 125, 224, 0.28);
  /* warna data (lolos validasi CVD) */
  --series-1: #257de0;   /* lead iklan */
  --series-2: #f47230;   /* order */
  --context: #dcdce2;    /* total chat (konteks) */
  --spark: #b9b9c1;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  /* status */
  --good: #006c10;
  --good-bg: #e8f5ea;
  --bad: #c4302f;
  --bad-bg: #fdecec;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --note-bg: #fff8db;
  --wa: #1fa855;
  --wa-hover: #188a45;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 650; font-size: 15px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.brand small { display: block; font-weight: 450; font-size: 12px; color: var(--text-2); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; cursor: pointer; border: 0; background: none; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--series-2); color: #fff; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: rgba(247, 247, 248, 0.86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.content { padding: 4px 28px 40px; max-width: 1360px; width: 100%; }

.bottom-nav { display: none; }

/* ------------------------------------------------------------ status chip */
.chip-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.dot.idle { background: var(--axis); }
.dot.busy { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .nav-item:focus-visible, .seg button:focus-visible,
.chart:focus-visible, .tab:focus-visible, .switch input:focus-visible + span { outline: 3px solid var(--accent-ring); outline-offset: 1px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); border-color: var(--wa-hover); }
.btn-danger { color: var(--bad); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.input, .select, .textarea {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; min-width: 0;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; width: 100%; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; width: 240px; }
label.field { display: grid; gap: 6px; font-weight: 550; font-size: 13px; }
label.field .hint, .hint { font-weight: 400; color: var(--text-2); font-size: 12px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 20px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background 0.15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ------------------------------------------------------------ filter bar & date popover */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 18px; }
.filters .sep { flex: 1; }
.popover-wrap { position: relative; }
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 240px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
}
.popover .opt { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.popover .opt:hover { background: var(--surface-2); }
.popover .opt .check { width: 16px; height: 16px; color: var(--text); visibility: hidden; flex: none; }
.popover .opt.on .check { visibility: visible; }
.popover .opt.on { font-weight: 650; }
.popover .foot { border-top: 1px solid var(--border); margin-top: 6px; padding: 10px 6px 4px; display: grid; gap: 8px; }
.popover .foot .row { display: flex; gap: 6px; align-items: center; }
.popover .foot .input { height: 32px; padding: 0 8px; flex: 1; }

/* ------------------------------------------------------------ cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-kpi { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 16px; }
.kpi-side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; grid-column: span 2; }

.tile { display: flex; flex-direction: column; gap: 6px; }
.tile .label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.tile .key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.tile .sub { color: var(--text-2); font-size: 12.5px; }
.tile .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.hero .value { font-size: 56px; letter-spacing: -0.03em; }
.hero { justify-content: space-between; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta.up-good, .delta.down-good { color: var(--good); }
.delta.up-bad, .delta.down-bad { color: var(--bad); }
.delta.flat, .delta.neutral { color: var(--text-2); }
.delta small { font-weight: 450; color: var(--text-2); }
.spark { width: 112px; height: 34px; flex: none; }
.hero .spark { width: 100%; max-width: 280px; height: 48px; }

.cost-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; }
.cost-strip .tile { padding: 18px 20px; }
.cost-strip .tile + .tile { border-left: 1px solid var(--border); }
.cost-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 0; color: var(--text-2); font-size: 12.5px; flex-wrap: wrap; }
.cost-wrap { padding: 0; }

.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid #cfe2fb; background: var(--accent-soft); margin-bottom: 16px; flex-wrap: wrap; }
.banner .txt { flex: 1; min-width: 220px; }
.banner strong { display: block; }
.banner.warn { background: var(--warn-bg); border-color: #f5e0ad; }

/* ------------------------------------------------------------ charts */
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-2); font-size: 12.5px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lk-line { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.lk-rect { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { width: 100%; position: relative; outline: none; border-radius: 6px; }
.chart text { font-family: var(--font); }
.chart .tick { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .endlabel { fill: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .barlabel { fill: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .rowlabel { fill: var(--text); font-size: 12.5px; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .cell { transition: opacity 0.1s; }
.chart .cell.dim { opacity: 0.55; }
.loading-dim { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 10px; flex-wrap: wrap; }
.scale i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.empty { display: grid; place-items: center; gap: 6px; text-align: center; color: var(--text-2); padding: 36px 12px; }
.empty svg { width: 28px; height: 28px; color: var(--text-3); }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; min-width: 150px; max-width: 280px;
}
.tooltip .tt-title { color: var(--text-2); margin-bottom: 6px; font-size: 12px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; font-size: 13px; }
.tooltip .tt-row span.n { color: var(--text-2); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 550; color: var(--text-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #fafafb; }
.table .who { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.table .who b { font-weight: 600; display: block; }
.table .snip { color: var(--text-2); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-weight: 650; font-size: 12.5px; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.blue { background: var(--accent-soft); color: var(--accent-hover); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }

/* ------------------------------------------------------------ list cards (follow-up) */
.list { display: grid; gap: 10px; }
.lead { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.lead .top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lead .top b { font-size: 14.5px; }
.lead .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.lead .msg { margin-top: 8px; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead .msg b { color: var(--text); font-weight: 600; }
.lead .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.statline { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.statline .tile .value { font-size: 24px; }

/* ------------------------------------------------------------ drawer & modal */
.overlay { position: fixed; inset: 0; background: rgba(15, 15, 20, 0.32); z-index: 60; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 61;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide 0.2s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0.4; } }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.drawer-head .row { display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 28px; background: #fbfbfc; }
.order-box { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.chat { display: grid; gap: 6px; }
.daysep { text-align: center; color: var(--text-3); font-size: 12px; margin: 14px 0 6px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.bubble.in { justify-self: start; border-bottom-left-radius: 4px; }
.bubble.out { justify-self: end; background: var(--accent-soft); border-color: #d6e7fb; border-bottom-right-radius: 4px; }
.bubble.note { justify-self: end; background: var(--note-bg); border-color: #f1e3a1; }
.bubble .who { font-size: 11.5px; color: var(--text-2); margin-bottom: 2px; font-weight: 550; }
.bubble .time { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 3px; }
.bubble img { display: block; max-width: 220px; max-height: 260px; border-radius: 9px; margin: 4px 0; background: var(--surface-2); }
.bubble.signal { box-shadow: 0 0 0 2px rgba(244, 114, 48, 0.55); }

.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { position: relative; z-index: 71; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(680px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px 22px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* tag input */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); min-height: 38px; align-items: center; }
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 7px; background: var(--surface-2); font-size: 13px; max-width: 100%; }
.tag span { overflow: hidden; text-overflow: ellipsis; }
.tag button { border: 0; background: none; cursor: pointer; padding: 2px; border-radius: 5px; color: var(--text-2); display: grid; }
.tag button:hover { background: var(--surface-3); }
.tag button svg { width: 13px; height: 13px; }
.tags input { border: 0; outline: none; flex: 1; min-width: 140px; height: 26px; background: transparent; }

.checklist { border: 1px solid var(--border-strong); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-weight: 450; }
.checklist label:last-child { border-bottom: 0; }
.checklist label:hover { background: var(--surface-2); }
.checklist .grow { flex: 1; min-width: 0; }
.checklist .grow div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 10px 12px; color: var(--text-2); font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.camp { display: grid; gap: 10px; }
.camp-row { display: flex; gap: 14px; align-items: flex-start; }
.camp-row .grow { flex: 1; min-width: 0; display: grid; gap: 8px; }
.camp-row h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.result { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--surface-2); }

/* toasts */
.toasts { position: fixed; z-index: 120; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { background: #1d1d22; color: #fff; padding: 11px 14px; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: center; animation: fade 0.2s ease; }
.toast.err { background: #8f1f1f; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 50% -10%, #e6f0fc 0%, rgba(230,240,252,0) 60%), var(--page); }
.login .card { width: min(380px, 100%); padding: 28px; display: grid; gap: 16px; }
.login h1 { margin: 0; font-size: 20px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ------------------------------------------------------------ responsif */
@media (max-width: 1180px) {
  .grid-kpi { grid-template-columns: 1fr 1fr; }
  .kpi-side { grid-column: span 2; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 2px 16px calc(84px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 2px; justify-content: center; align-items: center; text-align: center; position: relative; }
  .bottom-nav .nav-item.active { background: transparent; color: var(--accent); }
  .bottom-nav .nav-badge { position: absolute; top: 0; right: calc(50% - 22px); margin: 0; font-size: 10px; padding: 0 5px; }
  .grid-2 { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .filters .search { flex: 1 1 200px; }
}
@media (max-width: 640px) {
  .grid-kpi { grid-template-columns: 1fr; gap: 12px; }
  .kpi-side { grid-column: auto; gap: 12px; }
  .hero .value { font-size: 48px; }
  .tile .value { font-size: 24px; }
  .card { padding: 16px; border-radius: 13px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .cost-strip { grid-template-columns: 1fr; }
  .cost-strip .tile + .tile { border-left: 0; border-top: 1px solid var(--border); }
  .cost-strip .tile { padding: 14px 16px; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; }
  .cost-strip .tile .value { font-size: 20px; }
  .lead { grid-template-columns: auto 1fr; }
  .lead .actions { grid-column: 1 / -1; justify-content: stretch; }
  .lead .actions .btn { flex: 1; }
  .chip-status .long { display: none; }
  .topbar .btn .long { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; }
  .hide-sm { display: none !important; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .table.responsive td { border: 0; padding: 0; }
  .table.responsive td.r { text-align: left; }
  .table.responsive td[data-l]::before { content: attr(data-l) ": "; color: var(--text-3); font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .bottom-nav, .topbar .btn, .filters { display: none !important; }
  .shell { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ hero order + komposisi */
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.hero .hero-row .spark { flex: 1 1 auto; width: auto; min-width: 90px; max-width: 260px; height: 52px; margin-bottom: 8px; }
.mix-wrap { margin-top: auto; padding-top: 10px; }
.mix { display: flex; gap: 2px; height: 10px; }
.mix i { display: block; min-width: 3px; }
.mix i:first-child { border-radius: 99px 0 0 99px; }
.mix i:last-child { border-radius: 0 99px 99px 0; }
.mix i:only-child { border-radius: 99px; }
.mix-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 9px; font-size: 12.5px; color: var(--text-2); }
.mix-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mix-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.mix-legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cost-head svg, .banner svg { width: 16px; height: 16px; flex: none; }
.banner > svg { width: 20px; height: 20px; color: var(--accent); }
.banner.warn > svg { color: var(--warn); }
.brand-mark svg { width: 18px; height: 18px; }
.lead .badge svg { width: 12px; height: 12px; }
/* item grid tidak boleh melebar mengikuti isi (tabel lebar menggulir di dalam kartunya sendiri) */
.grid-2 > *, .grid-kpi > *, .kpi-side > *, .stack > *, .content > * { min-width: 0; }
@media (max-width: 640px) {
  .kpi-side .spark { display: none; }
  .hero .hero-row .spark { max-width: 60%; }
}
