/* Bank Muscat Micro AI — Shared Shell
   TSG Studio Suite design system
   Charcoal #2B2B2B · Orange #E8640A
*/

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Barlow:wght@400;500;600;700&family=Barlow+Semi+Condensed:wght@400;500;600&display=swap');

:root {
  /* Palette */
  --charcoal: #2B2B2B;
  --orange: #E8640A;
  --orange-soft: #FFE5D1;
  --orange-dim: #B04D08;
  --positive: #1F7A4C;
  --caution: #C8606D;
  --negative: #B03028;

  /* Supporting data palette (5 muted tones) */
  --d1: #3B5BA5;
  --d2: #7A5C3F;
  --d3: #4E6B5A;
  --d4: #8A6B9A;
  --d5: #B48D5E;

  /* Light theme (default) */
  --bg: #F7F4EF;
  --bg-elev: #FFFFFF;
  --bg-elev-2: #FBF8F3;
  --surface: #FFFFFF;
  --surface-alt: #F0ECE4;
  --border: #E6E0D4;
  --border-strong: #CCC3B2;
  --text: #1C1C1C;
  --text-dim: #5C5A54;
  --text-faint: #8A857B;
  --sidebar: #FFFFFF;
  --sidebar-text: #2B2B2B;
  --topbar: #FFFFFF;
  --chip: #F0ECE4;
  --focus: #E8640A;

  /* Fonts */
  --f-display: 'Sora', ui-sans-serif, system-ui, sans-serif;
  --f-text: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --f-num: 'Barlow', 'Barlow Semi Condensed', ui-sans-serif, system-ui, sans-serif;

  /* Spacing / radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.03);
  --shadow-md: 0 2px 8px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.03);
}

[data-theme="dark"] {
  --bg: #141414;
  --bg-elev: #1C1C1C;
  --bg-elev-2: #202020;
  --surface: #1E1E1E;
  --surface-alt: #262626;
  --border: #2E2E2E;
  --border-strong: #3A3A3A;
  --text: #F0ECE4;
  --text-dim: #B5B0A6;
  --text-faint: #7D7A72;
  --sidebar: #1E1E1E;
  --sidebar-text: #F0ECE4;
  --topbar: #1C1C1C;
  --chip: #2A2A2A;
  /* Dark-mode-friendly orange tint: translucent so highlighted rows and
     alert boxes keep text legible when the normal text colour (cream) sits on them. */
  --orange-soft: rgba(232, 100, 10, 0.16);
  /* In dark mode, use the standard orange for text that was previously var(--orange-dim) (burnt-dark).
     --orange-dim stays usable as a 'pressed' button background. */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
  --shadow-md: 0 2px 10px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.2);
}

/* Alert / interface-note boxes inline-styled with var(--orange-dim) text:
   the burnt-dark orange is unreadable on dark backgrounds — force to standard orange. */
[data-theme="dark"] [style*="color:var(--orange-dim)"],
[data-theme="dark"] [style*="color: var(--orange-dim)"] {
  color: var(--orange) !important;
}

/* Highlighted table rows that are inline-styled with background:var(--orange-soft).
   These are "pinned" / "current selection" rows (e.g. Bank Muscat row in the
   competitor table) — they must stay stable regardless of hover. */
tr[style*="orange-soft"] td {
  /* Cells inherit the row background cleanly — no cell background of their own */
  background: transparent !important;
  color: var(--text) !important;
  cursor: default;
}
tr[style*="orange-soft"]:hover td {
  background: transparent !important;
}
tr[style*="orange-soft"]:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--orange) !important;
}
tr[style*="orange-soft"] td:first-child {
  box-shadow: inset 3px 0 0 var(--orange);
}
[dir="rtl"] tr[style*="orange-soft"] td:first-child,
[dir="rtl"] tr[style*="orange-soft"]:hover td:first-child {
  box-shadow: inset -3px 0 0 var(--orange) !important;
}
tr[style*="orange-soft"] td strong {
  color: var(--text);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'tnum', 'ss01';
}

[dir="rtl"] body { font-family: var(--f-text); }

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: var(--f-text);
  cursor: pointer;
}

/* ============== APP SHELL ============== */
.app {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100vh;
  overflow: hidden;
}

[dir="rtl"] .app {
  grid-template-columns: 1fr 268px;
}

/* ============== SIDEBAR ============== */
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }

.sidebar-brand {
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  position: relative;
  flex: 0 0 34px;
}
.sidebar-brand .logo::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--charcoal);
  opacity: .95;
}
[data-theme="dark"] .sidebar-brand .logo::after { background: #141414; }

.sidebar-brand .name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
}
.sidebar-brand .sub {
  font-size: 10.5px;
  letter-spacing: .09em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-user {
  margin: 14px 14px 8px;
  padding: 12px 12px;
  background: var(--surface-alt);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--chip);
  color: var(--text);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 11px;
  font-family: var(--f-display);
}
.sidebar-user .meta .label { font-size: 10px; color: var(--text-faint); letter-spacing: .07em; text-transform: uppercase; }
.sidebar-user .meta .who { font-weight: 500; font-size: 13px; }
.sidebar-user .meta .role { font-size: 11px; color: var(--text-dim); }

.sidebar-section {
  padding: 14px 20px 6px;
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.sidebar-nav { padding: 0 10px; }
.sidebar-nav a, .sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  width: 100%;
  color: var(--sidebar-text);
  border: none;
  background: transparent;
  text-align: left;
  border-radius: var(--r-md);
  font-size: 13.5px;
  margin-bottom: 1px;
  cursor: pointer;
  font-family: var(--f-text);
}
.sidebar-nav a:hover, .sidebar-nav button:hover {
  background: var(--surface-alt);
  text-decoration: none;
}
.sidebar-nav .active {
  background: var(--orange-soft);
  color: var(--orange-dim);
  font-weight: 500;
}
[data-theme="dark"] .sidebar-nav .active {
  background: rgba(232,100,10,.12);
  color: var(--orange);
}
.sidebar-nav .icon {
  width: 16px; height: 16px;
  flex: 0 0 16px;
}
.sidebar-nav .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
}
[dir="rtl"] .sidebar-nav .count { margin-left: 0; margin-right: auto; }

.sidebar-status {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-status .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12.5px;
}
.sidebar-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-right: 8px;
  display: inline-block;
}
.sidebar-status .ok { background: var(--positive); }
.sidebar-status .warn { background: #D08A2A; }
.sidebar-status .err { background: var(--orange); }
.sidebar-status .pill { color: var(--text-dim); font-size: 11px; font-family: var(--f-num); }

/* ============== MAIN ============== */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  min-height: 64px;
}
.topbar .title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar .title .name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
}
.topbar .title .sub {
  font-size: 10.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.topbar .chip-live {
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  padding: 6px 12px 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.topbar .chip-live .plus {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--chip);
  display: grid; place-items: center;
  font-size: 10px;
}
.topbar .chip-live .live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 3px rgba(31,122,76,.18);
}
.topbar .chip-live .live-text { color: var(--positive); font-weight: 500; }

