/* ============================================================
   ReportAutoAds — Dashboard monitoring iklan
   Palet mengikuti brand guideline: navy #0B2050, biru #0F72D6,
   hijau #12A81E, dengan netral hangat #171717 → #F7F6F0.
   ============================================================ */

:root {
  /* --- brand: navy & biru --- */
  --blue-900: #0B2050;
  --blue-800: #12305F;
  --blue-700: #14509E;
  --blue-600: #0F72D6;
  --blue-500: #0E9BEC;
  --blue-300: #9FB0CC;
  --blue-100: #E7EDF8;

  /* --- brand: hijau (aksen kedua) --- */
  --green-900: #0A5C11;
  --green-800: #0E8C18;
  --green-700: #12A81E;
  --green-600: #22C529;
  --green-500: #3FD247;
  --green-400: #12A81E;
  --green-200: #B7F34A;
  --green-100: #E7F7E8;

  /* --- semantic --- */
  --ok: #0E8C18;
  --ok-bg: #E7F7E8;
  --warn: #F5A524;
  --warn-bg: #FDF3E2;
  --danger: #E5484D;
  --danger-bg: #FDEAEA;

  /* --- surface --- */
  --bg: #F7F6F0;
  --surface: #FFFFFF;
  --surface-2: #FBFBF7;
  --border: #E8E8E2;
  --border-strong: #CFCFC6;
  --text: #171717;
  --text-2: #6E6E68;
  --text-3: #8A8A82;

  --sidebar-bg: linear-gradient(180deg, #0B2050 0%, #0D2657 55%, #103063 100%);
  --sidebar-text: #C8D2E6;
  --sidebar-text-2: #9FB0CC;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(24, 38, 51, .06), 0 1px 3px rgba(24, 38, 51, .04);
  --shadow-md: 0 4px 14px rgba(24, 38, 51, .07);
  --shadow-lg: 0 18px 48px rgba(20, 41, 61, .18);
  --sidebar-w: 236px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0A1020;
  --surface: #111A2E;
  --surface-2: #16223A;
  --border: #22314D;
  --border-strong: #2E4064;
  --text: #E7EDF8;
  --text-2: #9FB0CC;
  --text-3: #7286A6;
  --blue-100: #16294B;
  --green-100: #0E2818;
  --green-200: #14512A;
  --ok-bg: #0E2818;
  --warn-bg: #33280F;
  --danger-bg: #3A1B1D;
  --sidebar-bg: linear-gradient(180deg, #081736 0%, #0B2050 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 22px; }
/* Logo dipasang di atas kotak putih: garis dokumennya navy, jadi kalau
   ditempel langsung ke sidebar yang juga navy dia hilang. */
.brand-logo {
  width: 52px; height: 40px; border-radius: 11px; flex: 0 0 52px;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.brand-logo img { display: block; width: 40px; height: auto; }
/* Layar login memakai ukuran logo yang sama persis dengan sidebar — nama
   brand di dua tempat itu sama-sama 15px, jadi kotak logo yang lebih besar
   bikin proporsinya jomplang. */
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.brand-text > span { color: var(--sidebar-text-2); font-size: 10.5px; letter-spacing: .01em; }

/* Nama brand tiga warna, mengikuti logo: Report(navy) Auto(biru) Ads(hijau).
   Di sidebar yang gelap, navy diganti putih supaya tetap terbaca. */
.brand-text .bn { color: #FFFFFF; }
.brand-text .bb { color: #58B6F5; }
.brand-text .bg { color: #4FD257; }
.topbar .brand-text .bn, .login-brand .bn { color: var(--blue-900); }
.topbar .brand-text .bb, .login-brand .bb { color: var(--blue-600); }
.topbar .brand-text .bg, .login-brand .bg { color: var(--green-700); }
[data-theme="dark"] .topbar .brand-text .bn,
[data-theme="dark"] .login-brand .bn { color: #FFFFFF; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label {
  margin: 14px 8px 6px; font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sidebar-text-2); font-weight: 600;
}
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--sidebar-text);
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #E9F0F6; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(15,114,214,.45), rgba(18,168,30,.30));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(18,168,30,.35);
}
.nav-item.active svg { opacity: 1; color: var(--green-400); }
.badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  background: var(--danger); color: #fff; min-width: 20px; height: 20px;
  border-radius: 999px; display: grid; place-items: center; padding: 0 6px;
}
.badge[data-empty="1"] { display: none; }

.sidebar-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--sidebar-text-2);
  padding: 12px 10px 2px; border-top: 1px solid rgba(255,255,255,.07);
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 3px rgba(34,197,41,.22); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { padding: 26px 30px 46px; max-width: 1480px; width: 100%; }

.topbar {
  display: none; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar strong { flex: 1; font-size: 15px; }
.scrim { display: none; }

/* ============ PAGE HEAD ============ */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 3px; font-size: 24px; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.page-head .meta { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.page-head .spacer { flex: 1; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.segmented {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 4px; gap: 2px; box-shadow: var(--shadow-sm);
}
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button svg { width: 14px; height: 14px; flex: 0 0 14px; }
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: linear-gradient(120deg, var(--blue-600), var(--blue-700));
  color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(15,114,214,.35);
}

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--blue-600); border-color: var(--blue-300); }
.icon-btn.spin svg { animation: spin .7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; gap: 8px; transition: .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(120deg, var(--blue-600), var(--blue-800)); color: #fff; box-shadow: 0 3px 10px rgba(11,32,80,.28); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: linear-gradient(120deg, var(--green-500), var(--green-700)); color: #fff; box-shadow: 0 3px 10px rgba(14,140,24,.28); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }

/* ============ CARD ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 12px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .spacer { flex: 1; }
.card-body { padding: 4px 18px 18px; }

/* ============ FILTER BAR (funnel) ============ */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-sm);
}
.filter-label {
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; margin-right: 4px;
}
.fchip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; font-weight: 550; color: var(--text-2); transition: .15s;
}
.fchip i { width: 8px; height: 8px; border-radius: 50%; }
.fchip em {
  font-style: normal; font-size: 11px; font-weight: 700; color: var(--text-3);
  background: var(--surface); border-radius: 999px; padding: 1px 7px; border: 1px solid var(--border);
}
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip.active {
  background: linear-gradient(120deg, var(--blue-600), var(--blue-800));
  color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(11,32,80,.30);
}
.fchip.active em { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }

