/* SV Funded — design system v3 "carbon cockpit".
   Dark-first: :root carries the carbon theme, html[data-theme="light"] overrides.
   Race Red is identity/action only; Profit/Loss/Hold are the data colors.
   Archivo (voice, width axis for display), JetBrains Mono (numbers, tabular).
   Color tokens stay 6-digit hex — the chart appends an alpha byte. */
:root {
  --bg: #0A0B0D;
  --bg2: #0F1114;
  --panel: #131518;
  --panel2: #1A1D22;
  --border: #23262D;
  --border2: #31353E;
  --text: #EDEFF3;
  --muted: #99A0AC;
  --accent: #E01B24;         /* Race Red */
  --accent-strong: #B3131C;  /* Red Press */
  --accent-soft: #261214;
  --accent2: #FF3B44;        /* bright red on carbon */
  --ok: #12B76A;             /* Profit */
  --ok-soft: #0E2B1F;
  --warn: #F5A524;           /* Hold */
  --warn-soft: #2E2410;
  --danger: #F04438;         /* Loss */
  --danger-soft: #351417;
  /* the sidebar is carbon in both themes */
  --side-bg: #0C0D10;
  --side-border: #1D2026;
  --side-text: #EDEFF3;
  --side-muted: #858C99;
  --radius: 14px;            /* surfaces */
  --radius-ctl: 6px;         /* controls */
  --nav-h: 66px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.44, 1);
  --t-micro: 140ms;
  --t-std: 260ms;
  --t-page: 520ms;
  --grad-red: linear-gradient(160deg, #FF3B44, #D5161F 55%, #A00F17);
  --grad-red-press: linear-gradient(160deg, #E02830, #B3131C 60%, #870D13);
  --ring: 0 0 0 3px rgba(224, 27, 36, .22);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 50px rgba(0, 0, 0, .5);
  --font-sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #F3F4F7;
  --bg2: #EAECF0;
  --panel: #FFFFFF;
  --panel2: #F0F2F5;
  --border: #DDE0E6;
  --border2: #C9CDD6;
  --text: #101215;
  --muted: #667085;
  --accent: #E01B24;
  --accent-strong: #B3131C;
  --accent-soft: #FBE9EA;
  --accent2: #C4141D;
  --ok: #0B8A57;
  --ok-soft: #E3F5EC;
  --warn: #A16207;
  --warn-soft: #FBF0DA;
  --danger: #D92D20;
  --danger-soft: #FBE9E7;
  --ring: 0 0 0 3px rgba(224, 27, 36, .16);
  --shadow-1: 0 1px 2px rgba(16, 18, 21, .05), 0 8px 24px rgba(16, 18, 21, .07);
  --shadow-2: 0 2px 6px rgba(16, 18, 21, .06), 0 18px 50px rgba(16, 18, 21, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* keep `hidden` winning over component display rules */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-std) var(--ease), color var(--t-std) var(--ease);
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.015em; }
img { max-width: 100%; }
::selection { background: var(--accent); color: #FFFFFF; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* slim scrollbars that match the surface */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- display type ---------- */
/* Expanded heavyweight caps — the racing voice. Pair with .sx serif accents. */
.disp {
  font-family: var(--font-sans);
  font-stretch: 116%; font-weight: 900; text-transform: uppercase;
  letter-spacing: -0.015em; line-height: .96;
}
.sx { /* serif italic accent — deliberately breaks the grid */
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  text-transform: none; letter-spacing: 0;
}
.kick {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.kick::before { content: ""; width: 26px; height: 1px; background: var(--accent); box-shadow: 0 0 8px rgba(224,27,36,.8); }

/* ---------- brand mark ---------- */
.logo-mark { display: inline-flex; width: 46px; flex-shrink: 0; }
.logo-mark svg, .logo-mark img { width: 100%; height: auto; display: block; }
.wordmark { font-weight: 900; font-stretch: 112%; letter-spacing: .04em; }
.wordmark.metal {
  background: linear-gradient(180deg, #FFFFFF 25%, #8E959F 60%, #E8EAEE 78%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: .3em; margin-right: -.3em; font-weight: 900;
}
.lockup-rules { display: flex; align-items: center; gap: 14px; }
.lockup-rules .line { height: 2px; width: 64px; background: linear-gradient(90deg, transparent, #E01B24); }
.lockup-rules .line.r { background: linear-gradient(90deg, #E01B24, transparent); }

/* ---------- buttons ---------- */
/* Solid buttons are chamfered like the blade logo; ghosts stay hairline rects. */
.btn {
  --cut: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border: 1px solid transparent; border-radius: 0;
  background: var(--grad-red); color: #FFFFFF;
  font-family: var(--font-sans); font-weight: 800; font-size: 14px; letter-spacing: .015em;
  cursor: pointer; position: relative; overflow: hidden; white-space: nowrap;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: transform var(--t-micro) var(--ease), filter var(--t-micro) var(--ease),
    background var(--t-micro) var(--ease), color var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
  text-decoration: none !important;
}
.btn:hover { background: var(--grad-red-press); transform: translateY(-1px); filter: drop-shadow(0 8px 22px rgba(224, 27, 36, .45)); }
.btn:active { transform: translateY(0); filter: none; }
/* shine sweep on solid buttons */
.btn:not(.ghost)::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: skewX(-18deg); transition: left .5s var(--ease); pointer-events: none;
}
.btn:not(.ghost):hover::after { left: 120%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn.ghost {
  --cut: 0px; clip-path: none; border-radius: var(--radius-ctl);
  background: transparent; color: var(--text); border-color: var(--border2);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent2); background: rgba(224, 27, 36, .06); transform: none; filter: none; }
.btn.soft { background: var(--accent-soft); color: var(--accent2); }
.btn.soft:hover { background: var(--grad-red); color: #FFFFFF; filter: none; }
.btn.danger { background: linear-gradient(160deg, #FF5A4E, #D92D20 60%, #B42318); }
.btn.danger:hover { filter: brightness(.92) drop-shadow(0 6px 18px rgba(240, 68, 56, .35)); background: linear-gradient(160deg, #FF5A4E, #D92D20 60%, #B42318); }
.btn.ok { background: linear-gradient(160deg, #1FD584, #0FA361 60%, #0B7B49); }
.btn.ok:hover { filter: brightness(.92) drop-shadow(0 6px 18px rgba(18, 183, 106, .35)); background: linear-gradient(160deg, #1FD584, #0FA361 60%, #0B7B49); }
.btn.sm { --cut: 6px; padding: 7px 14px; font-size: 13px; }
.btn.lg { --cut: 10px; padding: 15px 30px; font-size: 15px; letter-spacing: .03em; text-transform: uppercase; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- cards / panels ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, 0) 42%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: border-color var(--t-std) var(--ease);
}
html[data-theme="light"] .card { background: var(--panel); box-shadow: var(--shadow-1); }
.card.flat { box-shadow: none; }
.card h3 { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px;
  border-radius: 4px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: .04em; white-space: nowrap; border: 1px solid transparent;
}
.badge.gray { background: var(--panel2); color: var(--muted); border-color: var(--border); }
.badge.blue { background: var(--accent-soft); color: var(--accent2); border-color: rgba(224, 27, 36, .25); }
.badge.green { background: var(--ok-soft); color: var(--ok); border-color: rgba(18, 183, 106, .25); }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: rgba(240, 68, 56, .25); }
.badge.yellow { background: var(--warn-soft); color: var(--warn); border-color: rgba(245, 165, 36, .25); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- forms ---------- */
label.fld { display: block; margin-bottom: 15px; }
label.fld > span {
  display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
input, select, textarea {
  width: 100%; padding: 12px 15px; border-radius: var(--radius-ctl); border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font: inherit; outline: none;
  transition: border-color var(--t-micro) var(--ease), box-shadow var(--t-micro) var(--ease), background var(--t-micro) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--border2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); background: var(--panel);
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
/* password show/hide */
.pwwrap { position: relative; display: block; width: 100%; }
.pwwrap input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted);
  border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: color var(--t-micro) var(--ease), background var(--t-micro) var(--ease);
}
.pw-eye:hover { color: var(--accent2); background: var(--accent-soft); }
.pw-eye svg { width: 19px; height: 19px; }
textarea { resize: vertical; min-height: 96px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.checkline { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.checkline input { width: 17px; height: 17px; accent-color: #E01B24; }

/* ---------- custom dropdowns ---------- */
.switchers { display: flex; align-items: center; gap: 8px; }
.dd { display: inline-flex; }
.dd2 { position: relative; display: inline-flex; min-width: 0; }
.dd2 > select { display: none !important; }
.dd2-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 9px;
  width: 100%; padding: 9px 13px; font: inherit; font-size: 13px; font-weight: 600;
  background: var(--bg2); color: var(--text); text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-ctl); cursor: pointer;
  transition: border-color var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.switchers .dd2-btn {
  background: transparent; padding: 6px 10px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; border-color: transparent;
}
.switchers .dd2-btn:hover, .switchers .dd2.open .dd2-btn { border-color: var(--border2); }
.dd2-btn:hover { border-color: var(--border2); }
.dd2-btn:disabled { opacity: .6; cursor: not-allowed; }
.dd2.open .dd2-btn { border-color: var(--accent); }
.dd2-chev {
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--muted); flex-shrink: 0;
  transition: transform var(--t-micro) var(--ease);
}
.dd2.open .dd2-chev { transform: rotate(180deg); border-top-color: var(--accent2); }
.dd2-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 250;
  min-width: 100%; max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border2); border-radius: 10px;
  padding: 5px; box-shadow: var(--shadow-2);
}
.dd2.open .dd2-menu { display: block; animation: ddin var(--t-std) var(--spring); }
@keyframes ddin { from { transform: translateY(-6px) scale(.98); opacity: 0; } }
.dd2-item {
  padding: 9px 13px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text);
  display: flex; justify-content: space-between; gap: 14px;
  transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.dd2-item:hover { background: var(--accent-soft); color: var(--accent2); }
.dd2-item.sel { color: var(--accent2); }
.dd2-item.sel::after { content: "✓"; font-family: var(--font-mono); }

/* ---------- drawer (mobile menus) ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(5, 6, 8, .6); backdrop-filter: blur(4px);
  animation: fadein var(--t-std) var(--ease);
}
@keyframes fadein { from { opacity: 0; } }
body.no-scroll { overflow: hidden; }

/* ---------- live chat ---------- */
.chatfab {
  position: fixed; right: 18px; bottom: 18px; z-index: 135;
  width: 54px; height: 54px; border-radius: 16px; border: 0; cursor: pointer;
  background: var(--grad-red); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(224, 27, 36, .4);
  transition: transform var(--t-std) var(--spring), box-shadow var(--t-std) var(--ease);
}
.chatfab:hover { transform: translateY(-3px) rotate(-3deg); box-shadow: 0 16px 40px rgba(224, 27, 36, .5); }
.chatfab svg { width: 24px; height: 24px; }
.chatfab-dot { /* unread-count badge on the minimized bubble */
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: 10px;
  background: var(--warn); color: #0A0B0D; border: 2px solid var(--bg);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.chat-endlink {
  display: block; margin: 8px auto 0; padding: 2px 8px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-family: var(--font-sans); font-size: 11.5px; font-weight: 600;
  transition: color var(--t-micro) var(--ease);
}
.chat-endlink:hover { color: var(--danger); }
/* typing indicator (widget + staff console) */
.chat-typing {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 17px 8px; color: var(--muted); font-size: 12px;
}
.chatc-thread .chat-typing { padding: 4px 2px 6px; }
.chat-typing .tdots { display: inline-flex; gap: 3px; }
.chat-typing .tdots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--muted);
  animation: tdot 1.2s ease-in-out infinite;
}
.chat-typing .tdots i:nth-child(2) { animation-delay: .18s; }
.chat-typing .tdots i:nth-child(3) { animation-delay: .36s; }
@keyframes tdot { 0%, 70%, 100% { opacity: .25; transform: none; } 35% { opacity: 1; transform: translateY(-2px); } }
.chatpanel {
  position: fixed; right: 18px; bottom: 84px; z-index: 140;
  width: min(370px, calc(100vw - 24px)); height: min(520px, calc(100dvh - 110px));
  background: var(--panel); border: 1px solid var(--border2); border-radius: 18px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-2);
  animation: chatin var(--t-page) var(--spring);
}
@keyframes chatin { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.chat-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 15px 17px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(224, 27, 36, .07), transparent), var(--panel2);
}
.chat-head b { font-size: 14px; font-weight: 800; letter-spacing: .02em; }
.chat-sub { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 3px; }
.chat-sub .dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(18, 183, 106, .8); }
.chat-sub .dot.off { background: var(--muted); }
.chat-x { border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px; }
.chat-x:hover { color: var(--text); }
.chat-body { flex: 1; overflow-y: auto; padding: 15px 17px; }
.chat-msgs { display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 85%; animation: msgin var(--t-std) var(--spring); }
@keyframes msgin { from { transform: translateY(6px); opacity: 0; } }
.chat-msg .who { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.chat-msg .bubble {
  padding: 10px 14px; border-radius: 4px 12px 12px 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word;
  background: var(--panel2); border: 1px solid var(--border);
}
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-msg.mine .bubble {
  background: var(--grad-red); color: #FFFFFF; border: 0; text-align: left;
  border-radius: 12px 4px 12px 12px;
}
.chat-foot { padding: 13px 15px; border-top: 1px solid var(--border); background: var(--panel); }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; }
/* widget: conversation history on the home view */
.chat-hist-t {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px;
}
.chat-hist-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; color: var(--text); font: inherit;
  transition: border-color var(--t-micro) var(--ease);
}
.chat-hist-item:hover { border-color: var(--accent); }
.chat-hist-item .chi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.chat-hist-item .chi-top b { font-family: var(--font-mono); font-size: 12px; }
.chat-hist-item .chi-body { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-hist-item .chi-at { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 10px; margin-top: 4px; }
.chat-back { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.chat-back:hover { color: var(--text); }
.chat-back svg { width: 17px; height: 17px; }

/* staff chat console */
.chatc { display: grid; grid-template-columns: 310px 1fr; gap: 16px; align-items: start; }
.chatc > * { min-width: 0; }
.chatc-list { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.chatc-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; cursor: pointer;
  transition: border-color var(--t-micro) var(--ease), background var(--t-micro) var(--ease);
}
.chatc-item:hover { border-color: var(--border2); background: var(--panel2); }
.chatc-item.sel { border-color: var(--accent); }
.chatc-item.off { opacity: .55; }
.chatc-item .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatc-thread {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; min-height: 420px; max-height: 74vh;
}
.chatc-msgs { flex: 1; overflow-y: auto; padding: 4px 2px; }
.chatc-thread .chat-foot { padding: 12px 0 0; border-top: 1px solid var(--border); background: transparent; }
@media (max-width: 900px) { .chatc { grid-template-columns: 1fr; } .chatc-list { max-height: 300px; } }

/* ---------- scroll to top ---------- */
.to-top {
  position: fixed; right: 18px; bottom: 84px; z-index: 130;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity var(--t-std) var(--ease), transform var(--t-std) var(--ease),
    border-color var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { border-color: var(--accent); color: var(--accent2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.tbl th, .tbl td { text-align: left; padding: 12px 15px; border-bottom: 1px solid var(--border); }
.tbl th {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  background: var(--bg2); border-bottom-color: var(--border2);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr, .tbl tr { transition: background var(--t-micro) var(--ease); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover { background: var(--panel2); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.93em; }

/* ---------- tabs / chips ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .tab {
  padding: 8px 18px; border-radius: var(--radius-ctl); cursor: pointer; font-weight: 700; font-size: 13.5px;
  color: var(--muted); background: transparent; border: 1px solid var(--border);
  font-family: var(--font-sans); letter-spacing: .01em;
  transition: color var(--t-micro) var(--ease), background var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}
.tabs .tab:hover { color: var(--text); border-color: var(--border2); }
.tabs .tab.active { background: var(--grad-red); border-color: transparent; color: #FFFFFF; }
/* segmented control variant (auth) */
.tabs.seg { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; flex-wrap: nowrap; }
.tabs.seg .tab { border: 0; border-radius: 7px; padding: 10px 18px; }
.tabs.seg .tab:not(.active):hover { background: var(--panel2); color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 15px; border-radius: 4px; border: 1px solid var(--border); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .03em;
  color: var(--muted); background: var(--panel);
  transition: color var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border2); }
.chip.active { border-color: var(--accent); color: var(--accent2); background: var(--accent-soft); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 6, 8, .68); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(6px); animation: fadein var(--t-std) var(--ease);
}
.modal {
  background: var(--panel); border: 1px solid var(--border2); border-radius: var(--radius);
  max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px;
  box-shadow: var(--shadow-2); position: relative;
  animation: modalin var(--t-page) var(--spring);
}
.modal::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  border-radius: var(--radius) var(--radius) 0 0;
}
@keyframes modalin { from { transform: translateY(18px) scale(.98); opacity: 0; } }
.modal h3 { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal .x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; background: none; border: 0; }
.modal .x:hover { color: var(--text); }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); color: var(--text); border: 1px solid var(--border2);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 13px 17px;
  font-size: 14px; max-width: 340px; box-shadow: var(--shadow-2);
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  animation: slidein var(--t-page) var(--spring);
}
.toast .toast-ic { font-weight: 800; color: var(--accent2); flex-shrink: 0; font-family: var(--font-mono); }
.toast.ok { border-left-color: var(--ok); } .toast.ok .toast-ic { color: var(--ok); }
.toast.err { border-left-color: var(--danger); } .toast.err .toast-ic { color: var(--danger); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }

/* ---------- tooltips ---------- */
.tip {
  position: fixed; z-index: 400; max-width: 260px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2);
  border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 500; line-height: 1.45;
  box-shadow: var(--shadow-1);
  opacity: 0; transform: translateY(3px); pointer-events: none;
  transition: opacity var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.tip.show { opacity: 1; transform: none; }

/* ---------- app shell (dashboards) ---------- */
/* The sidebar stays carbon in both themes — the cockpit never changes color. */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 240px; flex-shrink: 0; background: var(--side-bg); border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column; position: sticky; top: 0;
  /* dvh tracks the real visible height on mobile (address bar shown/hidden) —
     with plain 100vh the foot (logout) ends up below the screen edge */
  height: 100vh; height: 100dvh;
}
.side .brand { padding: 22px 20px 18px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.side .brand .logo-mark { width: 36px; }
.side .brand a { display: flex; align-items: center; gap: 10px; color: var(--side-text); text-decoration: none !important; }
.side .brand .wordmark { letter-spacing: .14em; font-size: 14px; }
.side nav { flex: 1; padding: 10px 12px; overflow-y: auto; }
.side nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px;
  color: var(--side-muted); font-weight: 600; font-size: 13.5px; margin-bottom: 2px;
  text-decoration: none !important; position: relative;
  transition: color var(--t-micro) var(--ease), background var(--t-micro) var(--ease);
}
.side nav a .nic { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.side nav a .nic svg { width: 18px; height: 18px; }
.side nav a:hover { background: rgba(255, 255, 255, .045); color: var(--side-text); }
.side nav a.active { background: linear-gradient(90deg, rgba(224, 27, 36, .16), rgba(224, 27, 36, .03)); color: #FFFFFF; }
.side nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0; box-shadow: 0 0 10px rgba(224, 27, 36, .7);
}
.side nav a.active .nic { color: var(--accent2); }
.side nav a .ncount {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--grad-red); color: #FFFFFF;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(224, 27, 36, .35);
}
.side nav a .ncount.show { display: inline-flex; }
.side .foot { padding: 14px; border-top: 1px solid var(--side-border); font-size: 13px; display: flex; flex-direction: column; gap: 12px; color: var(--side-text); }
.side .foot .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side .foot .ava {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--grad-red); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  text-transform: uppercase; box-shadow: 0 4px 12px rgba(224, 27, 36, .35);
}
.side .foot .who .id { min-width: 0; }
.side .foot .who .em { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot .who .rl { color: var(--side-muted); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.side .foot .btn { border-color: var(--side-border); color: var(--side-muted); }
.side .foot .btn:hover { border-color: var(--accent); color: var(--accent2); }
.side .foot .btn svg { width: 15px; height: 15px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--nav-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  position: sticky; top: 0; z-index: 50; gap: 10px;
}
.topbar .title { font-weight: 800; font-size: 16px; letter-spacing: .01em; }
.content { padding: 26px 24px; max-width: 1280px; width: 100%; margin: 0 auto; animation: viewfade var(--t-page) var(--ease); }
@keyframes viewfade { from { opacity: 0; transform: translateY(6px); } }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; left: 20px; right: auto; bottom: 0; width: 28px; height: 2px;
  background: var(--accent); opacity: 0; transition: opacity var(--t-std) var(--ease), width var(--t-std) var(--ease);
}
.stat:hover::after { opacity: 1; width: 48px; }
.stat .k { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hamburger { display: none; border: 1px solid var(--border); background: transparent; color: var(--text);
  width: 38px; height: 38px; border-radius: var(--radius-ctl); cursor: pointer; font-size: 18px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.right { text-align: right; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.up { color: var(--ok); } .down { color: var(--danger); }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* prose (rendered content pages) */
.prose h2 { font-size: 20px; margin-top: 26px; }
.prose h3 { font-size: 16px; margin-top: 18px; }
.prose ul { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose p { margin: 10px 0; }

/* chart */
.chartbox { position: relative; }
.chartbox canvas { width: 100%; height: 260px; display: block; }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity var(--t-page) var(--ease), transform var(--t-page) var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- speed streaks (racing light-trail background) ----------
   Long-exposure red light trails on carbon: <div class="speedbg"><i></i>×7</div>
   inside a position:relative section. Streaks sweep horizontally at different
   heights/speeds; ::before is the big blurred light band, ::after the wet-floor
   reflection glow. */
.speedbg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* the photo already carries the trails — the animated layer stays whisper-quiet:
   three slow faint streaks, no extra band or floor glow */
.speedbg i {
  position: absolute; left: -40%; width: 120%; height: 2px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(224, 27, 36, .55) 30%, rgba(255, 90, 96, .8) 52%, rgba(224, 27, 36, .45) 70%, transparent);
  filter: blur(1.5px); opacity: 0; will-change: transform, opacity;
  animation: streak var(--sd, 4.6s) linear var(--so, 0s) infinite;
}
@keyframes streak {
  0% { transform: translateX(-16%); opacity: 0; }
  12% { opacity: var(--sa, .3); }
  70% { opacity: var(--sa, .3); }
  100% { transform: translateX(50%); opacity: 0; }
}
.speedbg i:nth-child(1) { top: 33%; --sd: 4.4s; --so: 0s;    --sa: .28; }
.speedbg i:nth-child(2) { top: 47%; height: 3px; filter: blur(2.5px); --sd: 5.2s; --so: 1.8s; --sa: .34; }
.speedbg i:nth-child(3) { top: 61%; --sd: 4.8s; --so: 3s; --sa: .22; }
.speedbg i:nth-child(n+4) { display: none; }
@media (prefers-reduced-motion: reduce) {
  .speedbg i { animation: none; opacity: .18; transform: none; }
}

/* dropdown icons (flags / theme glyphs) */
.dd2-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 13px; flex-shrink: 0;
  border-radius: 2.5px; overflow: hidden;
}
.dd2-ic svg { width: 100%; height: 100%; display: block; }
.dd2-ic.glyph { border-radius: 0; overflow: visible; width: 15px; height: 15px; }
.dd2-btn .dd2-label, .dd2-item .dd2-txt { display: inline-flex; align-items: center; gap: 8px; }

/* film grain texture — apply .grain to a position:relative section */
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: .05; mix-blend-mode: overlay;
}

@media (max-width: 900px) {
  .side {
    /* pin to both viewport edges instead of trusting a height value */
    position: fixed; z-index: 150; top: 0; bottom: 0; height: auto;
    left: 0; transform: translateX(-100%);
    transition: transform var(--t-std) var(--ease);
    border-right: 1px solid var(--side-border);
  }
  .side .foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .side.open { transform: translateX(0); }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  /* the topbar already names the view — don't repeat the title on small screens */
  .content > .section-head > h2 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