.topbar .spacer { flex: 1; }

.topbar .cluster {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.pill-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: var(--f-text);
}
.pill-btn:hover { border-color: var(--border-strong); }
.pill-btn.active { background: var(--chip); }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
}

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px;
  font-family: var(--f-display);
  font-weight: 600;
}

.topbar .user-meta {
  text-align: right;
  font-size: 11.5px;
}
.topbar .user-meta .who { font-weight: 600; }
.topbar .user-meta .role { font-size: 10.5px; color: var(--text-dim); }

/* ============== CONTENT ============== */
.content {
  padding: 20px 24px 40px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
}

/* ============== WALKTHROUGH ============== */
.walkthrough {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.walkthrough .label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: .11em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.walkthrough .steps {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}
.walk-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 6px 12px 6px 7px;
  background: var(--surface-alt);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: var(--f-text);
}
.walk-step:hover { border-color: var(--border); }
.walk-step .num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text-dim);
  display: grid; place-items: center;
  font-size: 10.5px;
  font-family: var(--f-num);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.walk-step.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.walk-step.active .num { background: #fff; color: var(--orange); }
.walkthrough .reset {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* ============== HEADLINE ============== */
.eyebrow {
  color: var(--orange);
  font-size: 11px;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
h1.headline {
  font-family: var(--f-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.1;
  margin: 0 0 8px;
}
.subhead {
  color: var(--text-dim);
  font-size: 14px;
  max-width: 60ch;
}

.hdr-row {
  display: flex;
  align-items: start;
  gap: 20px;
  margin-bottom: 28px;
}
.hdr-row .actions {
  margin-left: auto;
  display: inline-flex;
  gap: 8px;
}
[dir="rtl"] .hdr-row .actions { margin-left: 0; margin-right: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--f-text);
  font-weight: 500;
}
.btn:hover { border-color: var(--border-strong); }
.btn.primary {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.btn.primary:hover { background: var(--orange-dim); border-color: var(--orange-dim); }
.btn.ghost { background: transparent; }

/* ============== KPI CARDS ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
}
.kpi .label {
  font-size: 11px;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--d1);
}
.kpi.k-approved .label { color: var(--orange); }
.kpi.k-raised .label { color: #BF7A1F; }
.kpi.k-recovered .label { color: var(--positive); }
.kpi .value {
  font-family: var(--f-display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: 12px; color: var(--text-dim); }
.kpi .delta {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  margin-left: 6px;
}
.kpi .delta.up { color: var(--positive); }
.kpi .delta.down { color: var(--negative); }

/* KPI explain button */
.kpi .kpi-explain,
.kpi-explain {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--f-text);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.kpi .kpi-explain:hover,
.kpi-explain:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* Explain pills inline (used on driver cards, readout rows) */
.explain-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--f-text);
  transition: all .15s ease;
}
.explain-pill:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* Clickable row hint for tables and ladder rows */
tr.click-row { cursor: pointer; transition: background .12s ease; }
tr.click-row:hover { background: var(--surface-alt); }
tr.click-row td:first-child::before {
  content: '▸';
  color: var(--orange);
  margin-right: 6px;
  opacity: .6;
  font-size: 10px;
}

/* Clickable chart bar / cursor hint */
.chart-click rect { cursor: pointer; transition: opacity .12s ease; }
.chart-click rect:hover { opacity: 1 !important; filter: brightness(1.1); }

/* Click-prize bar hover */
.bar-row.click-bar { cursor: pointer; }
.bar-row.click-bar:hover .fill { filter: brightness(1.15); }
.bar-row.click-bar:hover .lbl { color: var(--orange); }

/* Rec blocks inside drawer/modal */
.rec-block {
  padding: 14px 16px;
  background: var(--surface-alt);
  border-radius: 10px;
  border-left: 3px solid var(--orange);
  margin-bottom: 12px;
}
.rec-block .rec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.rec-block .rec-head .rank {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--orange); color:#fff; display:grid; place-items:center;
  font-family: var(--f-num); font-weight:600; font-size:11px;
}
.rec-block .rec-head .title {
  font-family: var(--f-display); font-weight:600; font-size:13.5px;
}
.rec-block .rec-head .impact {
  margin-left:auto; font-family: var(--f-num); font-weight:600; font-size:12px; color:var(--orange);
}
.rec-block .rec-body { font-size:12.5px; line-height:1.55; color: var(--text-dim); }
.rec-block .rec-body strong { color: var(--text); }
.rec-block .rec-meta {
  margin-top:8px; display:flex; gap:10px; flex-wrap:wrap;
  font-size:11px; color: var(--text-faint); font-family: var(--f-num);
}

/* Workflow steps */
.wf-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.wf-step:last-child { border-bottom: none; }
.wf-step .step-num {
  flex-shrink:0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--charcoal); color:#fff; display:grid; place-items:center;
  font-family: var(--f-num); font-weight:600; font-size:11px;
}
.wf-step .step-body { flex:1; font-size:12.5px; line-height:1.5; }
.wf-step .step-body .title { font-weight:600; color: var(--text); margin-bottom:3px; }
.wf-step .step-body .meta { font-size:11px; color: var(--text-faint); margin-top:3px; }

/* Section divider inside drawers */
.drawer-section-h {
  font-size:10.5px; letter-spacing:.1em; text-transform:uppercase;
  color: var(--text-faint); font-weight:600;
  margin: 16px 0 8px;
}

/* Section pill group e.g. action-group header */
.group-header {
  display:flex; align-items:center; gap:10px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-radius: 10px 10px 0 0;
  border-left: 3px solid var(--orange);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 13px;
}
.group-header .count {
  margin-left:auto; font-family: var(--f-num); font-size:11.5px;
  color: var(--text-dim); font-weight:400;
}
.group-header .select-all {
  font-size: 10.5px;
  padding: 2px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
}
.group-table { margin-bottom: 14px; border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; overflow: hidden; }
.group-table table { margin:0; }

