/* ============================================================================
   EDGEPLAN UI 2  -  "instrument panel"
   Everything here is scoped under html.ui2, so the Classic UI (no class) is
   byte-for-byte the old stylesheet. Loaded after styles.css.
   ========================================================================== */

@font-face { font-family: 'Inter'; src: url('../fonts/InterVariable-latin.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/SpaceGrotesk-Variable.woff2') format('woff2'); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/JetBrainsMono-Variable.woff2') format('woff2'); font-weight: 100 800; font-style: normal; font-display: swap; }

/* ---------- Shell pieces exist only in UI 2 ---------- */
.u2-only { display: none; }

/* ---------- Tokens ---------- */
html.ui2 {
  --bg: #07090d;
  --surface: #0d1118;
  --surface-2: #131925;
  --surface-hover: #1a2132;
  --border: rgba(148, 170, 210, .13);
  --border-soft: rgba(148, 170, 210, .07);

  --text: #e8edf6;
  --text-dim: #98a2b7;
  --text-faint: #7a88a3;   /* was #5f6c84 (3.6:1); now 5.3:1 on panels, passes WCAG AA for small text */

  --ion: #4cc9f0;
  --ion-dim: rgba(76, 201, 240, .14);
  --ion-line: rgba(76, 201, 240, .45);
  --green-cta: var(--ion);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --u2-side-w: 232px;
  --u2-top-h: 56px;
  --u2-pad: 28px;
  --u2-hi: inset 0 1px 0 rgba(255, 255, 255, .045);
  --shadow-md: 0 18px 40px -18px rgba(0, 0, 0, .7);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, "SF Mono", Consolas, monospace;
}
html.ui2.u2-collapsed { --u2-side-w: 68px; }
html.ui2.theme-light {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-hover: #e8ecf3;
  --border: rgba(28, 48, 90, .13);
  --border-soft: rgba(28, 48, 90, .07);
  --text: #111827;
  --text-dim: #4a5670;
  --text-faint: #5f6a82;   /* was #7b869e (3.2:1); now 5.4:1 */
  --teal: #087a58;         /* light theme text colours darkened to pass AA (were 3.1:1 to 4.5:1) */
  --amber: #85590a;
  --ion: #0a6f94;
  --ion-dim: rgba(10, 134, 175, .11);
  --ion-line: rgba(10, 134, 175, .4);
  --u2-hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-md: 0 16px 34px -16px rgba(20, 30, 60, .2);
}

/* ---------- Base type ---------- */
html.ui2, html.ui2 body {
  font-family: var(--font-ui);
  font-feature-settings: "tnum" 1, "cv11" 1, "ss03" 1;
  letter-spacing: -.003em;
}
html.ui2 h1, html.ui2 h2, html.ui2 h3, html.ui2 h4,
html.ui2 .stat-card-value, html.ui2 .risk-value, html.ui2 .risk-fig {
  font-family: var(--font-display);
  letter-spacing: -.02em;
}
html.ui2 :focus-visible { outline-color: var(--ion); }
html.ui2 input:focus-visible, html.ui2 textarea:focus-visible, html.ui2 select:focus-visible { outline-color: var(--ion); }
html.ui2 ::selection { background: var(--ion-dim); }
html.ui2 .u2-mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }

