/* Menara Terminal: gaya aplikasi. Hanya selektor kelas (tanpa td/th/svg telanjang); tabel di-scope ke .tbl
   karena Lightweight Charts memakai <table> internal. Semua anak grid/flex memakai min-width: 0. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 56px; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 1.45;
  background: var(--page); color: var(--text-primary); min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 12px; background: var(--accent-fill); color: var(--accent-on); border-radius: var(--radius); }
.skip:focus { top: 8px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:focus-visible, .seg-btn:focus-visible, .tab-btn:focus-visible { outline-offset: 1px; }
.btn, .seg-btn, .tab-btn, .chip-btn, .led, .pill { font: inherit; color: var(--text-primary); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.anywhere { overflow-wrap: anywhere; }
.right { text-align: right; }
.ic { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: -3px; }
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 20px; height: 20px; }
.ic-good { color: var(--status-good); }
.ic-warning { color: var(--status-warning); }
.ic-serious { color: var(--status-serious); }
.ic-critical { color: var(--status-critical); }
.ic-neutral { color: var(--text-secondary); }
.ic-up { color: var(--delta-up); }
.ic-down { color: var(--delta-down); }
.ic-spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stack-sm { gap: 4px; }
.stack-lg { gap: 14px; }
.lk { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; vertical-align: middle; border-radius: 2px; }
.lk-1 { color: var(--series-1); }
.lk-2 { color: var(--series-2); }
.lk-8 { color: var(--series-8); }
.lk-ink { color: var(--text-primary); }
.lk-muted { color: var(--text-muted); }
.lk-dashed { border-top-style: dashed; }
.lk-dotted { border-top-style: dotted; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.sw-8 { background: var(--series-8); }
.sw-vol { background: var(--volume); }
.sw-hollow { border: 1.5px solid var(--candle-up-line); background: transparent; }
.sw-filled { background: var(--candle-down-fill); }
.sq { display: inline-block; width: 6px; height: 6px; background: var(--text-primary); margin-right: 6px; vertical-align: 1px; }

/* ---------- Kerangka ---------- */
.shell { max-width: 1600px; margin: 0 auto; padding: 0 24px 40px; }
.status-bar {
  position: sticky; top: 0; z-index: 40; height: 48px; display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); margin: 0 -24px; padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.status-inner .chip, .status-inner .countdown, .status-inner .btn { flex: 0 0 auto; }
/* Pil keadaan agen selebar isinya dan hanya menyusut (elipsis) bila ruang benar-benar habis; sisa ruang ke .spacer. */
.status-inner .pill { flex: 0 1 auto; min-width: 40px; }
.brand-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.spacer { flex: 1 1 auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: var(--radius-chip);
  border: 1px solid var(--border-strong); font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; background: transparent;
}
.chip-sm { height: 22px; font-size: 11px; padding: 0 6px; }
.chip-dotted { border-style: dotted; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { background: var(--wash); }
.chip-price { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background .4s; }
.chip-price.flash { background: var(--wash-strong); }
.chip-level-warning { border-color: var(--status-warning); }
.chip-level-serious { border-color: var(--status-serious); }
.chip-level-critical { border-color: var(--status-critical); }
.chip-level-good { border-color: var(--status-good); }
.chip-confirm { border: 1px solid var(--status-critical); color: var(--text-primary); }
.chip-stale { border-color: var(--status-warning); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 600; min-width: 0; }
.pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-since { font-weight: 400; color: var(--text-secondary); }
.pill.level-warning { border-color: var(--status-warning); }
.pill.level-serious { border-color: var(--status-serious); }
.pill.level-critical { border-color: var(--status-critical); }
.countdown { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown-label { color: var(--text-secondary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text-primary); cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--wash); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent-fill); color: var(--accent-on); border-color: transparent; }
.btn-accent:hover { background: var(--accent-fill); filter: brightness(1.08); }
.btn-danger { background: var(--danger-fill); color: var(--danger-on); border-color: transparent; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--wash); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 32px; padding: 0; }
.btn-lg { height: 44px; padding: 0 16px; }
.btn-44 { width: 44px; height: 44px; padding: 0; }
.tab-view { min-width: 0; }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--accent-ink); text-decoration: underline; cursor: pointer; font: inherit; }
.kbd { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-1); }
.a { color: var(--accent-ink); }