/* Bulk action bar */
.bulk-bar {
  position: sticky;
  bottom: 0;
  background: var(--charcoal);
  color:#fff;
  padding: 10px 16px;
  border-radius: 10px;
  display:flex; align-items:center; gap:12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  font-size:13px;
  margin-top: 10px;
}
.bulk-bar .count { font-weight:600; }
.bulk-bar .spacer { flex:1; }
.bulk-bar .btn.primary { background: var(--orange); color:#fff; }
.bulk-bar .btn.ghost { background:transparent; color:#fff; border:1px solid rgba(255,255,255,.3); }

/* Benchmarking cells colour */
td.bm-better { background: rgba(80,160,100,.14); color: var(--positive); font-weight:600; }
td.bm-worse  { background: rgba(176,48,40,.12); color: var(--negative); font-weight:600; }
td.bm-equal  { color: var(--text-dim); }
tr.bm-highlight { background: var(--orange-soft); }
tr.bm-cbo-row td { background: var(--surface-alt); font-style: italic; }

/* Tenor-level simulator controls */
.tenor-grid { display: grid; grid-template-columns: 90px 1fr 90px 90px 90px; gap:8px; align-items:center; padding:8px 0; border-bottom: 1px dashed var(--border); font-size:12px; }
.tenor-grid:last-child { border-bottom: none; }
.tenor-grid .lbl { font-weight:600; font-family: var(--f-display); }
.tenor-grid input[type="range"] { width:100%; }
.tenor-grid .readout { font-family: var(--f-num); text-align:right; }

/* Inline chatbot mini (embedded) */
.chatbot-mini {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: 480px;
  overflow: hidden;
}
.chatbot-mini .chatbot-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface-alt);
}
.chatbot-mini .chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.chatbot-mini .msg.bot {
  background: var(--surface-alt); border-radius: 10px; padding: 10px 12px;
  font-size: 12.5px; line-height: 1.5;
}
.chatbot-mini .msg.user {
  align-self: flex-end; background: var(--orange); color: #fff;
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; max-width: 80%;
}
.chatbot-mini .trace {
  margin-top:6px; font-size:10.5px; color: var(--text-faint); font-family: var(--f-num);
}
.chatbot-mini .chatbot-suggestions {
  padding: 8px 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.chatbot-mini .chatbot-suggestions button {
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; font-size: 11px; cursor: pointer;
  color: var(--text-dim);
}
.chatbot-mini .chatbot-suggestions button:hover { background: var(--orange); color:#fff; border-color: var(--orange); }
.chatbot-mini .chatbot-input {
  display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border);
}
.chatbot-mini .chatbot-input input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-family: var(--f-text);
}
.chatbot-mini .chatbot-input button {
  background: var(--orange); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}

/* =========== DEPOSIT ANALYST BOT · clean three-column layout =========== */
.da-shell {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 16px;
  height: calc(100vh - 240px);
  min-height: 560px;
}
@media (max-width: 1200px){ .da-shell { grid-template-columns: 220px 1fr; } .da-tools { display:none; } }
@media (max-width: 900px){ .da-shell { grid-template-columns: 1fr; } .da-rail { display:none; } }

.da-rail, .da-tools {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.da-rail-section, .da-tool-group { display: flex; flex-direction: column; gap: 6px; }
.da-rail-head, .da-tool-head {
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  margin-bottom: 2px;
}

.da-pin {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--f-text);
  transition: all .12s ease;
}
.da-pin:hover { background: var(--surface-alt); color: var(--text); }
.da-pin.active { background: var(--orange-soft); color: var(--orange); border-color: var(--orange); font-weight: 600; }

.da-sl-list { display: flex; flex-direction: column; gap: 4px; }
.da-sl {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--text-dim);
  border-radius: 6px;
  transition: background .12s ease;
}
.da-sl:hover { background: var(--surface-alt); }
.da-sl code {
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--f-num);
  font-size: 10.5px;
  color: var(--orange);
  font-weight: 600;
  white-space: nowrap;
}
.da-sl span { font-size: 11px; }

.da-rail-list {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.da-tool {
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: 8px;
  border-left: 2px solid var(--positive);
}
.da-tool-name { font-size: 12px; font-weight: 600; color: var(--text); }
.da-tool-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; font-family: var(--f-num); }

/* Center column */
.da-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.da-topbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.da-modes { display: flex; gap: 2px; background: var(--surface); border-radius: 999px; padding: 3px; border: 1px solid var(--border); }
.da-modes button {
  padding: 5px 12px;
  background: transparent;
  border: none;
  border-radius: 999px;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--f-text);
  font-weight: 500;
  transition: all .12s ease;
}
.da-modes button:hover { background: var(--surface-alt); color: var(--text); }
.da-modes button.active { background: var(--orange); color: #fff; font-weight: 600; }

.da-ctx {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}
.da-ctx-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--f-num);
}

/* Chatbot messages inside da-main */
.da-main .chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
}
.da-main .msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 88%;
}
.da-main .msg.bot {
  background: var(--surface-alt);
  color: var(--text);
  border-top-left-radius: 4px;
}
.da-main .msg.user {
  background: var(--orange);
  color: #fff;
  align-self: flex-end;
  border-top-right-radius: 4px;
}
.da-main .msg .trace {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--f-num);
}
.da-main .chatbot-suggestions {
  padding: 8px 14px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--surface);
}
.da-main .chatbot-suggestions button {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--f-text);
  transition: all .12s ease;
}
.da-main .chatbot-suggestions button:hover { background: var(--orange); color: #fff; border-color: var(--orange); }
.da-main .chatbot-input {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
}
.da-main .chatbot-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--f-text);
}
.da-main .chatbot-input input:focus { outline: none; border-color: var(--orange); }
.da-main .chatbot-input .btn.ghost {
  background: var(--surface-alt);
  color: var(--text-dim);
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.da-main .chatbot-input .btn.ghost:hover { background: var(--orange); color: #fff; border-color: var(--orange); }
.da-main .chatbot-input .btn.primary {
  padding: 9px 18px;
  background: var(--orange); color: #fff;
  border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Rich message content */
.da-rich-table { margin-top: 8px; width: 100%; font-size: 11.5px; font-family: var(--f-num); }
.da-rich-table td { padding: 3px 6px; }
.da-rich-table td:first-child { color: var(--text-dim); }
.da-rich-table td.num { text-align: right; color: var(--text); }
.da-rich-table tr { border-bottom: 1px dashed var(--border); }
.da-rich-table tr:last-child { border: none; }
.da-caution {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(176, 48, 40, 0.08);
  border-left: 2px solid var(--negative);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--negative);
}

/* Slash command palette */
.da-sl-palette {
  position: absolute;
  bottom: 100%;
  left: 14px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 20;
}
.da-sl-palette.show { display: block; }
.da-sl-palette .da-sl {
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.da-sl-palette .da-sl:last-child { border-bottom: none; }
.da-sl-palette .da-sl:hover { background: var(--orange-soft); }

/* ============== SECTIONS ============== */
.section-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 20px;
  margin: 8px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-title .tag {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--f-text);
  font-weight: 400;
  margin-left: auto;
}
[dir="rtl"] .section-title .tag { margin-left: 0; margin-right: auto; }

/* ============== CARDS ============== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}
.card .card-head { display: flex; align-items: start; gap: 10px; margin-bottom: 10px; }
.card .card-head .icon-sq {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange);
  display: grid; place-items: center;
}
[data-theme="dark"] .card .card-head .icon-sq {
  background: rgba(232,100,10,.15);
  color: var(--orange);
}
.card h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  margin: 0;
}
.card .card-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.card .footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1300px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }

.module-card {
  cursor: pointer;
  transition: transform .08s, border-color .1s;
}
.module-card:hover { border-color: var(--orange); }
.module-card .meter {
  margin-top: 10px;
  height: 4px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.module-card .meter > span {
  display: block;
  height: 100%;
  background: var(--orange);
  border-radius: var(--r-pill);
}

/* ============== TABLES ============== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
  position: sticky; top: 0;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table tr:hover td { background: var(--surface-alt); cursor: pointer; }
.table td.num, .table th.num { text-align: right; }
[dir="rtl"] .table td.num, [dir="rtl"] .table th.num { text-align: left; }

/* ============== CHIPS ============== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--chip);
  color: var(--text-dim);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--f-text);
}
.chip.pos { background: rgba(31,122,76,.12); color: var(--positive); }
.chip.neg { background: rgba(176,48,40,.12); color: var(--negative); }
.chip.warn { background: rgba(200,96,109,.14); color: #9F3F4E; }
.chip.info { background: rgba(59,91,165,.12); color: var(--d1); }
.chip.orange { background: var(--orange-soft); color: var(--orange-dim); }
[data-theme="dark"] .chip.orange { background: rgba(232,100,10,.15); color: var(--orange); }

.badge-synth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(200,96,109,.08);
  color: #9F3F4E;
  border: 1px dashed var(--caution);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-family: var(--f-num);
}

.badge-provenance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-family: var(--f-num);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-provenance.confirmed { background: rgba(31,122,76,.12); color: var(--positive); }
.badge-provenance.assumed { background: rgba(200,96,109,.12); color: #9F3F4E; }
.badge-provenance.illustrative { background: rgba(59,91,165,.12); color: var(--d1); }

/* ============== CHARTS ============== */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
}
.chart-wrap .chart-head { display: flex; justify-content: space-between; margin-bottom: 10px; align-items: baseline; }
.chart-wrap h4 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
}
.chart-wrap .chart-sub { font-size: 11.5px; color: var(--text-dim); }