/* ---------- Ambient risk light (the signature) ---------- */
html.ui2 .u2-ambient {
  display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
html.ui2 .u2-ambient i {
  position: absolute; left: 50%; top: -34vh; width: 120vw; height: 70vh; transform: translateX(-50%);
  border-radius: 50%; opacity: 0; filter: blur(60px);
  transition: opacity 1.2s ease;
}
html.ui2 .u2-ambient i.calm { background: radial-gradient(closest-side, rgba(76, 201, 240, .20), transparent 72%); }
html.ui2 .u2-ambient i.warn { background: radial-gradient(closest-side, rgba(240, 180, 41, .20), transparent 72%); }
html.ui2 .u2-ambient i.high { background: radial-gradient(closest-side, rgba(226, 97, 126, .24), transparent 72%); }
html.ui2 .u2-ambient[data-risk="ok"] i.calm,
html.ui2 .u2-ambient[data-risk="none"] i.calm { opacity: 1; }
html.ui2 .u2-ambient[data-risk="warn"] i.warn { opacity: 1; }
html.ui2 .u2-ambient[data-risk="high"] i.high { opacity: 1; }
html.ui2.theme-light .u2-ambient { opacity: .55; }

/* ---------- Layout ---------- */
html.ui2 .dashboard { position: relative; z-index: 1; }
html.ui2 .body-row {
  display: grid;
  grid-template-columns: var(--u2-side-w) minmax(0, 1fr);
  grid-template-rows: var(--u2-top-h) minmax(0, 1fr);
  transition: grid-template-columns var(--dur-drawer) var(--ease-out);
}
html.ui2 .sidebar { display: none; }
html.ui2 .u2-side { display: flex; grid-column: 1; grid-row: 1 / -1; }
html.ui2 .u2-top { display: flex; grid-column: 2; grid-row: 1; }
html.ui2 .u2-sub { display: flex; }
html.ui2 .u2-tabbar, html.ui2 .u2-sheet, html.ui2 .u2-sheet-backdrop { display: none; }
html.ui2 .content {
  grid-column: 2; grid-row: 2;
  padding: 0 var(--u2-pad) 64px;
  position: relative;
  scroll-behavior: auto;
}

/* ---------- Sidebar ---------- */
html.ui2 .u2-side {
  flex-direction: column; gap: 4px; padding: 14px 12px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-right: 1px solid var(--border);
  overflow: hidden; z-index: 30;
}
html.ui2 .u2-brand { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 8px; margin-bottom: 14px; color: var(--text); white-space: nowrap; }
html.ui2 .u2-logo {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(76, 201, 240, .22), rgba(76, 201, 240, .06));
  border: 1px solid var(--ion-line); color: var(--ion);
}
html.ui2 .u2-logo svg { width: 17px; height: 17px; }
html.ui2 .u2-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.03em; }
html.ui2 .u2-nav { display: flex; flex-direction: column; gap: 2px; position: relative; }
html.ui2 .u2-nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--text-dim); font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
html.ui2 .u2-nav-item svg { flex: 0 0 auto; width: 19px; height: 19px; }
html.ui2 .u2-nav-item .u2-dot {
  margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 3px var(--rose-dim);
}
html.ui2 .u2-nav-item .u2-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
html.ui2 .u2-nav-item .u2-dot.hidden { display: none; }
html.ui2 .u2-nav-item.active { color: var(--text); background: var(--ion-dim); }
html.ui2 .u2-nav-item.active svg { color: var(--ion); }
html.ui2 .u2-nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ion);
  box-shadow: 0 0 14px 1px var(--ion-line);
}
html.ui2 .u2-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
html.ui2 .u2-collapse { cursor: pointer; background: none; border: none; width: 100%; text-align: left; font: inherit; }
html.ui2 .u2-collapse svg { transition: transform var(--dur-drawer) var(--ease-out); }
html.ui2.u2-collapsed .u2-collapse svg { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) {
  html.ui2 .u2-nav-item:hover { color: var(--text); background: var(--surface-hover); }
  html.ui2 .u2-nav-item.active:hover { background: var(--ion-dim); }
}
html.ui2.u2-collapsed .u2-wordmark,
html.ui2.u2-collapsed .u2-nav-item .u2-lbl { display: none; }
html.ui2.u2-collapsed .u2-nav-item { padding: 0; justify-content: center; }
html.ui2.u2-collapsed .u2-nav-item .u2-dot { position: absolute; top: 8px; right: 12px; margin: 0; }
html.ui2.u2-collapsed .u2-brand { padding: 0; justify-content: center; }

/* ---------- Top bar ---------- */
html.ui2 .u2-top {
  align-items: center; gap: 14px; padding: 0 var(--u2-pad);
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  z-index: 25;
}
html.ui2 .u2-crumb { display: flex; align-items: baseline; gap: 9px; min-width: 0; white-space: nowrap; }
html.ui2 .u2-crumb .u2-hub { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
html.ui2 .u2-crumb .u2-sep { color: var(--text-faint); }
html.ui2 .u2-crumb .u2-view { color: var(--text-dim); font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
html.ui2 .u2-search {
  display: flex; align-items: center; gap: 9px; margin-left: auto; width: min(340px, 34vw); height: 36px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-faint); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--u2-hi);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
html.ui2 .u2-search svg { width: 15px; height: 15px; flex: 0 0 auto; }
html.ui2 .u2-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.ui2 .u2-search kbd {
  font: 600 10.5px var(--font-mono); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); color: var(--text-dim); background: var(--surface-2);
}
html.ui2 .u2-top-right { display: flex; align-items: center; gap: 6px; }
html.ui2 .u2-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  font: 600 12.5px var(--font-ui); cursor: pointer; white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
html.ui2 .u2-chip b { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
html.ui2 .u2-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); transition: background-color .6s ease, box-shadow .6s ease; }
html.ui2 .u2-chip[data-risk="ok"] i { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
html.ui2 .u2-chip[data-risk="warn"] i { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
html.ui2 .u2-chip[data-risk="high"] i { background: var(--rose); box-shadow: 0 0 0 3px var(--rose-dim); }
html.ui2 .u2-chip.is-stale { opacity: .6; }
html.ui2 .u2-sync-txt { font-size: 12px; color: var(--text-faint); padding: 0 6px 0 4px; white-space: nowrap; }
html.ui2 .u2-ibtn {
  position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
html.ui2 .u2-ibtn svg { width: 18px; height: 18px; }
html.ui2 .u2-ibtn:active, html.ui2 .u2-chip:active, html.ui2 .u2-nav-item:active { transform: scale(.97); }
html.ui2 .u2-ibtn.spinning svg { animation: spin .8s linear infinite; }
html.ui2 .u2-ibtn .u2-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--rose); color: #fff;
  font: 700 10px/16px var(--font-ui); text-align: center;
}
html.ui2 .u2-ibtn .u2-badge.hidden { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.ui2 .u2-ibtn:hover { color: var(--text); background: var(--surface-hover); }
  html.ui2 .u2-search:hover, html.ui2 .u2-chip:hover { border-color: var(--ion-line); color: var(--text); }
}
html.ui2 .u2-avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ion-line); background: var(--ion-dim); color: var(--ion);
  font: 700 13px var(--font-display); cursor: pointer; margin-left: 4px;
}