/* ============ FUNNEL CARDS ============ */
.funnel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.funnel-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: var(--surface-2); cursor: pointer; transition: .15s;
  border-top: 3px solid var(--fc, var(--blue-600));
}
.funnel-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.funnel-card.active {
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--fc, var(--blue-600)) inset, var(--shadow-md);
}
.funnel-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.funnel-top strong { font-size: 14px; letter-spacing: -.01em; }
.funnel-stage {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  color: #fff; background: var(--fc, var(--blue-600));
  padding: 2px 7px; border-radius: 5px;
}
.funnel-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.funnel-spend { font-size: 21px; font-weight: 700; letter-spacing: -.025em; display: flex; align-items: baseline; gap: 8px; }
.funnel-spend span { font-size: 11.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.funnel-bar {
  height: 7px; border-radius: 999px; background: var(--border);
  overflow: hidden; margin: 9px 0 12px;
}
.funnel-bar i { display: block; height: 100%; background: var(--fc, var(--blue-600)); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.3,1); }
.funnel-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 8px; }
.funnel-stats span { display: block; font-size: 10.5px; color: var(--text-3); }
.funnel-stats strong { font-size: 13.5px; font-weight: 650; }
.funnel-desc { margin-top: 11px; font-size: 11px; color: var(--text-3); line-height: 1.4; }