.chart-svg { width: 100%; display: block; }
.chart-svg .axis { stroke: var(--border); stroke-width: 1; }
.chart-svg .tick { font-size: 10px; fill: var(--text-faint); font-family: var(--f-num); }
.chart-svg .grid { stroke: var(--border); stroke-opacity: .5; stroke-dasharray: 2 3; }
.chart-svg .series-primary { stroke: var(--orange); fill: none; stroke-width: 2; }
.chart-svg .series-fill { fill: var(--orange); opacity: .12; }
.chart-svg .band-upper, .chart-svg .band-lower { fill: var(--orange); opacity: .18; }
.chart-svg .d1 { fill: var(--d1); stroke: var(--d1); }
.chart-svg .d2 { fill: var(--d2); stroke: var(--d2); }
.chart-svg .d3 { fill: var(--d3); stroke: var(--d3); }
.chart-svg .d4 { fill: var(--d4); stroke: var(--d4); }
.chart-svg .d5 { fill: var(--d5); stroke: var(--d5); }

/* ============== WHAT-IF SIM ============== */
.whatif {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}
@media (max-width: 1100px) { .whatif { grid-template-columns: 1fr; } }

.whatif-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
}
.whatif-controls h4 {
  margin: 0 0 14px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
}

.control {
  margin-bottom: 18px;
}
.control label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.control label .val {
  color: var(--text);
  font-weight: 600;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
}
.control input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}
.control select, .control input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background-color: var(--surface-alt);
  color: var(--text);
  font-family: var(--f-text);
  font-size: 13px;
}
.control select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 7px 32px 7px 10px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A857B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
}
[data-theme="dark"] .control select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B5B0A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* --- Global select & text input styling (applies everywhere) --- */
select, select.control, input[type="text"], input[type="search"], input[type="number"], textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--f-text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
  line-height: 1.3;
}
input[type="text"], input[type="search"], input[type="number"], textarea {
  cursor: text;
  padding: 8px 12px;
}
select, select.control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A857B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}
[data-theme="dark"] select, [data-theme="dark"] select.control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B5B0A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
select:hover, input:hover, textarea:hover {
  border-color: var(--border-strong);
}
select:focus, input:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,100,10,.14);
}
/* kill native browser select highlight on options */
select option {
  background: var(--surface);
  color: var(--text);
  padding: 6px;
}
select::-ms-expand { display: none; }

/* Labels for inline filter rows */
.row > label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
}
.seg {
  display: inline-flex;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  padding: 2px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: none;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============== CHATBOT ============== */
.chatbot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 540px;
}
.chatbot-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.chatbot-head h4 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
}
.chatbot-head .sub { font-size: 11.5px; color: var(--text-dim); }
.chatbot-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  max-width: 90%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.msg.user {
  align-self: flex-end;
  background: var(--orange);
  color: #fff;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface-alt);
  color: var(--text);
}
.msg .trace {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--f-num);
}
.msg table {
  width: 100%;
  margin-top: 8px;
  font-family: var(--f-num);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.msg table td { padding: 3px 6px 3px 0; }
.msg table td:last-child { text-align: right; font-weight: 600; }
.chatbot-input {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.chatbot-input input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--f-text);
  font-size: 13px;
}
.chatbot-input input:focus { outline: 2px solid var(--orange); outline-offset: 0; }
.chatbot-suggestions {
  padding: 0 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chatbot-suggestions .sug {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--r-pill);
  padding: 4px 11px;
  font-size: 11.5px;
  cursor: pointer;
}
.chatbot-suggestions .sug:hover { border-color: var(--orange); color: var(--orange); }

/* ============== FOOTER ============== */
.app-footer {
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev-2);
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
}
.app-footer .right { margin-left: auto; }
[dir="rtl"] .app-footer .right { margin-left: 0; margin-right: auto; }

