/* Layout: dealing-desk console. Grouped icon rail on the left, a command bar on top, dense ticket-style panels below.
   The rail collapses to icons on laptops and becomes a slide-over menu on phones. */
/* Look: deep navy console with an electric cyan accent and a gold highlight. Rounded cards that lift off a softly lit ground. */
:root {
  --bg: #EEF2F8; --surface: #FFFFFF; --raised: #FFFFFF; --sunken: #EDF1F7; --hover: #F1F5FB; --line: #DDE4EE; --line-strong: #C5D0DE;
  --fg: #0F1B33; --muted: #56647C; --faint: #8693A8;
  --accent: #0A8796; --accent-2: #0B6FB8; --accent-fg: #FFFFFF; --accent-soft: #DDF3F5;
  --gold: #B7790A; --gold-soft: #FBF0D9; --violet: #6B4FD8; --violet-soft: #ECE7FC;
  --pos: #0E8A5F; --pos-soft: #DCF4EA; --neg: #D1422F; --neg-soft: #FCE4E0;
  --warn: #B26B00; --warn-soft: #FBEFD6; --crit: #C8231A; --crit-soft: #FBDCD8;
  --a-book: #6B4FD8; --a-soft: #ECE7FC; --b-book: #0B6FB8; --b-soft: #DDEBF8;
  --rail: #0B1630; --rail-2: #10264A; --rail-fg: #CBD7EA; --rail-muted: #7F90AE; --rail-hover: rgba(255,255,255,.06); --rail-active: rgba(45,212,227,.14);
  --glow: radial-gradient(1200px 420px at 80% -120px, rgba(10,135,150,.12), transparent 70%), radial-gradient(900px 380px at 0% -80px, rgba(11,111,184,.10), transparent 70%);
  --scrim: rgba(8, 14, 28, .45); --shadow: 0 16px 40px rgba(15, 27, 51, .14), 0 2px 6px rgba(15, 27, 51, .06); --card-shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 4px 14px rgba(15, 27, 51, .05);
  --f-display: "Outfit", "IBM Plex Sans", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px; --row: 9px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #070D1C; --surface: #0E1730; --raised: #132042; --sunken: #0A1226; --hover: #142144; --line: #1C2A4D; --line-strong: #283A63;
  --fg: #E6EDF8; --muted: #93A3C0; --faint: #5F6F8E;
  --accent: #2DD4E3; --accent-2: #4FA3FF; --accent-fg: #04121C; --accent-soft: #0C2D3D;
  --gold: #F5B83D; --gold-soft: #2E2410; --violet: #A28BFF; --violet-soft: #221B45;
  --pos: #34D399; --pos-soft: #0B2A22; --neg: #FF7A66; --neg-soft: #36161A;
  --warn: #F5B83D; --warn-soft: #2E2410; --crit: #FF5C5C; --crit-soft: #3D1418;
  --a-book: #A28BFF; --a-soft: #221B45; --b-book: #4FA3FF; --b-soft: #10264A;
  --rail: #050B18; --rail-2: #0A1530; --rail-fg: #CBD7EA; --rail-muted: #6C7D9C; --rail-hover: rgba(255,255,255,.05); --rail-active: rgba(45,212,227,.13);
  --glow: radial-gradient(1200px 460px at 80% -140px, rgba(45,212,227,.13), transparent 70%), radial-gradient(900px 400px at 0% -80px, rgba(79,163,255,.12), transparent 70%);
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35); --card-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #070D1C; --surface: #0E1730; --raised: #132042; --sunken: #0A1226; --hover: #142144; --line: #1C2A4D; --line-strong: #283A63;
  --fg: #E6EDF8; --muted: #93A3C0; --faint: #5F6F8E;
  --accent: #2DD4E3; --accent-2: #4FA3FF; --accent-fg: #04121C; --accent-soft: #0C2D3D;
  --gold: #F5B83D; --gold-soft: #2E2410; --violet: #A28BFF; --violet-soft: #221B45;
  --pos: #34D399; --pos-soft: #0B2A22; --neg: #FF7A66; --neg-soft: #36161A;
  --warn: #F5B83D; --warn-soft: #2E2410; --crit: #FF5C5C; --crit-soft: #3D1418;
  --a-book: #A28BFF; --a-soft: #221B45; --b-book: #4FA3FF; --b-soft: #10264A;
  --rail: #050B18; --rail-2: #0A1530; --rail-fg: #CBD7EA; --rail-muted: #6C7D9C; --rail-hover: rgba(255,255,255,.05); --rail-active: rgba(45,212,227,.13);
  --glow: radial-gradient(1200px 460px at 80% -140px, rgba(45,212,227,.13), transparent 70%), radial-gradient(900px 400px at 0% -80px, rgba(79,163,255,.12), transparent 70%);
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35); --card-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark; }
:root[data-density="compact"] { --row: 5px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--glow), var(--bg); background-attachment: fixed; color: var(--fg); font-family: var(--f-body); font-size: 14px; line-height: 1.45; }
.num, td.n, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select, textarea { font: inherit; color: var(--fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); } .crit { color: var(--crit); } .muted { color: var(--muted); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.app.collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.rail { background: linear-gradient(180deg, var(--rail-2), var(--rail) 60%); color: var(--rail-fg); display: flex; flex-direction: column; position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto; overflow-x: hidden; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2DD4E3, #2F6BFF); box-shadow: 0 6px 18px rgba(45,212,227,.35); color: #fff; display: grid; place-items: center; font-family: var(--f-display); font-weight: 600; font-size: 12px; letter-spacing: .05em; flex: none; }
.brand-name { font-family: var(--f-display); font-weight: 600; font-size: 15.5px; line-height: 1.1; color: #fff; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--rail-muted); white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 12px 10px; }
.nav-section { font-family: var(--f-display); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--rail-muted); padding: 14px 10px 6px; white-space: nowrap; }
.nav-section:first-child { padding-top: 2px; }
.nav button { display: flex; align-items: center; gap: 11px; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: var(--r); color: var(--rail-fg); font-weight: 500; font-size: 13.5px; white-space: nowrap; position: relative; }
.nav button:hover { background: var(--rail-hover); color: #fff; }
.nav button[aria-current="page"] { background: var(--rail-active); color: #fff; }
.nav button[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #2DD4E3; box-shadow: 0 0 10px #2DD4E3; }
.nav button[aria-current="page"] svg.i { color: #2DD4E3; }
.nav .count { margin-left: auto; font-family: var(--f-mono); font-size: 10.5px; padding: 1px 6px; border-radius: 10px; background: #B0241C; color: #fff; }
.rail-foot { margin-top: auto; padding: 12px 16px 4px; font-size: 11.5px; color: var(--rail-muted); display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(255,255,255,.06); }
.rail-foot .feed { color: var(--rail-fg); }
.collapse-btn { border: 0; background: transparent; color: var(--rail-muted); display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 10px; border-radius: var(--r); font-size: 12.5px; white-space: nowrap; }
.collapse-btn:hover { background: var(--rail-hover); color: #fff; }
.app.collapsed .brand-text, .app.collapsed .nav-section, .app.collapsed .nav .label, .app.collapsed .rail-foot, .app.collapsed .collapse-btn .label { display: none; }
.app.collapsed .nav .count { position: absolute; top: 2px; right: 2px; padding: 0 4px; font-size: 9.5px; }
.app.collapsed .brand { justify-content: center; padding-inline: 0; }
.app.collapsed .nav button, .app.collapsed .collapse-btn { justify-content: center; }
.feed { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3CBD8A; box-shadow: 0 0 0 3px rgba(60, 189, 138, .2); flex: none; }
.feed.paused .dot { background: #E1AD44; box-shadow: 0 0 0 3px rgba(225, 173, 68, .2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.icon-btn.menu-btn { display: none; }
.gsearch { position: relative; flex: 1 1 auto; max-width: 440px; min-width: 0; }
.gsearch input { width: 100%; border: 1px solid var(--line); background: var(--sunken); border-radius: var(--r); padding: 7px 34px 7px 34px; font-size: 13px; }
.gsearch input:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.gsearch > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.gsearch kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--surface); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 380px; overflow-y: auto; padding: 6px; }
.results .grp { font-family: var(--f-display); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 8px 8px 4px; }
.results button { display: flex; width: 100%; align-items: center; gap: 10px; justify-content: space-between; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 4px; font-size: 13px; }
.results button:hover, .results button.active { background: var(--hover); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { border: 1px solid transparent; background: transparent; width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn .badge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--crit); color: #fff; font-family: var(--f-mono); font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
.clock { font-family: var(--f-mono); font-size: 12px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.user-btn { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; }
.user-btn:hover { border-color: var(--line-strong); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: #fff; flex: none; letter-spacing: .02em; }
.user-btn .who { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-btn .who b { font-size: 12.5px; font-weight: 600; }
.user-btn .who span { font-size: 11px; color: var(--muted); }

.content { padding-block: 20px 48px; padding-inline: 24px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 28px; letter-spacing: -.01em; letter-spacing: .005em; text-wrap: balance; }
.page-head .sub { color: var(--muted); font-size: 13px; max-width: 72ch; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); padding: 7px 14px; border-radius: 9px; transition: border-color .15s, color .15s, transform .1s; font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--neg); border-color: var(--neg); }
.btn.danger.solid { background: var(--neg); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--surface); white-space: nowrap; }
.chip b { color: var(--fg); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-size: 12px; font-weight: 500; color: var(--muted); }
.input, .select, textarea.input { border: 1px solid var(--line-strong); border-radius: var(--r); padding: 7px 10px; background: var(--surface); font-size: 13px; min-width: 0; width: 100%; }
.input:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.search { flex: 1 1 220px; min-width: 0; max-width: 300px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); padding: 5px 11px; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.toggle { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong); border: 0; padding: 0; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { transform: translateX(14px); }
.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.link { border: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 500; padding: 0; }
.link:hover { text-decoration: underline; }

/* ---------- panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; box-shadow: var(--card-shadow); overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-family: var(--f-display); font-size: 16px; font-weight: 600; letter-spacing: -.005em; }
.panel-head .meta { font-size: 12px; color: var(--muted); }
.panel-body { padding: 14px 16px; }
.grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-family: var(--f-display); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
th.n, td.n { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--fg); }
th .arrow { color: var(--accent); }
td { padding: var(--row) 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td, tbody tr.selected td { background: var(--hover); }
tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; background: var(--sunken); }
td.sym { font-weight: 600; font-family: var(--f-mono); }
td .sub, .sub-line { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--f-body); font-weight: 400; }
.wrap { white-space: normal; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--fg); font-size: 14px; margin-bottom: 4px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.role::before, .pill.flat::before { display: none; }
.pill.ok, .pill.active { background: var(--pos-soft); color: var(--pos); }
.pill.watch, .pill.invited { background: var(--warn-soft); color: var(--warn); }
.pill.call { background: var(--neg-soft); color: var(--neg); }
.pill.stopout { background: var(--crit); color: #fff; }
.pill.flat, .pill.disabled { background: var(--sunken); color: var(--muted); }
.pill.role { background: var(--accent-soft); color: var(--accent); }
.book { font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.book.A { background: var(--a-soft); color: var(--a-book); } .book.B { background: var(--b-soft); color: var(--b-book); }
.side-buy { color: var(--pos); font-weight: 500; } .side-sell { color: var(--neg); font-weight: 500; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--card-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: auto -30px -50px auto; width: 120px; height: 120px; border-radius: 50%; background: var(--tint, var(--accent)); opacity: .07; }
.kpi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--tint, var(--accent)) 16%, transparent); color: var(--tint, var(--accent)); }
.kpi-label { font-size: 12.5px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-family: var(--f-display); font-size: 28px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi .spark { position: absolute; right: 16px; top: 54px; width: 84px; height: 30px; }

/* exposure bars */
.div { position: relative; height: 10px; min-width: 110px; background: var(--sunken); border-radius: 2px; }
.div::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.div i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.div i.l { left: 50%; background: linear-gradient(90deg, color-mix(in srgb, var(--pos) 60%, transparent), var(--pos)); } .div i.s { right: 50%; background: linear-gradient(270deg, color-mix(in srgb, var(--neg) 60%, transparent), var(--neg)); }
.usage { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.usage .bar { width: 76px; height: 7px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.usage .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.usage.hot .bar i { background: linear-gradient(90deg, var(--gold), var(--warn)); } .usage.over .bar i { background: linear-gradient(90deg, var(--neg), var(--crit)); }
.ml { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.ccy { display: grid; grid-template-columns: 44px minmax(0, 1fr) 84px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.ccy .code { font-family: var(--f-mono); font-weight: 600; }
.ccy .v { text-align: right; font-family: var(--f-mono); }

/* alerts */
.alerts { list-style: none; margin: 0; padding: 0; }
.alert { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.alert:last-child { border-bottom: 0; }
.alert .stripe { align-self: stretch; border-radius: 2px; background: var(--faint); }
.alert.critical .stripe { background: var(--crit); } .alert.high .stripe { background: var(--neg); } .alert.medium .stripe { background: var(--warn); } .alert.info .stripe { background: var(--accent); }
.alert-type { font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.alert-type .sev { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--muted); font-weight: 500; }
.alert-text { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.alert-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 11.5px; color: var(--faint); font-family: var(--f-mono); }
.alert.acked { opacity: .5; }

.chart { width: 100%; height: 230px; display: block; }
.chart text { font-family: var(--f-mono); font-size: 10.5px; fill: var(--faint); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; white-space: nowrap; }
.fchip button { border: 0; background: transparent; color: inherit; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.fchip button:hover { background: var(--surface); }
.views { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 16px 0; }
.views button { border: 0; border-bottom: 2px solid transparent; background: none; padding: 6px 10px 8px; font-size: 13px; color: var(--muted); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.views button:hover { color: var(--fg); }
.views button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.views .x { color: var(--faint); font-size: 11px; }
.views-wrap { border-bottom: 1px solid var(--line); }
.bulk { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* popover, modal, drawer, toast */
.pop { position: fixed; z-index: 60; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 14px; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; }
.pop.menu { padding: 6px; gap: 0; width: 240px; }
.pop.menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 4px; text-align: left; font-size: 13px; width: 100%; }
.pop.menu button:hover { background: var(--hover); }
.pop.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.pop.menu .hd { padding: 8px 10px; }
.pop h4 { margin: 0; font-family: var(--f-display); font-size: 14px; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .field { flex: 1 1 120px; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: var(--shadow); }
.drawer-head { padding: 16px 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.drawer-head .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-head h3 { margin: 0; font-family: var(--f-display); font-size: 19px; font-weight: 600; }
.drawer-body { overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: none; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.facts .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-family: var(--f-display); }
.facts .v { font-family: var(--f-mono); font-size: 14px; overflow-wrap: anywhere; }
.facts.contact { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.2fr) minmax(0, .8fr); }
.facts.contact .v { font-size: 13px; }
.note { font-size: 13px; color: var(--muted); background: var(--sunken); border-radius: var(--r); padding: 10px 12px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.modal { position: fixed; z-index: 70; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.modal-scrim { z-index: 69; }
.modal header { padding: 18px 20px 6px; }
.modal header h3 { margin: 0; font-family: var(--f-display); font-size: 18px; font-weight: 600; }
.modal header p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.modal .body { padding: 12px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal footer { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.form-error { color: var(--neg); font-size: 12.5px; }
.toasts { position: fixed; z-index: 80; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: var(--r); font-size: 13px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--neg); color: #fff; }

/* matrices & misc */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td.cat { background: var(--sunken); font-family: var(--f-display); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--muted); text-align: left; }
.perm-name { font-weight: 500; }
.split { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split .k { font-size: 12px; color: var(--muted); }
.split .v { font-family: var(--f-mono); font-size: 18px; }
.bookbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 12px; background: var(--sunken); }
.bookbar .a { background: var(--a-book); } .bookbar .b { background: var(--b-book); }
.scenario { display: grid; grid-template-columns: 74px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.scenario input[type="range"] { width: 100%; accent-color: var(--accent); }
.scenario .v { text-align: right; font-family: var(--f-mono); }
.demo-tag { font-size: 11px; font-family: var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--warn); background: var(--warn-soft); padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.locked { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.login-art { background: linear-gradient(140deg, #0B1630 0%, #10305A 50%, #0B5E73 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; position: relative; overflow: hidden; }
.login-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.login-art > * { position: relative; }
.login-art h2 { font-family: var(--f-display); font-size: 40px; letter-spacing: -.02em; line-height: 1.1; margin: 0; font-weight: 600; max-width: 16ch; text-wrap: balance; }
.login-art p { color: var(--rail-fg); max-width: 44ch; margin: 12px 0 0; }
.login-art .ticks { display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 12px; color: var(--rail-fg); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 0; font-family: var(--f-display); font-size: 26px; font-weight: 600; }
.demo-users { display: flex; flex-direction: column; gap: 6px; }
.demo-users button { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 8px 10px; text-align: left; }
.demo-users button:hover { border-color: var(--accent); }
.demo-users .meta { margin-left: auto; font-size: 11.5px; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) { .flash-up { animation: fu .8s ease-out; } .flash-dn { animation: fd .8s ease-out; } }
@keyframes fu { from { background: var(--pos-soft); } } @keyframes fd { from { background: var(--neg-soft); } }

@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 1280px) { .grid, .grid.even { grid-template-columns: minmax(0, 1fr); } .grid.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 900px) { .clock, .user-btn .who { display: none; } .split { grid-template-columns: repeat(2, minmax(0, 1fr)); } .login { grid-template-columns: minmax(0, 1fr); } .login-art { display: none; } }
@media (max-width: 760px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .app.nav-open .rail { transform: none; box-shadow: var(--shadow); }
  .app.collapsed .brand-text, .app.collapsed .nav-section, .app.collapsed .nav .label, .app.collapsed .rail-foot { display: revert; }
  .collapse-btn { display: none; }
  .icon-btn.menu-btn { display: grid; }
  .app.nav-open .main { filter: brightness(.6); }
  .topbar { padding: 8px 16px; gap: 6px; }
  .gsearch kbd { display: none; }
  .content { padding-inline: 16px; }
  .grid.three, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .spark { display: none; }
}

/* ---------- refresh: hero, to-do, heat map, donut, hints ---------- */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px 24px; border-radius: 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #0B1630 0%, #10305A 55%, #0B5E73 100%); box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 220px at 85% 0%, rgba(45,212,227,.35), transparent 70%), radial-gradient(400px 200px at 10% 120%, rgba(245,184,61,.18), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero.s-watch { background: linear-gradient(120deg, #0B1630 0%, #2A3360 55%, #7A5A12 100%); }
.hero.s-elevated { background: linear-gradient(120deg, #1A1030 0%, #4A1F3E 55%, #9A4A14 100%); }
.hero.s-critical { background: linear-gradient(120deg, #1E0A14 0%, #5A1424 55%, #A82A1A 100%); }
.gauge { width: 150px; height: 92px; }
.gauge text { fill: #fff; font-family: var(--f-display); }
.hero-eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.7); font-weight: 500; }
.hero-title { font-family: var(--f-display); font-size: 30px; font-weight: 600; letter-spacing: -.015em; margin: 2px 0 6px; line-height: 1.1; }
.hero-text { color: rgba(255,255,255,.85); font-size: 14px; max-width: 70ch; }
.hero-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.hero .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff; justify-content: center; }
.hero .btn:hover:not(:disabled) { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.4); }
.hero .btn.primary { background: #fff; color: #0B1630; border-color: #fff; box-shadow: none; }
.hero .btn.primary:hover:not(:disabled) { color: #0B1630; filter: none; background: #E6FBFD; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); white-space: nowrap; }
.hero-chip b { font-family: var(--f-mono); font-weight: 600; }

.todo { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.todo li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--sunken); border: 1px solid transparent; }
.todo li:hover { border-color: var(--line-strong); }
.todo .t-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.todo .critical .t-ico, .todo li.critical .t-ico { background: linear-gradient(135deg, #FF6A5D, #C8231A); }
.todo li.high .t-ico { background: linear-gradient(135deg, #FF9A6A, #D1422F); }
.todo li.medium .t-ico { background: linear-gradient(135deg, #F7C964, #B26B00); }
.todo .t-title { font-weight: 600; font-size: 13.5px; }
.todo .t-text { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.todo .t-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 14px 16px; }
.tile { border: 0; text-align: left; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; color: var(--fg); position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--heat) calc(var(--u) * 1%), var(--sunken)); transition: transform .12s; }
.tile:hover { transform: translateY(-2px); }
.tile .sym { font-family: var(--f-mono); font-weight: 600; font-size: 13px; }
.tile .u { font-family: var(--f-display); font-size: 20px; font-weight: 600; }
.tile .l { font-size: 11.5px; color: var(--muted); font-family: var(--f-mono); }
.tile.hot .l, .tile.over .l { color: inherit; opacity: .85; }
.tile.over { color: #fff; } .tile.over .l { color: #fff; }

.donut-wrap { display: flex; align-items: center; gap: 18px; padding: 16px; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: none; }
.donut text { font-family: var(--f-display); fill: var(--fg); }
.legend-list { display: flex; flex-direction: column; gap: 10px; font-size: 13px; min-width: 0; flex: 1 1 160px; }
.legend-list .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; vertical-align: middle; }
.legend-list .row-l { display: flex; justify-content: space-between; gap: 10px; }
.legend-list .v { font-family: var(--f-mono); }

.hint { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--faint); font-size: 10px; font-weight: 600; font-family: var(--f-body); cursor: help; position: relative; text-transform: none; letter-spacing: 0; flex: none; }
.hint:hover, .hint:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.kpi-label .hint, .panel-head h2 .hint { margin-left: 2px; }
.panel-head h2 { display: flex; align-items: center; gap: 6px; }
.tip { position: fixed; z-index: 95; max-width: 280px; background: var(--fg); color: var(--bg); padding: 8px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow); pointer-events: none; }
th .hint { margin-left: 4px; vertical-align: -2px; }
.greet { font-size: 13px; color: var(--muted); }
.mode-toggle { margin-left: 8px; }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-actions { flex-direction: row; flex-wrap: wrap; } .gauge { width: 130px; } }

/* BIS logo */
.brand-logo { display: block; width: 100%; max-width: 196px; height: auto; }
.brand-mark-img { display: none; height: 24px; width: auto; }
.app.collapsed .brand-logo { display: none; }
.app.collapsed .brand-mark-img { display: block; }
.login-logo { width: 320px; max-width: 100%; height: auto; }
.logo-themed img { display: block; width: 220px; max-width: 100%; height: auto; }
.logo-themed .for-dark { display: none; }
:root[data-theme="dark"] .logo-themed .for-dark { display: block; }
:root[data-theme="dark"] .logo-themed .for-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-themed .for-dark { display: block; }
  :root:not([data-theme="light"]) .logo-themed .for-light { display: none; }
}
@media (min-width: 901px) { .login-card .logo-themed { display: none; } }
@media (max-width: 760px) { .app.collapsed .brand-logo { display: block; } .app.collapsed .brand-mark-img { display: none; } }