/* ============ COMPARE ============ */
.cmp-periods { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.cmp-period {
  border: 1px solid var(--border); border-left: 4px solid var(--pc, var(--blue-600));
  border-radius: 12px; padding: 13px 15px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
}
.cmp-period-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.cmp-period-date { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.cmp-period-meta { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.cmp-swap {
  align-self: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: .15s;
}
.cmp-swap svg { width: 18px; height: 18px; }
.cmp-swap:hover { color: var(--blue-600); border-color: var(--blue-300); transform: rotate(180deg); }

.cmp-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cmp-warn {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid transparent;
}

/* --- tabel rincian gaya laporan bulanan --- */
.report { padding-top: 6px; }
.report-dates {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 14px; color: var(--text-2); padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.report-dates b { color: var(--text); font-weight: 650; }

.report-headline { text-align: center; padding: 20px 8px 22px; }
.rh-name {
  font-size: 17px; font-weight: 750; letter-spacing: -.01em;
  display: inline-flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: center;
}
.rh-name .delta { font-size: 16px; font-weight: 750; }
.rh-name .delta svg { width: 15px; height: 15px; flex-basis: 15px; }
.rh-values { margin-top: 6px; font-size: 21px; letter-spacing: -.02em; }
.rh-values strong { font-weight: 750; }
.rh-values span { color: var(--text-3); font-weight: 500; }
.rh-sub { margin-top: 7px; font-size: 12.5px; color: var(--text-3); }
.rh-sub b { color: var(--text-2); font-weight: 650; }

table.report-table { min-width: 480px; }
table.report-table th { font-size: 11px; letter-spacing: .04em; text-transform: none; color: var(--text-2); }
table.report-table td { padding: 11px 12px; }
table.report-table td.prev { color: var(--text-3); }
table.report-table tr.group-row td {
  background: var(--surface-2); font-size: 10.5px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
  padding: 7px 12px;
}
table.report-table tbody tr:hover:not(.group-row) { background: var(--surface-2); }

.report-note {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 18px;
  background: linear-gradient(110deg, var(--blue-900) 0%, var(--blue-800) 55%, var(--green-800) 100%);
  color: #EAF0F6; border-radius: 12px; padding: 14px 16px;
  font-size: 13px; line-height: 1.55;
}
.report-note .rn-text { flex: 1; min-width: 0; white-space: pre-wrap; }
.rn-edit {
  flex: 0 0 auto; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  color: #fff; border-radius: 8px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.rn-edit:hover { background: rgba(255,255,255,.26); }

@media (max-width: 620px) {
  .report-dates { flex-direction: column; gap: 4px; font-size: 13px; }
  .rh-values { font-size: 18px; }
  .report-note { flex-direction: column; }
}

.cmp-row { padding: 11px 0; border-bottom: 1px solid var(--border); }
.cmp-row:last-of-type { border-bottom: 0; }
.cmp-row-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cmp-row-top .funnel-stage { font-size: 9px; padding: 1px 5px; }
.cmp-row-vals { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.cmp-row-bars { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.cmp-row-bars i { display: block; height: 6px; border-radius: 999px; min-width: 2px; transition: width .5s cubic-bezier(.2,.8,.3,1); }

@media (max-width: 720px) {
  .cmp-periods { grid-template-columns: 1fr; }
  .cmp-swap { transform: rotate(90deg); }
  .cmp-swap:hover { transform: rotate(270deg); }
}

/* ============ KPI ============ */
.kpi-grid {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px 14px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--blue-600);
}
.kpi.accent::before { background: var(--green-500); }
.kpi.ok::before { background: var(--ok); }
.kpi.warn::before { background: var(--warn); }
.kpi .label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 23px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
/* dipakai di kartu KPI, tabel report, dan baris perbandingan */
.delta { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.delta svg { width: 12px; height: 12px; flex: 0 0 12px; stroke-width: 2.4; }
.kpi .delta { margin-top: 7px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }

/* ============ GRID ============ */
.grid { display: grid; gap: 16px; }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt-16 { margin-top: 16px; }

/* ============ CHART ============ */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }
.chart-legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-2); }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.tick { font-size: 10.5px; fill: var(--text-3); stroke: none; }
.gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.axisline { stroke: var(--border-strong); stroke-width: 1; }

.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--blue-900); color: #fff; border-radius: 9px;
  padding: 8px 11px; font-size: 12px; box-shadow: var(--shadow-lg);
  transform: translate(-50%, -112%); white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.chart-tip b { display: block; font-size: 11px; color: #9DB6CC; font-weight: 600; margin-bottom: 4px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 50%; }
.chart-tip .row span { color: #C9D8E4; }
.chart-tip .row strong { margin-left: auto; padding-left: 12px; }

/* ============ DONUT LIST ============ */
.legend-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.legend-row { display: flex; align-items: center; gap: 9px; padding: 7px 4px; font-size: 13px; border-radius: 8px; }
.legend-row:hover { background: var(--surface-2); }
.legend-row i { width: 9px; height: 9px; border-radius: 50%; }
.legend-row .name { color: var(--text); }
.legend-row .val { margin-left: auto; font-weight: 650; }
.legend-row .amt { color: var(--text-3); font-size: 11.5px; }

/* ============ TABLE ============ */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface);
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--blue-600); }
table.data th .arrow { opacity: .45; font-size: 9px; }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Baris total di kaki tabel */
table.data tfoot .total-row td {
  background: var(--surface-2); font-weight: 700; font-size: 13px;
  border-top: 2px solid var(--border-strong); border-bottom: 0;
}

/* Paginasi tabel */
.pager {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.pager-info { font-size: 12.5px; color: var(--text-3); }
.pager-btns { display: flex; align-items: center; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.pager-num {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; transition: .15s;
}
.pager-num:hover { border-color: var(--border-strong); color: var(--text); }
.pager-num.active {
  background: linear-gradient(120deg, var(--blue-600), var(--blue-800));
  color: #fff; border-color: transparent;
}
@media (max-width: 620px) {
  .pager { flex-direction: column; align-items: stretch; }
  .pager-btns { margin-left: 0; justify-content: center; }
}
.cell-name { display: flex; align-items: center; gap: 9px; font-weight: 550; }
.cell-name .pdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.good { color: var(--ok); font-weight: 650; }
.bad { color: var(--danger); font-weight: 650; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.chip.blue { background: var(--blue-100); color: var(--blue-600); border-color: transparent; }
.chip.green { background: var(--green-100); color: var(--green-700); border-color: transparent; }

/* ============ ALERTS ============ */
.alert-list { display: flex; flex-direction: column; gap: 9px; }
.alert-item {
  display: flex; gap: 11px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--text-3); cursor: default;
}
.alert-item:hover { border-color: var(--border-strong); }
.alert-item.high { border-left-color: var(--danger); }
.alert-item.medium { border-left-color: var(--warn); }
.alert-item.low { border-left-color: var(--blue-500); }
.alert-item .body { flex: 1; min-width: 0; }
.alert-item .title { font-weight: 650; font-size: 13px; display: flex; gap: 7px; flex-wrap: wrap; align-items: baseline; }
.alert-item .title small { font-weight: 500; color: var(--text-3); }
.alert-item .desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.alert-item .time { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* ============ PLATFORM CARDS ============ */
.plat-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.plat-top { display: flex; align-items: center; gap: 11px; }
.plat-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.plat-top .n { font-weight: 700; font-size: 14.5px; }
.plat-top .s { font-size: 12px; color: var(--text-3); }
.plat-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
.plat-stats div span { display: block; font-size: 11px; color: var(--text-3); }
.plat-stats div strong { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }

/* ============ FORM ============ */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  outline: none; transition: .15s; font-size: 13.5px;
}
.input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(61,119,174,.15); }
textarea.input { resize: vertical; min-height: 90px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: .18s; flex: 0 0 40px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--blue-600); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Baris aturan alert di Pengaturan */
.rule-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.rule-row:last-of-type { border-bottom: 0; }
.rule-info { display: flex; flex-direction: column; min-width: 0; }
.rule-info strong { font-size: 13px; font-weight: 600; }
.rule-info span { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.rule-input { display: flex; align-items: center; gap: 7px; }
.rule-input .input { width: 118px; padding: 7px 9px; font-size: 12.5px; text-align: right; }
.rule-unit { font-size: 11.5px; color: var(--text-3); white-space: nowrap; min-width: 62px; }
@media (max-width: 620px) {
  .rule-row { grid-template-columns: auto 1fr; }
  .rule-input { grid-column: 2; justify-content: flex-start; }
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.toolbar .search .input { padding-left: 34px; }

.empty { text-align: center; padding: 34px 16px; color: var(--text-3); font-size: 13px; }
.empty svg { width: 34px; height: 34px; margin-bottom: 10px; opacity: .5; }

/* ============ LOGIN ============ */
body.need-login .app { display: none; }

.login-screen {
  position: fixed; inset: 0; z-index: 80; overflow: auto;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(15,114,214,.18), transparent 60%),
    radial-gradient(880px 460px at 92% 108%, rgba(18,168,30,.16), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(430px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 30px 28px 24px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand > div { display: flex; flex-direction: column; line-height: 1.25; }
.login-brand strong { font-size: 15px; }
.login-brand span { font-size: 11.5px; color: var(--text-3); }
.login-card h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.02em; }
.login-card > p { margin: 0 0 22px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }

.login-buttons { display: flex; flex-direction: column; gap: 10px; }
.login-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 15px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); transition: .15s;
}
.login-btn:hover:not(:disabled) { border-color: var(--blue-500); box-shadow: 0 3px 12px rgba(15,114,214,.16); transform: translateY(-1px); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; }
.lb-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: 0 0 38px; }
.lb-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lb-text strong { font-size: 13.5px; font-weight: 650; }
.lb-text span { font-size: 11.5px; color: var(--text-3); }
.lb-arrow { color: var(--text-3); font-size: 16px; }

.login-note {
  margin-top: 18px; padding: 10px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5;
  background: var(--warn-bg); color: var(--warn);
}
.login-note.err { background: var(--danger-bg); color: var(--danger); }
.login-note code { font-size: 11.5px; }
.login-foot { margin-top: 18px; font-size: 11.5px; color: var(--text-3); text-align: center; line-height: 1.5; }

/* ============ USER CHIP ============ */
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 9px 8px; margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.07);
}
.uc-av {
  width: 28px; height: 28px; border-radius: 9px; flex: 0 0 28px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-600), var(--green-700)); color: #fff;
  font-weight: 700; font-size: 12.5px;
}
.uc-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.uc-name strong { font-size: 12.5px; color: #E9F0F6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-name span { font-size: 10.5px; color: var(--sidebar-text-2); }
.uc-out {
  margin-left: auto; background: transparent; border: 0; color: var(--sidebar-text-2);
  cursor: pointer; padding: 4px; border-radius: 7px; display: grid; place-items: center;
}
.uc-out svg { width: 16px; height: 16px; }
.uc-out:hover { color: #fff; background: rgba(255,255,255,.09); }

/* ============ PEMILIH LINGKUP AD ACCOUNT ============ */
.scope { padding: 0 6px 14px; display: flex; flex-direction: column; gap: 5px; }
.scope-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sidebar-text-2); font-weight: 700;
}
.scope-sel {
  width: 100%; padding: 8px 10px; border-radius: 9px; font-size: 12.5px;
  background: rgba(255,255,255,.07); color: #E9F0F6;
  border: 1px solid rgba(255,255,255,.14); outline: none; cursor: pointer;
}
.scope-sel:focus { border-color: var(--green-400); }
.scope-sel option, .scope-sel optgroup { background: #17293A; color: #E9F0F6; }

/* ============ KONEKSI OAUTH ============ */
.conn-block {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 12px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 9px;
}
.conn-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-head strong { font-size: 13px; }
/* ---------- Login email/password ---------- */
.login-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.login-form label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 6px; }
.login-submit { width: 100%; justify-content: center; margin-top: 14px; }
.login-err { font-size: 12px; color: var(--danger); min-height: 16px; margin-top: 6px; }
.login-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 14px; font-size: 11.5px; color: var(--text-3);
}
.login-sep::before, .login-sep::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ---------- Form token manual ---------- */
.tok-box {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); overflow: hidden;
}
.tok-box > summary {
  cursor: pointer; padding: 10px 12px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; list-style: none;
}
.tok-box > summary::-webkit-details-marker { display: none; }
.tok-box > summary svg { width: 15px; height: 15px; }
.tok-box > summary:hover { background: var(--surface); }
.tok-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 9px; }
/* token panjang dan tidak perlu dibaca ulang — biar dibungkus, bukan melebar */
.tok-input {
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  resize: vertical; word-break: break-all;
}
.tok-msg {
  font-size: 11.5px; line-height: 1.45; border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.tok-msg.err { background: var(--danger-bg); color: var(--danger); }
.tok-msg.ok { background: var(--ok-bg); color: var(--ok); }
.tok-msg span { color: var(--text-2); }

/* ---------- Daftar akun klien ---------- */
.user-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 10px; border-radius: 9px; background: var(--surface-2);
  border: 1px solid var(--border);
}
.user-row .ad-txt { flex: 1; min-width: 150px; }