/* ============== UTIL ============== */
.row { display: flex; gap: 12px; align-items: center; }
.wrap { display: flex; flex-wrap: wrap; gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.hidden { display: none !important; }

.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

.scroll-x { overflow-x: auto; }

/* Scenario pill rows */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scenario-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--r-md);
  cursor: pointer;
  border: 1px solid transparent;
}
.scenario-row:hover { border-color: var(--orange); }
.scenario-row .code {
  width: 30px; height: 30px;
  background: var(--surface);
  color: var(--orange);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 13px;
}
.scenario-row .meta { flex: 1; }
.scenario-row .title { font-weight: 600; font-size: 13px; }
.scenario-row .desc { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* Scatter quadrants */
.quad-labels { position: absolute; inset: 0; pointer-events: none; }
.quad-label {
  position: absolute;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  color: var(--text-dim);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 32px; height: 18px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  display: inline-block;
  cursor: pointer;
  flex: 0 0 32px;
}
.toggle::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.toggle.on { background: var(--orange); }
.toggle.on::after { transform: translateX(14px); background: #fff; }

/* Progress bar */
.progress {
  height: 6px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--orange);
  border-radius: var(--r-pill);
}

/* Icons via inline SVG color inherit */
svg { display: inline-block; vertical-align: middle; }

/* Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.panel .panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.panel .panel-head h5 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14px;
}
.panel .panel-head .sub { font-size: 11.5px; color: var(--text-dim); }

/* Big number */
.bignum {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

/* Delta */
.delta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: var(--r-sm);
}
.delta-chip.up { background: rgba(31,122,76,.12); color: var(--positive); }
.delta-chip.down { background: rgba(176,48,40,.12); color: var(--negative); }
.delta-chip.flat { background: var(--chip); color: var(--text-dim); }

/* Waterfall-ish bars */
.bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 90px;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
}
.bar-row .lbl { color: var(--text-dim); }
.bar-row .track {
  height: 18px;
  background: var(--surface-alt);
  border-radius: var(--r-sm);
  position: relative;
}
.bar-row .fill {
  height: 100%;
  background: var(--orange);
  border-radius: var(--r-sm);
}
.bar-row .fill.pos { background: var(--positive); }
.bar-row .fill.neg { background: var(--negative); }
.bar-row .fill.neu { background: var(--text-faint); }
.bar-row .amt { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Model trace box */
.trace-box {
  background: var(--bg-elev-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--f-num);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Decision verdict */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 13px;
  font-family: var(--f-display);
}
.verdict.approve { background: rgba(31,122,76,.14); color: var(--positive); }
.verdict.decline { background: rgba(176,48,40,.14); color: var(--negative); }
.verdict.refer { background: rgba(200,96,109,.14); color: #9F3F4E; }
.verdict.condition { background: rgba(59,91,165,.14); color: var(--d1); }

/* ===================================================================
   ANIMATIONS & TRANSITIONS LAYER
   =================================================================== */

/* --- Keyframes --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(31,122,76,.5); }
  70%  { box-shadow: 0 0 0 8px rgba(31,122,76,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,122,76,0); }
}
@keyframes pulseOrange {
  0%   { box-shadow: 0 0 0 0 rgba(232,100,10,.5); }
  70%  { box-shadow: 0 0 0 10px rgba(232,100,10,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,100,10,0); }
}
@keyframes breathe {
  0%, 100% { opacity: .85; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}
@keyframes shimmer {
  0%   { background-position: -220% 0; }
  100% { background-position: 220% 0; }
}
@keyframes drawLine {
  from { stroke-dashoffset: var(--length, 1000); }
  to   { stroke-dashoffset: 0; }
}
@keyframes growBar {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ripple {
  to { transform: scale(2.4); opacity: 0; }
}
@keyframes rotate360 {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@keyframes dash {
  to { stroke-dashoffset: -24; }
}
@keyframes gradientMove {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* --- Global transitions on common elements --- */
.card, .panel, .chart-wrap, .kpi,
.pill-btn, .icon-btn, .btn, .avatar-sm,
.walk-step, .scenario-row, .module-card,
.sidebar-nav a, .sidebar-nav button,
.chip, .delta-chip, .badge-provenance,
.toggle, .seg button, .chatbot-suggestions .sug,
.table tr, .verdict {
  transition:
    background-color .22s cubic-bezier(.4,.0,.2,1),
    color .22s cubic-bezier(.4,.0,.2,1),
    border-color .22s cubic-bezier(.4,.0,.2,1),
    box-shadow .22s cubic-bezier(.4,.0,.2,1),
    transform .22s cubic-bezier(.4,.0,.2,1),
    opacity .22s cubic-bezier(.4,.0,.2,1);
}

/* Smooth theme switch across the whole document */
html { transition: background-color .35s ease; }
body { transition: background-color .35s ease, color .35s ease; }

/* --- Live indicator breathing --- */
.chip-live .live-dot {
  animation: pulseRing 2s infinite, breathe 2s ease-in-out infinite;
}
.sidebar-status .ok { animation: breathe 2.4s ease-in-out infinite; }
.sidebar-status .err { animation: pulseOrange 2.4s infinite; }

/* --- Entry animations (page load) --- */
.walkthrough     { animation: fadeIn .5s ease .05s both; }
.hdr-row         { animation: fadeUp .55s cubic-bezier(.2,.7,.3,1) .1s both; }
.hdr-row .eyebrow,
.hdr-row .headline,
.hdr-row .subhead,
.hdr-row .actions { animation: fadeUp .55s cubic-bezier(.2,.7,.3,1) both; }
.hdr-row .eyebrow  { animation-delay: .14s; }
.hdr-row .headline { animation-delay: .22s; }
.hdr-row .subhead  { animation-delay: .30s; }
.hdr-row .actions  { animation-delay: .38s; }

.kpi-grid > .kpi   { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }
.kpi-grid > .kpi:nth-child(1) { animation-delay: .20s; }
.kpi-grid > .kpi:nth-child(2) { animation-delay: .28s; }
.kpi-grid > .kpi:nth-child(3) { animation-delay: .36s; }
.kpi-grid > .kpi:nth-child(4) { animation-delay: .44s; }

.module-grid > *       { animation: fadeUp .55s cubic-bezier(.2,.7,.3,1) both; }
.module-grid > *:nth-child(1) { animation-delay: .36s; }
.module-grid > *:nth-child(2) { animation-delay: .44s; }
.module-grid > *:nth-child(3) { animation-delay: .52s; }
.module-grid > *:nth-child(4) { animation-delay: .60s; }

.grid-2 > *, .grid-3 > * { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }
.grid-3 > *:nth-child(1) { animation-delay: .10s; }
.grid-3 > *:nth-child(2) { animation-delay: .18s; }
.grid-3 > *:nth-child(3) { animation-delay: .26s; }
.grid-3 > *:nth-child(4) { animation-delay: .34s; }
.grid-3 > *:nth-child(5) { animation-delay: .42s; }
.grid-3 > *:nth-child(6) { animation-delay: .50s; }

/* Sidebar entrance */
.sidebar-brand { animation: slideRight .5s ease .02s both; }
.sidebar-user  { animation: slideRight .5s ease .10s both; }
.sidebar-section { animation: fadeIn .5s ease .18s both; }
.sidebar-nav   { animation: fadeIn .5s ease .22s both; }

/* Topbar entrance */
.topbar > *    { animation: fadeUp .4s ease .02s both; }
.topbar .chip-live { animation-delay: .14s; }
.topbar .cluster   { animation-delay: .20s; }

/* --- Hover micro-interactions --- */
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.07);
  border-color: var(--border-strong);
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(232,100,10,.14);
  border-color: var(--orange);
}
.scenario-row:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
[dir="rtl"] .scenario-row:hover { transform: translateX(-3px); }

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,.06);
}
.btn:active { transform: translateY(0); }
.btn.primary:hover { box-shadow: 0 6px 14px rgba(232,100,10,.3); }