/* Avatar menu */
html.ui2 .u2-menu {
  display: none; position: absolute; right: var(--u2-pad); top: calc(var(--u2-top-h) - 6px); min-width: 220px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md), var(--u2-hi);
  z-index: 60; transform-origin: top right;
}
html.ui2 .u2-menu.open { display: block; animation: u2Pop var(--dur-base) var(--ease-out); }
html.ui2 .u2-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: none; background: none;
  border-radius: 8px; color: var(--text); font: 600 13px var(--font-ui); cursor: pointer; text-align: left;
}
html.ui2 .u2-menu button.danger { color: var(--rose); }
html.ui2 .u2-menu hr { border: none; border-top: 1px solid var(--border-soft); margin: 5px 4px; }
html.ui2 .u2-menu small { color: var(--text-faint); font-weight: 500; font-size: 11.5px; }
@media (hover: hover) and (pointer: fine) { html.ui2 .u2-menu button:hover { background: var(--surface-hover); } }
@keyframes u2Pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Hub sub-bar ---------- */
html.ui2 .u2-sub {
  position: sticky; top: 0; z-index: 20; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  margin: 0 calc(var(--u2-pad) * -1) 18px; padding: 14px var(--u2-pad) 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
html.ui2 .u2-sub.is-empty { padding: 0; height: 22px; margin-bottom: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html.ui2 .u2-sub .segmented { background: var(--surface); box-shadow: var(--u2-hi); }
html.ui2 .u2-sub .seg-btn { padding: 8px 16px; font-size: 13px; font-weight: 600; }
html.ui2 .u2-sub .seg-btn.active { color: var(--text); }
html.ui2 .u2-lens { display: flex; gap: 6px; flex-wrap: wrap; }
html.ui2 .u2-lens[hidden] { display: none; }
html.ui2 .u2-lens button {
  height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  font: 600 12.5px var(--font-ui); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
html.ui2 .u2-lens button.active { color: var(--ion); border-color: var(--ion-line); background: var(--ion-dim); }
@media (hover: hover) and (pointer: fine) { html.ui2 .u2-lens button:hover:not(.active) { color: var(--text); border-color: var(--text-faint); } }
html.ui2 .u2-sub .u2-sub-gap { width: 1px; height: 22px; background: var(--border); }

/* Seg indicator picks up the new accent */
html.ui2 .seg-btn.active { color: var(--ion); }

/* ---------- Pages inside hubs ---------- */
html.ui2 .page:not(.hidden) { animation: u2PageIn 170ms var(--ease-out); }
@keyframes u2PageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Titles live in the top bar now; headers that hold only a title go away,
   headers that also carry toolbar controls keep the controls. */
html.ui2 .page-header > h2 { display: none; }
html.ui2 .page-header { margin-bottom: 16px; }
html.ui2 .page-header:not(:has(> *:not(h2))) { display: none; }
html.ui2 #journalSubtabToggle { display: none; }

/* ---------- Component refresh (token-driven, existing markup) ---------- */
html.ui2 .card, html.ui2 .stat-card, html.ui2 .chart-panel, html.ui2 .widget-card, html.ui2 .active-card, html.ui2 .queue-card,
html.ui2 .tag-report-card, html.ui2 .kit-card, html.ui2 .risk-panel, html.ui2 .trades-container, html.ui2 .analytics-container {
  box-shadow: var(--u2-hi);
  border-color: var(--border);
}
html.ui2 .pill-btn { border-radius: 999px; background: var(--surface); box-shadow: var(--u2-hi); }
html.ui2 .pill-btn.active { color: var(--ion); border-color: var(--ion-line); background: var(--ion-dim); }
html.ui2 .pill-btn.pill-primary, html.ui2 .pill-btn.primary, html.ui2 .btn-primary { color: #04121a; }
html.ui2 .btn-primary, html.ui2 .pill-btn.pill-primary, html.ui2 .pill-btn.primary { background: var(--ion); border-color: var(--ion); }
html.ui2.theme-light .pill-btn.pill-primary, html.ui2.theme-light .pill-btn.primary, html.ui2.theme-light .btn-primary { color: #fff; }
html.ui2 .form-group input:focus { border-color: var(--ion); }
html.ui2 .modal-header h1 { color: var(--ion); }

/* ---------- Readiness (new Growth view) ---------- */
html.ui2 .rd-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
html.ui2 .rd-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--u2-hi); min-width: 0; }
html.ui2 .rd-card h3 { font-size: 16px; margin-bottom: 4px; }
html.ui2 .rd-card > p { color: var(--text-dim); font-size: 12.5px; margin-bottom: 16px; line-height: 1.5; }
html.ui2 .rd-score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
html.ui2 .rd-score b { font: 700 40px var(--font-display); letter-spacing: -.04em; }
html.ui2 .rd-score span { color: var(--text-dim); font-size: 13px; }
html.ui2 .rd-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
html.ui2 .rd-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
html.ui2 .rd-form input {
  height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: 600 14px var(--font-mono); text-transform: none; letter-spacing: 0; width: 100%;
}
html.ui2 .rd-form input:focus { outline: none; border-color: var(--ion); }
html.ui2 .rd-out { display: grid; gap: 10px; }
html.ui2 .rd-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-soft); }
html.ui2 .rd-row span { color: var(--text-dim); font-size: 13px; }
html.ui2 .rd-row b { font: 600 14px var(--font-mono); text-align: right; }
html.ui2 .rd-row.is-key { border-color: var(--ion-line); background: var(--ion-dim); }
html.ui2 .rd-note { margin-top: 14px; font-size: 12px; color: var(--text-faint); line-height: 1.55; }
html.ui2 .rd-empty { color: var(--text-dim); font-size: 13px; padding: 10px 0; }

/* ---------- Phones: bottom tab bar ---------- */
@media (max-width: 700px) {
  html.ui2 { --u2-pad: 14px; --u2-top-h: 52px; }
  html.ui2 .body-row { grid-template-columns: minmax(0, 1fr); }
  html.ui2 .u2-side { display: none; }
  html.ui2 .u2-top { grid-column: 1; padding: 0 var(--u2-pad); gap: 6px; }
  html.ui2 .u2-crumb .u2-sep, html.ui2 .u2-crumb .u2-view { display: none; }
  html.ui2 .u2-crumb .u2-hub { font-size: 18px; }
  html.ui2 .u2-search { width: 36px; padding: 0; justify-content: center; margin-left: auto; border: none; background: transparent; box-shadow: none; }
  html.ui2 .u2-search span, html.ui2 .u2-search kbd { display: none; }
  html.ui2 .u2-search svg { width: 18px; height: 18px; }
  html.ui2 .u2-sync-txt, html.ui2 .u2-top-right .u2-desk { display: none; }
  html.ui2 .content { grid-column: 1; padding: 0 var(--u2-pad) calc(92px + env(safe-area-inset-bottom, 0px)); }
  html.ui2 .u2-sub { padding-top: 10px; gap: 8px; }
  html.ui2 .u2-sub .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  html.ui2 .u2-sub .segmented::-webkit-scrollbar { display: none; }
  html.ui2 .u2-sub .seg-btn { padding: 9px 14px; white-space: nowrap; }
  html.ui2 .u2-lens { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; padding-bottom: 2px; }
  html.ui2 .u2-lens::-webkit-scrollbar { display: none; }
  html.ui2 .u2-lens button { flex: 0 0 auto; height: 34px; }
  html.ui2 .u2-menu { right: 10px; }
  html.ui2 .rd-grid { grid-template-columns: minmax(0, 1fr); }
  html.ui2 .rd-form input { font-size: 16px; }

  html.ui2 .u2-tabbar {
    display: grid; grid-template-columns: repeat(var(--tabs, 5), minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
  }
  /* the page fills the real screen (100dvh is wrong in some home-screen apps) and the bar sits on the true bottom edge */
  html.ui2 .dashboard { position: fixed; inset: 0; height: auto; }
  html.ui2 .u2-tabbar { min-height: calc(62px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 140px 0 140px var(--surface); }
  html.ui2 .content { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  /* iPhone: the blur on a fixed bar can leave a dark band under it in a saved app, so the bar is solid there */
  @supports (-webkit-touch-callout: none) { html.ui2 .u2-tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); } }
  html.ui2 .u2-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px;
    border: none; background: none; border-radius: 12px; color: var(--text-faint); font: 600 10.5px var(--font-ui); cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out);
  }
  html.ui2 .u2-tab svg { width: 22px; height: 22px; }
  html.ui2 .u2-tab.active { color: var(--ion); }
  html.ui2 .u2-tab.active::after { content: ''; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ion); box-shadow: 0 0 12px var(--ion-line); }
  html.ui2 .u2-tab .u2-dot { position: absolute; top: 6px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--rose); border: 2px solid var(--surface); }
  html.ui2 .u2-tab .u2-dot.warn { background: var(--amber); }
  html.ui2 .u2-tab .u2-dot.hidden { display: none; }

  html.ui2 .u2-sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity var(--dur-drawer) var(--ease-out); }
  html.ui2 .u2-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
  html.ui2 .u2-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 10px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-2); border: 1px solid var(--border); border-bottom: none; border-radius: 22px 22px 0 0;
    transform: translateY(105%); transition: transform var(--dur-modal) var(--ease-drawer); box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .6);
    max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  }
  html.ui2 .u2-sheet.open { transform: none; }
  html.ui2 .u2-sheet .u2-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 12px; }
  html.ui2 .u2-sheet h4 { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin: 10px 4px 6px; }
  html.ui2 .u2-sheet button {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 0 12px; border: none; background: none; border-radius: 12px;
    color: var(--text); font: 600 14.5px var(--font-ui); cursor: pointer; text-align: left;
  }
  html.ui2 .u2-sheet button svg { width: 20px; height: 20px; color: var(--text-dim); }
  html.ui2 .u2-sheet button:active { background: var(--surface-hover); }
  html.ui2 .u2-sheet button.danger { color: var(--rose); }
}