/* ---------- AI Insight ---------- */
.ai-bar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:4px}
.ai-bar .oa-hint{flex:1;min-width:200px}
.ai-wait{padding:26px 0;color:var(--text-2);font-size:13.5px}
.ai-setup{padding:30px 26px}
.ai-setup h3{margin:0 0 8px;font-size:16px}
.ai-setup p{margin:0 0 12px;color:var(--text-2);max-width:62ch;line-height:1.6}
.ai-setup pre{
  background:var(--surface-2);border:1px solid var(--border);border-radius:8px;
  padding:11px 13px;margin:0;overflow-x:auto;
  font-family:ui-monospace,Consolas,monospace;font-size:12.5px;
}
/* Keluaran model dibaca berurutan, bukan dipindai — jadi diberi lebar baca
   yang wajar, bukan dibiarkan selebar layar. */
.ai-out{margin-top:18px;max-width:74ch}
.ai-out h4{
  margin:22px 0 8px;font-size:14px;font-weight:700;letter-spacing:-.01em;
  color:var(--blue-600);
}
.ai-out h4:first-child{margin-top:0}
.ai-out p{margin:0 0 10px;line-height:1.65;color:var(--text)}
.ai-out ul{margin:0 0 14px;padding-left:20px;display:flex;flex-direction:column;gap:7px}
.ai-out li{line-height:1.6}
.ai-out strong{font-weight:650}
.ai-meta{
  margin-top:18px;padding-top:12px;border-top:1px solid var(--border);
  font-size:11.5px;color:var(--text-3);font-family:ui-monospace,Consolas,monospace;
}