/* Ticker + LED */
.ticker-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 32px; margin-top: 4px; min-width: 0; }
.ticker { display: flex; align-items: center; gap: 18px; min-width: 0; overflow: hidden; flex: 1 1 auto; }
.tick { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.tick-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.tick-value { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tick.is-hidden { display: none; }
.leds { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.led { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 2px 4px; border-radius: 4px; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.led:hover { background: var(--wash); }
.led-value { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.health-chip { display: none; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: stretch; }
.grid-start { align-items: start; }
.c2 { grid-column: span 2; min-width: 0; }
.c3 { grid-column: span 3; min-width: 0; }
.c4 { grid-column: span 4; min-width: 0; }
.c5 { grid-column: span 5; min-width: 0; }
.c6 { grid-column: span 6; min-width: 0; }
.c7 { grid-column: span 7; min-width: 0; }
.c8 { grid-column: span 8; min-width: 0; }
.c12 { grid-column: span 12; min-width: 0; }
.section-title { margin: 28px 0 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-secondary); }

/* Kartu */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; display: flex; flex-direction: column; gap: 10px; position: relative; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; flex-wrap: wrap; }
.card-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); display: inline-flex; align-items: center; min-width: 0; }
.h2 { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.3; }
.h2-count { font-size: 24px; }
.hero { font-size: 48px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; margin: 0; font-variant-numeric: normal; overflow-wrap: anywhere; }
.card-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; transition: opacity .2s; overflow-wrap: anywhere; }
.is-stale { opacity: .5; }
.empty { color: var(--text-secondary); font-size: 13px; padding: 6px 0; }
.err-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--status-critical); border-radius: var(--radius); font-size: 13px; }
.warn-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--status-warning); border-radius: var(--radius); font-size: 13px; }
.note { font-size: 12px; color: var(--text-secondary); margin: 0; }
.scroll-y { overflow-y: auto; min-height: 0; }
.h480 { max-height: 480px; }
.h560 { max-height: 560px; }
.h420 { max-height: 420px; }