@media (min-width: 701px) and (max-width: 1000px) {
  html.ui2 { --u2-side-w: 68px; --u2-pad: 22px; }
  html.ui2 .u2-wordmark, html.ui2 .u2-nav-item .u2-lbl { display: none; }
  html.ui2 .u2-nav-item { padding: 0; justify-content: center; }
  html.ui2 .u2-nav-item .u2-dot { position: absolute; top: 8px; right: 12px; margin: 0; }
  html.ui2 .u2-brand { padding: 0; justify-content: center; }
  html.ui2 .u2-collapse { display: none; }
  html.ui2 .u2-search { width: 40px; padding: 0; justify-content: center; }
  html.ui2 .u2-search span, html.ui2 .u2-search kbd { display: none; }
  html.ui2 .u2-sync-txt { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html.ui2 .page:not(.hidden) { animation: none; }
  html.ui2 .u2-menu.open { animation: none; }
  html.ui2 .body-row, html.ui2 .u2-sheet, html.ui2 .u2-ambient i { transition: none; }
  html.ui2 .u2-ambient i { transition: opacity .01s; }
}

/* ============================================================================
   MOTION + NAVIGATION LAYER
   Rules: transform/opacity only, strong ease-out, under 300ms, nothing animated on
   keyboard-driven or all-day actions, everything gated for reduced motion.
   ========================================================================== */

/* Sliding active markers replace the old per-item bars (one element that glides). */
html.ui2 .u2-nav-item.active::before { content: none; }
html.ui2 .u2-nav-ind {
  position: absolute; left: -12px; top: 0; width: 3px; height: 24px; border-radius: 0 3px 3px 0;
  background: var(--ion); box-shadow: 0 0 14px 1px var(--ion-line); opacity: 0; pointer-events: none;
}
html.ui2.u2-ready .u2-nav-ind { transition: transform 240ms var(--ease-out), opacity 120ms linear; }
html.ui2 .u2-tab.active::after { content: none; }
html.ui2 .u2-tab-ind {
  position: absolute; left: 0; top: 0; width: 22px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--ion); box-shadow: 0 0 12px var(--ion-line); opacity: 0; pointer-events: none;
}
html.ui2.u2-ready .u2-tab-ind { transition: transform 240ms var(--ease-out), opacity 120ms linear; }