.pill-btn:hover { transform: translateY(-1px); }
.icon-btn:hover {
  transform: rotate(18deg);
  background: var(--surface-alt);
  color: var(--orange);
}
.avatar-sm:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(232,100,10,.4); }

.chip:hover, .delta-chip:hover { transform: translateY(-1px); }

.walk-step:hover:not(.active) {
  background: var(--chip);
  transform: translateY(-1px);
}
.walk-step.active {
  animation: dropIn .35s cubic-bezier(.2,.9,.3,1.1);
}
.walk-step.active .num { animation: scaleIn .3s ease; }

.table tr { transition: background-color .18s ease; }
.table tbody tr:hover td {
  background: var(--surface-alt);
}
.table tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--orange);
}
[dir="rtl"] .table tr:hover td:first-child { box-shadow: inset -3px 0 0 var(--orange); }

.sidebar-nav a:hover, .sidebar-nav button:hover {
  transform: translateX(2px);
}
[dir="rtl"] .sidebar-nav a:hover, [dir="rtl"] .sidebar-nav button:hover { transform: translateX(-2px); }
.sidebar-nav .active {
  position: relative;
}
.sidebar-nav .active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--orange);
  border-radius: 0 3px 3px 0;
  animation: scaleIn .3s ease;
}
[dir="rtl"] .sidebar-nav .active::before { left: auto; right: 0; border-radius: 3px 0 0 3px; }

/* --- Chart draw animations --- */
.chart-svg path.series-primary {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawLine 1.6s cubic-bezier(.4,.0,.2,1) .3s forwards;
}
.chart-svg path.series-fill {
  animation: fadeIn 1.4s ease .7s both;
}
.chart-svg path.band-upper {
  animation: fadeIn 1.2s ease .4s both;
}
.chart-svg rect {
  transform-origin: center bottom;
  animation: growBar .7s cubic-bezier(.3,1.4,.3,1) both;
}
.chart-svg rect:nth-child(odd) { animation-delay: .15s; }
.chart-svg rect:nth-child(even) { animation-delay: .25s; }
.chart-svg circle {
  animation: scaleIn .5s cubic-bezier(.2,1.4,.3,1) .4s both;
  transform-box: fill-box;
  transform-origin: center;
}
.chart-svg circle:hover { r: 5; }

/* --- Bar rows (waterfalls) --- */
.bar-row .fill {
  transform-origin: left center;
  animation: growBar .7s cubic-bezier(.3,1.4,.3,1) .2s both;
}
[dir="rtl"] .bar-row .fill { transform-origin: right center; }

/* --- Progress meter --- */
.meter > span, .progress > span {
  transform-origin: left center;
  animation: growBar 1s cubic-bezier(.3,1.4,.3,1) .4s both;
}
[dir="rtl"] .meter > span, [dir="rtl"] .progress > span { transform-origin: right center; }

/* --- Range sliders (what-if) with smooth thumb --- */
input[type="range"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(
    to right,
    var(--orange) 0%,
    var(--orange) var(--pct, 0%),
    var(--range-track, #D7CFBD) var(--pct, 0%),
    var(--range-track, #D7CFBD) 100%
  );
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border);
  box-sizing: border-box;
}
[data-theme="dark"] input[type="range"] { --range-track: #3A3A3A; }
[dir="rtl"] input[type="range"] {
  background: linear-gradient(
    to left,
    var(--orange) 0%,
    var(--orange) var(--pct, 0%),
    var(--range-track, #D7CFBD) var(--pct, 0%),
    var(--range-track, #D7CFBD) 100%
  );
}

/* webkit track + thumb */
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 2px solid var(--surface);
  margin-top: -6px; /* vertical centring on 8px track */
  box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 0 0 0 rgba(232,100,10,0);
  transition: transform .15s cubic-bezier(.2,1.4,.3,1), box-shadow .18s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.25), 0 0 0 6px rgba(232,100,10,.18);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.35);
  box-shadow: 0 2px 6px rgba(0,0,0,.3), 0 0 0 8px rgba(232,100,10,.26);
}
/* mozilla track + thumb */
input[type="range"]::-moz-range-track {
  height: 8px;
  background: var(--range-track, #D7CFBD);
  border-radius: 999px;
  border: none;
}
input[type="range"]::-moz-range-progress {
  height: 8px;
  background: var(--orange);
  border-radius: 999px;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

input[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(232,100,10,.22);
}

/* --- Seg buttons smooth active --- */
.seg button.active {
  animation: dropIn .25s ease;
}

/* --- Chat messages pop in --- */
.msg {
  animation: dropIn .35s cubic-bezier(.2,.9,.3,1.1);
}
.msg.bot .trace {
  animation: fadeIn .5s ease .2s both;
}
.msg table tr {
  animation: fadeUp .35s ease both;
}
.msg table tr:nth-child(1) { animation-delay: .05s; }
.msg table tr:nth-child(2) { animation-delay: .10s; }
.msg table tr:nth-child(3) { animation-delay: .15s; }
.msg table tr:nth-child(4) { animation-delay: .20s; }
.msg table tr:nth-child(5) { animation-delay: .25s; }
.msg table tr:nth-child(6) { animation-delay: .30s; }

.chatbot-suggestions .sug:hover {
  transform: translateY(-2px);
  background: var(--orange-soft);
  color: var(--orange-dim);
  border-color: var(--orange);
}
[data-theme="dark"] .chatbot-suggestions .sug:hover {
  background: rgba(232,100,10,.14);
  color: var(--orange);
}

/* --- Theme toggle rotation --- */
.icon-btn[data-action="theme"] svg {
  transition: transform .4s cubic-bezier(.2,1.4,.3,1);
}
.icon-btn[data-action="theme"]:hover svg {
  transform: rotate(30deg);
}

/* --- Scenario code chip pop --- */
.scenario-row:hover .code {
  background: var(--orange);
  color: #fff;
  transform: scale(1.1) rotate(-6deg);
}
.scenario-row .code { transition: all .22s cubic-bezier(.2,1.4,.3,1); }

/* --- Verdict pop --- */
.verdict { animation: scaleIn .5s cubic-bezier(.2,1.4,.3,1); }

/* --- Panel subtle lift on hover --- */
.panel:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.chart-wrap:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

/* --- Walkthrough step shimmer when live --- */
.walk-step.active {
  background: linear-gradient(90deg, var(--orange) 0%, #FF7F2B 50%, var(--orange) 100%);
  background-size: 220% 100%;
  animation: dropIn .35s cubic-bezier(.2,.9,.3,1.1), gradientMove 4s ease-in-out infinite;
}

/* --- Logo gentle breathing --- */
.sidebar-brand .logo { transition: transform .3s ease; }
.sidebar-brand:hover .logo { transform: scale(1.08) rotate(-6deg); }

/* --- Deltas (up/down arrows add micro bob on positive) --- */
.delta.up, .delta-chip.up { position: relative; }
.delta.up:hover { animation: bob 1.2s infinite; }

/* --- Count-up tnum friendly --- */
.counting { opacity: .4; }
.counted { opacity: 1; transition: opacity .3s ease; }

/* --- Scroll reveal baseline --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.2,.7,.3,1), transform .6s cubic-bezier(.2,.7,.3,1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* --- Ripple effect on buttons --- */
.btn, .pill-btn, .seg button, .walk-step {
  position: relative;
  overflow: hidden;
}
.ripple-dot {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .22;
  pointer-events: none;
  transform: scale(0);
  animation: ripple .6s ease-out;
}

/* --- Section switch anim (prototype module tabs) --- */
section[data-view]:not(.hidden) {
  animation: fadeUp .35s cubic-bezier(.2,.7,.3,1);
}

/* --- Tabular numbers transition --- */
.kpi .value, .bignum {
  font-variant-numeric: tabular-nums;
  transition: color .3s ease;
}

/* --- Loading shimmer (used sparingly for KPI placeholders) --- */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-alt) 0%,
    var(--chip) 50%,
    var(--surface-alt) 100%
  );
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
}

/* --- Chart axis fade in --- */
.chart-svg .grid { animation: fadeIn 1s ease both; }
.chart-svg .tick { animation: fadeIn .8s ease .2s both; }

/* --- Marching ants on chart tracked lines (dashed) --- */
.chart-svg path[stroke-dasharray] {
  animation: dash 20s linear infinite;
}

/* --- Spinner (for any future loading state) --- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: rotate360 .9s linear infinite;
  display: inline-block;
}

/* --- Toggle pop --- */
.toggle::after { transition: transform .3s cubic-bezier(.2,1.4,.3,1), background .2s ease; }

/* --- Chip-live plus icon spins subtly on hover --- */
.chip-live .plus { transition: transform .35s cubic-bezier(.2,1.4,.3,1); }
.chip-live:hover .plus { transform: rotate(90deg) scale(1.1); }

/* --- Reduce motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-delay: 0s !important;
    transition-duration: .001s !important;
  }
}

/* ===================================================================
   STRONGER HOVER STATES (pass 2) — tiles, bars, scatter, tables, titles
   =================================================================== */

/* Panels: stronger lift + orange accent border reveal on hover */
.panel, .chart-wrap {
  position: relative;
  overflow: hidden;
}
.panel::after, .chart-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0 var(--orange);
  opacity: 0;
  transition: opacity .25s ease, box-shadow .25s ease;
}
.panel:hover::after, .chart-wrap:hover::after {
  box-shadow: inset 0 0 0 1px var(--orange);
  opacity: .55;
}
.panel:hover, .chart-wrap:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
[data-theme="dark"] .panel:hover, [data-theme="dark"] .chart-wrap:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