/* Daftar kunci-nilai */
.kv { display: grid; grid-template-columns: fit-content(55%) minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; align-items: baseline; }
.kv .kv-k { color: var(--text-secondary); margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .kv-v { margin: 0; font-variant-numeric: tabular-nums; text-align: right; min-width: 0; white-space: nowrap; }
/* Daftar ekonomi P4 (SEC-UI-8): kolom nilai selebar isinya (maks 62%) dan boleh membungkus, label mengambil sisa; dua
   pasang kolom hanya bila wadah daftar itu sendiri >= 720 px (container query), bukan menurut lebar layar. */
.kv-wrap { container-type: inline-size; }
.kv-2 { grid-template-columns: minmax(0, 1fr) fit-content(62%); }
.kv-2 .kv-v { white-space: normal; overflow-wrap: break-word; }
@container (min-width: 720px) { .kv-2 { grid-template-columns: minmax(0, 1fr) fit-content(31%) minmax(0, 1fr) fit-content(31%); } }
/* P4 Dompet Indodax: tabel ringkas yang muat di lebar isi 328 px (ponsel 390 px: padding 4/6 px, judul kolom boleh dua
   baris), baris rincian bebas/tertahan di bawah asetnya, penanda "di luar bot" / "tanpa harga IDR" sebagai teks kecil di
   bawah nama. Selektor .tbl.tbl-wallet supaya menang atas aturan umum .tbl th/td yang ditulis sesudahnya. */
.wallet { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 10px; border-top: 1px solid var(--grid); }
.wallet-head { display: flex; align-items: center; justify-content: space-between; gap: 6px 8px; flex-wrap: wrap; min-width: 0; }
.wallet-head .eyebrow { margin: 0; flex-wrap: wrap; }
.wallet-tag { margin-left: 4px; }
.tbl.tbl-wallet table { font-size: 12px; }
/* Tanpa pemotongan di tengah kata (.card-body mewariskan overflow-wrap: anywhere; dulu kolom Aset terjepit sampai satu
   huruf per baris di ponsel): nama aset tidak membungkus, sel angka hanya boleh pindah baris di spasi sesudah "Rp". */
.tbl.tbl-wallet th, .tbl.tbl-wallet td { padding: 4px 6px; overflow-wrap: normal; }
.tbl.tbl-wallet th { position: static; white-space: normal; vertical-align: bottom; }
.tbl.tbl-wallet td.wallet-asset { white-space: normal; }
.tbl.tbl-wallet td.wallet-asset .strong { white-space: nowrap; }
/* Keterangan judul kolom di baris sendiri: lebar judul = baris terpanjangnya, jadi di desktop tidak ada yang terjepit. */
.tbl.tbl-wallet th .th-sub { display: block; }
.tbl.tbl-wallet td.num, .tbl.tbl-wallet tfoot td { white-space: normal; }
/* Wadah Dompet sempit (ponsel <= 360 px, isi <= 340 px): padding sel 3 px dan angka 11 px; ponsel 320 px (isi 258 px)
   2 px, supaya IDR jutaan tetap muat tanpa gulir di dalam kartu. */
.wallet-fit { container-type: inline-size; min-width: 0; }
@container (max-width: 340px) {
  .tbl.tbl-wallet table { font-size: 11px; }
  .tbl.tbl-wallet th, .tbl.tbl-wallet td { padding: 4px 3px; }
  .tbl.tbl-wallet th { letter-spacing: .02em; }
}
@container (max-width: 270px) {
  .tbl.tbl-wallet th, .tbl.tbl-wallet td { padding: 4px 2px; }
}
.wallet-flag { display: block; font-size: 11px; color: var(--text-secondary); }
.tbl.tbl-wallet tr.has-sub td { border-bottom: 0; }
.tbl.tbl-wallet tr.wallet-sub td { padding-top: 0; color: var(--text-secondary); white-space: normal; text-align: right; }
.tbl.tbl-wallet tfoot td { font-weight: 600; border-bottom: 0; }
.history .card, .history .tiles { scroll-margin-top: 104px; }
.plot-wrap { width: 100%; min-width: 0; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fact { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.fact .ic { margin-top: 3px; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rule { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rule-text { flex: 1 1 auto; min-width: 0; }
.rule-val { font-variant-numeric: tabular-nums; color: var(--text-secondary); text-align: right; overflow-wrap: anywhere; }
.rail { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.rail-step { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-secondary); }
.rail-step[aria-current="step"] { border-color: var(--text-primary); color: var(--text-primary); font-weight: 600; }

/* Meter */
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.meter-track { height: 8px; border-radius: 4px; background: var(--meter-track); overflow: hidden; }
.meter-fill { height: 100%; background: var(--series-1); border-radius: 4px; width: 0; transition: width .3s; }
.meter-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; gap: 8px; }
.meter-cap { font-size: 12px; color: var(--text-secondary); margin: 0; }
.sev { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.progress-track { height: 6px; border-radius: 3px; background: var(--meter-track); overflow: hidden; }
.progress-fill { height: 100%; background: var(--series-1); width: 0; }

/* Segmented, chip rows, filter */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg-btn { height: 28px; padding: 0 10px; border: 0; background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 4px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { background: var(--wash); }
.seg-btn[aria-checked="true"], .seg-btn[aria-pressed="true"] { background: var(--wash-strong); color: var(--text-primary); }
.chips { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 2px; min-width: 0; }
.chips .chip { scroll-snap-align: start; flex: 0 0 auto; }
.range-row {
  position: sticky; top: 48px; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; margin-top: 24px;
}
.range-row .seg-btn[aria-checked="true"] .ic { display: inline; }
.range-row .seg-btn .ic { display: none; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent-fill); width: 16px; height: 16px; }
.input { font: inherit; font-size: 14px; height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-raised); color: var(--text-primary); min-width: 0; }
.input-mono { font-family: var(--font-mono); }
.input-lg { height: 40px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); min-width: 0; }
.pair { display: grid; grid-template-columns: 1fr 88px; gap: 8px; align-items: center; }
.pair input[type="range"] { width: 100%; accent-color: var(--accent-fill); }

/* Tabel (hanya di dalam .tbl) */
.tbl { overflow-x: auto; max-width: 100%; min-width: 0; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; white-space: nowrap; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.mono { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; white-space: normal; }
.tbl td.wrap { white-space: normal; overflow-wrap: anywhere; }
.tbl tr.is-selected td { background: var(--wash-strong); }
.tbl tr.is-row:hover td { background: var(--wash); }
.tbl tr.is-row { cursor: pointer; }
.tbl tr.is-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tbl-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; text-transform: inherit; letter-spacing: inherit; }
.twin[hidden] { display: none; }

/* Buku order dan tape */
.book { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.book-head, .book-row { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 8px; padding: 2px 6px; position: relative; min-width: 0; }
.book-head { font-family: var(--font-sans); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
.book-row { cursor: default; }
.book-row > span { position: relative; z-index: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.book-row .num { text-align: right; }
.book-wash { position: absolute; top: 0; bottom: 0; right: 0; width: var(--w, 0%); z-index: 0; pointer-events: none; }
.book-ask .book-wash { background: var(--book-ask-wash); }
.book-bid .book-wash { background: var(--book-bid-wash); }
.book-best { box-shadow: inset 2px 0 0 var(--text-primary); }
.book-side { font-family: var(--font-sans); font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-secondary); padding: 4px 6px; }
.book-mid { font-family: var(--font-sans); font-size: 12px; padding: 4px 6px; border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); display: flex; justify-content: space-between; gap: 8px; }
.book-row:hover { background: var(--wash); }
.imb { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.imb-bid { background: var(--text-secondary); }
.imb-ask { background: var(--text-muted); }
:root[data-candles="teal"] .imb-bid { background: var(--series-3); }
:root[data-candles="teal"] .imb-ask { background: var(--series-8); }
.tape { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tape-head, .tape-row { display: grid; grid-template-columns: 1fr 1.4fr 1.1fr .7fr; gap: 8px; padding: 2px 6px; min-width: 0; }
.tape-head { font-family: var(--font-sans); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.tape-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tape-row.is-big { font-weight: 700; }
.tape-row.flash { animation: washflash .8s ease-out; }
@keyframes washflash { from { background: var(--wash-strong); } to { background: transparent; } }
.range-bar { position: relative; height: 6px; border-radius: 3px; background: var(--meter-track); margin: 6px 0; }
.range-mark { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--text-primary); margin-left: -1px; left: var(--x, 50%); }
.stat2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.stat-value { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; color: var(--text-secondary); }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-value { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.tile-sub { font-size: 12px; color: var(--text-secondary); }

/* Log */
.log { font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.log-run { border: 1px solid var(--border); border-radius: var(--radius); }
.log-run-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; font-size: 12px; }
.log-entry { display: flex; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--grid); align-items: flex-start; }
.log-msg { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12.5px; flex: 1 1 auto; min-width: 0; }
.log-data { font-family: var(--font-mono); font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; color: var(--text-secondary); }
.lvl { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; letter-spacing: .04em; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 3px; white-space: nowrap; }

/* Matriks run */
.matrix { position: relative; display: inline-block; max-width: 100%; }
.matrix-row { display: flex; align-items: center; gap: 2px; margin-bottom: 2px; }
.matrix-day { width: 40px; font-size: 11px; color: var(--text-secondary); flex: 0 0 40px; white-space: nowrap; overflow: hidden; }
.cell { width: var(--cell, 13px); height: var(--cell, 13px); flex: 0 0 auto; position: relative; border-radius: 2px; box-sizing: border-box; }
.cell-ok { background: var(--axis); }
.cell-before, .cell-future { background: transparent; }
.cell-pending { border: 1px dashed var(--text-muted); }
.cell-missed { border: 1px solid var(--text-muted); }
.cell-warn { color: var(--status-warning); }
.cell-error { color: var(--status-critical); }
.cell .ic { width: 100%; height: 100%; display: block; }
.cell-trade::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: var(--text-primary); }
.cell-decision { outline: 1px solid var(--border-strong); outline-offset: 0; }
.cell.is-cur { box-shadow: 0 0 0 2px var(--focus); }
.matrix:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.sistem-wrap { border-top: 1px solid var(--grid); padding-top: 8px; }
.matrix-hours { display: flex; gap: 2px; margin-left: 42px; }
.matrix-hour { width: var(--cell, 13px); font-size: 9px; color: var(--text-muted); text-align: center; flex: 0 0 auto; }
.matrix-hit { position: absolute; inset: 0; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-secondary); align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-val { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.incidents { display: flex; flex-direction: column; gap: 6px; }
.incident { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13px; background: var(--surface-1); }
.incident.level-critical { border-color: var(--status-critical); }
.incident.level-serious { border-color: var(--status-serious); }
.incident.level-warning { border-color: var(--status-warning); }
.incident .ic { margin-top: 2px; }
.incident-body { flex: 1 1 auto; min-width: 0; }
.incident-hint { color: var(--text-secondary); font-size: 12px; }
.banner { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.sistem { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sistem-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border-radius: 4px; font-size: 13px; }
.sistem-row:target, .sistem-row.is-focus { background: var(--wash-strong); }
.sistem-label { font-weight: 600; width: 64px; flex: 0 0 64px; }

/* Plot SVG (tangga, bar P/L, tahunan, sparkline) */
.plot { width: 100%; display: block; overflow: visible; }
.plot-text { fill: var(--text-primary); font-family: var(--font-sans); font-size: 12px; }
.plot-text-sec { fill: var(--text-secondary); font-family: var(--font-sans); font-size: 11px; }
.plot-text-mono { fill: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; }
.plot-axis { stroke: var(--axis); stroke-width: 1; }
.plot-grid { stroke: var(--grid); stroke-width: 1; }
.plot-ink { stroke: var(--text-primary); }
.plot-muted { stroke: var(--text-muted); }
.plot-s1 { stroke: var(--series-1); }
.plot-f1 { fill: var(--series-1); }
.plot-f2 { fill: var(--series-2); }
.plot-f8 { fill: var(--series-8); }
.plot-fink { fill: var(--text-primary); }
.plot-fwash { fill: var(--wash-strong); }
.plot-hit { fill: transparent; cursor: pointer; }
.plot-hit:focus-visible, .plot-hit-g:focus-visible { outline: 2px solid var(--focus); }
.plot-mark:focus-visible { outline: 2px solid var(--focus); }
.spark { width: 100%; height: 40px; display: block; }
.spark-wrap { width: 100%; min-width: 0; }
.spark-dot { stroke: var(--surface-1); stroke-width: 2; }
.heat { display: grid; gap: 2px; font-size: 11px; font-variant-numeric: tabular-nums; }
.heat-cell { display: flex; align-items: center; justify-content: center; height: 30px; border-radius: 3px; position: relative; cursor: default; }
.heat-cell.is-bot { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.heat-label { display: flex; align-items: center; justify-content: center; color: var(--text-secondary); height: 30px; }
.scale-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); }
.scale-step { width: 22px; height: 10px; border-radius: 2px; }

/* Grafik LWC */
.chart-host { position: relative; width: 100%; min-width: 0; outline: none; border-radius: 4px; }
.chart-host:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.chart-540 { height: 440px; }
.chart-420 { height: 330px; }
.chart-300 { height: 300px; }
.chart-180 { height: 180px; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; display: none; min-width: 140px; max-width: 260px; padding: 8px 10px; font-size: 12px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-overlay); color: var(--text-primary);
}
.tip.is-on { display: block; }
.tip-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tip-v { font-weight: 600; font-variant-numeric: tabular-nums; order: 2; }
.tip-l { color: var(--text-secondary); order: 1; display: inline-flex; align-items: center; gap: 5px; }
.tip-t { color: var(--text-secondary); margin-top: 4px; font-size: 11px; }
.fig { margin: 0; min-width: 0; }
.figcap { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* Dialog, laci, lembar, palet, gerbang token, toast */
.dlg { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-raised); color: var(--text-primary); padding: 0; box-shadow: var(--shadow-overlay); max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: 440px; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; overflow-y: auto; }
.sheet-handle { display: none; }
.palette { width: min(640px, calc(100vw - 32px)); margin-top: 10vh; }
.palette-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.palette-sub { list-style: none; margin: 0; padding: 0; }
.palette-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); padding: 8px 10px 2px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.palette-item[aria-selected="true"] { background: var(--wash-strong); }
.palette-item.is-disabled { opacity: .5; cursor: not-allowed; }
.palette-code { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); margin-left: auto; }
.toasts { position: fixed; top: 56px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-overlay); font-size: 13px; }
.toast.kind-error { border-color: var(--status-critical); }
.toast.kind-status { border-color: var(--status-good); }
.step { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-1); }
.step-title { font-weight: 600; font-size: 14px; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--grid); }
.action-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin: 12px 0 0; }
.live-banner { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 2px solid var(--status-critical); border-radius: var(--radius); font-size: 13px; font-weight: 600; }
.paper-banner { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13px; }
.hist { list-style: none; margin: 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.details-sum { cursor: pointer; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.lab-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tiles-lab { margin-top: 0; }
.card.lab-details { display: block; margin-top: 16px; }
.card.lab-details > .card-body { margin-top: 10px; }
.card.lab-details > .details-sum { list-style: none; }
.card.lab-details > .details-sum::-webkit-details-marker { display: none; }
.lab-wide { grid-column: 1 / -1; }
.footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 6px; }
.footer a { color: var(--accent-ink); }

/* Shell mobile */
.mtop { position: sticky; top: 0; z-index: 40; height: 52px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); margin: 0 -16px; padding: 0 12px; }
.botstrip { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.botstrip .tick { height: 44px; justify-content: center; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--surface-2); border-top: 1px solid var(--border); }
.tab-btn { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; border-top: 2px solid transparent; font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer; min-width: 0; padding: 0 2px; }
/* Enam tab (tab "Uji" mode gambling): di ponsel < 360 px tiap tab sekitar 53 px, "Keputusan" 11 px = 57 px; 10 px muat. */
@media (max-width: 359px) { .tab-btn { font-size: 10px; letter-spacing: -.01em; } }
.tab-btn[aria-current="page"] { color: var(--text-primary); border-top-color: var(--accent-fill); }
.tab-btn[aria-current="page"] .ic { color: var(--accent-ink); }
.mobile-pad { padding-bottom: 80px; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.mcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.mcard-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mcard.is-selected { border-color: var(--text-primary); }
.mcard-head { cursor: pointer; list-style: none; }
.mcard-head::-webkit-details-marker { display: none; }
.row-inline { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ---------- P29 Mode gambling: uji bukti keunggulan (v0.4, simulasi) ----------
   Satu kartu selebar penuh (#gambling, desktop) / tab "Uji" (mobile). Wadah .gb = container query: bukti per aturan
   berdampingan bila muat (blok min. 260 px), posisi + transaksi dua kolom bila isi kartu >= 1100 px. Tabel ringkas seperti
   Dompet (padding 4/6 px, judul kolom boleh dua baris, tanpa pemotongan di tengah angka); di ponsel tabel menjadi kartu,
   jadi lebar 320 px (isi 258 px) tidak pernah menggulir. Warna status hanya pada ikon. */
.gb-measure { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gb { display: flex; flex-direction: column; gap: 12px; min-width: 0; container-type: inline-size; }
.gb-principle { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.gb-principle .ic { margin-top: 2px; }
.gb-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 10px; border-top: 1px solid var(--grid); }
.gb-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; min-width: 0; }
.gb-sec .eyebrow { margin: 0; }
.gb-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.gb-rule { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
.gb-rule-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.gb-h4 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.gb-reason { margin: 0; font-size: 12px; color: var(--text-secondary); overflow-wrap: break-word; }
.gb-prog { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; font-size: 12px; }
.gb-prog-label { color: var(--text-secondary); min-width: 0; }
.gb-prog-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.gb-prog .gb-prog-track { grid-column: 1 / -1; }
.gb-prog-track { height: 6px; border-radius: 3px; background: var(--meter-track); overflow: hidden; }
.gb-prog-fill { height: 100%; width: 0; background: var(--series-1); }
.kv.gb-kv { font-size: 12px; }
.kv.gb-kv .kv-v { white-space: nowrap; }
.gb-meaning { color: var(--text-primary); }
.gb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.gb-kpi { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.gb-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); overflow-wrap: break-word; }
.gb-kpi-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gb-kpi-sub { font-size: 12px; color: var(--text-secondary); overflow-wrap: break-word; }
.gb-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
/* Dua kolom hanya bila tiap kolom >= ~720 px (QA 1440 px: tabel posisi 676-711 px tidak muat di kolom 673 px). */
@container (min-width: 1480px) { .gb-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tbl.tbl-gb table { font-size: 12px; }
.tbl.tbl-gb th, .tbl.tbl-gb td { padding: 4px 6px; overflow-wrap: normal; }
.tbl.tbl-gb th { position: static; white-space: normal; vertical-align: bottom; }
.tbl.tbl-gb th .th-sub { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; }
.tbl.tbl-gb td.gb-wrap { white-space: normal; }
/* Level exit (TP, stop, trailing) cukup lebar untuk satu level per baris; kolom lain mengikuti isinya, jadi tabel posisi
   muat di kolom setengah kartu (QA 1440 px: 708 px di 673 px sebelum ini). */
.tbl.tbl-gb td.gb-levels { white-space: normal; min-width: 150px; }
.tbl.tbl-gb td.gb-name { white-space: normal; }
.tbl.tbl-gb tr.gb-blind td { color: var(--text-secondary); }
.gb-flag { display: block; font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.gb-line { display: block; }
.gb-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.gb-sub { display: flex; flex-direction: column; gap: 4px; }
.gb-sub-title { margin: 0; font-size: 12px; font-weight: 600; }
.gb-details { border-top: 1px solid var(--grid); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.gb-details[open] > .details-sum .ic { transform: rotate(90deg); }
.gb .mcard-head { cursor: default; flex-wrap: wrap; }
.gb .mcard { overflow-wrap: break-word; }
.gb-marks { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12px; }

/* ---------- Tablet (768–1199) ---------- */
@media (max-width: 1199px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .c2 { grid-column: span 2; }
  .c3, .c4 { grid-column: span 3; }
  .c5, .c6, .c7, .c8, .c12 { grid-column: span 6; }
  .leds { display: none; }
  .health-chip { display: inline-flex; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-540 { height: 400px; }
}
@media (max-width: 1359px) { .brand-sub { display: none; } }
.show-tablet { display: none; }
@media (max-width: 1199px) {
  .hide-tablet { display: none; }
  .show-tablet { display: inline; }
  .status-inner { gap: 8px; }
  .status-inner .btn { padding: 0 8px; }
}
@media (max-width: 899px) { .brand-name { display: none; } }
@media (max-width: 1279px) { .countdown-label { display: none; } }

/* ---------- Mobile (<768) ---------- */
@media (max-width: 767px) {
  .shell { padding: 0 16px 24px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
  .c2, .c3, .c4, .c5, .c6, .c7, .c8, .c12 { grid-column: span 1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero { font-size: 40px; }
  .mono, .book, .tape { font-size: 12px; }
  .tbl table { font-size: 12px; }
  .kv .kv-v { white-space: normal; }
  .range-row { top: 52px; }
  .lab-form { grid-template-columns: minmax(0, 1fr); }
  .chart-540, .chart-420 { height: 300px; }
  .chart-180 { height: 180px; }
  .drawer { inset: auto 0 0 0; width: 100%; height: auto; max-height: 85dvh; border-radius: 12px 12px 0 0; border-width: 1px 0 0; }
  .sheet-handle { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; }
  .palette { margin-top: 4vh; }
  .toasts { top: auto; bottom: calc(68px + env(safe-area-inset-bottom)); left: 16px; right: 16px; max-width: none; }
  .btn-lg, .seg-btn-touch { min-height: 44px; }
  .seg-touch .seg-btn { height: 44px; }
  .book-head, .book-row { grid-template-columns: 1.3fr 1fr 1.1fr; }
}

/* ---------- Gerak terbatas, warna paksa, cetak ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .ic-spin { animation: none !important; }
}
@media (forced-colors: active) {
  .chip, .pill, .led, .meter-track, .meter-fill, .progress-fill, .cell, .tile, .card, .btn, .seg { forced-color-adjust: none; outline: 1px solid CanvasText; }
  .book-wash, .plot-f1, .plot-f8, .plot-f2 { background: repeating-linear-gradient(45deg, CanvasText 0 2px, transparent 2px 6px); }
}
@media print {
  :root { color-scheme: light; }
  .status-bar, .ticker-row, .tabbar, .mtop, .toasts, .range-row .btn, dialog { display: none !important; }
  .twin[hidden] { display: block !important; }
  .card { break-inside: avoid; }
  .chart-host { background: #fff; }
}

/* ---------- Tambahan kerangka (UI-4) ---------- */
.boot { padding: 24px; color: var(--text-secondary); font-family: var(--font-sans); }
.kv .kv-v.left { text-align: left; font-variant-numeric: normal; }
.kv .kv-v.wrap { white-space: normal; overflow-wrap: anywhere; }
.help { width: min(720px, calc(100vw - 32px)); max-height: 90dvh; overflow-y: auto; }
.gate { width: min(440px, calc(100vw - 32px)); }
.history { min-width: 0; }
.pill-btn { background: none; cursor: pointer; }
.led-wrap { display: contents; }
.status-bar { margin: 0; padding: 0; }
.status-inner { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 24px; height: 48px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.mtop { margin: 0; padding: 0 16px; }