/* ---------- Profil Audiens ---------- */
.aud-list{display:flex;flex-direction:column;gap:13px}
.aud-row{display:flex;flex-direction:column;gap:5px}
.aud-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.aud-name{font-size:12.5px;font-weight:550;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aud-val{font-size:12.5px;font-weight:600;white-space:nowrap;font-variant-numeric:tabular-nums}
.aud-val em{font-style:normal;font-weight:450;color:var(--text-3);margin-left:7px;font-size:11.5px}
/* latar bar tetap kelihatan walau nilainya nol, biar barisnya tidak terlihat rusak */
.aud-bar{height:6px;border-radius:4px;background:var(--surface-2);border:1px solid var(--border);overflow:hidden}
.aud-bar i{display:block;height:100%;background:var(--blue-600);border-radius:4px}

/* ---------- Ads Performance ---------- */
.ad-cell { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.ad-thumb {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px;
  object-fit: cover; background: var(--surface-2); border: 1px solid var(--border);
}
/* URL thumbnail dari CDN Meta bisa kedaluwarsa. Kalau gagal dimuat, kotaknya
   tetap dipertahankan supaya baris tabel tidak melompat-lompat tingginya. */
.ad-thumb.gagal { display: inline-block; background: var(--surface-2); }
.ad-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ad-txt strong { font-size: 13px; font-weight: 600; }
.ad-txt span { font-size: 11px; color: var(--text-3); }
.ad-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
}
.ad-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ad-state.on { color: var(--ok); }
.ad-state.off { color: var(--text-3); }

.acc-list { display: flex; flex-direction: column; gap: 2px; }
.acc-item {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 9px;
  align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
.acc-item:hover { background: var(--surface); }
.acc-item input { grid-row: span 2; width: 15px; height: 15px; accent-color: var(--blue-600); cursor: pointer; }
.acc-name { font-size: 12.5px; font-weight: 550; }
.acc-meta {
  font-size: 10.5px; color: var(--text-3); grid-column: 2;
  font-family: ui-monospace, Consolas, monospace;
}

/* Status penarikan data per ad account. Baris ketiga di grid .acc-item, jadi
   checkbox-nya dipatok ke atas supaya tidak ikut melayang ke tengah saat
   akun yang gagal menampilkan kalimat perbaikan yang panjang. */
.acc-item input { align-self: start; margin-top: 2px; }
.acc-status {
  grid-column: 2; font-size: 11px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
}
.acc-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px;
}
.acc-status.ok { color: var(--ok); }
.acc-status.empty { color: var(--text-3); }
.acc-status.off { color: var(--text-3); font-weight: 450; }
.acc-status.fail { color: var(--danger); }
.acc-fix {
  grid-column: 2; font-size: 11px; color: var(--text-2); line-height: 1.45;
  background: var(--danger-bg); border-radius: 7px; padding: 6px 8px; margin-top: 3px;
}

.oa-box { display: flex; flex-direction: column; gap: 9px; }
.oa-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.45; }
.oa-row { display: flex; gap: 7px; flex-wrap: wrap; }
.oa-row .input { font-size: 12.5px; padding: 8px 10px; }
.oa-acc {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 1px;
}
.oa-acc span { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.oa-acc strong { font-size: 13.5px; }
.oa-acc em { font-style: normal; font-size: 11px; color: var(--text-3); font-family: ui-monospace, Consolas, monospace; }
.oa-warn {
  background: var(--warn-bg); color: var(--warn); border-radius: 9px;
  padding: 8px 11px; font-size: 11.5px; line-height: 1.45;
}

/* Baris kelompok metrik menempel ke kartu KPI di bawahnya */
.metric-bar { margin-bottom: 14px; }
.metric-bar .btn svg { width: 15px; height: 15px; }
@media (max-width: 720px) {
  .metric-bar { overflow-x: auto; flex-wrap: nowrap; }
  .metric-bar #metricEditBtn { margin-left: 8px !important; flex: 0 0 auto; }
}

/* Pemilih metrik di header grafik Tren Performa */
.trend-sel {
  width: auto; max-width: 160px; padding: 6px 9px; font-size: 12px;
  border-radius: 8px; cursor: pointer;
}
.trend-sel + .trend-sel { margin-left: 6px; }
@media (max-width: 620px) {
  .trend-sel { max-width: 120px; font-size: 11.5px; }
}

/* ============ PEMILIH METRIK DASHBOARD ============ */
.mp-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; }
.mp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; border: 1px solid transparent;
}
.mp-item.on { background: var(--surface-2); border-color: var(--border); }
.mp-item:hover { border-color: var(--border-strong); }
.mp-item label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.mp-item input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; flex: 0 0 16px; }
.mp-item span { font-size: 13px; font-weight: 550; }
.mp-item:not(.on) span { color: var(--text-3); font-weight: 500; }
.mp-move { display: flex; gap: 3px; }
.mp-move button {
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; transition: .12s;
}
.mp-move button svg { width: 14px; height: 14px; }
.mp-move button:hover:not(:disabled) { color: var(--blue-600); border-color: var(--blue-300); }
.mp-move button:disabled { opacity: .3; cursor: not-allowed; }
.mp-sep {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 14px 10px 6px;
}
.mp-count { margin-top: 12px; font-size: 12px; color: var(--text-3); text-align: center; }