/* Big-number tiles: number scales + colour-shifts on hover */
.panel .bignum, .kpi .value {
  transition: transform .25s cubic-bezier(.2,1.4,.3,1), color .25s ease, letter-spacing .25s ease;
  display: inline-block;
  transform-origin: left center;
}
.panel:hover .bignum, .kpi:hover .value {
  color: var(--orange);
  letter-spacing: -.015em;
}
[dir="rtl"] .panel .bignum, [dir="rtl"] .kpi .value { transform-origin: right center; }

/* Panel head icon ping on hover */
.panel:hover .panel-head h5,
.chart-wrap:hover .chart-head h4 {
  color: var(--orange);
}
.panel-head h5, .chart-head h4 { transition: color .25s ease; }

/* --- Elasticity driver tiles explicitly bounce on hover --- */
.grid-3 > .panel, .grid-2 > .panel {
  cursor: default;
}
.grid-3 > .panel:hover, .grid-2 > .panel:hover {
  transform: translateY(-3px) scale(1.012);
  box-shadow: 0 8px 24px rgba(232,100,10,.10);
}

/* --- Bar rows (quadrant distribution, waterfalls) --- */
.bar-row {
  cursor: pointer;
  padding-left: 2px;
  padding-right: 2px;
  border-radius: 6px;
  transition: background-color .18s ease, transform .18s ease;
}
.bar-row:hover {
  background: var(--surface-alt);
  transform: translateX(2px);
}
[dir="rtl"] .bar-row:hover { transform: translateX(-2px); }
.bar-row .fill {
  position: relative;
  transition: filter .2s ease, transform .25s ease;
}
.bar-row:hover .fill {
  filter: brightness(1.12) saturate(1.1);
}
.bar-row:hover .amt {
  color: var(--orange);
  transform: scale(1.06);
}
.bar-row .amt { transition: color .2s ease, transform .2s ease; transform-origin: right center; }
[dir="rtl"] .bar-row .amt { transform-origin: left center; }

/* --- Section titles: animated underline grow on hover --- */
.section-title {
  position: relative;
  cursor: default;
}
.section-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  height: 2px;
  width: 0;
  background: var(--orange);
  border-radius: 2px;
  transition: width .35s cubic-bezier(.2,.9,.3,1);
}
[dir="rtl"] .section-title::after { left: auto; right: 0; }
.section-title:hover::after { width: 46px; }

/* --- Scatter chart dots: scale + glow on hover (SVG) --- */
.chart-svg circle {
  cursor: pointer;
  transition: r .18s cubic-bezier(.2,1.4,.3,1), opacity .18s ease, filter .18s ease;
}
.chart-svg circle:hover {
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px currentColor) brightness(1.2);
}

/* --- SVG bars (chart) --- */
.chart-svg rect {
  cursor: pointer;
  transition: opacity .2s ease, filter .2s ease;
}
.chart-svg rect:hover {
  opacity: 1 !important;
  filter: brightness(1.15) saturate(1.1);
}

/* --- Table rows: stronger hover with slide indicator --- */
.table tbody tr {
  cursor: pointer;
}
.table tbody tr:hover td {
  background: linear-gradient(90deg, var(--surface-alt) 0%, transparent 100%);
}
[dir="rtl"] .table tbody tr:hover td {
  background: linear-gradient(-90deg, var(--surface-alt) 0%, transparent 100%);
}

/* --- Chips: pop more on hover --- */
.chip, .delta-chip, .badge-provenance {
  cursor: default;
}
.chip:hover, .delta-chip:hover, .badge-provenance:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

/* --- KPI tiles: stronger lift & inner glow --- */
.kpi {
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: -30%; left: -30%;
  width: 60%; height: 160%;
  background: radial-gradient(ellipse at center, rgba(232,100,10,.14), transparent 70%);
  opacity: 0;
  transform: translateX(-20%);
  transition: opacity .4s ease, transform .5s ease;
  pointer-events: none;
}
.kpi:hover::before {
  opacity: 1;
  transform: translateX(0);
}
.kpi:hover {
  transform: translateY(-3px);
  border-color: var(--orange);
  box-shadow: 0 8px 24px rgba(232,100,10,.14);
}