/* First visit to a view this session: its blocks rise in one after another. */
html.ui2 .page.u2-stag { animation: none; }
html.ui2 .page.u2-stag > * { animation: u2Rise 280ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes u2Rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Press feedback: quick, small, only while pressed. */
html.ui2 button:not(:disabled):active, html.ui2 .pill-btn:active, html.ui2 .cx-card:active { transition: transform 90ms var(--ease-out); }
html.ui2 .pill-btn:active, html.ui2 .btn-primary:active:not(:disabled), html.ui2 .seg-btn:active, html.ui2 .u2-lens button:active { transform: scale(.97); }

/* Dialogs pop in (occasional action). Their exit is instant on purpose. */
html.ui2 .modal:not(.hidden) .modal-content { animation: u2Pop 200ms var(--ease-out); transform-origin: 50% 40%; }
html.ui2 .qm-host:not(.hidden) > *, html.ui2 .note-overlay-host { animation: u2Pop 200ms var(--ease-out); }

/* The command palette is opened with the keyboard, many times a day: no animation at all. */
html.ui2 .cmdk-backdrop, html.ui2 .cmdk-panel { transition: none !important; animation: none !important; }

/* Loading: numbers shimmer instead of showing stale or empty values. */
html.ui2 body.loading-data .stat-card-value, html.ui2 .risk-panel.risk-unknown .risk-value {
  color: transparent !important; border-radius: 8px; min-width: 3ch;
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-hover) 50%, var(--surface-2) 70%) 0 0 / 220% 100%;
  animation: u2Shimmer 1.3s linear infinite;
}
@keyframes u2Shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* Sync in progress: a thin line travels along the bottom of the top bar. */
html.ui2 .u2-top { position: relative; }
html.ui2 .u2-top.is-syncing::after {
  content: ''; position: absolute; left: 0; bottom: -1px; height: 2px; width: 40%;
  background: linear-gradient(90deg, transparent, var(--ion), transparent); animation: u2Sweep 1.2s var(--ease-in-out) infinite;
}
@keyframes u2Sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Hover polish only on real pointers. */
@media (hover: hover) and (pointer: fine) {
  html.ui2 .card, html.ui2 .stat-card, html.ui2 .active-card, html.ui2 .queue-card, html.ui2 .widget-card, html.ui2 .kit-card {
    transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  html.ui2 .active-card:hover, html.ui2 .queue-card:hover, html.ui2 .widget-card:hover { border-color: var(--ion-line); transform: translateY(-1px); }
}

/* Accessibility helpers */
html.ui2 .u2-sr, .u2-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.u2-skip { position: fixed; left: 12px; top: -48px; z-index: 2000; padding: 10px 14px; border-radius: 10px; background: var(--ion, #4cc9f0); color: #04121a; font: 700 13px var(--font-ui, system-ui); text-decoration: none; transition: top 120ms var(--ease-out); }
.u2-skip:focus { top: 12px; }
html:not(.ui2) .u2-skip { display: none; }
html.ui2 #u2Main:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  html.ui2 .page.u2-stag > *, html.ui2 .modal:not(.hidden) .modal-content, html.ui2 .qm-host:not(.hidden) > * { animation: none !important; }
  html.ui2 .u2-nav-ind, html.ui2 .u2-tab-ind { transition: opacity 120ms linear !important; }
  html.ui2 .u2-top.is-syncing::after { animation: none; width: 100%; opacity: .5; }
  html.ui2 body.loading-data .stat-card-value, html.ui2 .risk-panel.risk-unknown .risk-value { animation: none; }
  html.ui2 .active-card:hover, html.ui2 .queue-card:hover, html.ui2 .widget-card:hover { transform: none; }
}


/* ---------- Review (Growth) ---------- */
html.ui2 .rv-grid { display: grid; gap: 16px; }
html.ui2 .rv-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--u2-hi); min-width: 0; }
html.ui2 .rv-card h3 { font-size: 16px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
html.ui2 .rv-card .cx-note { margin-bottom: 12px; }
html.ui2 .rv-count { font: 700 12px var(--font-mono); background: var(--ion-dim); color: var(--ion); padding: 2px 8px; border-radius: 999px; }
html.ui2 .rv-list { display: grid; gap: 10px; }
html.ui2 .rv-trade { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out); }
html.ui2 .rv-trade.rv-done { opacity: 0; transform: translateX(14px); }
html.ui2 .rv-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
html.ui2 .rv-head small { color: var(--text-faint); font-size: 11.5px; }
html.ui2 .rv-pnl { font: 600 13px var(--font-mono); }
html.ui2 .rv-skip { margin-left: auto; background: none; border: none; color: var(--text-faint); font: 600 12px var(--font-ui); cursor: pointer; padding: 4px 6px; }
html.ui2 .rv-q { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
html.ui2 .rv-q > span { flex: 0 0 120px; color: var(--text-dim); font-size: 12px; }
html.ui2 .rv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
html.ui2 .rv-chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font: 600 12.5px var(--font-ui); cursor: pointer; transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
html.ui2 .rv-chip.on { color: var(--ion); border-color: var(--ion-line); background: var(--ion-dim); }
html.ui2 .rv-chip:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { html.ui2 .rv-chip:hover:not(.on) { color: var(--text); border-color: var(--text-faint); } }
html.ui2 .rv-weekhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
html.ui2 .rv-weekhead h3 { margin: 0; }
html.ui2 .rv-nav { display: flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: 13px; font-weight: 600; }
html.ui2 .rv-conf { margin-left: auto; font: 600 11.5px var(--font-mono); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
html.ui2 .rv-conf-very-low, html.ui2 .rv-conf-low { color: var(--amber); border-color: var(--amber-dim); background: var(--amber-dim); }
html.ui2 .rv-conf-good { color: var(--teal); background: var(--teal-dim); border-color: var(--teal-dim); }
html.ui2 .rv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-bottom: 16px; }
html.ui2 .rv-stat { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
html.ui2 .rv-stat span { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
html.ui2 .rv-stat b { font: 700 18px var(--font-display); }
html.ui2 .rv-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 18px 0 8px; }
html.ui2 .rv-findings { display: grid; gap: 8px; }
html.ui2 .rv-finding { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 13px; line-height: 1.5; }
html.ui2 .rv-finding p { margin: 0; }
html.ui2 .rv-warn .rv-ico { color: var(--amber); }
html.ui2 .rv-info .rv-ico { color: var(--text-faint); }
html.ui2 .rv-link { background: none; border: none; padding: 2px 0; margin-top: 4px; color: var(--ion); font: 600 12px var(--font-ui); cursor: pointer; }
html.ui2 .rv-evidence { margin-top: 6px; display: grid; gap: 3px; }
html.ui2 .rv-ev { font: 500 12px var(--font-mono); color: var(--text-dim); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
html.ui2 .rv-commit { display: flex; gap: 8px; }
html.ui2 .rv-commit input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 500 14px var(--font-ui); }
html.ui2 .rv-commit input:focus { outline: none; border-color: var(--ion); }
html.ui2 .rv-detectors { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
html.ui2 .rv-det { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px; }
html.ui2 .rv-det h5 { font-size: 14px; margin: 0 0 2px; }
html.ui2 .rv-det small { color: var(--text-faint); display: block; margin-bottom: 8px; }
html.ui2 .rv-det p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-dim); }
html.ui2 .rv-pill { display: inline-block; font: 700 11px var(--font-ui); padding: 3px 9px; border-radius: 999px; }
html.ui2 .rv-pill-wait { background: var(--surface-hover); color: var(--text-dim); }
html.ui2 .rv-pill-bad { background: var(--rose-dim); color: var(--rose); }
html.ui2 .rv-pill-ok { background: var(--teal-dim); color: var(--teal); }
html.ui2 .rv-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 6px 0; }
html.ui2 .rv-progress i { display: block; height: 100%; background: var(--ion); border-radius: 3px; }
html.ui2 .rv-prompt { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--ion-dim); border: 1px solid var(--ion-line); }
html.ui2 .rv-prompt div { display: flex; flex-direction: column; gap: 2px; }
html.ui2 .rv-prompt span { color: var(--text-dim); font-size: 12.5px; }
@media (max-width: 700px) {
  html.ui2 .rv-card { padding: 16px; }
  html.ui2 .rv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.ui2 .rv-q > span { flex-basis: 100%; }
  html.ui2 .rv-chip { height: 38px; padding: 0 14px; }
  html.ui2 .rv-conf { margin-left: 0; }
  html.ui2 .rv-prompt { flex-direction: column; align-items: stretch; }
  html.ui2 .rv-commit { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { html.ui2 .rv-trade { transition: none; } }


/* ---------- Guardrails ---------- */
html.ui2 .gd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
html.ui2 .gd-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--u2-hi); min-width: 0; }
html.ui2 .gd-wide { grid-column: 1 / -1; }
html.ui2 .gd-card h3 { font-size: 16px; margin-bottom: 10px; }
html.ui2 .gd-ev { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-soft); margin-bottom: 8px; font-size: 13px; }
html.ui2 .gd-ev small { color: var(--text-faint); }
html.ui2 .gd-critical { border-color: var(--rose-dim); background: var(--rose-dim); }
html.ui2 .gd-warn { border-color: var(--amber-dim); background: var(--amber-dim); }
html.ui2 .gd-ok { border-color: var(--teal-dim); background: var(--teal-dim); color: var(--teal); }
html.ui2 .gd-adh { margin-top: 10px; font-size: 13px; color: var(--text-dim); }
html.ui2 .gd-adh b { font: 700 18px var(--font-display); color: var(--text); }
html.ui2 .gd-adh small { display: block; color: var(--text-faint); margin-top: 2px; }
html.ui2 .gd-rule { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
html.ui2 .gd-rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
html.ui2 .gd-rule-text small { color: var(--text-faint); font-size: 11.5px; }
html.ui2 .gd-val { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
html.ui2 .gd-val input { width: 72px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 600 13px var(--font-mono); text-align: right; }
html.ui2 .gd-switch { position: relative; flex: 0 0 auto; width: 40px; height: 24px; cursor: pointer; }
html.ui2 .gd-switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
html.ui2 .gd-switch i { position: absolute; inset: 0; border-radius: 12px; background: var(--surface-hover); border: 1px solid var(--border); transition: background-color var(--dur-base) var(--ease-out); }
html.ui2 .gd-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-dim); transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out); }
html.ui2 .gd-switch input:checked + i { background: var(--ion-dim); border-color: var(--ion-line); }
html.ui2 .gd-switch input:checked + i::after { transform: translateX(16px); background: var(--ion); }
html.ui2 .gd-switch input:focus-visible + i { outline: 2px solid var(--ion); outline-offset: 2px; }
html.ui2 .gd-banner { display: flex; margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--rose-dim); border: 1px solid var(--rose); }
html.ui2 .gd-banner.gd-warn { background: var(--amber-dim); border-color: var(--amber); }
html.ui2 .gd-banner div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
html.ui2 .gd-banner span { color: var(--text-dim); }
html.ui2 .gd-card code { font: 600 12px var(--font-mono); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
html.ui2 .gd-card .form-group input { width: 100%; height: 40px; padding: 0 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
@media (max-width: 700px) { html.ui2 .gd-grid { grid-template-columns: minmax(0, 1fr); } html.ui2 .gd-card { padding: 16px; } html.ui2 .gd-rule { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { html.ui2 .gd-switch i, html.ui2 .gd-switch i::after { transition: none; } }
html.ui2 .rv-chips { flex: 1; min-width: 0; }

html.ui2 .rd-wide { grid-column: 1 / -1; }

html.ui2 .u2-sub .seg-btn { white-space: nowrap; }


/* ---------- Real charts (TradingView Lightweight Charts) ---------- */
html .lw-host { position: absolute; inset: 0; }
html .lw-host .tv-lightweight-charts { border-radius: inherit; }
.lw-tip { position: absolute; top: 6px; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--surface-2, #131925); border: 1px solid var(--border, rgba(148,170,210,.2)); display: flex; flex-direction: column; gap: 1px; font-size: 11px; box-shadow: 0 8px 24px -12px rgba(0,0,0,.6); }
.lw-tip small { color: var(--text-faint); font-size: 10.5px; }
.lw-tip b { font: 700 13px var(--font-mono, ui-monospace, monospace); }
.lw-tip b.pos { color: var(--teal); } .lw-tip b.neg { color: var(--rose); }
.lw-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: 12.5px; pointer-events: none; }
.lw-empty.hidden, .lw-tip.hidden { display: none; }

/* ---------- Colour-blind safe palette: blue = up, orange = down (signs stay on every figure) ---------- */
html[data-palette="cb"] { --teal: #4aa3ff; --teal-dim: rgba(74, 163, 255, .16); --rose: #ff9a3d; --rose-dim: rgba(255, 154, 61, .16); }
html.theme-light[data-palette="cb"] { --teal: #0a64c8; --teal-dim: rgba(11, 111, 214, .12); --rose: #b45400; --rose-dim: rgba(180, 84, 0, .12); }


/* ---------- In-line charts: sparkline, day bars, bullet graph ---------- */
html.ui2 .rd-spark { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
html.ui2 .rd-spark span { color: var(--text-faint); font-size: 11.5px; }
html.ui2 .spark { width: 100%; height: 56px; display: block; }
html.ui2 .rv-days { margin: 4px 0 6px; max-width: 520px; }
html.ui2 .daybars text { font-family: var(--font-ui); }
html.ui2 .gd-bullet { margin-bottom: 14px; }
html.ui2 .gd-bullet-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
html.ui2 .gd-bullet-head b { font: 700 18px var(--font-display); }
html.ui2 .gd-bullet-head b.pos { color: var(--teal); } html.ui2 .gd-bullet-head b.warn { color: var(--amber); } html.ui2 .gd-bullet-head b.neg { color: var(--rose); }
html.ui2 .bullet { position: relative; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
html.ui2 .bl-band { position: absolute; top: 0; bottom: 0; }
html.ui2 .bl-ok { background: color-mix(in srgb, var(--teal) 16%, transparent); }
html.ui2 .bl-warn { background: color-mix(in srgb, var(--amber) 20%, transparent); }
html.ui2 .bl-high { background: color-mix(in srgb, var(--rose) 22%, transparent); }
html.ui2 .bl-bar { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 3px; background: var(--text); transition: width 700ms var(--ease-expo, ease-out); }
html.ui2 .bl-target { position: absolute; top: 1px; bottom: 1px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ion); box-shadow: 0 0 6px var(--ion-line); }
html.ui2 .gd-bullet-scale { position: relative; height: 14px; font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
html.ui2 .gd-bullet-scale span { position: absolute; transform: translateX(-50%); }
html.ui2 .gd-bullet-scale span:first-child { transform: none; }
@media (prefers-reduced-motion: reduce) { html.ui2 .bl-bar { transition: none; } }

/* ============================================================================
   HOME: key-numbers strip (js/home.js) and section order
   ========================================================================== */
html.ui2 #homePage { display: flex; flex-direction: column; }
html.ui2 #homePage > .page-header { order: 0; }
html.ui2 #homePage > #u2Hero { order: 1; }
html.ui2 #homePage > .gd-banner, html.ui2 #homePage > .rv-prompt { order: 2; }
html.ui2 #homePage > #riskPanel { order: 3; }
html.ui2 #homePage > .kit-grid { order: 4; }
html.ui2 #homePage > .stat-row { order: 5; }
html.ui2 #homePage > .chart-panel { order: 6; }
html.ui2 #homePage > #trailPanel { order: 7; }
html.ui2 #homePage > .two-col { order: 8; }
html.ui2 #homePage > .trades-container { order: 9; }

html.ui2 .hh-hero { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
html.ui2 .hh-tile {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--u2-hi);
}
html.ui2 #hh-process, html.ui2 #hh-risk { cursor: pointer; }
html.ui2 .hh-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
html.ui2 .hh-val { font: 700 24px/1.1 var(--font-display); letter-spacing: -.03em; white-space: nowrap; }
html.ui2 .hh-cmp { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.ui2 .hh-cmp i { font-style: normal; font-weight: 500; color: var(--text-faint); }
html.ui2 .hh-cmp.up { color: var(--teal); } html.ui2 .hh-cmp.down { color: var(--rose); } html.ui2 .hh-cmp.flat { color: var(--text-dim); }
html.ui2 .hh-viz { margin-top: auto; padding-top: 4px; min-height: 36px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
html.ui2 .hh-viz .spark { height: 34px; }
html.ui2 .hh-viz .daybars { height: 52px; }
html.ui2 .hh-none { font-size: 11.5px; color: var(--text-faint); }
html.ui2 .hh-n { font-size: 11px; color: var(--text-faint); }
html.ui2 .hh-skel { font-style: normal; color: var(--text-faint); }
html.ui2 .hh-ratio { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); gap: 2px; }
html.ui2 .hh-ratio i { display: block; height: 100%; }
html.ui2 .hh-ratio .w { background: var(--teal); } html.ui2 .hh-ratio .l { background: var(--rose); }
html.ui2 .hh-ratio.ok { background: var(--surface-2); }
@media (max-width: 1180px) { html.ui2 .hh-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { html.ui2 .hh-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } html.ui2 .hh-tile { padding: 12px; } html.ui2 .hh-val { font-size: 20px; } }

/* ============================================================================
   INSTANT PAINT: saved numbers stay visible while the real refresh runs behind them
   ========================================================================== */
html.ui2 body.from-cache.loading-data .stat-card-value { color: inherit !important; background: none !important; animation: none !important; }
html.ui2 body.from-cache.loading-data .u2-top::after {
  content: ''; position: absolute; left: 0; bottom: -1px; height: 2px; width: 40%;
  background: linear-gradient(90deg, transparent, var(--ion), transparent); animation: u2Sweep 1.2s var(--ease-in-out) infinite;
}

/* ============================================================================
   ONE ICON FAMILY: same stroke, caps and joins everywhere (Lucide's 24px / 2px / round)
   ========================================================================== */
html.ui2 svg[stroke="currentColor"] { stroke-linecap: round; stroke-linejoin: round; }
html.ui2 :is(.u2-side, .u2-top, .u2-tabbar, .u2-sheet, .u2-menu, .pill-btn, .icon-btn, .btn-primary, .toast-icon, .page-header, .chart-panel-head, .table-head-row, .toolbar) svg[stroke-width] { stroke-width: 2; }
html.ui2 .u2-build { margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--border-soft); font: 500 10.5px/1.5 var(--font-mono); color: var(--text-faint); }

/* ============================================================================
   TABLES: tighter rows, quieter headers, numbers that line up
   ========================================================================== */
html.ui2 .trades-table, html.ui2 .analytics-table { font-size: 12.5px; border-spacing: 0 1px; }
html.ui2 .trades-table thead th, html.ui2 .analytics-table thead th {
  font: 700 10.5px var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); padding: 9px 12px; background: transparent;
}
html.ui2 .trades-table td { padding: 8px 12px; }
html.ui2 .analytics-table td { padding: 8px 12px; }
html.ui2 .trades-table td.num, html.ui2 .analytics-table td.num, html.ui2 th.num { text-align: right; font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum" 1, "zero" 1; }
html.ui2 .trades-table tbody tr { transition: background-color var(--dur-fast) linear; }
html.ui2 .trades-table tbody tr.trade-row:hover td { background: transparent; }
html.ui2 .trades-table td .pos, html.ui2 .trades-table td .neg { font-weight: 600; }

.lw-credit { margin: 14px 4px 0; font-size: 11px; color: var(--text-faint); }
.lw-credit a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }

/* the phone bar lives on <body>: it must disappear with the dashboard (login screen, story) */
html.ui2 #dashboard.hidden ~ :is(.u2-tabbar, .u2-sheet, .u2-sheet-backdrop) { display: none !important; }
