/* ─────────────────────────────────────────
   Design Tokens
───────────────────────────────────────── */
:root {
  --bg:             #f7f8fa;
  --surface:        #ffffff;
  --border:         #dde1e8;
  --border-light:   #edf0f4;
  --text:           #111827;
  --text-muted:     #555f6e; /* darker than gray-500 for AA contrast on bg */
  --brand:          #1a5fac;
  --brand-light:    #e8f3ff;
  --accent:         #0ea5e9;
  --neg:            #c2410c;
  --neg-bg:         #fff7ed;
  --pos:            #16a34a;
  --row-pad:        2px;
  --row-alt:        #f0f2f5;
  --row-section:    #f0ede8;
  --fib-bg:         #e8f3ff;
  --fib-sep:        #c8d4e0;
  --navy:           #1e2a3a;
  --navy-hover:     #263548;
  --navy-text:      rgba(255,255,255,0.88);
  --navy-muted:     rgba(255,255,255,0.42);
  --navy-sep:       rgba(255,255,255,0.10);
  --navy-active-bg: rgba(14,165,233,0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'IBM Plex Sans', -apple-system, system-ui, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

/* ─────────────────────────────────────────
   Layout
───────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   Sidebar — dark navy (icon rail)
───────────────────────────────────────── */
#sb {
  width: 90px;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  background: var(--navy);
  transition: width .2s ease, min-width .2s ease;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

#sb::-webkit-scrollbar {
  width: 4px;
}
#sb::-webkit-scrollbar-track {
  background: transparent;
}
#sb::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
#sb::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

#sb.sb-collapsed {
  width: 40px;
  min-width: 40px;
}

#sb.sb-collapsed .sb-logo-text,
#sb.sb-collapsed .sb-global-scen,
#sb.sb-collapsed .sb-sep-lbl,
#sb.sb-collapsed .sb-item,
#sb.sb-collapsed .sb-rd-info,
#sb.sb-collapsed .sb-brand {
  display: none;
}

.sb-rd-info {
  margin: 0 8px 8px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.28);
  display: none;
  text-align: center;
}

.sb-rd-lbl {
  display: block;
  font-size: 8px;
  font-weight: 700;
  color: rgba(16, 185, 129, 0.75);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 2px;
}

.sb-rd-val {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* ─── Icon-rail topbar ─── */
.sb-topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 6px;
  flex-shrink: 0;
}

.sb-dark-pill {
  position: relative;
  width: 74px;
  height: 26px;
  margin: 6px 0 8px;
  cursor: pointer;
  color: #9ba8b8;
  user-select: none;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.15s, color 0.15s;
}
.sb-dark-pill:hover { background: rgba(255,255,255,0.13); color: #d1d9e6; }

/* icon: starts at right (light mode) */
.sb-pill-icon {
  position: absolute;
  top: 50%;
  left: 9px;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-50%) translateX(41px);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
/* label: starts at left (light mode) */
.sb-pill-label {
  position: absolute;
  top: 50%;
  left: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transform: translateY(-50%) translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
/* dark: icon slides to left, label shifts right */
.sb-dark-pill.is-dark .sb-pill-icon  { transform: translateY(-50%) translateX(0); }
.sb-dark-pill.is-dark .sb-pill-label { transform: translateY(-50%) translateX(20px); }

/* collapsed: icon only, centred */
#sb.sb-collapsed .sb-dark-pill { width: 28px; }
#sb.sb-collapsed .sb-pill-label { display: none; }
#sb.sb-collapsed .sb-pill-icon {
  left: 50%;
  transform: translate(-50%, -50%) !important;
  transition: none !important;
}

.sb-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 8px 4px;
  gap: 8px;
}

.sb-ship-icon {
  width: 64px;
  height: 64px;
  display: block;
  flex-shrink: 0;
  border-radius: 10px;
}

.sb-logo {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: .04em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

/* ─── Scenario section (compact) ─── */
.sb-global-scen {
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--navy-sep);
  margin-bottom: 6px;
}

.sb-scen-lbl {
  font-size: 8px;
  font-weight: 700;
  color: var(--navy-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 4px;
  text-align: center;
}

.sb-scen-sel {
  width: 100%;
  font-size: 11px;
  padding: 4px 4px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.sb-scen-sel option {
  background: var(--navy);
  color: #fff;
}

/* ─── Group separator ─── */
.sb-sep-lbl {
  font-size: 7px;
  font-weight: 700;
  color: var(--navy-muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 8px 0 3px;
  text-align: center;
  border-top: 1px solid var(--navy-sep);
  margin-top: 4px;
}

/* ─── Collapsible group header (extends .sb-sep-lbl) ─── */
.sb-grp-hdr {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
  transition: color .12s;
}
.sb-grp-hdr:hover { color: #fff; }
.sb-grp-chev {
  display: inline-block;
  font-size: 8px;
  opacity: .6;
  transition: opacity .12s;
}
.sb-grp-hdr:hover .sb-grp-chev { opacity: 1; }
.sb-grp-items {
  display: flex;
  flex-direction: column;
}

/* ─── Icon nav item ─── */
.sb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  border-left: 2.5px solid transparent;
  user-select: none;
  transition: background .12s, color .12s;
  gap: 2px;
  min-height: 48px;
}

.sb-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--navy-text);
}

.sb-item:focus { outline: none; }
.sb-item:focus-visible {
  outline: 2px solid #7ab8ff;
  outline-offset: -2px;
  background: rgba(122,184,255,0.12);
  color: var(--navy-text);
}

.sb-item.on {
  color: #fff;
  border-left-color: var(--accent);
  background: var(--navy-active-bg);
}

.sb-item-icon {
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inline SVG nav icon — sizes to container font-size, recolors via currentColor */
.sb-ico {
  width: 1em;
  height: 1em;
  display: block;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sb-item-lbl {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
}

/* ─────────────────────────────────────────
   Main content area
───────────────────────────────────────── */
#main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#v-charts {
  min-height: 0;
}

/* ─────────────────────────────────────────
   Admin tab
───────────────────────────────────────── */
#va {
  flex: 1;
  overflow: auto;
  padding: 28px;
  background: var(--bg);
}

.v-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.v-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.6;
}

.up-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 760px;
}

.up-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.up-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.up-card .desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.up-card input[type=file] {
  font-size: 11px;
  width: 100%;
  color: #555;
  cursor: pointer;
}

.st {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 8px;
  display: inline-block;
  line-height: 1.6;
}

.st.ok {
  background: #edf7ee;
  color: #267a35;
}

.st.err {
  background: var(--neg-bg);
  color: var(--neg);
}

.st.idle {
  color: var(--text-muted);
}

.info-bar {
  font-size: 11px;
  padding: 8px 14px;
  background: var(--brand-light);
  border-radius: 6px;
  color: var(--brand);
  display: inline-block;
  margin-top: 18px;
  line-height: 1.7;
}

.schema-note {
  font-size: 11px;
  color: #999;
  margin-top: 20px;
  max-width: 580px;
  line-height: 1.8;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.schema-note code {
  background: var(--row-alt);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
  font-family: 'IBM Plex Mono', monospace;
}

/* ─────────────────────────────────────────
   IRFCL tab
───────────────────────────────────────── */
#vi {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────
   Toolbar
───────────────────────────────────────── */
.toolbar {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: var(--surface);
  flex-wrap: wrap;
}

.tb-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}

/* ─────────────────────────────────────────
   Toggle buttons
───────────────────────────────────────── */
.tgl {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.tgl-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  transition: background .1s, color .1s;
}

.tgl-btn.on {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

.tgl-btn:hover:not(.on) {
  background: var(--row-alt);
  color: var(--text);
}

.tgl.tgl-pill {
  border-radius: 999px;
  border-color: var(--brand);
  background: transparent;
}
.tgl.tgl-pill .tgl-btn { padding: 3px 14px; }
.tgl.tgl-pill .tgl-btn.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.tgl.tgl-pill .tgl-btn:hover:not(.on) {
  background: var(--brand-light);
  color: var(--brand);
}

/* ─────────────────────────────────────────
   Unified button
───────────────────────────────────────── */
.btn {
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  line-height: 1.5;
  transition: background .12s;
}

.btn-dark {
  background: var(--navy);
  color: #fff;
}

.btn-dark:hover {
  background: var(--navy-hover);
}

.btn-upload {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 4px rgba(26,95,172,0.25);
}

.btn-upload:hover {
  background: #1a52a0;
}

/* ─────────────────────────────────────────
   Selects & inputs
───────────────────────────────────────── */
.m-sel {
  font-size: 12px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* Date pill overlay (Simulasi Migrasi Periode Dari/s.d.) */
.date-pill-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 80px;
  background: var(--brand-light);
  border: 1px solid #b8d4f4;
  border-radius: 5px;
  cursor: pointer;
}
.date-pill-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  padding: 0 8px;
  pointer-events: none;
  user-select: none;
}
.date-pill-input {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  z-index: 1;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.tb-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.tb-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ci {
  font-size: 11px;
  color: #bbb;
}

.plg {
  font-size: 10px;
  color: #bbb;
  display: flex;
  align-items: center;
  gap: 5px;
}

.plg-badge {
  font-style: italic;
  font-size: 10px;
  background: var(--row-alt);
  padding: 1px 5px;
  border-radius: 3px;
  color: #aaa;
}

/* ─────────────────────────────────────────
   Table wrapper
───────────────────────────────────────── */
.tw {
  flex: 1;
  overflow: auto;
  background:
    linear-gradient(to right, #fff 20%, rgba(255,255,255,0)) 0 0,
    linear-gradient(to left,  #fff 20%, rgba(255,255,255,0)) 100% 0,
    radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.07), transparent) 0 0,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.07), transparent) 100% 0;
  background-repeat: no-repeat;
  background-color: #fff;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

.no-data {
  padding: 40px;
  color: #aaa;
  font-size: 13px;
}

/* ─────────────────────────────────────────
   Table
───────────────────────────────────────── */
table {
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12px;
}

/* Tables with sticky columns: separate so sticky z-index properly
   covers adjacent cell borders (collapse bypasses stacking contexts) */
#tw table, #tw-f table, #tw-sk table {
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: var(--row-pad, 5px) 10px;
  border-bottom: 1px solid var(--border-light);
}

/* Sticky label column */
.lc {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 210px;
  max-width: 210px;
  background: var(--surface);
  box-shadow: 1px 0 0 0 var(--border);
}

/* Sticky top-left corner header */
.hdr-lc {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 5;
  background: var(--navy);
  color: rgba(255,255,255,0.80);
  font-size: 11px;
  font-weight: 500;
  min-width: 210px;
  max-width: 210px;
  padding: 7px 10px;
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.12);
}

/* Column headers — dark navy */
.hdr {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--navy);
  color: rgba(255,255,255,0.90);
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 10px;
  min-width: 110px;
  vertical-align: bottom;
  line-height: 1.4;
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.12);
}

.hdr.pr {
  background: #283545;
  color: rgba(255,255,255,0.78);
  font-weight: 400;
  font-style: italic;
}

.hdr-p {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  display: inline-block;
  margin-left: 4px;
  color: rgba(255,255,255,0.40);
}

/* ─────────────────────────────────────────
   Table row types
───────────────────────────────────────── */
/* Typographic section breaks — small-caps label above a hairline, no grey fill */
tr.sc td {
  background: var(--row-section) !important;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .10em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 10px;
  border-bottom: none;
  border-top: 1px solid var(--border);
}

tr.sc .lc {
  background: var(--row-section) !important;
}

tr.sb td {
  font-weight: 600;
  border-top: 1px solid var(--border);
}

tr.sb .lc {
  background: var(--surface);
}

tr.hi td {
  background: var(--row-alt) !important;
  font-weight: 500;
}

tr.hi .lc {
  background: var(--row-alt) !important;
}

tr.xr td {
  height: 5px;
  background: var(--row-alt);
  border: none;
  padding: 0;
}

