/* Hunting Cuan — design system v11
   Prinsip warna: indigo = aksi, hijau = baik, kuning = perhatian, merah = masalah.
   Warna platform HANYA di penanda huruf kecil (.pl) dan grafik. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f2f4f7; --surface-3: #e9edf2;
  --border: #e4e7ec; --border-strong: #d0d5dd;
  --text: #101828; --text-2: #475467; --text-3: #8b95a7;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eef2ff; --accent-ink: #3730a3;
  --success: #079455; --success-soft: #ecfdf3;
  --warning: #b54708; --warning-dot: #f79009; --warning-soft: #fffaeb;
  --danger: #d92d20; --danger-soft: #fef3f2;
  --info: #2e90fa;
  --sidebar: #0f1729; --sidebar-text: #aab4c6; --sidebar-active: #1d2940;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 16px 40px -12px rgba(16, 24, 40, .25);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bottomnav-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #111a2e; --surface-2: #17223a; --surface-3: #1e2b47; --border: #22304b; --border-strong: #2e3e5e;
    --text: #e6eaf2; --text-2: #a5b0c4; --text-3: #6b7894;
    --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e2350; --accent-ink: #c7d2fe;
    --success: #3ccb7f; --success-soft: #0f2e22; --warning: #fdb022; --warning-dot: #fdb022; --warning-soft: #33250a;
    --danger: #f97066; --danger-soft: #3a1512;
    --sidebar: #070c18; --sidebar-active: #16213a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #17223a; --surface-3: #1e2b47; --border: #22304b; --border-strong: #2e3e5e;
  --text: #e6eaf2; --text-2: #a5b0c4; --text-3: #6b7894;
  --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e2350; --accent-ink: #c7d2fe;
  --success: #3ccb7f; --success-soft: #0f2e22; --warning: #fdb022; --warning-dot: #fdb022; --warning-soft: #33250a;
  --danger: #f97066; --danger-soft: #3a1512;
  --sidebar: #070c18; --sidebar-active: #16213a; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
svg.i.sm { width: 15px; height: 15px; vertical-align: -3px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hidden, [hidden] { display: none !important; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.warn-text { color: var(--warning); }
.show-sm { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 18px 12px; position: sticky; top: 0;
           height: 100vh; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700;
         font-size: 16px; letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; flex: none; }
.topbar .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); letter-spacing: 0; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5d6a84; padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px;
         border-radius: 99px; line-height: 16px; }
.count.warn { background: var(--warning-dot); color: #1f1300; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #1c2740; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sidebar-foot button { background: none; border: 0; color: var(--sidebar-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.sidebar-foot button:hover { background: var(--sidebar-active); color: #fff; }

.main { min-width: 0; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; }
.topbar { display: none; }
.bottomnav { display: none; }
.content { max-width: 1280px; padding: 24px 28px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.card-body { padding: 18px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }

/* status: dot + teks (makna, bukan platform) */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.st.ok { color: var(--success); } .st.ok::before { background: var(--success); }
.st.warn { color: var(--warning); } .st.warn::before { background: var(--warning-dot); }
.st.bad { color: var(--danger); } .st.bad::before { background: var(--danger); }
.st.run { color: var(--accent); } .st.run::before { background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* penanda platform */
.pl { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 9.5px;
      font-weight: 800; line-height: 1; flex: none; letter-spacing: 0; }
.pl.lg { width: 30px; height: 30px; font-size: 13px; border-radius: 9px; }
.pchip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* status platform (Ringkasan) */
.pflist { display: flex; flex-direction: column; }
.pfrow { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(120px, 1fr) 90px minmax(120px, 1fr) 40px;
         gap: 10px 16px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.pfrow:last-child { border-bottom: 0; }
.pfrow-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pfrow-name b { font-weight: 600; }
.pfrow-num, .pfrow-time { display: flex; flex-direction: column; line-height: 1.25; }
.pfrow-num b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pfrow-num span, .pfrow-time span { font-size: 11.5px; color: var(--text-3); }
.pfrow-time b { font-weight: 550; font-size: 13px; }
.pfrow-act { display: flex; justify-content: flex-end; }
.pfrow-note { grid-column: 1 / -1; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; padding-left: 42px; margin-top: -4px; }

/* grafik */
.chart { display: flex; gap: 8px; height: 150px; }
.chart-grid { display: flex; flex-direction: column; justify-content: space-between; font-size: 10.5px; color: var(--text-3);
              text-align: right; min-width: 18px; padding-bottom: 1px; }
.chart-bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--border);
              background: linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 50%; }