.env-keys { display: flex; flex-wrap: wrap; gap: 7px; }
.env-keys code {
  font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 9px; color: var(--text-2);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* ============ MODAL ============ */
.modal-back {
  position: fixed; inset: 0; background: rgba(18,32,44,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px; z-index: 90; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: 88vh; overflow: auto; border: 1px solid var(--border);
  animation: pop .18s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 0 20px 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 12px 0 4px; }
.kv > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.kv span { display: block; font-size: 11px; color: var(--text-3); }
.kv strong { font-size: 15px; letter-spacing: -.02em; }

/* ============ TOAST ============ */
.toast-root { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 120; }
.toast {
  background: var(--blue-900); color: #fff; border-radius: 11px; padding: 11px 15px;
  font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px;
  animation: slideIn .2s; max-width: 330px;
}
.toast.ok { background: linear-gradient(120deg, #2F8F63, #24704E); }
.toast.err { background: linear-gradient(120deg, #C0503C, #93372A); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 18px 16px 40px; }
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15,26,36,.5); z-index: 35; }
  .page-head h1 { font-size: 20px; }
  .page-head .head-actions { width: 100%; }
  /* 5 tombol rentang tidak muat di layar kecil — biar bisa digeser sendiri
     tanpa membuat halaman ikut melebar */
  .segmented { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .segmented::-webkit-scrollbar { height: 0; }
  .segmented button { padding: 7px 10px; font-size: 12.5px; }
}