/* --- Module cards even stronger --- */
.module-card {
  transform-style: preserve-3d;
  cursor: pointer;
}
.module-card:hover .icon-sq {
  transform: scale(1.12) rotate(-6deg);
  background: var(--orange);
  color: #fff;
}
.module-card .icon-sq { transition: all .3s cubic-bezier(.2,1.4,.3,1); }
.module-card:hover h3 { color: var(--orange); }
.module-card h3 { transition: color .25s ease; }
.module-card:hover .meter > span {
  filter: brightness(1.15) saturate(1.15);
  box-shadow: 0 0 10px rgba(232,100,10,.4);
}
.module-card .meter > span { transition: filter .25s ease, box-shadow .25s ease; }

/* --- Scenario rows: more pronounced --- */
.scenario-row {
  cursor: pointer;
}
.scenario-row:hover {
  transform: translateX(5px);
  background: var(--surface);
  border-color: var(--orange);
  box-shadow: 0 4px 14px rgba(232,100,10,.1);
}
[dir="rtl"] .scenario-row:hover { transform: translateX(-5px); }
.scenario-row .btn { transition: all .22s cubic-bezier(.2,1.4,.3,1); }
.scenario-row:hover .btn {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* --- Sidebar nav: smoother highlight bar --- */
.sidebar-nav a, .sidebar-nav button {
  position: relative;
  overflow: hidden;
}
.sidebar-nav a::before, .sidebar-nav button::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--orange);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .25s cubic-bezier(.2,.9,.3,1);
}
[dir="rtl"] .sidebar-nav a::before, [dir="rtl"] .sidebar-nav button::before {
  left: auto; right: 0;
}
.sidebar-nav a:hover::before, .sidebar-nav button:hover::before {
  transform: scaleY(1);
}
.sidebar-nav a:hover .icon, .sidebar-nav button:hover .icon {
  color: var(--orange);
  transform: scale(1.14);
  transition: all .22s cubic-bezier(.2,1.4,.3,1);
}

/* --- Walk-step: pulse on active, scale on hover --- */
.walk-step {
  transform-origin: center;
}
.walk-step:not(.active):hover {
  transform: translateY(-2px) scale(1.03);
  color: var(--orange);
}
.walk-step:not(.active):hover .num {
  background: var(--orange);
  color: #fff;
  transform: rotate(-8deg);
}
.walk-step .num { transition: all .22s cubic-bezier(.2,1.4,.3,1); }

/* --- Buttons: stronger press feedback --- */
.btn:active, .pill-btn:active, .seg button:active {
  transform: translateY(1px) scale(.98);
}
.btn.primary:hover {
  background: var(--orange);
  box-shadow: 0 6px 18px rgba(232,100,10,.4), inset 0 0 0 1px rgba(255,255,255,.15);
}
.btn.primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.btn.primary:hover::after { opacity: 1; }

/* --- Example chips (do-it agent) --- */
.example-chip {
  position: relative;
  overflow: hidden;
}
.example-chip::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(232,100,10,.15), transparent);
  transition: left .55s ease;
  pointer-events: none;
}
.example-chip:hover::before { left: 100%; }

/* --- Scatter tooltip (populated by JS) --- */
.scatter-tooltip {
  position: fixed;
  background: var(--charcoal);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--f-num);
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity .15s ease;
  white-space: nowrap;
}
[data-theme="dark"] .scatter-tooltip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.scatter-tooltip.show { opacity: 1; }
.scatter-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--charcoal);
}
[data-theme="dark"] .scatter-tooltip::after { border-top-color: var(--surface); }

/* --- Chatbot message avatar --- */
.chatbot-head .avatar {
  animation: breathe 3s ease-in-out infinite;
}

/* --- Range slider value chip pulse on change --- */
.control label .val {
  display: inline-block;
  transition: transform .18s cubic-bezier(.2,1.4,.3,1), color .18s ease;
}
.control:hover label .val, input[type="range"]:focus + label .val {
  color: var(--orange);
  transform: scale(1.08);
}

/* --- Chart wrap: light inner glow border on hover --- */
.chart-wrap:hover {
  border-color: var(--orange);
}

/* --- Verdict pop on hover --- */
.verdict:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

/* --- Avatar sidebar mini-glow --- */
.sidebar-user:hover .avatar {
  background: var(--orange);
  color: #fff;
  transform: scale(1.08) rotate(-6deg);
}
.sidebar-user .avatar { transition: all .3s cubic-bezier(.2,1.4,.3,1); }

/* --- Topbar role avatar hover-pulse --- */
.avatar-sm {
  position: relative;
}
.avatar-sm::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s, transform .25s;
}
.avatar-sm:hover::after {
  opacity: .6;
  transform: scale(1.15);
}

/* --- Metric sparkline fade-in --- */
.chart-svg {
  transition: filter .25s ease;
}
.chart-wrap:hover .chart-svg {
  filter: contrast(1.05) saturate(1.1);
}

/* --- Audit trail event rows ultra-interactive --- */
#eventStream tr { transition: all .18s ease; }
#eventStream tr:hover {
  background: linear-gradient(90deg, rgba(232,100,10,.08) 0%, transparent 80%);
  transform: translateX(3px);
}
[dir="rtl"] #eventStream tr:hover {
  background: linear-gradient(-90deg, rgba(232,100,10,.08) 0%, transparent 80%);
  transform: translateX(-3px);
}

/* --- "Reproduce" button in audit rows pops orange --- */
#eventStream tr:hover .btn {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* --- Run-step hover (do-it agent) --- */
.run-step {
  transition: all .25s ease;
  cursor: default;
}
.run-step:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  border-color: var(--orange);
}
[dir="rtl"] .run-step:hover { transform: translateX(-3px); }

/* --- Walkthrough flash target highlight --- */
@keyframes walkFlashRing {
  0%   { box-shadow: 0 0 0 0 rgba(232,100,10,.0),    0 0 0 0 rgba(232,100,10,0); outline: 0 solid transparent; }
  12%  { box-shadow: 0 0 0 6px rgba(232,100,10,.22), 0 0 24px 4px rgba(232,100,10,.3); }
  100% { box-shadow: 0 0 0 0 rgba(232,100,10,0),     0 0 0 0 rgba(232,100,10,0); }
}
.walk-flash {
  position: relative;
  animation: walkFlashRing 1.6s cubic-bezier(.2,.7,.3,1);
  border-radius: var(--r-md);
}
.walk-flash::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--orange);
  border-radius: calc(var(--r-md) + 6px);
  opacity: 0;
  pointer-events: none;
  animation: walkFlashBorder 1.6s cubic-bezier(.2,.7,.3,1);
}
@keyframes walkFlashBorder {
  0%, 100% { opacity: 0; transform: scale(.98); }
  25%      { opacity: 1; transform: scale(1); }
}