.chart .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; height: 100%; position: relative; min-width: 0; cursor: default; }
.chart .col:hover { background: var(--surface-2); }
.chart .bar { border-radius: 2px 2px 0 0; min-height: 2px; }
.chart .col:hover::after, .chart .col:focus::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%;
  transform: translate(-50%, -6px); background: var(--text); color: var(--surface); font-size: 11.5px; padding: 4px 8px;
  border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.chart-x { display: flex; gap: 3px; margin: 6px 0 0 26px; }
.chart-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--text-3); min-width: 0; overflow: visible; white-space: nowrap; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.toprow { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.toprow:last-child { border-bottom: 0; }
.toprow:hover { background: var(--surface-2); color: var(--text); }
.toprow .grow { display: flex; flex-direction: column; }
.toprow-pf { display: flex; gap: 8px; font-size: 12px; color: var(--text-2); }
.toprow-pf span { display: inline-flex; align-items: center; gap: 3px; }
.toprow > b { font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 1px 8px;
         border-radius: 99px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; line-height: 18px; }
.badge.drop, .badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.dot-new { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: 1px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
       font: 500 13.5px var(--font); border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
       background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none;
       transition: background .12s, border-color .12s, color .12s; touch-action: manipulation; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn.icon { width: 34px; height: 34px; padding: 0; }
.btn.icon.sm { width: 30px; height: 30px; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent;
                       border-radius: 50%; animation: spin .7s linear infinite; }
.btn.icon.loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.star-on { color: #f5a524 !important; }
.star-on svg { fill: #f5a524; }

/* menu ⋯ */
.menu { position: relative; display: inline-flex; }
.menu-list { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; padding: 5px;
             background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.menu.open .menu-list { display: block; }
.menu.up .menu-list { top: auto; bottom: calc(100% + 4px); }
.menu-list > a, .menu-list > button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0;
  background: none; border-radius: 7px; font: 500 13px var(--font); color: var(--text); cursor: pointer; text-align: left; white-space: nowrap; }
.menu-list > a:hover, .menu-list > button:hover { background: var(--surface-2); color: var(--text); }
.menu-list > .danger { color: var(--danger); }
.menu-list > .danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu-note { display: block; font-size: 11.5px; color: var(--text-3); padding: 6px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; white-space: normal; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 550; color: var(--text); }
.field .hint, .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input { height: 38px; width: 100%; padding: 0 12px; font: 14px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
  transition: border-color .12s, box-shadow .12s; min-width: 0; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { height: 32px; font-size: 13px; }
.input.num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.input-prefix > .input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; }
.seg.scroll-x { overflow-x: auto; scrollbar-width: none; }
.seg input { display: none; }
.seg label, .seg a { padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg input:checked + label, .seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
                        transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch.sm .track { width: 30px; height: 18px; }
.switch.sm .track::after { width: 12px; height: 12px; }
.switch.sm input:checked + .track { background: var(--success); }
.switch.sm input:checked + .track::after { transform: translateX(12px); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:first-child { padding-top: 0; }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.setting-row .desc { max-width: 580px; min-width: 0; }
.setting-row .desc p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.setting-row .ctl { flex: none; width: 220px; }
.setting-row .ctl-end { width: auto; display: flex; justify-content: flex-end; }
.setting-row .ctl-num { width: auto; display: flex; gap: 8px; align-items: center; }
.setting-row .ctl-num .input.unit { width: 96px; }
.interval-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.chip-btn:hover { color: var(--text); border-color: var(--border-strong, var(--border)); }
.chip-btn.on { background: var(--accent-soft, var(--surface)); color: var(--accent); border-color: var(--accent); }
.settings-wrap { max-width: 860px; }
.savebar { display: none; align-items: center; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border);
           background: var(--accent-soft); border-radius: 0 0 var(--radius) var(--radius);
           position: sticky; bottom: calc(var(--bottomnav-h) + var(--safe-b)); z-index: 10; }
form.dirty .savebar { display: flex; }
details.adv > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 14px 0 8px; }
.devlist { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.devlist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.devlist li .btn.sm { margin-left: auto; }
.devlist li .btn.sm + .btn.sm { margin-left: 0; }
.paircode { margin-top: 8px; }
/* ---- aplikasi Android (WebView) */
.app-only { display: none; }
html.in-app .app-only { display: block; }
html.in-app .web-only, html.in-app [data-enable-notif], html.in-app [data-install] { display: none !important; }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.checklist li::before { content: "✗"; color: var(--danger, #ef4444); font-weight: 700; margin-right: 6px; }
.checklist li.ok::before { content: "✓"; color: var(--success, #10b981); }
.app-update { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
              margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px;
              background: color-mix(in srgb, var(--accent, #6366f1) 14%, var(--surface, #fff)); border: 1px solid var(--border, #ddd); }
.app-update .btn { margin-left: auto; }
.paircode b { font-size: 26px; letter-spacing: .14em; font-variant-numeric: tabular-nums; color: var(--accent, #34d399); }

/* chip input */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; min-height: 38px; border: 1px solid var(--border-strong);
         border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border);
        border-radius: 6px; padding: 1px 4px 1px 8px; font-size: 12.5px; max-width: 100%; overflow-wrap: anywhere; }
.chip.red { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 3px; font-size: 15px; line-height: 1; opacity: .7; }
.chip button:hover { opacity: 1; }
.chips input { border: 0; outline: none; flex: 1; min-width: 120px; font: 13.5px var(--font); background: transparent; color: var(--text); padding: 3px 4px; }

/* ---------------------------------------------------------------- toolbar & table */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.toolbar .search .input { padding-left: 34px; height: 34px; }
.toolbar select.input { width: auto; height: 34px; max-width: 200px; }
.bulkbar { display: none; align-items: center; gap: 8px; padding: 8px 14px; background: var(--accent-soft); flex-wrap: wrap;
           border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.bulkbar.show { display: flex; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2);
            padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.right { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.paused td { opacity: .5; }
.table tr.paused td.keep { opacity: 1; }
.table .check { width: 36px; padding-right: 0; }
.kw-name { font-weight: 600; }
.kw-sub { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.kw-sub:empty { display: none; }
.tag { font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
a.tag:hover { background: var(--surface-3); color: var(--text); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warning-soft); color: var(--warning); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ---------------------------------------------------------------- findings */
.feed { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px;
        border-bottom: 1px solid var(--border); position: relative; }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--surface-2); }
.item.unread::before, .mini-item.unread::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
.item.unread .item-title { color: var(--text); }
.item:not(.unread) .item-title { font-weight: 500; }
.item-body { min-width: 0; }
.thumb { width: 64px; height: 64px; border-radius: 9px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center;
         color: var(--text-3); border: 1px solid var(--border); }
.item-title { font-weight: 600; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
a.item-title:hover { color: var(--accent); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); align-items: center; }
.item-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.price { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-actions { display: flex; gap: 2px; }
.mini-item { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); position: relative; color: var(--text); }
.mini-item:hover { background: var(--surface-2); color: var(--text); }
.mini-item:last-child { border-bottom: 0; }
.mini-item .thumb { width: 44px; height: 44px; flex: none; }
.mini-body { flex: 1; min-width: 0; }
.mini-item .item-title { -webkit-line-clamp: 1; }

/* ---------------------------------------------------------------- logs */
.loglist { display: flex; flex-direction: column; }
.logrow, .logrow > summary { display: grid; grid-template-columns: 96px 80px minmax(0, 1fr) 36px 16px; gap: 10px; align-items: center; }
.logrow { padding: 9px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
details.logrow { display: block; }
details.logrow > summary { list-style: none; cursor: pointer; }
details.logrow > summary::-webkit-details-marker { display: none; }
details.logrow[open] > summary svg { transform: rotate(180deg); }
.logrow.has-new { background: linear-gradient(90deg, var(--success-soft), transparent 60%); }
.logrow.has-err { background: linear-gradient(90deg, var(--danger-soft), transparent 60%); }
.lr-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lr-pf { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.lr-main { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; min-width: 0; }
.lr-main .muted { font-size: 12.5px; }
.lr-msg { flex-basis: 100%; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-new { text-align: right; font-variant-numeric: tabular-nums; }
.lr-new b { color: var(--success); }
.lr-detail { padding: 6px 0 2px 88px; }
.evlist { display: flex; flex-direction: column; }
.ev { display: flex; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
details.ev { display: block; }
details.ev > summary { display: flex; gap: 10px; list-style: none; cursor: pointer; }
details.ev > summary::-webkit-details-marker { display: none; }
details.ev > summary > svg { margin-left: auto; color: var(--text-3); }
details.ev[open] > summary > svg { transform: rotate(180deg); }
details.ev ul { margin: 8px 0 0 26px; padding: 0; list-style: none; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.ev-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev-title { overflow-wrap: anywhere; }
.ev-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-3); }
.lvl { flex: none; display: inline-flex; margin-top: 1px; }
.lvl.info { color: var(--info); } .lvl.warn { color: var(--warning-dot); } .lvl.error { color: var(--danger); }

/* ---------------------------------------------------------------- misc */
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty.compact { padding: 28px 20px; }
.empty svg.i { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; flex-wrap: wrap;
              border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pagination .pages { display: flex; gap: 4px; }
.flash-stack { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border);
         border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow-lg);
         font-size: 13.5px; animation: slidein .2s ease; overflow-wrap: anywhere; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning-dot); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes slidein { from { transform: translateY(-6px); opacity: 0; } }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text);
           font-size: 13px; border: 1px solid transparent; }
details.callout { display: block; }
details.callout > summary { cursor: pointer; }
.callout.warning { background: var(--warning-soft); }
.callout.danger { background: var(--danger-soft); }
.callout svg.i { color: var(--accent); margin-top: 1px; }
.callout.warning svg.i { color: var(--warning-dot); }
.callout.danger svg.i { color: var(--danger); }
.unk-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; overflow-wrap: anywhere; }
.copy-field { display: flex; gap: 6px; }
.copy-field .input { font-family: var(--mono); font-size: 12.5px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 860px) {
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .tabs a { padding: 10px 12px; }
}
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
          display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .badge { font-size: 11px; }
.divider { height: 1px; background: var(--border); margin: 2px 0; }

/* quick add (Keyword) */
details.quick-add > summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
details.quick-add > summary::-webkit-details-marker { display: none; }
details.quick-add > summary > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
details.quick-add[open] > summary { border-bottom: 1px solid var(--border); }
details.quick-add form { padding: 16px 18px 12px; }
.qa-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: start; }
.qa-grid .hint { min-height: 16px; display: block; }
@media (max-width: 1100px) { .qa-grid { grid-template-columns: 1fr 1fr; } .qa-grid .field:first-child { grid-column: 1 / -1; } }

/* modal */
dialog.modal { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
               width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; }
dialog.modal.narrow { width: min(540px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border);
              position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border);
              position: sticky; bottom: 0; background: var(--surface); }
.modal-body { padding: 0; overflow-y: auto; max-height: calc(100dvh - 150px); }
.preview-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 20px;
               border-bottom: 1px solid var(--border); }
.preview-row.rejected { opacity: .6; }
.preview-row .thumb { width: 44px; height: 44px; }
dialog.gcb { width: min(640px, calc(100vw - 32px)); }
.gcb-bar { display: flex; flex-direction: column; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.gcb-add { display: flex; gap: 8px; }
.gcb-add .input { flex: 1; min-width: 0; }
.gcb-list { list-style: none; margin: 0; padding: 4px 0; }
.gcb-list li { display: flex; align-items: center; gap: 10px; padding: 7px 20px; border-bottom: 1px solid var(--border); }
.gcb-list li:last-child { border-bottom: 0; }
.gcb-list li:hover { background: var(--surface-2); }
.gcb-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gcb-act { display: flex; gap: 2px; flex-shrink: 0; }
.gcb-empty { justify-content: center; color: var(--text-3); padding: 28px 20px !important; }
.gcb-editf { display: flex; gap: 6px; width: 100%; }
.gcb-editf .input { flex: 1; min-width: 0; }

/* install banner */
.install-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px;
               background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.install-bar .grow b { display: block; }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #4f46e5 0%, transparent 55%),
             radial-gradient(900px 500px at 110% 110%, #16a34a 0%, transparent 50%), #0b1120;
             color: #e6eaf2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 30px; line-height: 1.2; font-weight: 700; max-width: 420px; letter-spacing: -.02em; }
.auth-side p { color: #aab4c6; max-width: 420px; margin-top: 12px; font-size: 15px; }
.auth-points { display: grid; gap: 14px; margin-top: 32px; }
.auth-points div { display: flex; gap: 12px; align-items: flex-start; color: #cbd3e1; }
.auth-points svg.i { color: #86efac; }
.auth-main { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h1 { font-size: 24px; }
body.bare { min-height: 100vh; }
body.bare .content { margin: 0 auto; }

/* ================================================================ tablet */
@media (max-width: 1180px) {
  .pfrow { grid-template-columns: minmax(160px, 1.5fr) minmax(110px, 1fr) 80px minmax(110px, 1fr) 40px; gap: 8px 12px; }
}

/* ================================================================ HP / PWA */
@media (max-width: 860px) {
  :root { --bottomnav-h: 62px; }
  body { font-size: 14.5px; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 70; width: min(280px, 82vw); height: 100dvh; transform: translateX(-100%);
             transition: transform .2s ease; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
            background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
  .topbar .brand { color: var(--text); padding: 0; font-size: 15px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
               background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b);
               box-shadow: 0 -4px 16px -8px rgba(16,24,40,.15); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--bottomnav-h);
    color: var(--text-3); font: 500 11px var(--font); background: none; border: 0; cursor: pointer; position: relative; }
  .bottomnav svg.i { width: 22px; height: 22px; }
  .bottomnav .active { color: var(--accent); }
  .bottomnav .count { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; font-size: 10px; padding: 0 5px; min-width: 16px; text-align: center; }
  .content { padding: 16px 14px calc(var(--bottomnav-h) + var(--safe-b) + 28px); }
  .flash-stack { top: auto; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 12px); right: 12px; left: 12px; max-width: none; }
  h1 { font-size: 20px; }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions > .btn, .page-head .page-actions > form { flex: 1; }
  .page-head .page-actions > form .btn { width: 100%; }
  .hide-sm { display: none !important; }
  .show-sm { display: inline-flex !important; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .btn.icon { width: 40px; height: 40px; }
  .btn.icon.sm { width: 36px; height: 36px; }
  .input, select.input { height: 42px; font-size: 16px; } /* 16px: cegah zoom otomatis iOS */
  .input.sm { height: 36px; font-size: 15px; }
  .toolbar { padding: 10px 12px; gap: 8px; }
  .toolbar .search { max-width: none; flex-basis: calc(100% - 34px); }
  .toolbar .search .input { height: 40px; }
  .toolbar select.input { flex: 1 1 40%; max-width: none; height: 40px; padding: 0 8px; }
  .toolbar > .small.muted { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .qa-grid { grid-template-columns: 1fr 1fr; }
  .qa-grid .field:first-child, .qa-grid .field:nth-child(4), .qa-grid .qa-submit { grid-column: 1 / -1; }
  .qa-submit .btn { width: 100%; }
  details.quick-add > summary .small { display: none; }
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row .ctl, .setting-row .ctl-end { width: 100%; justify-content: flex-start; }
  .setting-row .ctl-end .switch { margin-left: 0; }
  .savebar { bottom: calc(var(--bottomnav-h) + var(--safe-b)); border-radius: 0; margin: 0 -1px; }

  /* status platform: kartu ringkas 2 kolom */
  .pfrow { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  .pfrow-name { grid-column: 1; }
  .pfrow-act { grid-column: 2; grid-row: 1; }
  .pfrow-status { grid-column: 1 / -1; grid-row: 2; }
  .pfrow-num, .pfrow-time { flex-direction: row; gap: 6px; align-items: baseline; }
  .pfrow-num { grid-column: 1; grid-row: 3; }
  .pfrow-time { grid-column: 1 / -1; grid-row: 4; }
  .pfrow-num b { font-size: 14px; }
  .pfrow-note { padding-left: 0; margin-top: 0; }

  /* temuan: judul penuh lebar, harga di bawah */
  .item { grid-template-columns: 56px minmax(0, 1fr); gap: 4px 12px; padding: 12px 12px 10px 14px; align-items: start; }
  .item > input[type="checkbox"] { position: absolute; top: 10px; left: 8px; z-index: 2; opacity: 0; }
  .feed.selecting .item > input[type="checkbox"] { opacity: 1; }
  .item .thumb { width: 56px; height: 56px; }
  .item-side { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 2px; }
  .item-title { -webkit-line-clamp: 3; }
  .mini-item { padding: 10px 14px; }
  .mini-item .item-title { -webkit-line-clamp: 2; }
  .mini-item .price { font-size: 13.5px; }

  /* keyword: tabel jadi kartu */
  .kw-table thead { display: none; }
  .kw-table, .kw-table tbody { display: block; }
  .kw-table tr { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: center; }
  .kw-table td { padding: 0; border: 0; }
  .kw-table td.check { grid-row: 1 / span 2; width: auto; }
  .kw-table td.kw-cell { grid-column: 2 / 4; grid-row: 1; }
  .kw-table td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--text-2); }
  .kw-table td:nth-child(5) { grid-column: 3; grid-row: 2; }
  .kw-table td:nth-child(6) { grid-column: 4; grid-row: 1; justify-self: end; }
  .kw-table td:nth-child(7) { grid-column: 4; grid-row: 2; }
  .kw-table .row-actions { gap: 0; }

  /* log */
  .logrow, .logrow > summary { grid-template-columns: 50px 18px minmax(0, 1fr) 28px 14px; gap: 8px; }
  .lr-time .faint { display: none; }
  .logrow { padding: 9px 14px; }
  .lr-detail { padding-left: 0; }
  .ev { padding: 10px 14px; }

  /* modal jadi bottom sheet */
  dialog.modal, dialog.modal.narrow, dialog.gcb { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0;
    max-height: 92dvh; padding-bottom: var(--safe-b); }
  .modal-body { max-height: calc(92dvh - 130px); }
  .menu.open { z-index: 80; }
  .menu-list { position: fixed; left: 0; right: 0; top: auto !important; bottom: 0; min-width: 0; z-index: 81;
               padding: 8px 8px calc(12px + var(--safe-b)); border-radius: 16px 16px 0 0; border-bottom: 0; }
  .menu-list::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 2px auto 8px; }
  .menu-list > a, .menu-list > button { padding: 13px 12px; font-size: 15px; }
  .menu.open::before { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; }
  .table td, .table th { padding-left: 12px; padding-right: 12px; }
  .chart { height: 130px; }
}

@media (display-mode: standalone) {
  .hide-standalone { display: none !important; }
}