/* ─────────────────────────────────────────
   Number cells
───────────────────────────────────────── */
.num {
  text-align: right;
  font-family: 'IBM Plex Mono', 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.neg {
  color: var(--neg) !important;
}

.pos {
  color: var(--text) !important;
}

.ind {
  padding-left: 22px !important;
}

/* ─────────────────────────────────────────
   FIB / highlight rows
───────────────────────────────────────── */
tr.f-bg td {
  background: var(--fib-bg) !important;
}

tr.f-bg .lc {
  background: var(--fib-bg) !important;
}

tr.h-bg td {
  background: #fdfdde !important;
}

tr.h-bg .lc {
  background: #fdfdde !important;
}

tr.sk1-bg td {
  background: #e8f5e9 !important;
}

tr.sk1-bg .lc {
  background: #e8f5e9 !important;
}

tr.y-bg td {
  background: #fef9c3 !important;
}

tr.y-bg .lc {
  background: #fef9c3 !important;
}

tr.sim-row td {
  background: #fffbe6 !important;
}

tr.sim-row td.lc {
  background: #fffbe6 !important;
}

/* ─────────────────────────────────────────
   Row hover — matrix data tables
   Inset overlay tints the whole row, compositing
   over any (even !important) cell background.
   Headers are <th> in <thead>, so excluded.
   Tables with their own hover (rekap, si) opt out.
───────────────────────────────────────── */
.tw table:not(.rekap-tbl):not(.si-tbl) tbody tr:not(.xr):not(.sc):hover td {
  box-shadow: inset 0 0 0 9999px rgba(26, 95, 172, .05);
}
.tw table:not(.rekap-tbl):not(.si-tbl) tbody tr:not(.xr):not(.sc):hover td.lc {
  box-shadow: inset 0 0 0 9999px rgba(26, 95, 172, .05), 1px 0 0 0 var(--border);
}

/* ─────────────────────────────────────────
   Skenario Custom tab
───────────────────────────────────────── */

.sk-rules-wrap {
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 220px;
  overflow-y: auto;
}

.sk-save-bar {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sk-rules-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sk-rule-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  font-size: 12px;
}

.sk-rule-card.mode-set {
  border-left-color: #e67e22;
}

.sk-rule-card.mode-add {
  border-left-color: var(--pos);
}

.sk-rule-card.mode-sub {
  border-left-color: var(--neg);
}

/* ── Mad Libs rule sentence ─────────────────────────── */
.sk-madlibs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
  padding: 12px 16px 8px;
  font-size: 13px;
  line-height: 2.4;
}
/* Delete pushed to far right in event-list card header */
.sk-ml-del-right { margin-left: auto; }
/* Yellow badge for rule number */
.sk-rule-num-badge {
  background: #fef08a;
  color: #713f12;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-right: 2px;
}
.sk-ml-txt {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 13px;
}
.sk-ml-label {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
.sk-ml-derived {
  color: var(--text);
  white-space: nowrap;
  font-size: 13px;
}
/* Pill button — base (shared by all popup-dropdown pills) */
.sk-ml-pill {
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  transition: filter 0.1s;
}
.sk-ml-pill:hover { filter: brightness(0.94); }
/* Color variants */
.sk-ml-pill-add   { background: #dcfce7; color: #15803d; }
.sk-ml-pill-set   { background: #ffedd5; color: #c2410c; }
.sk-ml-pill-field { background: #dbeafe; color: #1e40af; font-size: 12px; }
.sk-ml-pill-phrase { background: #ede9fe; color: #5b21b6; font-size: 12px; }
/* Value input */
.sk-ml-input {
  border: none;
  border-bottom: 1.5px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 0 2px 1px;
  outline: none;
  width: 68px;
  text-align: right;
  cursor: text;
}
/* Date pill overlay */
.sk-ml-date-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-light);
  border: 1px solid #b8d4f4;
  border-radius: 999px;
  height: 26px;
  padding: 0 10px;
  cursor: pointer;
  min-width: 72px;
  overflow: visible;
}
.sk-ml-date-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
  z-index: 0;
}
.sk-ml-date-input {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  z-index: 2;
  padding: 0;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}
/* Kembali ke proyeksi awal — at sentence end */
.sk-ml-kembali {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  margin-left: 6px;
}
.sk-ml-chk-lbl {
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--text-muted);
  white-space: nowrap;
}
/* ── Mad Libs custom popup dropdown ─────────────────── */
.sk-ml-drop-panel {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
  min-width: 160px;
  max-width: 240px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px 0;
  z-index: 9999;
}
.sk-ml-drop-sep {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 5px 12px 4px;
  margin-top: 2px;
}
.sk-ml-drop-item {
  font-size: 12px;
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  border-radius: 0;
  transition: background 0.08s;
}
.sk-ml-drop-item:hover { background: var(--brand-light); }
.sk-ml-drop-active {
  color: var(--brand);
  font-weight: 700;
  background: #f0f7ff;
}
.sk-ml-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ml-dot-add { background: #15803d; }
.ml-dot-set { background: #f97316; }
.ml-dot-rollover { background: #2563eb; }
.sk-rule-card.mode-rollover { border-left: 3px solid #2563eb; }
.sk-ml-pill-rollover { background: #dbeafe; color: #1e40af; }

/* Drag-reorder: the #N badge is the handle; cards become drop targets. */
.sk-rule-num-badge { cursor: grab; user-select: none; }
.sk-rule-num-badge:active { cursor: grabbing; }
.sk-rule-card { transition: opacity .15s, box-shadow .15s; }
.sk-rule-card.sk-rule-dragging { opacity: .45; }
.sk-rule-card.sk-rule-drop-target { box-shadow: 0 0 0 2px var(--brand); }
/* Inline lihat data + delete inside madlibs row */
.sk-ml-lihat  { font-size: 11px; white-space: nowrap; margin-left: 4px; }
.sk-ml-del    { padding: 1px 5px; font-size: 11px; }
/* Count badge on Tambah Simulasi button */
.sk-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1a5fac;
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.sk-rule-summary {
  font-size: 11px;
  color: #444;
  font-style: italic;
  width: 100%;
  padding: 1px 0 3px;
  border-bottom: 1px solid #eee;
  margin-bottom: 2px;
}

.sk-rule-num {
  font-weight: 600;
  color: #888;
  min-width: 20px;
  font-size: 11px;
}

.sk-lbl {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
}

.sk-proj-lbl {
  cursor: pointer;
}

.sk-info {
  font-size: 10px;
  color: #999;
  font-style: italic;
  white-space: nowrap;
  margin-left: 4px;
}

.sk-btn-add {
  padding: 4px 12px;
  border: 1px solid var(--brand);
  border-radius: 5px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.sk-btn-add:hover {
  background: #d4e6f9;
}

.sk-btn-del {
  padding: 1px 6px;
  border: 1px solid #e0c0c0;
  border-radius: 4px;
  background: #fdf0f0;
  color: var(--neg);
  font-size: 13px;
  cursor: pointer;
  margin-left: auto;
}

.sk-btn-del:hover {
  background: #fad7d7;
}

td.sk-diff-cell {
  background: #fffbe6 !important;
}

.sk-ctx-toggle {
  font-size: 10px;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  margin-left: 6px;
  user-select: none;
}

.sk-ctx-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.sk-ctx-tbl {
  border-collapse: collapse;
  font-size: 10px;
  white-space: nowrap;
}

.sk-ctx-tbl th {
  background: var(--row-alt);
  padding: 3px 8px;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sk-ctx-tbl th.ctx-r  { color: #267a35; }
.sk-ctx-tbl th.ctx-p  { color: var(--brand); font-style: italic; }
.sk-ctx-tbl th.ctx-t  { color: #555; font-weight: 700; }
.sk-ctx-tbl th.ctx-fy { background: var(--brand-light); color: var(--brand); font-weight: 700; }

.sk-ctx-tbl td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
  font-family: 'IBM Plex Mono', 'SF Mono', 'Menlo', monospace;
  color: #333;
}

.sk-ctx-tbl td.ctx-lbl {
  text-align: left;
  font-family: inherit;
  font-weight: 600;
  color: #555;
  background: #fafafa;
  position: sticky;
  left: 0;
}

.sk-ctx-tbl td.neg   { color: var(--neg); }
.sk-ctx-tbl td.ctx-fy { background: var(--brand-light); font-weight: 700; }
tr.ctx-sim-row td         { background: #f0f7ff; font-style: italic; }
tr.ctx-sim-row td.ctx-fy  { background: #ddeeff; font-style: italic; }

/* Event list */
.sk-evt-wrap       { padding: 6px 0 4px 0; }
.sk-evt-two-col    { display: flex; gap: 0; align-items: flex-start; }
.sk-evt-col-left   { flex: 0 0 auto; min-width: 180px; border-right: 1px solid var(--border); padding-right: 16px; display: flex; flex-direction: column; align-items: center; }
.sk-evt-col-right  { flex: 1 1 auto; padding-left: 16px; min-width: 0; }
.sk-evt-empty      { font-size: 12px; color: var(--text-muted); padding: 8px 0; }
.sk-evt-toolbar         { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-height: 28px; }
/* Proyeksi toolbar+table left-aligned in its column */
.sk-evt-proj-wrap  { width: fit-content; }
.sk-evt-sec-lbl    { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #888; }
.sk-evt-tbl        { border-collapse: collapse; font-size: 12px; width: auto; }
.sk-evt-tbl th     { background: var(--row-alt); font-size: 10px; font-weight: 600; text-transform: uppercase; color: #888; padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.sk-evt-tbl th.r   { text-align: right; }
.sk-evt-tbl td     { padding: 3px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.sk-evt-tbl tr:last-child td { border-bottom: none; }
.sk-evt-tbl-real   { opacity: 0.75; }
.sk-evt-date       { font-size: 11px; color: #444; white-space: nowrap; }
.sk-evt-val-inp    { width: 72px; font-size: 12px; padding: 2px 4px; border: 1px solid #cdd4de; border-radius: 3px; text-align: right; }
.sk-evt-date-inp   { font-size: 11px; padding: 2px 4px; border: 1px solid #cdd4de; border-radius: 3px; width: 110px; }

/* Transposed table — dates as column headers */
.sk-evt-tbl-trans th.sk-evt-row-lbl  { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; padding-right: 10px; background: var(--row-alt); }
.sk-evt-tbl-trans th.sk-evt-date-col { text-align: center; white-space: nowrap; }
.sk-evt-tbl-trans th.sk-evt-add-col  { text-align: center; white-space: nowrap; background: var(--row-alt); }
.sk-evt-tbl-trans td                 { text-align: center; }

/* Column state colors (applied per-cell in transposed layout) */
th.sk-evt-del, td.sk-evt-del        { background: #fdecea; }
th.sk-evt-del                        { text-decoration: line-through; color: #aaa; }
td.sk-evt-del .sk-evt-val-inp        { opacity: 0.4; }
th.sk-evt-new, td.sk-evt-new        { background: #e8f5e9; }
th.sk-evt-chg, td.sk-evt-chg        { background: #fffde7; }

/* Row state colors (original vertical layout kept for compatibility) */
tr.sk-evt-del td             { background: #fdecea; }
tr.sk-evt-del .sk-evt-date   { text-decoration: line-through; color: #aaa; }
tr.sk-evt-del .sk-evt-val-inp { opacity: 0.4; }
tr.sk-evt-new td             { background: #e8f5e9; }
tr.sk-evt-chg td             { background: #fffde7; }

tr.sk-evt-add-row td { background: #fafafa; padding-top: 5px; padding-bottom: 5px; }

/* Action buttons */
.sk-evt-act-btn  { font-size: 13px; line-height: 1; padding: 1px 6px; border-radius: 3px; cursor: pointer; border: 1px solid transparent; background: none; }
.sk-evt-x        { color: var(--neg); border-color: #f5c6c6; }
.sk-evt-x:hover  { background: #fde; }
.sk-evt-undo     { color: #267a35; border-color: #b2dfbd; font-weight: 700; }
.sk-evt-undo:hover { background: #e8f5e9; }
.sk-evt-badge    { font-size: 9px; font-weight: 700; background: #267a35; color: #fff; padding: 1px 4px; border-radius: 3px; vertical-align: middle; }

/* ─────────────────────────────────────────
   Saved scenario list
───────────────────────────────────────── */
.sk-saved-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; padding: 16px; }
.sk-saved-card { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; display: flex; flex-direction: column; }
.sk-saved-card.base-baseline { border-left-color: var(--brand); }
.sk-saved-card.base-potential { border-left-color: var(--pos); }
.sk-saved-card.base-tail { border-left-color: #e67e22; }

/* Card header */
.sk-saved-hdr   { background: #f5f8fc; padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ss-hdr-left    { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sk-saved-name  { font-weight: 700; font-size: 14px; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-saved-base  { font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--brand-light); color: var(--brand); padding: 2px 7px; border-radius: 10px; border: 1px solid #cbe0f5; white-space: nowrap; }
.ss-del-btn     { font-size: 11px; font-weight: 600; padding: 3px 9px; border: 1px solid #f5c6c6; border-radius: 4px; background: #fef2f2; color: var(--neg); cursor: pointer; white-space: nowrap; }
.ss-del-btn:hover { background: #fdecea; border-color: var(--neg); }

/* Section label above rules / impact */
.ss-section-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); padding: 7px 14px 2px; }

/* Footer: view buttons */
.ss-footer      { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-top: 1px solid var(--border-light); background: #f9fafb; }
.ss-view-lbl    { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-right: 2px; }
.ss-view-btn    { font-size: 11px; font-weight: 600; padding: 3px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--brand); cursor: pointer; }
.ss-view-btn:hover { background: var(--brand-light); }
.ss-export-btn  { font-size: 11px; font-weight: 600; padding: 3px 9px; border: 1px solid #b8d4b0; border-radius: 4px; background: #f0faf0; color: #267a35; cursor: pointer; white-space: nowrap; }
.ss-export-btn:hover { background: #267a35; color: #fff; }
.ss-edit-btn    { font-size: 11px; font-weight: 600; padding: 3px 10px; border: 1px solid var(--brand); border-radius: 4px; background: #fff; color: var(--brand); cursor: pointer; white-space: nowrap; }
.ss-edit-btn:hover { background: var(--brand); color: #fff; }
.sk-clear-btn   { font-size: 11px; font-weight: 600; padding: 3px 10px; border: 1px solid #c0392b; border-radius: 4px; background: #fff; color: #c0392b; cursor: pointer; white-space: nowrap; }
.sk-clear-btn:hover { background: #c0392b; color: #fff; }

/* Rules section */
.ss-rules       { padding: 10px 14px; display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid #f0ece7; }
.ss-empty       { padding: 10px 14px; font-size: 12px; color: #aaa; font-style: italic; border-bottom: 1px solid #f0ece7; }
.ss-rule        { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed #f0ece7; }
.ss-rule:last-child { border-bottom: none; }
.ss-rule-evt    { flex-direction: column; align-items: flex-start; gap: 4px; background: #f7fbff; border-radius: 6px; padding: 7px 10px; border: 1px solid #dce8f5; border-bottom: 1px solid #dce8f5 !important; }
.ss-mode-tag    { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; text-transform: uppercase; white-space: nowrap; }
.ss-add         { background: #e8f5e9; color: #267a35; }
.ss-set         { background: #fef3e2; color: #d68910; }
.ss-evt         { background: var(--brand-light); color: var(--brand); }
.ss-rollover    { background: #dbeafe; color: #1e40af; }
.ss-type-tag    { font-size: 10px; color: #aaa; background: #f0f0f0; padding: 1px 5px; border-radius: 3px; }
.ss-rule-field  { font-weight: 600; color: #222; }
.ss-period      { color: #888; font-size: 11px; }
.ss-val         { font-variant-numeric: tabular-nums; font-weight: 600; }
.ss-unit        { font-size: 10px; color: #aaa; font-weight: 400; }

/* Event stats badges */
.ss-evt-stats  { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.ss-badge      { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.ls-count-badge { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 10px; background: var(--navy); color: var(--navy-text); }
.ls-import-btn  { font-size: 11px; font-weight: 600; padding: 4px 12px; border: none; border-radius: 4px; background: var(--navy); color: var(--navy-text); cursor: pointer; }
.ls-import-btn:hover { background: var(--navy-hover); }
.ss-b-del      { background: #fdecea; color: var(--neg);  border: 1px solid #f5c6c6; }
.ss-b-new      { background: #e8f5e9; color: #267a35;    border: 1px solid #b2dfbd; }
.ss-b-chg      { background: #fffde7; color: #b7950b;    border: 1px solid #f9e79f; }
.ss-b-ok       { background: #f0f0f0; color: #888;       border: 1px solid #e0e0e0; }

/* Impact section */
.ss-impact             { padding: 10px 14px; background: var(--brand-light); font-size: 11px; color: #555; border-bottom: 1px solid var(--border-light); }
.ss-impact-row         { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #eee; }
.ss-impact-row:last-child { border-bottom: none; }
.ss-impact-date        { font-size: 9px; font-weight: 700; color: #bbb; text-transform: uppercase; min-width: 72px; flex-shrink: 0; }
.ss-impact-vals        { display: flex; gap: 14px; flex-wrap: wrap; }
.ss-impact-metric      { display: flex; align-items: baseline; gap: 4px; }
.ss-impact-metric strong { color: #1a3050; font-size: 12px; }
.ss-impact-vs          { color: #aaa; font-size: 10px; }
.ss-impact-delta       { font-size: 10px; font-weight: 700; }
.ss-delta-pos          { color: #267a35; }
.ss-delta-neg          { color: var(--neg); }
.no-data-saved         { padding: 40px; color: #aaa; font-size: 13px; text-align: center; background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; margin: 20px; }

/* ─────────────────────────────────────────
   Simulasi Intervensi
───────────────────────────────────────── */
.si-tbl         { border-collapse: collapse; font-size: 13px; min-width: 560px; }
.si-tbl thead tr { background: var(--fib-bg); }
.si-lbl-hdr     { text-align: left; padding: 8px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #555; border-bottom: 2px solid #c8d8ea; min-width: 220px; }
.si-val-hdr     { text-align: right; padding: 6px 10px; font-size: 12px; font-weight: 700; color: var(--brand); border-bottom: 2px solid #c8d8ea; min-width: 140px; }
.si-inp-wrap    { display: inline-flex; align-items: center; gap: 4px; }
.si-inp-pre     { font-size: 11px; font-weight: 600; color: var(--brand); }
.si-inp-suf     { font-size: 11px; font-weight: 600; color: var(--brand); }
.si-amt-inp     { width: 70px; padding: 3px 6px; border: 1px solid #b0c8e0; border-radius: 4px; font-size: 13px; font-weight: 700; color: #1a3050; text-align: right; background: #fff; }
.si-tbl-wrap    { display: inline-block; vertical-align: top; }
.si-omv-ctrl    { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 6px 12px; background: #f5f8fd; border: 1px solid #c8d8ea; border-radius: 6px; font-size: 12px; }
.si-omv-lbl     { font-weight: 600; color: #345; white-space: nowrap; }
.si-omv-date    { font-size: 11px; color: var(--brand); font-weight: 700; background: #dce8f5; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.si-omv-inp     { width: 100px; padding: 3px 6px; border: 1px solid #b0c8e0; border-radius: 4px; font-size: 13px; font-weight: 700; color: #1a3050; text-align: right; background: #fff; }
.si-reset-btn   { padding: 2px 9px; border: 1px solid #b0c8e0; border-radius: 4px; background: #fff; font-size: 11px; color: var(--brand); cursor: pointer; white-space: nowrap; }
.si-reset-btn:hover { background: var(--fib-bg); }

/* ─────────────────────────────────────────
   Tabel C
───────────────────────────────────────── */
.tc-tbl      { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.tc-no       { min-width: 40px; max-width: 40px; z-index: 10; }
.tc-desc     { min-width: 280px; max-width: 280px; z-index: 9; }
.tc-desc-cell { min-width: 280px; max-width: 280px; white-space: normal; line-height: 1.4; padding: 5px 8px; }
tr.tc-hi td  { background: var(--row-alt) !important; font-weight: 500; }
tr.tc-hi .lc { background: var(--row-alt) !important; }
/* hdr-lc right separator comes from box-shadow; border-right would double with
   adjacent hdr cell's border-left when border-collapse: separate is active */
.tc-tbl .hdr-lc { border-right: none; }

.si-tbl-sep        { height: 20px; }
.si-section-title  { font-size: 13px; font-weight: 700; color: #1a3050; margin-bottom: 8px; letter-spacing: .01em; }
.si-ctrl-sep       { display: inline-block; width: 1px; height: 18px; background: #c8d8ea; margin: 0 8px; vertical-align: middle; }
.si-omv-col-hdr    { font-size: 13px; font-variant-numeric: tabular-nums; }
.si-omv-col2-hdr   { background: #eaf5ee; color: #267a35; }
.si-footnote       { max-width: 100%; margin: 8px 0 0; font-size: 11px; color: #666; font-style: italic; text-align: left; line-height: 1.5; }
.si-shock-greeting { max-width: 100%; margin: 8px 0 10px; font-size: 12px; color: #333; line-height: 1.8; }
.si-laporan-card   { background: #fff; border: 1px solid #dde1e8; border-radius: 10px; padding: 18px 22px; margin: 10px 0 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); font-size: 12px; color: #222; line-height: 1.9; max-width: 720px; }
.si-copy-btn       { font-size: 11px; font-weight: 600; padding: 4px 12px; border: 1px solid #c8d8ea; border-radius: 5px; background: #f5f8fd; color: #1a5fac; cursor: pointer; }
.si-copy-btn:hover { background: #e8f3ff; border-color: #1a5fac; }
.si-tbl tbody tr   { border-bottom: 1px solid #eee; }
.si-tbl tbody tr:last-child { border-bottom: none; }
.si-tbl tbody tr:hover { background: #f7fafd; }
.si-lbl            { padding: 7px 14px; font-size: 12px; color: #444; white-space: nowrap; }
.si-lbl-wrap       { white-space: normal; max-width: 220px; line-height: 1.4; }
.si-val            { padding: 7px 14px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: #1a3050; }
.si-row-ref td     { font-size: 11px; color: #888; background: #fafafa; font-style: italic; }
.si-row-mig .si-mig-date { color: var(--neg); font-weight: 600; }
.si-below-min      { color: var(--neg); font-weight: 700; }

/* --- Rekap --- */
.rekap-wrap          { padding: 0 0 24px; }
.rekap-scroll        { overflow: visible; }
.rekap-tbl           { border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.rekap-tbl thead tr  { background: #1a3050; color: #fff; }
.rekap-tbl thead th  { padding: 7px 10px; font-weight: 700; font-size: 11px; border-right: 1px solid rgba(255,255,255,.12); position: sticky; top: 0; z-index: 2; background: #1a3050; color: #fff; }
.rekap-tbl th.rk-no   { width: 44px; min-width: 44px; box-sizing: border-box; text-align: center; position: sticky; left: 0; z-index: 5; }
.rekap-tbl th.rk-desc { text-align: left; min-width: 230px; white-space: normal; border-right: 1px solid rgba(255,255,255,.2); position: sticky; left: 44px; z-index: 5; }
.rekap-tbl th.rk-val  { width: 110px; text-align: right; }
/* Body cells — base */
.rekap-tbl td            { padding: 4px 10px; border-right: 1px solid #eef0f3; }
.rekap-tbl td.rk-no      { text-align: center; color: #aaa; font-size: 11px; width: 44px; min-width: 44px; box-sizing: border-box; position: sticky; left: 0; z-index: 2; background: #fff; }
.rekap-tbl td.rk-desc    { color: #333; padding-left: 12px; border-right: 1px solid #dde1e8; position: sticky; left: 44px; z-index: 2; background: #fff; }
.rekap-tbl td.rk-val     { text-align: right; font-variant-numeric: tabular-nums; color: #1a3050; }
/* Data row stripe + hover */
.rekap-tbl tbody tr.rk-data          { border-bottom: 1px solid #f0f0f0; }
.rekap-tbl tbody tr.rk-data:hover td { background: #f0f6ff; }
/* Section rows — high specificity so they override column-cell rules */
.rekap-tbl tbody tr.rk-section td          { background: #1a3050 !important; color: #fff !important; font-weight: 700; font-size: 11px; letter-spacing: .05em; padding-top: 5px; padding-bottom: 5px; border-right-color: rgba(255,255,255,.1); }
.rekap-tbl tbody tr.rk-section td.rk-neg  { color: #ffd180 !important; }
/* Group rows */
.rekap-tbl tbody tr.rk-group td           { background: #dce6f4; color: #1a3050; font-weight: 700; }
.rekap-tbl tbody tr.rk-group td.rk-neg   { color: var(--neg); }
/* Total rows */
.rekap-tbl tbody tr.rk-total td           { background: #eef3fa; font-weight: 700; border-top: 1.5px solid #8fa8cc; border-bottom: 1.5px solid #8fa8cc; }
.rekap-tbl tbody tr.rk-total td.rk-neg   { color: var(--neg); }
/* Negative value color (data rows) */
.rekap-tbl td.rk-neg { color: var(--neg); }
/* Frozen column backgrounds — must match each row type */
.rekap-tbl tbody tr.rk-data:hover td.rk-no,
.rekap-tbl tbody tr.rk-data:hover td.rk-desc { background: #f0f6ff; }
.rekap-tbl tbody tr.rk-section td.rk-no,
.rekap-tbl tbody tr.rk-section td.rk-desc { background: #1a3050 !important; color: #fff !important; }
.rekap-tbl tbody tr.rk-group td.rk-no,
.rekap-tbl tbody tr.rk-group td.rk-desc { background: #dce6f4; color: #1a3050; }
.rekap-tbl tbody tr.rk-total td.rk-no,
.rekap-tbl tbody tr.rk-total td.rk-desc { background: #eef3fa; }

/* ─────────────────────────────────────────
   KPI Strip — 4 headline cards above IRFCL
───────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: hidden;
}

.kpi-card .kpi-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.kpi-card .kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  line-height: 1;
}

.kpi-card .kpi-delta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  margin-top: 4px;
  color: var(--text-muted);
}

.kpi-card .kpi-delta.pos { color: var(--pos); }
.kpi-card .kpi-delta.neg { color: var(--neg); }

/* ─────────────────────────────────────────
   Scenario chip + diff chip
───────────────────────────────────────── */
.scen-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.scen-chip.chip-base     { background: #dcfce7; color: #15803d; }
.scen-chip.chip-pot      { background: #fef3c7; color: #b45309; }
.scen-chip.chip-tail     { background: #fee2e2; color: #dc2626; }
.scen-chip.chip-custom   { background: #f3e8ff; color: #7c3aed; }
.scen-chip.chip-none     { background: var(--border); color: var(--text-muted); }

.scen-chip.chip-fv-default   { background: #e8f3ff; color: #1a5fac; }
.scen-chip.chip-fv-custom    { background: #f3e8ff; color: #7c3aed; }
.scen-chip.chip-fv-quarterly { background: #fef3c7; color: #b45309; }
.scen-chip.chip-fv-monthly   { background: #ccfbf1; color: #0d9488; }
.scen-chip.chip-fv-daily     { background: #e0e7ff; color: #4338ca; }
.scen-chip.chip-fv-fib      { background: #fff7ed; color: #c2410c; }
.scen-chip.chip-fv-lepcd    { background: #d1fae5; color: #065f46; }
.scen-chip.chip-fv-monitor  { background: #ecfeff; color: #0e7490; }

.scen-chip.chip-fxc-dtd      { background: #fef3c7; color: #92400e; }
.scen-chip.chip-fxc-wtd      { background: #fde7e7; color: #b91c1c; }
.scen-chip.chip-fxc-mtd      { background: #dbeafe; color: #1e40af; }
.scen-chip.chip-fxc-ytd      { background: #d1fae5; color: #047857; }
.scen-chip.chip-fxc-custom   { background: #f3e8ff; color: #7c3aed; }

.charts-change-date-pill {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}
.charts-change-date-pill::-webkit-calendar-picker-indicator {
  filter: invert(31%) sepia(48%) saturate(919%) hue-rotate(186deg);
  cursor: pointer;
}

.charts-change-period-range {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}
.charts-change-period-range strong {
  color: var(--text);
  font-weight: 600;
}

#ci-charts {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  display: inline-block;
  background: #f3f4f6;
  color: #6b7280;
}
#ci-charts.ci-loaded {
  background: #d1fae5;
  color: #065f46;
}
#ci-charts .ci-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  margin-right: 3px;
}

.scen-chip .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Transient diff chip — appears after scenario switch */
.scen-diff-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  white-space: nowrap;
}

.scen-diff-chip.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scen-diff-chip .diff-x {
  opacity: .5;
  cursor: pointer;
  font-size: 10px;
  margin-left: 2px;
  font-family: inherit;
  font-weight: 400;
}

.scen-diff-chip .diff-x:hover { opacity: 1; }

/* ─────────────────────────────────────────
   Floating scenario dropdown (chip click)
───────────────────────────────────────── */
#scen-dropdown {
  position: fixed;
  z-index: 8000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  padding: 4px;
  min-width: 160px;
}

.scen-dd-sep {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--text-muted);
  padding: 6px 10px 2px;
}

.scen-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.scen-dd-item:hover { background: var(--bg); }

.scen-dd-item.active { font-weight: 700; }

.scen-dd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.scen-dd-dot.dd-base   { background: #15803d; }
.scen-dd-dot.dd-pot    { background: #b45309; }
.scen-dd-dot.dd-tail   { background: #dc2626; }
.scen-dd-dot.dd-custom { background: #7c3aed; }

.scen-dd-dot.dd-fv-default   { background: #1a5fac; }
.scen-dd-dot.dd-fv-custom    { background: #7c3aed; }
.scen-dd-dot.dd-fv-quarterly { background: #b45309; }
.scen-dd-dot.dd-fv-monthly   { background: #0d9488; }
.scen-dd-dot.dd-fv-daily     { background: #4338ca; }
.scen-dd-dot.dd-fv-fib      { background: #c2410c; }
.scen-dd-dot.dd-fv-lepcd    { background: #065f46; }
.scen-dd-dot.dd-fv-monitor  { background: #0e7490; }

/* ─────────────────────────────────────────
   Toolbar 2-line control groups
───────────────────────────────────────── */
.tb-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tb-ctrl-lbl {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1;
}

/* ─────────────────────────────────────────
   Density toggle (in toolbar)
───────────────────────────────────────── */
.density-tgl {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.density-tgl .dt-btn {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  transition: background .1s, color .1s;
}

.density-tgl .dt-btn.on {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

/* ─────────────────────────────────────────
   Command Palette (⌘K overlay)
───────────────────────────────────────── */
#cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

#cmd-palette-overlay.open {
  display: flex;
}

.cmd-palette-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 32px 64px -16px rgba(0,0,0,.28), 0 8px 24px -8px rgba(0,0,0,.12);
  width: 520px;
  max-width: 92vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.cmd-prefix {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--brand);
}

#cmd-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
}

.cmd-esc-kbd {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--bg);
}

.cmd-section-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  padding: 10px 16px 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background .1s;
}

.cmd-item:hover, .cmd-item.cmd-active {
  background: var(--brand-light);
}

.cmd-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cmd-item.cmd-active .cmd-item-icon {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.cmd-item-lbl {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

.cmd-item-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}

.cmd-palette-list {
  max-height: 360px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.cmd-no-results {
  padding: 20px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ─────────────────────────────────────────
   Overview
───────────────────────────────────────── */
.ovr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ovr-card-hdr {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ovr-sel-item {
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.ovr-sel-item:hover { background: var(--bg); }
.ovr-sel-item.active {
  background: var(--brand-light);
  border-color: #cbe0f5;
}

/* Metric pills above chart */
.ovr-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px 4px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--bg);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  user-select: none;
}
.ovr-pill:not(.active):hover {
  border-color: #b0bac8;
  color: var(--text);
}
.ovr-pill.active {
  color: #fff;
  border-color: transparent;
}

/* Vertical KPI cards in left column */
.ovr-kpi-card {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px 8px 11px;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.12s, background 0.12s;
}
.ovr-kpi-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.ovr-kpi-card.active {
  border-color: transparent;
  box-shadow: 0 0 0 1.5px currentColor;
}
.ovr-kpi-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ovr-kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ovr-kpi-delta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  margin-top: 3px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ovr-kpi-delta.pos { color: var(--pos); }
.ovr-kpi-delta.neg { color: var(--neg); }

/* Narrative body scroll */
#ovr-narrative strong { font-weight: 700; }
#ovr-narrative p strong[style*="color"] { font-style: normal; }

/* ── Simulasi Cadev Enhancements ────────────────────────────────────────────── */
.sc-wrap { background: #f4f7f9; }

.sc-header { 
  padding: 24px 32px 20px; 
  font-size: 26px; 
  font-weight: 800; 
  color: #1a3050;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.05); 
  flex-shrink: 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sc-header::before {
  content: '✦';
  color: var(--brand);
  font-size: 20px;
}

/* .sc-tab-bar / .sc-tab share the canonical underline-tab
   definition with .utab-* (see "Underline Tab Bar" below). */

/* Method description strip */
.sc-description { 
  padding: 16px 32px; 
  font-size: 13px; 
  color: #4a5568; 
  line-height: 1.6;
  background: #fff; 
  border-bottom: 1px solid var(--border); 
  flex-shrink: 0; 
  position: relative; 
}
.sc-description::before {
  content: 'ℹ';
  position: absolute;
  left: 32px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  background: var(--fib-bg);
  width: 24px; 
  height: 24px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 50%; 
  top: 14px; 
}
.sc-description-text { padding-left: 36px; }
.sc-description strong { color: #1a3050; font-weight: 700; }
.sc-description em { font-style: italic; color: #2c5282; }

/* Inner Layout Body */
.sc-inner-body { 
  padding: 20px 32px; 
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
  flex: 1; 
  overflow: hidden; 
  background: #f4f7f9; 
}

/* Controls — Mad Libs sentence row */
.sc-controls { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 12px 20px; 
  flex-wrap: wrap;
  font-size: 13px; 
  background: #fff; 
  border: 1px solid var(--border-light); 
  border-radius: 12px; 
  flex-shrink: 0; 
  box-shadow: 0 2px 4px rgba(0,0,0,.02); 
}
.sc-ml-text { color: #4a5568; white-space: nowrap; font-weight: 500; }
.sc-ml-sep { color: var(--text-muted); font-size: 12px; }
.sc-ctrl-sep { width: 4px; height: 4px; background: #cbd5e0; border-radius: 50%; margin: 0 4px; }
.sc-refresh-btn { 
  margin-left: auto; 
  padding: 8px 16px; 
  font-size: 12px; 
  font-weight: 700;
  background: #fff; 
  color: var(--brand); 
  border: 1px solid var(--brand); 
  border-radius: 8px;
  cursor: pointer; 
  font-family: inherit; 
  white-space: nowrap; 
  transition: all .15s; 
  box-shadow: 0 2px 6px rgba(26,95,172,.1); 
}
.sc-refresh-btn::before { content: '↻ '; font-weight: bold; }
.sc-refresh-btn:hover { 
  background: var(--brand); 
  color: #fff; 
  transform: translateY(-1px); 
  box-shadow: 0 4px 10px rgba(26,95,172,.2); 
}

/* Parameter pills */
.sc-param-pill { 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  padding: 4px 12px; 
  border-radius: 20px;
  font-size: 12px; 
  font-family: 'IBM Plex Mono', monospace; 
  white-space: nowrap; 
  font-weight: 500; 
}
.sc-pill-count { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; box-shadow: inset 0 1px 2px rgba(255,255,255,.5); }
.sc-pill-count strong { font-weight: 700; }
.sc-pill-mu    { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; box-shadow: inset 0 1px 2px rgba(255,255,255,.5); }
.sc-pill-sigma { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; box-shadow: inset 0 1px 2px rgba(255,255,255,.5); }
.sc-pill-n     { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; box-shadow: inset 0 1px 2px rgba(255,255,255,.5); }

/* Side-by-side chart layout */
.sc-charts-row { display: flex; flex: 1; overflow: hidden; min-height: 0; gap: 20px; }
.sc-card { 
  background: #fff; 
  border: 1px solid var(--border-light); 
  border-radius: 12px; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  box-shadow: 0 4px 15px rgba(0,0,0,.03); 
  transition: box-shadow 0.2s; 
}
.sc-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,.05); }
.sc-left { flex: 0 0 calc(62% - 10px); min-width: 0; overflow: hidden; }
.sc-right { flex: 0 0 calc(38% - 10px); min-width: 0; overflow: hidden; }

.sc-section-lbl { 
  font-size: 11px; 
  font-weight: 700; 
  color: #1a3050; 
  text-transform: uppercase;
  letter-spacing: .08em; 
  padding: 16px 20px 4px; 
  flex-shrink: 0; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}
.sc-section-lbl::before { 
  content: ''; 
  display: block; 
  width: 4px; 
  height: 12px; 
  background: var(--brand); 
  border-radius: 2px; 
}

.sc-chart-wrap-full { flex: 1; padding: 10px 20px 20px; min-height: 0; }
.sc-hist-stats { 
  font-size: 12px; 
  color: #718096; 
  padding: 4px 20px 10px; 
  flex-shrink: 0; 
  background: #fff; 
  border-bottom: 1px dashed var(--border-light); 
  margin-bottom: 10px; 
}
.sc-hist-stats strong { color: #2d3748; font-weight: 700; }
.sc-hist-wrap-full { flex: 1; padding: 0 20px 20px; min-height: 0; }

.sc-empty { 
  padding: 80px 20px; 
  color: #a0aec0; 
  font-size: 15px; 
  text-align: center; 
  line-height: 1.7; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  height: 100%; 
  border: 2px dashed #e2e8f0; 
  border-radius: 12px; 
  background: #fafbff; 
  margin: 20px; 
}
.sc-empty::before { content: '📊'; font-size: 40px; margin-bottom: 16px; opacity: 0.5; }
.sc-empty strong { color: #4a5568; }

/* Stress episode selector (Historical Scenario tab) */
.sc-sel {
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: all 0.15s;
}
.sc-sel:hover { border-color: #94a3b8; }
.sc-sel:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,95,172,0.1);
}

.sc-ep-desc-box { 
  font-size: 13px; 
  color: #475569; 
  background: #f8fafc; 
  border-left: 3px solid #cbd5e0; 
  padding: 8px 12px;
  margin-top: 4px;
  border-radius: 0 6px 6px 0;
  width: 100%;
}
.sc-ep-desc-box strong { color: #1e293b; }

/* Historical Path year summary table */
.sc-yr-tbl { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0; 
  font-size: 11px; 
  margin-top: 4px; 
  border-radius: 6px; 
  overflow: hidden; 
  border: 1px solid #e2e8f0; 
}
.sc-yr-tbl thead { background: #f7fafc; }
.sc-yr-tbl th { 
  text-align: left; 
  padding: 8px 12px; 
  color: #4a5568; 
  font-weight: 700;
  font-size: 10px; 
  text-transform: uppercase; 
  letter-spacing: .06em;
  border-bottom: 1px solid #e2e8f0; 
}
.sc-yr-tbl td { 
  padding: 6px 12px; 
  border-bottom: 1px solid #edf2f7; 
  color: #2d3748; 
}
.sc-yr-tbl td.num { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.sc-yr-tbl tr:last-child td { border-bottom: none; }
.sc-yr-tbl tr:hover td { background: #fbfdff; }
.sc-yr-dot { 
  display: inline-block; 
  width: 8px; 
  height: 8px; 
  border-radius: 50%;
  margin-right: 6px; 
  vertical-align: middle; 
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(0,0,0,.1); 
}

/* ─────────────────────────────────────────
   Global Upload Overlay
───────────────────────────────────────── */
.global-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-overlay-content {
  max-width: 500px;
  width: 100%;
  padding: 20px;
}

#charts-upload-overlay .global-overlay-content {
  max-width: 920px;
}

/* Ranking Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #cbd5e0;
}
.rank-top { background: #10b981; } /* Green */
.rank-bot { background: #ef4444; } /* Red */

/* Heatmap */
.sc-hm-wrap { padding: 0 20px 20px; overflow-x: auto; }
.sc-hm-tbl { width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 10px; white-space: nowrap; }
.sc-hm-tbl th {
  padding: 6px 6px;
  text-align: center;
  color: #718096;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sc-hm-tbl th:first-child {
  left: 0;
  z-index: 11;
}
.sc-hm-tbl td {
  padding: 5px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  min-width: 38px;
  height: 26px;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.sc-hm-tbl td.yr-cell {
  color: #374151;
  background: #f8fafc;
  font-weight: 700;
  text-shadow: none;
  border-bottom: 1px solid #e9eef4;
  border-right: 2px solid #cbd5e1;
  position: sticky;
  left: 0;
  z-index: 10;
  will-change: transform;
}
/* covers any cells that scroll behind the sticky year column */
.sc-hm-tbl td.yr-cell::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: 9999px;
  background: inherit;
}
.sc-hm-ctrl { 
  display: flex; 
  justify-content: flex-end; 
  padding: 0 20px 10px; 
  gap: 12px;
  align-items: center;
}
.sc-hm-legend { font-size: 9px; color: #94a3b8; display: flex; gap: 8px; align-items: center; }
.sc-hm-dot { width: 8px; height: 8px; border-radius: 2px; }

/* --- IRFCL / Skenario-preview row & column hover highlight --- */
#tw tbody tr:not(.sc):hover > td:not(.lc),
#tw tbody tr:not(.sc):hover > th,
#tw-sk.irfcl-hl tbody tr:not(.sc):hover > td:not(.lc),
#tw-sk.irfcl-hl tbody tr:not(.sc):hover > th {
  background-color: rgba(234, 179, 8, 0.15) !important;
}
/* Sticky label cell gets a solid equivalent — never semi-transparent */
#tw tbody tr:not(.sc):hover > td.lc,
#tw-sk.irfcl-hl tbody tr:not(.sc):hover > td.lc {
  background: #fcf4da !important;
}
#tw td:not(.lc).col-hl,
#tw-sk.irfcl-hl td:not(.lc).col-hl {
  background-color: rgba(234, 179, 8, 0.15) !important;
}
#tw tbody tr:not(.sc):hover > td:not(.lc).col-hl,
#tw-sk.irfcl-hl tbody tr:not(.sc):hover > td:not(.lc).col-hl {
  background-color: rgba(234, 179, 8, 0.28) !important;
}


/* ─── Underline Tab Bar — canonical (Sim Cadev + Sim P.Cadev) ─── */
.utab-bar,
.sc-tab-bar {
  display: flex;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.utab-item,
.sc-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  margin-bottom: -1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.utab-item.on,
.sc-tab.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.utab-item:hover:not(.on),
.sc-tab:hover:not(.on) { color: var(--text); }

/* Upload pair: two up-cards side by side */
.up-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 900px;
}

/* Asumsi read-only tables */
.spc-table-section { margin-bottom: 24px; }
.spc-table-lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px;
}
.spc-tbl { border-collapse: collapse; font-size: 11px; width: 100%; white-space: nowrap; }
.spc-tbl th {
  background: var(--bg); padding: 4px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: #555; border-bottom: 1px solid var(--border);
  text-align: center; position: sticky; top: 0;
}
.spc-tbl th.spc-lbl-th { text-align: left; min-width: 160px; position: sticky; left: 0; z-index: 2; background: var(--bg); }
.spc-tbl td { padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.spc-tbl td.spc-lbl-td { text-align: left; font-family: inherit; font-weight: 600; color: var(--text); background: var(--bg); position: sticky; left: 0; }
.spc-placeholder { padding: 32px 20px; color: var(--text-muted); font-size: 13px; font-style: italic; text-align: center; }

/* Fullscreen loading overlay */
@keyframes tabFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spc-spin { to { transform: rotate(360deg); } }
#spc-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247, 248, 250, 0.88);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
html.dark #spc-loading-overlay { background: rgba(13, 15, 20, 0.92); }
.spc-loading-ring {
  width: 64px;
  height: 64px;
  border: 5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spc-spin 0.75s linear infinite;
}
.spc-loading-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.spc-loading-pct {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
  font-family: 'IBM Plex Mono', monospace;
  min-height: 38px;
}
.up-status-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.up-del-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
  cursor: pointer;
  white-space: nowrap;
}
.up-del-btn:hover { background: #fee2e2; border-color: #f87171; }

/* ─────────────────────────────────────────
   Dark Mode
───────────────────────────────────────── */
html.dark {
  --bg:           #0f1117;
  --surface:      #1a1d24;
  --border:       #2e333d;
  --border-light: #252930;
  --text:         #e8eaf0;
  --text-muted:   #7a8494;
  --brand:        #4a9eff;
  --brand-light:  rgba(74,158,255,0.12);
  --accent:       #38bdf8;
  --neg:          #fb923c;
  --neg-bg:       rgba(251,146,60,0.10);
  --pos:          #4ade80;
  --row-alt:      #1f2330;
  --row-section:  #1c1f27;
  --fib-bg:       rgba(74,158,255,0.08);
  --fib-sep:      rgba(255,255,255,0.10);
  color-scheme: dark;
}

html.dark *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html.dark *::-webkit-scrollbar-track {
  background: var(--bg);
}
html.dark *::-webkit-scrollbar-thumb {
  background: #3a3f4b;
  border-radius: 4px;
}
html.dark *::-webkit-scrollbar-thumb:hover {
  background: #4e5566;
}
html.dark *::-webkit-scrollbar-corner {
  background: var(--bg);
}

html.dark .sb-ship-icon g { fill: rgba(255,255,255,0.55); }

html.dark .tw {
  background:
    linear-gradient(to right, #1a1d24 20%, rgba(26,29,36,0)) 0 0,
    linear-gradient(to left,  #1a1d24 20%, rgba(26,29,36,0)) 100% 0,
    radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.18), transparent) 0 0,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), transparent) 100% 0;
  background-color: #1a1d24;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

html.dark input,
html.dark select,
html.dark textarea {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

html.dark code { background: var(--row-alt); color: var(--text); }

html.dark .global-overlay { background: var(--surface); }
html.dark .sk-ml-drop-panel { background: var(--bg); border-color: var(--border); }
html.dark .up-card { background: var(--row-alt) !important; border-color: var(--border); }
html.dark .up-card h3 { color: var(--text); }
html.dark .up-card .desc { color: var(--text-muted); }
html.dark .up-card input[type=file] { color: var(--text-muted); }
/* BI / LB / SPC overlays use inline background:var(--bg) — give them a non-body shade in dark */
html.dark #charts-upload-overlay,
html.dark #lb-upload-overlay,
html.dark #spc-upload-overlay { background: var(--surface) !important; }
html.dark .sk-ml-drop-sep   { background: var(--row-alt); }
html.dark .sk-ml-drop-item:hover { background: rgba(26,95,172,0.15); }
html.dark .sk-ml-drop-active { background: rgba(26,95,172,0.20); color: var(--brand); }

/* Total row uniform background in dark mode */
html.dark tr.sb td    { background: rgba(255,255,255,0.06) !important; }
/* Sticky .lc must be opaque — semi-transparent causes scroll-through */
html.dark tr.sb td.lc { background: #252c33 !important; }

/* Skenario diff cells — dark amber instead of bright yellow */
html.dark td.sk-diff-cell { background: #2d2810 !important; }

html.dark .st.ok  { background: rgba(74,222,128,0.12); color: #4ade80; border-color: rgba(74,222,128,0.3); }
html.dark .st.err { background: rgba(251,146,60,0.12);  color: #fb923c; border-color: rgba(251,146,60,0.3); }

html.dark tr.ctx-sim-row td        { background: rgba(74,158,255,0.06); }
html.dark tr.ctx-sim-row td.ctx-fy { background: rgba(74,158,255,0.12); }

/* ── Simulasi Cadev — comprehensive dark mode ───────────────────────────── */
html.dark .sc-wrap               { background: var(--bg); }
html.dark .sc-header             { background: var(--surface); color: var(--text); border-bottom-color: var(--border); }
/* .sc-tab-bar / .sc-tab dark styling now inherited from the unified .utab-* tokens */
html.dark .sc-description        { background: var(--surface); border-bottom-color: var(--border); }
html.dark .sc-description strong { color: var(--text); }
html.dark .sc-description em     { color: var(--text-muted); }
html.dark .sc-inner-body         { background: var(--bg); }
html.dark .sc-controls           { background: var(--surface); border-color: var(--border); }
html.dark .sc-ml-text            { color: var(--text-muted); }
html.dark .sc-ctrl-sep           { background: var(--border); }
html.dark .sc-refresh-btn        { background: var(--surface); }
html.dark .sc-pill-count { background: rgba(99,102,241,0.15);  color: #a5b4fc; border-color: rgba(99,102,241,0.3); }
html.dark .sc-pill-mu    { background: rgba(16,185,129,0.15);  color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
html.dark .sc-pill-sigma { background: rgba(245,158,11,0.15);  color: #fbbf24; border-color: rgba(245,158,11,0.3); }
html.dark .sc-pill-n     { background: rgba(255,255,255,0.06); color: var(--text-muted); border-color: var(--border); }
html.dark .sc-card               { background: var(--surface); border-color: var(--border); }
html.dark .sc-section-lbl        { color: var(--text); }
html.dark .sc-hist-stats         { background: var(--surface); color: var(--text-muted); border-bottom-color: var(--border); }
html.dark .sc-hist-stats strong  { color: var(--text); }
html.dark .sc-empty              { background: var(--surface); border-color: var(--border); color: var(--text-muted); }
html.dark .sc-empty strong       { color: var(--text); }
html.dark .sc-sel                { background: var(--surface); color: var(--text); border-color: var(--border); }
html.dark .sc-ep-desc-box        { background: var(--row-alt); color: var(--text-muted); border-left-color: var(--border); }
html.dark .sc-ep-desc-box strong { color: var(--text); }
html.dark .sc-yr-tbl             { border-color: var(--border); }
html.dark .sc-yr-tbl thead       { background: var(--row-alt); }
html.dark .sc-yr-tbl th          { color: var(--text-muted); border-bottom-color: var(--border); }
html.dark .sc-yr-tbl td          { border-bottom-color: var(--border-light); color: var(--text); }
html.dark .sc-yr-tbl tr:hover td { background: var(--row-alt); }
html.dark .sc-hm-tbl th          { background: var(--row-alt); color: var(--text-muted); border-bottom-color: var(--border); }
html.dark .sc-hm-tbl td.yr-cell  { background: var(--row-alt) !important; color: var(--text); border-right-color: var(--border); }
html.dark #sc-line-chart,
html.dark #sc-hist-chart,
html.dark #sc-heatmap-area       { background: var(--surface) !important; }

html.dark .si-amt-inp,
html.dark .si-omv-inp  { background: var(--surface); color: var(--text); border-color: var(--border); }
html.dark .si-reset-btn { background: var(--surface); color: var(--brand); border-color: var(--border); }
html.dark .si-omv-ctrl { background: var(--surface); border-color: var(--border); }
html.dark .si-omv-date { background: var(--fib-bg); }

/* Simulasi Intervensi — dark mode fixes */
html.dark .si-section-title { color: var(--text); }
html.dark .si-lbl-hdr       { color: var(--text-muted); border-bottom-color: var(--border); }
html.dark .si-val-hdr       { border-bottom-color: var(--border); }
html.dark .si-tbl thead tr  { background: var(--surface); }
html.dark .si-omv-col2-hdr  { background: rgba(38,122,53,0.20); color: #6fcf97; }
html.dark .si-lbl           { color: var(--text-muted); }
html.dark .si-val           { color: var(--text); }
html.dark .si-tbl tbody tr  { border-bottom-color: var(--border); }
html.dark .si-tbl tbody tr:hover { background: var(--row-alt); }
html.dark tr.si-row-ref td  { background: var(--surface); color: var(--text-muted); font-style: italic; }
html.dark .si-omv-lbl       { color: var(--text-muted); }
html.dark .si-footnote      { color: var(--text-muted); }
html.dark .si-shock-greeting { color: var(--text); }
html.dark .si-laporan-card  { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
html.dark #si-shock-tbl,
html.dark #si-lcd-tbl       { background: var(--surface) !important; }
html.dark .si-copy-btn      { background: var(--surface); border-color: var(--border); color: var(--brand); }
html.dark .si-copy-btn:hover { background: var(--fib-bg); border-color: var(--brand); }

html.dark .global-overlay { background: rgba(0,0,0,0.65); }
html.dark .global-overlay .global-overlay-content { background: var(--surface); }

/* Rekap table — dark mode fixes */
html.dark .rekap-tbl td                           { border-right-color: var(--border); }
html.dark .rekap-tbl td.rk-desc                   { color: var(--text); border-right-color: var(--border); }
html.dark .rekap-tbl td.rk-val                    { color: var(--text); }
html.dark .rekap-tbl tbody tr.rk-data             { border-bottom-color: var(--border-light); }
html.dark .rekap-tbl tbody tr.rk-data:hover td    { background: var(--row-alt); }
html.dark .rekap-tbl tbody tr.rk-group td         { background: rgba(74,158,255,0.12); color: var(--text); }
html.dark .rekap-tbl tbody tr.rk-total td         { background: rgba(74,158,255,0.08); color: var(--text); }

/* More visible Copy Table button in dark mode */
html.dark .btn-dark,
html.dark .btn-dark:hover,
html.dark .ls-import-btn,
html.dark .ls-import-btn:hover {
  background: var(--brand);
  color: #000;
}

/* IRFCL dark mode fixes */
html.dark tr.sc td,
html.dark tr.sc .lc {
  background: #252a35 !important;
  color: var(--text-muted);
}
html.dark #tw tbody tr:not(.sc):hover > td.lc,
html.dark #tw-sk.irfcl-hl tbody tr:not(.sc):hover > td.lc {
  background: #393420 !important;
}

html.dark .hdr-lc {
  background: #1a3050;
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.08), 2px 0 0 0 rgba(255,255,255,0.10);
}
html.dark .hdr {
  background: #1a3050;
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.08);
}
html.dark .hdr.pr {
  background: #122840;
}

/* FIB dark mode fixes */
html.dark #fib-daily-chart-wrap {
  background: var(--surface) !important;
  border-top-color: var(--border) !important;
}
/* Solid sticky column backgrounds — prevent scroll-through in dark mode */
html.dark tr.f-bg td.lc {
  background: #1e2736 !important;
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.06);
}
html.dark tr.h-bg td.lc,
html.dark tr.h-bg td {
  background: #25241a !important;
}
html.dark tr.h-bg td.lc {
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.06);
}
html.dark tr.sk1-bg td.lc,
html.dark tr.sk1-bg td {
  background: #1a2a1c !important;
}
html.dark tr.sk1-bg td.lc {
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.06);
}
html.dark tr.y-bg td.lc,
html.dark tr.y-bg td {
  background: #3a3414 !important;
}
html.dark tr.y-bg td.lc {
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.06);
}
html.dark tr.sim-row td.lc,
html.dark tr.sim-row td {
  background: #252218 !important;
}
html.dark tr.sim-row td.lc {
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.06);
}
/* Sim Migrasi chart containers */
html.dark #sim-chart-wrap,
html.dark #sim-is-ara-chart-wrap,
html.dark #sk-sim-canvas,
html.dark #sk-sim-is-ara-canvas { background: var(--surface) !important; }

/* FIB header group separator — more visible border */
html.dark .hdr {
  border-bottom-color: rgba(255,255,255,0.12);
}

/* Row hover — matrix data tables (dark): light overlay */
html.dark .tw table:not(.rekap-tbl):not(.si-tbl) tbody tr:not(.xr):not(.sc):hover td {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, .06);
}
html.dark .tw table:not(.rekap-tbl):not(.si-tbl) tbody tr:not(.xr):not(.sc):hover td.lc {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, .06), 1px 0 0 0 var(--border);
}

/* Tabel C dark mode — sub-section rows (light pastels → opaque dark tints)
   Must override both <tr> and <td>: rgba on <td> composites on top of the
   bright <tr inline style>, making the result still too bright. */
html.dark tr.tc-sub-green,
html.dark tr.tc-sub-green td  { background: #1a2e24 !important; }
html.dark tr.tc-sub-yellow,
html.dark tr.tc-sub-yellow td { background: #252018 !important; }
html.dark tr.tc-sub-purple,
html.dark tr.tc-sub-purple td { background: #22193a !important; }
html.dark tr.tc-sub-blue,
html.dark tr.tc-sub-blue td   { background: #192338 !important; }
html.dark tr.tc-sub-red,
html.dark tr.tc-sub-red td    { background: #2c1a1c !important; }
html.dark tr.tc-sub-green td.tc-desc-cell  { color: #86efac !important; }
html.dark tr.tc-sub-yellow td.tc-desc-cell { color: #fde047 !important; }
html.dark tr.tc-sub-purple td.tc-desc-cell { color: #c4b5fd !important; }
html.dark tr.tc-sub-blue td.tc-desc-cell   { color: #93c5fd !important; }
html.dark tr.tc-sub-red td.tc-desc-cell    { color: #fca5a5 !important; }

/* Tabel C dark mode — HTM/AFS breakdown rows */
html.dark tr.tc-grey-sec td  { background: #252a35 !important; color: #a0a8b8 !important; }
html.dark tr.tc-grey-data td { background: #1d2130 !important; }

/* Tabel C — Asumsi HTM & AFS control bar */
html.dark #tc-htmafs-bar { background: var(--surface) !important; border-top-color: var(--border) !important; }

/* Rekap dark mode — column headers */
html.dark .rekap-tbl thead tr { background: #1a3050 !important; }
html.dark .rekap-tbl thead th { background: #1a3050 !important; }
html.dark .rekap-tbl tbody tr.rk-section td { background: #1a3050 !important; }
/* Rekap dark mode — frozen column backgrounds */
html.dark .rekap-tbl tbody td.rk-no,
html.dark .rekap-tbl tbody td.rk-desc { background: var(--surface); }
html.dark .rekap-tbl tbody tr.rk-data:hover td.rk-no,
html.dark .rekap-tbl tbody tr.rk-data:hover td.rk-desc { background: var(--row-alt); }
html.dark .rekap-tbl tbody tr.rk-section td.rk-no,
html.dark .rekap-tbl tbody tr.rk-section td.rk-desc { background: #1a3050 !important; color: #fff !important; }
html.dark .rekap-tbl tbody tr.rk-group td.rk-no,
html.dark .rekap-tbl tbody tr.rk-group td.rk-desc { background: rgba(74,158,255,0.12); color: var(--text); }
html.dark .rekap-tbl tbody tr.rk-total td.rk-no,
html.dark .rekap-tbl tbody tr.rk-total td.rk-desc { background: rgba(74,158,255,0.08); }

/* Saved scenario dark mode */
html.dark .sk-saved-card { box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
html.dark .sk-saved-card.base-baseline { border-left-color: var(--brand); }
html.dark .sk-saved-card.base-potential { border-left-color: var(--pos); }
html.dark .sk-saved-card.base-tail { border-left-color: #e67e22; }

html.dark .sk-saved-hdr { background: var(--row-alt); }
html.dark .sk-saved-name { color: var(--brand); }
html.dark .sk-saved-base { background: rgba(74,158,255,0.15); color: var(--brand); border-color: rgba(74,158,255,0.25); }

html.dark .ss-del-btn { background: rgba(251,146,60,0.10); border-color: rgba(251,146,60,0.25); color: var(--neg); }
html.dark .ss-del-btn:hover { background: rgba(251,146,60,0.20); border-color: var(--neg); }

html.dark .ss-section-lbl { color: var(--text-muted); }

html.dark .ss-footer { background: var(--row-alt); }

html.dark .ss-export-btn { background: rgba(74,222,128,0.10); border-color: rgba(74,222,128,0.25); color: #6fcf97; }
html.dark .ss-export-btn:hover { background: #267a35; color: #fff; }
html.dark .ss-edit-btn { background: var(--surface); border-color: var(--brand); color: var(--brand); }
html.dark .ss-edit-btn:hover { background: var(--brand); color: #000; }
html.dark .sk-clear-btn { background: var(--surface); border-color: #e67e22; color: #e67e22; }
html.dark .sk-clear-btn:hover { background: #e67e22; color: #000; }

html.dark .ss-rules { border-bottom-color: var(--border); }
html.dark .ss-empty { color: var(--text-muted); border-bottom-color: var(--border); }
html.dark .ss-rule { border-bottom-color: var(--border); }
html.dark .ss-rule-evt { background: rgba(74,158,255,0.06); border-color: rgba(74,158,255,0.15); }

html.dark .ss-rule-field { color: var(--text); }
html.dark .ss-period { color: var(--text-muted); }
html.dark .ss-unit { color: var(--text-muted); }

html.dark .ss-type-tag { color: var(--text-muted); background: var(--row-alt); }
html.dark .ss-mode-tag.ss-add { background: rgba(74,222,128,0.15); color: #6fcf97; }
html.dark .ss-mode-tag.ss-set { background: rgba(251,191,36,0.15); color: #fbbf24; }
html.dark .ss-mode-tag.ss-evt { background: rgba(74,158,255,0.15); color: var(--brand); }

html.dark .ss-impact { background: rgba(74,158,255,0.06); color: var(--text-muted); }
html.dark .ss-impact-row { border-bottom-color: var(--border); }
html.dark .ss-impact-date { color: var(--text-muted); }
html.dark .ss-impact-metric strong { color: var(--text); }
html.dark .ss-impact-vs { color: var(--text-muted); }
html.dark .ss-delta-pos { color: #6fcf97; }
html.dark .no-data-saved { color: var(--text-muted); }

/* Skenario modified-column header */
.sk-hdr-mod { background: #1a5232 !important; color: #fff !important; border-color: #145c29 !important; }
html.dark .sk-hdr-mod { background: #14391f !important; color: #86efac !important; border-color: #1c5230 !important; }

/* Scenario chips — dark mode (light pastels → muted tints) */
html.dark .scen-chip.chip-base        { background: rgba(74,222,128,0.15);  color: #86efac; }
html.dark .scen-chip.chip-pot         { background: rgba(251,191,36,0.15);  color: #fbbf24; }
html.dark .scen-chip.chip-tail        { background: rgba(252,165,165,0.15); color: #fca5a5; }
html.dark .scen-chip.chip-custom      { background: rgba(196,181,253,0.15); color: #c4b5fd; }
html.dark .scen-chip.chip-fv-default  { background: rgba(74,158,255,0.15);  color: var(--brand); }
html.dark .scen-chip.chip-fv-custom   { background: rgba(196,181,253,0.15); color: #c4b5fd; }
html.dark .scen-chip.chip-fv-quarterly{ background: rgba(251,191,36,0.15);  color: #fbbf24; }
html.dark .scen-chip.chip-fv-monthly  { background: rgba(52,211,153,0.15);  color: #34d399; }
html.dark .scen-chip.chip-fv-daily    { background: rgba(129,140,248,0.15); color: #818cf8; }
html.dark .scen-chip.chip-fv-fib      { background: rgba(251,146,60,0.15);  color: #fb923c; }
html.dark .scen-chip.chip-fv-lepcd    { background: rgba(52,211,153,0.15);  color: #34d399; }
html.dark .scen-chip.chip-fv-monitor  { background: rgba(34,211,238,0.15);  color: #22d3ee; }

/* ─────────────────────────────────────────
   Animations
───────────────────────────────────────── */

/* Tab panel fade-in — fires automatically when display is set to block/flex */
#va, #vi, #vf, #vs, #v-si, #v-tc, #vsk, #vls,
#v-rekap, #v-track, #v-ovr, #v-scadev, #v-asumsi, #v-spcadev {
  animation: tabFadeIn 0.15s ease forwards;
}

/* Sidebar collapse transition (width already has .2s ease) */
#sb {
  transition: width .2s cubic-bezier(0.4,0,0.2,1), min-width .2s cubic-bezier(0.4,0,0.2,1);
}

/* Sidebar nav item — add border-left to transition */
.sb-item {
  transition: background .12s, color .12s, border-left-color .15s;
}

/* KPI cards — hover lift */
.ovr-kpi-card {
  transition: box-shadow 0.12s, background 0.12s, transform 0.12s;
}
.ovr-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

/* Scenario dropdown — fade + slide (replaces display:none toggle) */
#scen-dropdown {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
#scen-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Accessibility: respect user motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────
   Charts / Business Intelligence
───────────────────────────────────────── */
.charts-content {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
  position: relative;
}

.charts-empty {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  text-align: center;
}

.charts-empty-icon {
  font-size: 28px;
  color: var(--brand);
}

.charts-loading-state .charts-empty-icon {
  animation: chartsSpin 1.1s linear infinite;
}

@keyframes chartsSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.charts-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.charts-empty-sub {
  font-size: 12px;
}

/* ─────────────────────────────────────────
   Charts / FXMO Analytics from FXMon
───────────────────────────────────────── */
.charts-fxmo-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.charts-upload-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.charts-upload-card.compact { padding: 10px 14px; }
.charts-upload-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.charts-upload-sub,
.charts-schema-list {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
}
.charts-schema-list { margin-top: 6px; }
.charts-schema-list code,
.charts-upload-sub code {
  background: #f0f2f5;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
  font-family: 'IBM Plex Mono', monospace;
}
.charts-upload-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  min-width: 220px;
}
.charts-upload-actions input[type=file] {
  font-size: 11px;
  max-width: 220px;
}

.charts-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(6px, 0.7vw, 10px);
}
.charts-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: clamp(7px, 0.75vw, 10px) clamp(8px, 0.9vw, 12px);
  min-width: 0;
}
.charts-kpi-lbl {
  font-size: clamp(7.5px, 0.7vw, 9px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.charts-kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(11px, 1.2vw, 16px);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.charts-kpi-unit {
  font-size: clamp(8.5px, 0.8vw, 10px);
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
}
.charts-card,
.charts-audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  min-width: 0;
}
.charts-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a3050;
  margin-bottom: 3px;
}
.charts-card-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.charts-canvas-wrap {
  position: relative;
  height: 260px;
  min-height: 220px;
}
.charts-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.charts-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: normal;
}
.charts-audit-table th {
  text-align: left;
  background: #f0f2f5;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.charts-audit-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.charts-status-ok {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf7ee;
  color: #267a35;
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .charts-grid { grid-template-columns: 1fr; }
  .charts-upload-card { align-items: flex-start; flex-direction: column; }
  .charts-upload-actions { align-items: flex-start; }
}

/* FXMon loading progress */
.charts-progress-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  margin-top: 4px;
  text-align: center;
}
.up-card #fxmon-progress-msg,
.up-card #srbi-progress-msg {
  text-align: center;
}
.charts-progress-track {
  width: min(360px, 78%);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border-light);
  border: 1px solid var(--border);
  margin: 6px auto 4px;
}
.charts-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--brand);
  transition: width .15s ease;
}

/* SRBI Bid-to-Cover summary table card */
.srbi-btc-card {
  grid-column: span 1;
}
.srbi-btc-split {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.35fr);
  gap: 16px;
  align-items: stretch;
  min-height: 260px;
  margin-top: 10px;
}
.srbi-btc-table-wrap {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
  height: 260px;
  min-height: 220px;
}
.srbi-btc-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12px;
}
.srbi-btc-table th {
  position: sticky;
  top: 0;
  background: #f5f8fc;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.srbi-btc-table th:first-child { text-align: left; }
.srbi-btc-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}
.srbi-btc-table td:first-child {
  font-weight: 600;
  color: var(--text);
  background: #fbfcfe;
}
.srbi-btc-table tr:last-child td { border-bottom: none; }
.srbi-btc-chart-wrap {
  position: relative;
  min-height: 260px;
}
.srbi-btc-chart-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
@media (max-width: 1100px) {
  .srbi-btc-card { grid-column: span 1; }
  .srbi-btc-split { grid-template-columns: 1fr; }
  .srbi-btc-chart-wrap { min-height: 240px; }
  .srbi-btc-table-wrap { height: 240px; }
}

/* FXMO header dropdown + Change page */
.charts-head-menu {
  position: fixed;
  z-index: 8500;
  min-width: 140px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.charts-head-menu-item {
  display: block;
  width: 100%;
  border: none;
  border-radius: 5px;
  padding: 7px 10px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.charts-head-menu-item:hover { background: var(--bg); }
.charts-head-menu-item.on { background: var(--brand-light); color: var(--brand); }

.charts-change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
}
.charts-change-card { min-height: 460px; }
.charts-change-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}
.charts-change-controls .tgl-btn {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.charts-change-controls .tgl-btn.on {
  background: var(--brand-light);
  border-color: #cbe0f5;
}
.charts-change-dates {
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}
.charts-change-date {
  width: 132px;
  font-size: 11px;
  padding: 3px 6px;
}
.charts-change-period {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.charts-change-table-wrap {
  max-height: 350px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 7px;
}
.charts-change-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: normal;
}
.charts-change-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8fc;
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: right;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.charts-change-table th:first-child { text-align: left; }
.charts-change-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.charts-change-table td:first-child {
  max-width: 260px;
  white-space: normal;
  line-height: 1.35;
}
.charts-change-total td {
  background: var(--brand-light);
  color: #1a3050;
  font-weight: 700;
  border-top: 1px solid #cbe0f5;
}
.charts-change-empty {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .charts-change-grid { grid-template-columns: 1fr; }
}

/* FXMO Rollover Simulation */
.charts-rollover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
}
.charts-rollover-card { min-height: 355px; }
.charts-rollover-sim-card {
  grid-column: 1 / -1;
  min-height: 460px;
}
.charts-rollover-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #f7f9fc;
}
.charts-rollover-control {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.charts-rollover-control input,
.charts-rollover-control select { height: 26px; }
.charts-rollover-control em {
  position: absolute;
  margin-left: 76px;
  margin-top: 22px;
  font-size: 10px;
  font-style: normal;
  color: var(--text-muted);
  pointer-events: none;
}
.charts-rollover-rate {
  width: 92px;
  padding-right: 18px;
  text-align: right;
}
.charts-rollover-sim-wrap { height: 310px; }
@media (max-width: 980px) {
  .charts-rollover-grid { grid-template-columns: 1fr; }
}

/* FXMO Rollover Rate heatmap + summary */
.charts-rollover-heatmap-card {
  min-height: 355px;
}
.charts-rollover-summary {
  margin: 8px 0 8px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
  max-height: 118px;
}
.charts-rollover-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  white-space: nowrap;
}
.charts-rollover-summary-table th {
  position: sticky;
  top: 0;
  background: #f5f8fc;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.charts-rollover-summary-table th:first-child,
.charts-rollover-summary-table td:first-child {
  text-align: left;
}
.charts-rollover-summary-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
}
.charts-rollover-summary-table tr.total td {
  background: var(--brand-light);
  color: #1a3050;
  font-weight: 700;
}
.charts-rollover-heatmap-wrap {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.charts-rollover-heatmap-meta {
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
}
.charts-rollover-heatmap-scroll {
  height: 136px;
  overflow: auto;
}
.charts-rollover-heatmap {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 9.5px;
  white-space: nowrap;
}
.charts-rollover-heatmap th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f8fc;
  color: var(--text-muted);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.charts-rollover-heatmap th:first-child,
.charts-rollover-heatmap td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-weight: 700;
  min-width: 118px;
  text-shadow: none;
  border-right: 1px solid var(--border-light);
}
.charts-rollover-heatmap th:first-child {
  z-index: 4;
  background: #f5f8fc;
}
.charts-rollover-heatmap td {
  padding: 5px 6px;
  text-align: center;
  min-width: 44px;
  border-bottom: 1px solid rgba(255,255,255,.18);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0,0,0,.12);
}

.charts-rollover-full { grid-column: 1 / -1; }
.charts-rollover-summary-tall { max-height: 255px; min-height: 255px; }
.charts-rollover-heatmap-wrap-full { min-height: 235px; }
.charts-rollover-heatmap-scroll-full { height: 235px; }
.charts-rollover-gap-wrap { height: 260px; }
.charts-rollover-sim-meta { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.charts-rollover-meta-chip { padding:6px 10px; border:1px solid var(--border-light); border-radius:999px; background:#f8fafc; font-size:10px; color:var(--text-muted); }

.charts-rollover-monthly-card {
  min-height: 500px;
}
.charts-rollover-monthly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  align-items: end;
}
.charts-rollover-monthly-grid .charts-rollover-control {
  min-width: 0;
}
@media (max-width: 980px) {
  .charts-rollover-monthly-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

/* FXMO Change analytical expansion */
.charts-change-global-card { margin-bottom: 14px; min-height: auto; }
.charts-change-controls-global { justify-content: flex-end; margin: 0; }
.charts-change-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(6px, 0.7vw, 10px);
  margin-bottom: 14px;
}
.charts-change-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: clamp(7px, 0.75vw, 10px) clamp(8px, 0.9vw, 12px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
  min-width: 0;
}
.charts-change-kpi-lbl {
  font-size: clamp(7.5px, 0.7vw, 9px);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.charts-change-kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(11px, 1.2vw, 16px);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.charts-change-kpi-sub {
  margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(8.5px, 0.8vw, 10px);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.charts-change-narrative {
  margin-bottom: 14px;
  min-height: auto;
}
.charts-change-chart-card { min-height: 360px; }
.charts-change-waterfall-wrap { height: 265px; }
.charts-change-wide { grid-column: 1 / -1; min-height: 360px; }
.charts-change-decomp-wrap { max-height: 290px; }
.charts-change-drilldown-card { min-height: 520px; }
.charts-change-drilldown-wrap { height: 280px; margin-bottom: 10px; }
.charts-change-table tbody tr[onclick] { cursor: pointer; }
.charts-change-table tbody tr[onclick]:hover td { background: #f0f7ff; }
.charts-change-table .pos, .charts-change-kpi-val.pos { color: var(--pos) !important; }
.charts-change-table .neg, .charts-change-kpi-val.neg { color: var(--neg) !important; }

.charts-change-combo-section + .charts-change-combo-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.charts-change-ins-tabs {
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
}
.charts-change-ins-tabs .tgl-btn {
  padding: 5px 22px;
  font-size: 12px;
  font-weight: 600;
}

.sig-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.sig-bar {
  display: inline-flex;
  gap: 2px;
}
.sig-seg {
  display: inline-block;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: var(--border);
}
.sig-seg.sig-gain-strong { background: var(--pos); }
.sig-seg.sig-gain        { background: rgba(22,163,74,0.45); }
.sig-seg.sig-loss-strong { background: var(--neg); }
.sig-seg.sig-loss        { background: rgba(180,83,9,0.45); }
.sig-seg.sig-none        { background: var(--border); }
.sig-label {
  font-size: 10.5px;
  font-weight: 600;
}
.sig-label.sig-label-pos { color: var(--pos); }
.sig-label.sig-label-neg { color: var(--neg); }
.sig-label.sig-label-mix { color: var(--text-muted); }

@media (max-width: 760px) {
  .charts-change-controls-global { justify-content: flex-start; }
}

/* ─────────────────────────────────────────
   Business Intelligence — dark mode
───────────────────────────────────────── */

/* Card titles + sub */
html.dark .charts-card-title { color: var(--text); }
html.dark .charts-card-sub   { color: var(--text-muted); }

/* FXMo Change tables */
html.dark .charts-change-table th {
  background: var(--row-alt);
  color: var(--text-muted);
  border-bottom-color: var(--border);
}
html.dark .charts-change-table td {
  border-bottom-color: var(--border);
  color: var(--text);
}
html.dark .charts-change-table tbody tr[onclick]:hover td {
  background: rgba(74,158,255,0.18) !important;
  color: var(--text) !important;
}
html.dark .charts-change-total td {
  background: var(--brand-light);
  color: var(--text);
}

/* FXMo Change KPI strip + Summary text */
html.dark .charts-change-kpi { background: var(--surface); border-color: var(--border); }
html.dark .charts-change-kpi-lbl { color: var(--text-muted); }
html.dark .charts-change-kpi-val { color: var(--text); }
html.dark .charts-change-kpi-sub { color: var(--text-muted); }
html.dark .charts-change-narrative .charts-card-sub { color: var(--text); }
html.dark .charts-change-empty { color: var(--text-muted); }

/* Persistent Movers signal cell */
html.dark .sig-seg.sig-none { background: var(--border); }
html.dark .sig-label.sig-label-mix { color: var(--text-muted); }

/* FXMo Rollover — summary tables, sim card, heatmap */
html.dark .charts-rollover-summary,
html.dark .charts-rollover-heatmap-wrap {
  background: var(--surface);
  border-color: var(--border);
}
html.dark .charts-rollover-summary-table th {
  background: var(--row-alt);
  color: var(--text-muted);
}
html.dark .charts-rollover-summary-table td {
  color: var(--text);
  border-color: var(--border);
}
html.dark .charts-rollover-summary-table tr.total td {
  background: var(--brand-light);
  color: var(--text);
}
html.dark .charts-rollover-controls {
  background: var(--row-alt);
  border-color: var(--border-light);
}
html.dark .charts-rollover-control { color: var(--text-muted); }
html.dark .charts-rollover-control input,
html.dark .charts-rollover-control select,
html.dark .charts-rollover-rate {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html.dark .charts-rollover-heatmap-meta { background: var(--row-alt); color: var(--text-muted); }
html.dark .charts-rollover-heatmap th,
html.dark .charts-rollover-heatmap th:first-child {
  background: var(--row-alt) !important;
  color: var(--text-muted);
}
html.dark .charts-rollover-heatmap td:first-child {
  background: var(--surface) !important;
  color: var(--text);
}
html.dark .charts-rollover-heatmap td { color: var(--text); border-color: var(--border); }

/* SRBI Bid-to-Cover table */
html.dark .srbi-btc-card { background: var(--surface); border-color: var(--border); }
html.dark .srbi-btc-table-wrap {
  background: var(--surface);
  border-color: var(--border);
}
html.dark .srbi-btc-table th {
  background: var(--row-alt);
  color: var(--text-muted);
}
html.dark .srbi-btc-table td { color: var(--text); border-color: var(--border); }
html.dark .srbi-btc-table td:first-child {
  background: var(--surface) !important;
  color: var(--text);
}

/* Rollover meta-chip pills (Monthly Rollover Assumption sim card bottom) */
html.dark .charts-rollover-meta-chip {
  background: var(--row-alt);
  border-color: var(--border-light);
  color: var(--text-muted);
}

/* Rollover Rate Heatmap — dim the inline hsl tints in dark mode so they're not glaring */
html.dark .charts-rollover-heatmap td:not(:first-child) {
  filter: brightness(0.55) saturate(1.25);
}

/* Code chips, audit, progress track */
html.dark .charts-schema-list code,
html.dark .charts-upload-sub code { background: var(--border); color: var(--text); }
html.dark .charts-progress-track { background: var(--border); border-color: var(--border-light); }
html.dark .charts-audit-card { background: var(--surface); border-color: var(--border); }
html.dark .charts-audit-table th { background: var(--row-alt); color: var(--text-muted); }
html.dark .charts-audit-table td { color: var(--text); border-color: var(--border); }

/* ─────────────────────────────────────────
   Liquidity Buffer
───────────────────────────────────────── */
.lb-content {
  flex: 1;
  overflow: hidden;
  padding: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.lb-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.lb-upload-card,
.lb-controls-card,
.lb-card,
.lb-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.lb-upload-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}
.lb-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.lb-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.lb-upload-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.lb-upload-actions input[type=file] {
  font-size: 11px;
  max-width: 220px;
}
.lb-controls-card {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
}
.lb-control {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.lb-control input,
.lb-control select { height: 28px; }
.lb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}
.lb-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
}
.lb-kpi-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
}
.lb-kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-card {
  padding: 12px;
  overflow: hidden;
}
.lb-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.lb-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.lb-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}
.lb-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fff;
  max-height: 520px;
}
.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
  white-space: nowrap;
}
.lb-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--navy);
  color: rgba(255,255,255,.92);
  padding: 5px 7px;
  text-align: right;
  font-size: 9px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.lb-table th:first-child,
.lb-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  text-align: left;
  background: #fff;
  font-weight: 700;
  border-right: 1px solid var(--border-light);
}
.lb-table th:first-child {
  z-index: 4;
  background: var(--navy);
}
.lb-table td {
  padding: 4px 7px;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
}
.lb-table tr.cash-row td {
  background: var(--brand-light) !important;
  font-weight: 700;
}
.lb-table td.strong { font-weight: 700; color: #1a3050; }
.lb-table td.tier3 { font-weight: 700; color: var(--brand); }
.lb-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px;
}
.lb-chart-wrap {
  height: 300px;
  margin-top: 8px;
}
.lb-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.lb-empty-icon {
  font-size: 32px;
  margin-bottom: 10px;
  color: var(--brand);
}
.lb-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.lb-empty-sub {
  font-size: 12px;
  color: var(--text-muted);
}
@media (max-width: 1100px) {
  .lb-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .lb-chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .lb-upload-card { flex-direction: column; align-items: stretch; }
  .lb-upload-actions { justify-content: flex-start; }
  .lb-kpi-grid { grid-template-columns: 1fr; }
}

/* Liquidity Buffer toolbar inline controls */
.lb-tb-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.lb-tb-control input,
.lb-tb-control select { height: 24px; font-size: 11px; }

/* Liquidity Buffer split layout */
.lb-split-layout {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.lb-split-left {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lb-split-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lb-split-right .lb-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lb-cumulative-card .lb-chart-wrap { flex: 1; min-height: 0; }
.lb-detail-card { overflow: auto; }
.lb-split-left .lb-table-card { flex: 1; display: flex; flex-direction: column; padding: 12px 12px 0 12px; overflow: hidden; }
.lb-split-left .lb-table-wrap { flex: 1; overflow: auto; margin: 0; min-height: 0; max-height: none; background: transparent; }
.lb-profile-table { margin-bottom: 0; }
.lb-detail-card { overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lb-detail-table-wrap { flex: 1 !important; overflow: auto; min-height: 0; height: auto !important; max-height: none !important; }
.lb-detail-card.hidden { display: none; }
@media (max-width: 1100px) {
  .lb-split-layout { flex-direction: column; }
}

/* Liquidity Buffer cash card */
.lb-cash-card { flex-shrink: 0; margin-bottom: 8px; }
.lb-cash-card .lb-detail-table { font-size: 11px; }

/* Liquidity Buffer compact KPI grid */
.lb-page .lb-kpi-grid {
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.lb-page .lb-kpi { padding: 6px 8px; }
.lb-page .lb-kpi-lbl { font-size: 9px; }
.lb-page .lb-kpi-val { font-size: 15px; }
@media (max-width: 1100px) {
  .lb-page .lb-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
  .lb-page .lb-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Liquidity Buffer clickable maturity details */
.lb-cell-btn {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  min-width: 100%;
  text-align: right;
}
.lb-cell-btn:hover,
.lb-cell-btn.selected {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
}
.lb-detail-card {
  min-height: 330px;
}
.lb-detail-head {
  margin-bottom: 8px;
}
.lb-detail-empty {
  height: 250px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  padding: 20px;
}
.lb-detail-kpis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.lb-detail-kpis span {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #f8fafc;
  padding: 5px 10px;
  font-size: 10px;
  color: var(--text-muted);
}
.lb-detail-kpis strong {
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 9px;
}
.lb-detail-table-wrap {
  height: 220px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fff;
}
.lb-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  white-space: nowrap;
}
.lb-detail-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f8fc;
  color: var(--text-muted);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.lb-detail-table th:nth-child(5),
.lb-detail-table td:nth-child(5) { text-align: right; }
.lb-detail-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.lb-detail-table tbody tr:hover td {
  background: #f8fbff;
}
.lb-detail-empty-row {
  text-align: center !important;
  color: var(--text-muted) !important;
  padding: 28px 8px !important;
}
.lb-detail-note {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* Liquidity Buffer dashboard-side row cleanup */
.lb-deleted-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff7ed;
  color: var(--neg);
  border: 1px solid #fed7aa;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lb-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.lb-row-action {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.lb-row-action.danger {
  color: var(--neg);
  border-color: #f5c6c6;
  background: #fff7ed;
}
.lb-row-action.danger:hover {
  background: #fee2e2;
  border-color: var(--neg);
}
.lb-row-action.restore {
  color: var(--pos);
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.lb-row-action.restore:hover {
  background: #dcfce7;
  border-color: var(--pos);
}
.lb-deleted-panel {
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.lb-deleted-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.lb-deleted-table-wrap {
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fff;
}
.lb-detail-table th:last-child,
.lb-detail-table td:last-child {
  text-align: center;
}

/* Liquidity Buffer validation / export additions */
.lb-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.lb-validation-card {
  padding: 12px;
}
.lb-validation-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.lb-validation-kpi {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}
.lb-validation-kpi.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.lb-validation-kpi.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}
.lb-validation-kpi.info {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.lb-validation-table-wrap {
  max-height: 185px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 1100px) {
  .lb-validation-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .lb-validation-grid { grid-template-columns: 1fr; }
  .lb-card-actions { justify-content: flex-start; }
}

.lb-cash-editor { margin: 10px 0 12px; border: 1px solid var(--border-light); border-radius: 8px; background: #fff; overflow: hidden; }
.lb-cash-override-input { width: 145px; text-align: right; font-family: 'IBM Plex Mono', monospace; }
.lb-table td:last-child { background: #f8fafc; }
.lb-table th:last-child { background: var(--navy); color: rgba(255,255,255,.92); }
.lb-table td.lb-nonusd-cell { color: #475569; }

/* ─────────────────────────────────────────
   Liquidity Buffer — dark mode
───────────────────────────────────────── */

/* Main maturity table */
html.dark .lb-table-wrap { background: var(--surface); border-color: var(--border); }
html.dark .lb-table td { color: var(--text); border-color: var(--border); }
html.dark .lb-table td:first-child {
  background: var(--surface) !important;
  color: var(--text);
  border-color: var(--border);
}
html.dark .lb-table td:last-child { background: var(--row-alt) !important; }
html.dark .lb-table td.strong { color: var(--text); }
html.dark .lb-table td.lb-nonusd-cell { color: var(--text-muted); }
html.dark .lb-table tr.cash-row td { background: rgba(74,158,255,0.18) !important; color: var(--text); }
html.dark .lb-cell-btn:hover,
html.dark .lb-cell-btn.selected { background: rgba(74,158,255,0.20); color: var(--brand); }

/* Detail (clicked maturity drilldown) table */
html.dark .lb-detail-table-wrap { background: var(--surface); border-color: var(--border); }
html.dark .lb-detail-table th { background: var(--row-alt); color: var(--text-muted); border-color: var(--border); }
html.dark .lb-detail-table td { color: var(--text); border-color: var(--border); }
html.dark .lb-detail-table tbody tr:hover td {
  background: rgba(74,158,255,0.18) !important;
  color: var(--text);
}
html.dark .lb-detail-empty { background: var(--row-alt); border-color: var(--border); color: var(--text-muted); }
html.dark .lb-detail-kpis span { background: var(--row-alt); border-color: var(--border-light); color: var(--text-muted); }
html.dark .lb-detail-kpis strong { color: var(--text); }

/* Cash editor + deleted panel + row actions */
html.dark .lb-cash-editor { background: var(--surface); border-color: var(--border); }
html.dark .lb-deleted-table-wrap { background: var(--surface); border-color: var(--border); }
html.dark .lb-deleted-pill {
  background: rgba(251,146,60,0.15);
  color: var(--neg);
  border-color: rgba(251,146,60,0.40);
}
html.dark .lb-row-action { background: var(--surface); border-color: var(--border); color: var(--text); }
html.dark .lb-row-action.danger {
  background: rgba(251,146,60,0.10);
  border-color: rgba(251,146,60,0.40);
  color: var(--neg);
}
html.dark .lb-row-action.danger:hover {
  background: rgba(251,146,60,0.22);
  border-color: var(--neg);
}
html.dark .lb-row-action.restore {
  background: rgba(74,222,128,0.10);
  border-color: rgba(74,222,128,0.35);
  color: var(--pos);
}
html.dark .lb-row-action.restore:hover {
  background: rgba(74,222,128,0.22);
  border-color: var(--pos);
}

/* Validation card */
html.dark .lb-validation-kpi { background: var(--row-alt); border-color: var(--border-light); color: var(--text); }
html.dark .lb-validation-kpi.ok {
  background: rgba(74,222,128,0.10);
  border-color: rgba(74,222,128,0.35);
}
html.dark .lb-validation-kpi.warn {
  background: rgba(251,146,60,0.10);
  border-color: rgba(251,146,60,0.40);
}
html.dark .lb-validation-kpi.info {
  background: rgba(74,158,255,0.10);
  border-color: rgba(74,158,255,0.35);
}
html.dark .lb-validation-table-wrap { background: var(--surface); border-color: var(--border); }

/* Track Changes */
.track-rd-chip {
  display:inline-flex;
  align-items:center;
  height:24px;
  padding:0 8px;
  border-radius:6px;
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text);
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.track-wrap { height:100%; min-height:0; padding:0; }
.track-wrap .rekap-scroll { overflow:auto; height:100%; max-width:100%; }

/* Drag-to-resize handle between chart and table */
.chart-resizer {
  height: 6px;
  cursor: row-resize;
  flex-shrink: 0;
  background: var(--border);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s;
}
.chart-resizer:hover,
.chart-resizer.dragging { background: var(--brand-light); }
.chart-resizer::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-muted);
  opacity: 0.55;
}
.chart-resizer:hover::after,
.chart-resizer.dragging::after { background: var(--brand); opacity: 0.7; }

/* Track Changes uses a 3-layer sticky header. The explicit row heights
   keep rowspan headers aligned and prevent body rows from showing through. */
.track-tbl {
  --track-h1:36px;
  --track-h2:26px;
  --track-h3:26px;
  --track-left-no:44px;
  --track-left-desc:240px;
}
.track-tbl thead th {
  box-sizing:border-box;
  background:#1a3050 !important;
  color:#fff;
  z-index:24;
  background-clip:padding-box;
  vertical-align:middle;
  border-right:1px solid rgba(255,255,255,.18);
  border-bottom:1px solid rgba(255,255,255,.18);
}
.track-tbl thead tr:nth-child(1) th {
  top:0;
  height:var(--track-h1);
  min-height:var(--track-h1);
  padding:2px 10px;
  z-index:26;
}
.track-tbl thead tr:nth-child(2) th {
  top:var(--track-h1);
  height:var(--track-h2);
  min-height:var(--track-h2);
  padding:2px 8px;
  z-index:25;
}
.track-tbl thead tr:nth-child(3) th {
  top:calc(var(--track-h1) + var(--track-h2));
  height:var(--track-h3);
  min-height:var(--track-h3);
  padding:2px 6px;
  z-index:24;
  box-shadow:0 2px 0 rgba(26,48,80,.95), 0 4px 8px rgba(15,23,42,.16);
}
.track-tbl thead th[rowspan="3"] {
  top:0;
  height:calc(var(--track-h1) + var(--track-h2) + var(--track-h3));
  min-height:calc(var(--track-h1) + var(--track-h2) + var(--track-h3));
  z-index:35;
}
.track-tbl thead th[rowspan="2"] {
  top:0;
  height:calc(var(--track-h1) + var(--track-h2));
  min-height:calc(var(--track-h1) + var(--track-h2));
  z-index:27;
}
.track-tbl th.track-side-head {
  text-align:center;
  font-size:11px;
  font-weight:800;
}
.track-tbl th.track-side-top,
.track-tbl th.track-side-mid {
  border-bottom-color:transparent;
  box-shadow:none;
}
.track-tbl th.track-side-mid,
.track-tbl th.track-side-bottom {
  border-top-color:transparent;
}
.track-tbl th.track-side-top { padding:0 10px !important; }
.track-tbl th.track-side-mid { padding:4px 10px !important; }
.track-tbl th.track-side-bottom {
  padding:0 10px !important;
  box-shadow:0 2px 0 rgba(26,48,80,.95), 0 4px 8px rgba(15,23,42,.16);
}
.track-tbl th.track-col-head { text-align:center; min-width:260px; }
.track-tbl th.track-real-head { min-width:780px; }
.track-tbl th.track-period-head { text-align:center; font-size:10px; }
.track-tbl th.track-sub-head { text-align:center; font-size:10px; min-width:88px; }
.track-tbl th.track-current-head { background:#1d4ed8 !important; color:#fff; border-left:2px solid rgba(255,255,255,0.45) !important; }
.track-tbl th.track-reference-head { background:#475569 !important; color:#fff; }
.track-tbl th.track-change-head { background:#92400e !important; color:#fff; }
.track-tbl th.track-period-sep { border-left:2px solid rgba(255,255,255,0.45) !important; }
.track-tbl th.track-col-head:not(.track-real-head) { border-left:2px solid rgba(255,255,255,0.45) !important; }
.track-tbl td.track-change-val { font-weight:700; }
.track-tbl td.rk-pos { color:#15803d; }
.track-tbl td.track-cur-cell { background:rgba(29,78,216,0.04); border-left:2px solid rgba(26,48,80,0.18) !important; }
.track-tbl td.track-ref-cell { background:rgba(71,85,105,0.06); }
.track-tbl td.track-dlt-cell { background:rgba(146,64,14,0.06); }
.track-period-title { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; line-height:1.15; min-height:100%; }
.track-period-title span { opacity:.72; font-weight:500; font-size:10px; }
.track-real-title { display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap; line-height:1.15; min-height:100%; }
.track-real-title span { opacity:.86; font-weight:700; }
.track-real-title strong { font-size:11px; font-weight:800; }
.track-tbl th.rk-no,
.track-tbl td.rk-no {
  position:sticky;
  left:0;
  min-width:var(--track-left-no);
  width:var(--track-left-no);
  box-sizing:border-box;
  z-index:6;
}
.track-tbl th.rk-desc,
.track-tbl td.rk-desc {
  position:sticky;
  left:var(--track-left-no);
  min-width:var(--track-left-desc);
  width:var(--track-left-desc);
  box-sizing:border-box;
  z-index:6;
}
.track-tbl thead th.rk-no,
.track-tbl thead th.rk-desc {
  z-index:40 !important;
  background:#1a3050 !important;
}
.track-tbl tbody td.rk-no,
.track-tbl tbody td.rk-desc { background:#fff; }
.track-tbl tbody tr.rk-data:hover td.rk-no,
.track-tbl tbody tr.rk-data:hover td.rk-desc { background:#f0f6ff; }
.track-tbl tbody tr.rk-section td.rk-no,
.track-tbl tbody tr.rk-section td.rk-desc { background:#1a3050 !important; color:#fff !important; }
.track-tbl tbody tr.rk-group td.rk-no,
.track-tbl tbody tr.rk-group td.rk-desc { background:#dce6f4; color:#1a3050; }
.track-tbl tbody tr.rk-total td.rk-no,
.track-tbl tbody tr.rk-total td.rk-desc { background:#eef3fa; }
html.dark .track-tbl td.track-cur-cell { background:rgba(99,130,255,0.07); }
html.dark .track-tbl td.track-ref-cell { background:rgba(100,116,139,0.09); }
html.dark .track-tbl td.track-dlt-cell { background:rgba(180,110,30,0.08); }
html.dark .track-rd-chip { background:var(--surface-2); border-color:var(--border); color:var(--text); }
html.dark .track-tbl thead th { background:#1a3050 !important; }
html.dark .track-tbl th.track-current-head { background:#1e40af !important; }
html.dark .track-tbl th.track-reference-head { background:#334155 !important; }
html.dark .track-tbl th.track-change-head { background:#78350f !important; }
html.dark .track-tbl td.rk-pos { color:#86efac; }
html.dark .track-tbl tbody td.rk-no,
html.dark .track-tbl tbody td.rk-desc { background:var(--surface); }
html.dark .track-tbl tbody tr.rk-data:hover td.rk-no,
html.dark .track-tbl tbody tr.rk-data:hover td.rk-desc { background:var(--row-alt); }
html.dark .track-tbl tbody tr.rk-section td.rk-no,
html.dark .track-tbl tbody tr.rk-section td.rk-desc { background:#1a3050 !important; color:#fff !important; }
html.dark .track-tbl tbody tr.rk-group td.rk-no,
html.dark .track-tbl tbody tr.rk-group td.rk-desc { background:rgba(74,158,255,0.12); color:var(--text); }
html.dark .track-tbl tbody tr.rk-total td.rk-no,
html.dark .track-tbl tbody tr.rk-total td.rk-desc { background:rgba(74,158,255,0.08); }

/* ── Portrait bottom navigation (section approach) ─────────────────────────
   Applies on any device where height > width AND width ≤ 1024px.
   Bottom bar shows 4 section buttons; tapping a section reveals a tray of
   items above it. Landscape and desktop keep the left sidebar unchanged.
   ─────────────────────────────────────────────────────────────────────── */

/* Hidden by default on all viewport sizes; portrait query reveals it */
#sb-bottom { display: none; }

@media (orientation: portrait) and (max-width: 1024px) {
  /* Bar height token — 10% of viewport height, clamped 62–88px */
  :root { --sbb-h: clamp(78px, 13vh, 104px); }

  /* Stack layout vertically */
  #app { flex-direction: column; }
  #main { order: 1; padding-bottom: var(--sbb-h); }

  /* Hide left sidebar in portrait */
  #sb { display: none; }

  /* Bottom nav container — fixed to viewport bottom */
  #sb-bottom {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--navy);
    border-top: 1px solid rgba(255,255,255,0.10);
  }

  /* Item tray — hidden until a section is tapped */
  #sbb-tray {
    display: none;
    flex-direction: row;
    overflow-x: auto;
    padding: 6px 6px 4px;
    gap: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    scrollbar-width: none;
  }
  #sbb-tray::-webkit-scrollbar { display: none; }
  #sbb-tray.open { display: flex; }

  /* Bottom bar row */
  .sbb-bar {
    display: flex;
    flex-direction: row;
    height: var(--sbb-h);
    flex-shrink: 0;
  }

  /* Logo slot — center */
  .sbb-logo {
    width: 54px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .sbb-logo-icon {
    width: 50px;
    height: 50px;
    display: block;
    border-radius: 6px;
    opacity: 0.82;
  }

  /* Section button */
  .sbb-sec {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: rgba(255,255,255,0.50);
    border-top: 2.5px solid transparent;
    padding: 4px 2px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .12s, background .12s;
  }
  .sbb-sec:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.88); }
  .sbb-sec.on {
    color: #fff;
    border-top-color: var(--accent, #0ea5e9);
    background: rgba(14,165,233,0.12);
  }
  .sbb-sec-icon {
    font-size: 28px;
    line-height: 1;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
  }
  .sbb-sec-lbl {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  /* Tray items */
  .sbb-tray-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 6px 10px;
    gap: 4px;
    cursor: pointer;
    color: rgba(255,255,255,0.60);
    border-radius: 6px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background .10s, color .10s;
  }
  .sbb-tray-item:hover, .sbb-tray-item:active {
    background: rgba(255,255,255,0.10);
    color: #fff;
  }
  .sbb-tray-item.on {
    color: var(--accent, #0ea5e9);
    background: rgba(14,165,233,0.18);
  }
  .sbb-tray-icon {
    font-size: 24px;
    line-height: 1;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
  }
  .sbb-tray-lbl {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
  }
}

