/* Notion-dark base, app-shell layout */
:root {
  --bg: #191919;
  --side: #1c1c1c;
  --card: #202020;
  --card2: #262626;
  --hover: rgba(255, 255, 255, .055);
  --active: rgba(255, 255, 255, .085);
  --border: #2a2a2a;
  --border-strong: #383838;
  --text: #ececea;
  --muted: #9b9b9b;
  --faint: #6e6e6e;
  --accent: #2383e2;
  --link: #6cabd8;
  --pos: #4dab9a;
  --pos-bg: rgba(60, 130, 113, .18);
  --neg: #ff7369;
  --neg-bg: rgba(135, 65, 58, .22);
  --amber: #ffa344;
  --amber-bg: rgba(133, 76, 29, .25);
  --gray-bg: rgba(255, 255, 255, .07);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .18);
  --ring: 0 0 0 2px rgba(35, 131, 226, .55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--amber); }
code {
  background: var(--gray-bg); padding: 1px 5px; border-radius: 4px;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--amber);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 218px; flex: 0 0 218px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--border);
  padding: 14px 10px 12px;
}
.side-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 14.5px; font-weight: 650; letter-spacing: -.01em;
  padding: 4px 10px 14px;
}
.side-brand .logo { width: 22px; height: 22px; border-radius: 6px; box-shadow: var(--shadow); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--muted); font-size: 13.5px; font-weight: 530;
  transition: background .12s, color .12s;
}
.side-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--active); color: var(--text); }
.side-nav svg { width: 17px; height: 17px; fill: currentColor; opacity: .8; flex: 0 0 17px; }
.side-nav a.active svg { opacity: 1; }
.side-foot { margin-top: auto; padding: 10px 10px 0; border-top: 1px solid var(--border); }
.live-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--pos);
  box-shadow: 0 0 0 0 rgba(77, 171, 154, .5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(77, 171, 154, .45); }
  70% { box-shadow: 0 0 0 6px rgba(77, 171, 154, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 171, 154, 0); }
}
.tzpick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.tzpick span { white-space: nowrap; }
.tzselect {
  height: 28px;
  max-width: 122px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 3px 8px;
}
.tzselect:hover { border-color: var(--border-strong); background: var(--card2); }
.tzselect:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.side-tz {
  margin-top: 10px;
  width: 100%;
  justify-content: space-between;
}
.side-tz .tzselect { flex: 0 0 122px; }

.content { flex: 1; min-width: 0; }
main { max-width: none; margin: 0; padding: 26px 40px 48px; }

.topbar {
  display: none;
  position: sticky; top: 0; z-index: 20;
  align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(25, 25, 25, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 650; font-size: 15px; }
.topbar .tzpick { margin-left: auto; }
.topbar .updated { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.bottombar {
  display: none;
  position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 80;
  width: 100vw;
  height: calc(58px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  background: rgba(28, 28, 28, .97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 0 0 env(safe-area-inset-bottom);
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: layout paint;
}
.bottombar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 58px;
  padding: 8px 0 7px; color: var(--faint); font-size: 11px;
}
.bottombar a:hover { text-decoration: none; }
.bottombar svg { width: 21px; height: 21px; fill: currentColor; }
.bottombar a.active { color: var(--text); }

.english-shell {
  display: block;
}

/* The English tab hosts a full app — let it breathe on wide screens. */
main:has(.english-frame) { max-width: 1480px; }

.english-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 74px);
  min-height: 640px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
}

@media (max-width: 919px) {
  .english-frame {
    height: calc(100dvh - 130px - env(safe-area-inset-bottom));
    min-height: 600px;
  }
}

@media (max-width: 919px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .bottombar { display: grid; }
  main { padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .topbar { gap: 9px; }
  .topbar .updated { display: none; }
  .topbar .tzselect { max-width: 108px; }
}

/* ---------- page header ---------- */
.pagetitle { font-size: 23px; font-weight: 700; margin: 0 0 2px; letter-spacing: -.015em; }
.pagesub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
@media (max-width: 919px) { .pagetitle { font-size: 20px; } }

/* view transition */
#view.fade > * { animation: fadeUp .3s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* skeleton */
.skel { border-radius: 8px; background: linear-gradient(100deg, #202020 40%, #262626 50%, #202020 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- cards & stats ---------- */
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (min-width: 920px) { .cards { grid-template-columns: repeat(auto-fit, minmax(162px, 1fr)); } }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 15px;
  min-width: 0;
  box-shadow: var(--shadow);
  transition: border-color .15s;
}
.card:hover { border-color: var(--border-strong); }
.stat .label { font-size: 10.5px; color: var(--faint); letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
.stat .value { font-size: 21px; font-weight: 680; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

.strategy-grid {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.strategy-card {
  display: block; width: 100%; min-width: 0; text-align: left;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--model-color, #9d7bd8);
  border-radius: 8px; padding: 12px 13px;
  font: inherit;
  box-shadow: var(--shadow); cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.strategy-card:hover { background: var(--card2); border-color: var(--border-strong); }
.strategy-card:active { transform: translateY(1px); }
.strategy-card.active {
  background: color-mix(in srgb, var(--model-color, #9d7bd8) 10%, var(--card));
  border-color: color-mix(in srgb, var(--model-color, #9d7bd8) 45%, var(--border));
}
.strategy-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 0; margin-bottom: 4px;
}
.strategy-title {
  display: inline-flex; align-items: center; gap: 7px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 650; font-size: 13.5px;
}
.strategy-sub {
  color: var(--muted); font-size: 12px; min-height: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.strategy-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  margin-top: 10px; font-variant-numeric: tabular-nums;
}
.strategy-metrics span {
  display: block; color: var(--faint); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 650;
}
.strategy-metrics b {
  display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 13px; font-weight: 680;
}

.bonding-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}
.bonding-kpis > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.bonding-kpis span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.bonding-kpis b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
}
.bonding-kpis small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strategy-board {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.strategy-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.6fr) repeat(6, minmax(86px, 1fr)) minmax(116px, 1.2fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
}
.strategy-row:hover { background: var(--card2); border-color: var(--border-strong); }
.strategy-row:active { transform: translateY(1px); }
.strategy-row.active {
  border-color: rgba(77, 171, 154, .48);
  background: linear-gradient(180deg, rgba(77, 171, 154, .07), transparent), var(--card);
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow);
}
.strategy-cell {
  min-width: 0;
  display: block;
}
.strategy-cell em {
  display: block;
  color: var(--faint);
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.strategy-cell b {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.strategy-cell small,
.strategy-note {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.strategy-name-cell b {
  display: inline;
  font-size: 13.5px;
}
.strategy-real-line {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.strategy-real-line b { font-weight: 650; }
.bonding-kpis .kpi-real { box-shadow: inset 2px 0 0 var(--pos); }
.strategy-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.trend-cell {
  min-width: 72px;
}
.mini-trend {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
  margin-top: 1px;
}
.mini-trend span {
  width: 5px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
}
.mini-trend .pos { background: #57bca9; }
.mini-trend .neg { background: #e2685e; }
.empty-trend {
  border-bottom: 1px solid var(--border);
}
.selected-strategy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: 10px;
  align-items: stretch;
}
.compact-cards {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}
.selected-trend .chart-card {
  height: 100%;
}
.compact-report {
  margin-top: 14px;
}
.compact-report .body {
  padding-top: 10px;
}
.compact-catrows .catrow {
  grid-template-columns: minmax(150px, 1.5fr) repeat(6, minmax(74px, 1fr));
}

@media (max-width: 1100px) {
  .strategy-row {
    grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(78px, 1fr));
  }
  .strategy-row .strategy-cell:nth-last-child(-n + 2) {
    display: none;
  }
  .bonding-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .selected-strategy-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .strategy-row {
    grid-template-columns: minmax(0, 1fr) minmax(80px, .55fr);
    gap: 8px;
  }
  .strategy-row .strategy-cell:nth-child(n + 3) {
    display: none;
  }
  .bonding-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .compact-cards {
    grid-template-columns: 1fr;
  }
}

.visibility-panel {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
}
.visibility-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.visibility-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.visibility-chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--model-color, #888) 34%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--model-color, #888) 10%, var(--card));
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.visibility-chips button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visibility-chips button.hidden {
  border-style: dashed;
  background: transparent;
  color: var(--faint);
  opacity: .58;
}
.visibility-chips button.hidden .model-dot {
  opacity: .45;
}
.visibility-chips button:hover {
  color: var(--text);
  opacity: 1;
  border-color: color-mix(in srgb, var(--model-color, #888) 56%, var(--border-strong));
}

.ribbon {
  display: flex; flex-wrap: wrap; gap: 6px 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 15px; margin-bottom: 12px; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ribbon b { font-weight: 650; }
.real-ribbon {
  border-color: rgba(77, 171, 154, .28);
  background: linear-gradient(180deg, rgba(77, 171, 154, .055), transparent), var(--card);
}

section h2 {
  font-size: 14.5px; font-weight: 650; letter-spacing: -.005em;
  margin: 28px 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
section h2 .hint { font-size: 12px; font-weight: 400; color: var(--faint); }

/* ---------- toolbar / buttons / segmented ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.toolbar .spacer { flex: 1; }
.account-toolbar { align-items: flex-start; }
.account-toolbar #acctseg { flex: 1 1 320px; }
.account-note {
  color: var(--faint);
  font-size: 12px;
  margin: -8px 0 12px;
}
.bonding-alerts {
  display: grid;
  gap: 8px;
  margin: -2px 0 12px;
}
.bonding-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 12.5px;
}
.bonding-alert.warn {
  border-color: rgba(255, 111, 105, .42);
  background: linear-gradient(180deg, rgba(255, 111, 105, .075), transparent), var(--card);
}
.bonding-alert.info {
  border-color: rgba(84, 150, 226, .34);
  background: linear-gradient(180deg, rgba(84, 150, 226, .06), transparent), var(--card);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; min-height: 34px;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--card); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 530; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: background .12s, border-color .12s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--card2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #2b8ce6, #1f78d1);
  border-color: rgba(255, 255, 255, .08); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn.primary:hover { background: linear-gradient(180deg, #3193ec, #2380dc); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 4px 11px; min-height: 28px; font-size: 12.5px; }
.btn.busy::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.seg {
  display: inline-flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 2px; gap: 1px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 530; padding: 5px 13px; min-height: 28px;
  border-radius: 5px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--card2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.segcount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gray-bg);
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.seg button.active .segcount { color: var(--text); background: rgba(255, 255, 255, .11); }
.real-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--pos-bg);
  color: var(--pos);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}
section h2 .seg { margin-left: auto; }
section h2 .seg button { padding: 3px 10px; min-height: 24px; font-size: 12px; }

/* ---------- list rows ---------- */
.rows { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.trow {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .08s;
}
.trow:hover { background: var(--hover); }
.trow:last-child { border-bottom: 0; }
.model-trow { border-left: 3px solid var(--model-color, transparent); padding-left: 11px; }
.model-dot {
  display: inline-block; width: 9px; height: 9px; flex: 0 0 auto;
  border-radius: 50%; background: var(--model-color, #9d7bd8);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--model-color, #9d7bd8) 18%, transparent);
}
.trow .ttl .model-dot { margin-right: 7px; vertical-align: 1px; }
.trow .meta .model-dot { width: 7px; height: 7px; margin-right: 5px; vertical-align: 1px; }
.trow .main { flex: 1; min-width: 0; }
.trow .ttl { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .meta { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.trow .right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 550; }
.trow .right .meta { margin-top: 0; font-weight: 400; }
.empty { color: var(--faint); padding: 26px; text-align: center; font-size: 13px; }

.trade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.trade-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 126px;
  padding: 12px 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: background .12s, border-color .12s;
}
.trade-tile:hover { background: var(--card2); border-color: var(--border-strong); }
.trade-tile-head,
.trade-tile-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.trade-tile-head { justify-content: space-between; }
.trade-tile-title { font-size: 15px; font-weight: 650; letter-spacing: 0; }
.trade-tile-asset {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-tile-pnl {
  text-align: right;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 680;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.trade-tile-entry,
.trade-tile-model,
.trade-tile-foot {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.trade-tile-model {
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.trade-tile-model .model-dot {
  width: 7px;
  height: 7px;
  margin-right: 5px;
  vertical-align: 1px;
}
.trade-tile-foot {
  margin-top: auto;
  padding-top: 2px;
}

.exec-panel {
  margin-top: 10px;
  padding: 11px 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.exec-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 620;
}
.exec-note {
  margin: -2px 0 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.exec-cell {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .025);
  font-variant-numeric: tabular-nums;
}
.exec-cell span,
.exec-cell em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exec-cell span {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-style: normal;
  font-weight: 650;
}
.exec-cell b {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.exec-cell em {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
}
.loss-report {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .012)),
    var(--card);
}
.loss-driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 9px;
}
.loss-driver {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, .12);
  font-variant-numeric: tabular-nums;
}
.loss-driver span,
.loss-examples span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 650;
}
.loss-driver b {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}
.loss-driver em {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.execution-coverage {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.coverage-strategy {
  display: grid;
  gap: 6px;
}
.coverage-strategy-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(92px, .8fr));
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 6px;
  background: rgba(0, 0, 0, .10);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.coverage-strategy-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coverage-strategy-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loss-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.loss-examples ul {
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.loss-examples li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loss-attribution {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.loss-attribution-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.loss-attribution-head b {
  font-size: 13px;
}
.loss-attribution-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.loss-attribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 9px;
}
.loss-attribution-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.loss-attribution-kpi {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .025);
  font-variant-numeric: tabular-nums;
}
.loss-attribution-kpi b.warn {
  color: var(--amber);
}
.loss-attribution-kpi span,
.loss-attribution-card-head span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 650;
}
.loss-attribution-kpi b {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.18;
}
.loss-attribution-kpi em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
  font-style: normal;
}
.loss-attribution-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, .12);
}
.loss-attribution-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.loss-attribution-card-head em {
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
}
.loss-attribution-rows {
  display: grid;
  gap: 8px;
}
.loss-attribution-row {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-variant-numeric: tabular-nums;
}
.loss-attribution-row:first-child {
  padding-top: 0;
  border-top: 0;
}
.loss-attribution-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}
.loss-attribution-row-top strong {
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.loss-attribution-row-top b {
  font-size: 12.5px;
  line-height: 1.25;
  white-space: nowrap;
}
.loss-attribution-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.loss-attribution-bar {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
}
.loss-attribution-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.loss-attribution-row.pos .loss-attribution-bar i {
  background: rgba(75, 190, 171, .75);
}
.loss-attribution-row.neg .loss-attribution-bar i {
  background: rgba(255, 111, 99, .78);
}
@media (max-width: 780px) {
  .coverage-strategy-row {
    grid-template-columns: 1fr 1fr;
  }
  .coverage-strategy-row strong {
    grid-column: 1 / -1;
  }
}
.loss-top-events {
  margin-top: 9px;
}

.sizecalc {
  padding: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .012)),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.sizecalc-top {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(360px, 1.35fr);
  gap: 12px;
  align-items: stretch;
}
.sizecalc-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}
.size-levels {
  display: grid;
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, .12);
}
.sizecalc label,
.size-level {
  min-width: 0;
}
.sizecalc label {
  display: grid;
  gap: 5px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 650;
}
.size-level label span {
  display: none;
}
.sizecalc input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 5px 9px;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sizecalc input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.sizecalc input::-webkit-outer-spin-button,
.sizecalc input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.sizecalc input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.size-level {
  display: grid;
  grid-template-columns: 54px minmax(92px, .8fr) minmax(102px, .8fr) minmax(150px, 1.4fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(77, 171, 154, .10) 0 var(--fill-pct, 0%), transparent var(--fill-pct, 0%)),
    rgba(255, 255, 255, .015);
}
.size-level:last-child {
  border-bottom: 0;
}
.size-level-head {
  min-height: 30px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, .035);
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.size-level b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.size-level.used b {
  color: var(--pos);
}
.size-level.partial b {
  color: var(--amber);
}
.size-level.invalid b {
  color: var(--neg);
}
.size-fill {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.size-fill > span {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .07);
}
.size-fill i {
  display: block;
  width: var(--fill-pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pos), #73c8ba);
}
.size-level.partial .size-fill i {
  background: linear-gradient(90deg, var(--amber), #f2c46e);
}
.size-fill em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.size-output {
  min-width: 0;
}
.size-summary {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(130px, 1.05fr) minmax(110px, .85fr) minmax(110px, .85fr);
  gap: 8px;
}
.size-primary,
.size-result,
.size-progress,
.size-used {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(0, 0, 0, .14);
  padding: 9px 10px;
  font-variant-numeric: tabular-nums;
}
.size-primary {
  background: rgba(255, 255, 255, .035);
}
.size-primary span,
.size-result span,
.size-used span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.size-primary b,
.size-result b {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: 0;
}
.size-primary em,
.size-result em,
.size-progress em {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
}
.size-progress,
.size-used {
  grid-column: span 3;
  padding: 8px 10px;
}
.size-progress > div {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}
.size-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--pos));
}
.size-used {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
}
.size-used b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
}
@media (max-width: 860px) {
  .sizecalc-top {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .sizecalc {
    padding: 10px;
  }
  .sizecalc-controls,
  .size-summary {
    grid-template-columns: 1fr;
  }
  .size-progress,
  .size-used {
    grid-column: auto;
  }
  .size-level-head {
    display: none;
  }
  .size-level {
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
  }
  .size-level label span {
    display: block;
    font-size: 9.5px;
  }
  .size-fill {
    grid-column: 2 / -1;
  }
}

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 550;
  padding: 1.5px 7px; border-radius: 4px; white-space: nowrap;
}
.badge.win, .badge.up { background: var(--pos-bg); color: var(--pos); }
.badge.loss, .badge.down { background: var(--neg-bg); color: var(--neg); }
.badge.open { background: var(--amber-bg); color: var(--amber); }
.badge.gray { background: var(--gray-bg); color: var(--muted); }
.badge.real { background: var(--pos-bg); color: var(--pos); }
.badge.cat { background: var(--gray-bg); color: var(--muted); }
.badge.cat-sports { background: rgba(84, 150, 226, .14); color: #78b7f0; }
.badge.cat-weather { background: rgba(87, 188, 169, .14); color: #65cdbb; }
.badge.cat-crypto { background: rgba(238, 184, 90, .16); color: #e8bd6a; }
.badge.cat-stocks { background: rgba(168, 129, 224, .15); color: #b895ec; }
.badge.cat-earnings { background: rgba(236, 130, 94, .15); color: #ee9b7d; }
.badge.cat-politics { background: rgba(238, 101, 101, .14); color: #ef8585; }
.badge.cat-news { background: rgba(122, 148, 235, .16); color: #9fb0f5; }

/* bonding trades as compact tiles, colored by category filter */
.trade-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1250px) { .trade-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 920px) { .trade-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .trade-tiles { grid-template-columns: 1fr; } }
.trade-tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 8px;
  min-width: 0;
}
.trade-tile.tile-cat-sports { border-left-color: #78b7f0; }
.trade-tile.tile-cat-weather { border-left-color: #65cdbb; }
.trade-tile.tile-cat-crypto { border-left-color: #e8bd6a; }
.trade-tile.tile-cat-stocks { border-left-color: #b895ec; }
.trade-tile.tile-cat-earnings { border-left-color: #ee9b7d; }
.trade-tile.tile-cat-politics { border-left-color: #ef8585; }
.trade-tile.tile-cat-news { border-left-color: #9fb0f5; }
.trade-tile .tile-top { display: flex; align-items: center; gap: 6px; }
.trade-tile .tile-when { margin-left: auto; color: var(--faint); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trade-tile .tile-title { font-size: 13px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trade-tile .tile-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; }
.trade-tile .tile-terms { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.trade-tile .tile-pnl { white-space: nowrap; font-variant-numeric: tabular-nums; }
.trade-tile .tile-pnl b { font-weight: 650; }
.trade-tile .tile-pnl small { margin-left: 5px; color: var(--muted); }

/* real money history fold */
.real-history { margin-top: 8px; }

/* bonding uses the wide layout */
main:has(.view-surface[data-route="bonding"]) { max-width: 1480px; }

.catrows { font-variant-numeric: tabular-nums; }
.catrow {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) repeat(6, minmax(82px, 1fr));
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.catrow:last-child { border-bottom: 0; }
.catrow:hover { background: var(--hover); }
.catrow.chart-filterable { cursor: pointer; }
.catrow.chart-filterable.active {
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 3px 0 0 var(--accent);
}
.catrow.chart-filterable:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 var(--accent), var(--ring);
}
.catrow.realrow {
  grid-template-columns: minmax(170px, 1.65fr) repeat(7, minmax(86px, 1fr));
}
.catname { min-width: 0; }
.catname .meta {
  color: var(--muted); font-size: 12px; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.catmetric { min-width: 0; }
.catmetric span {
  display: block; color: var(--faint); font-size: 10px; letter-spacing: 0;
  text-transform: uppercase; font-weight: 650; white-space: nowrap;
}
.catmetric b {
  display: block; margin-top: 2px; font-size: 13px; font-weight: 680;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 900px) {
  .catrow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catname { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .catrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-grid { grid-template-columns: 1fr; }
  .trade-tile { min-height: 0; padding: 11px 12px; }
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 570;
  padding: 2.5px 9px; border-radius: 5px;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.running { background: var(--pos-bg); color: var(--pos); }
.pill.stale { background: var(--amber-bg); color: var(--amber); }
.pill.paused { background: rgba(190, 190, 190, .12); color: #aaa; }
.pill.down { background: var(--neg-bg); color: var(--neg); }

.subhead {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0;
}
.subhead .hint {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- pager ---------- */
.pager {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 12px 0 0; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- charts ---------- */
.chart-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.chart-card h3 { margin: 0 0 12px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chart-head h3 { margin: 0; }
.chart-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn.chart-reset {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}
.assetseg button {
  min-height: 24px;
  padding: 3px 9px;
  font-size: 12px;
}
.chartfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -3px 0 9px;
}
.chartfilters button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.chartfilters button:hover { color: var(--text); border-color: var(--border-strong); }
.chartfilters button.active {
  background: var(--card2);
  color: var(--text);
  border-color: var(--border-strong);
}
.chartfilters .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.chart-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 10px;
}
.chart-option-group,
.chart-option-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.chart-option-label {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.chartseg button,
.chart-toggle {
  min-height: 24px;
  padding: 3px 9px;
  font-size: 12px;
}
.chart-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chart-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.chart-toggle.active,
.btn.active-soft {
  color: var(--text);
  background: var(--card2);
  border-color: var(--border-strong);
}

.barwrap { position: relative; height: 150px; }
.barwrap .gline { position: absolute; left: 0; right: 0; height: 1px; background: rgba(255, 255, 255, .06); }
.barwrap .gline.zero { background: rgba(255, 255, 255, .16); }
.barwrap .gl-lbl {
  position: absolute; right: 2px; transform: translateY(-110%);
  font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums;
  background: rgba(32, 32, 32, .8); padding: 0 3px; border-radius: 3px;
}
.barwrap .bar { position: absolute; border-radius: 2.5px 2.5px 0 0; min-height: 2px; transition: filter .1s; }
.barwrap .bar:hover { filter: brightness(1.25); }
.barwrap .bar.pos { background: linear-gradient(180deg, #57bca9, #429884); }
.barwrap .bar.neg { background: linear-gradient(180deg, #e2685e, #ff7369); border-radius: 0 0 2.5px 2.5px; }
.barwrap.stacked .stackseg {
  position: absolute;
  min-height: 1px;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .055);
  transition: filter .1s, opacity .1s;
}
.barwrap.stacked .stackseg.round-top { border-radius: 3px 3px 0 0; }
.barwrap.stacked .stackseg.round-bottom { border-radius: 0 0 3px 3px; }
.barwrap.stacked .stackseg.neg { opacity: .82; }
.barwrap.stacked .stackseg:hover { filter: brightness(1.22); opacity: 1; }
.barwrap.stacked .zerobar {
  position: absolute;
  height: 2px;
  transform: translateY(-1px);
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
}
.barwrap .cat-sports, .stacklegend .cat-sports, .chartfilters .cat-sports { background: #5fa8dd; }
.barwrap .cat-weather, .stacklegend .cat-weather, .chartfilters .cat-weather { background: #4db5a5; }
.barwrap .cat-crypto, .stacklegend .cat-crypto, .chartfilters .cat-crypto { background: #d6a84f; }
.barwrap .cat-stocks, .stacklegend .cat-stocks, .chartfilters .cat-stocks { background: #a881e0; }
.barwrap .cat-earnings, .stacklegend .cat-earnings, .chartfilters .cat-earnings { background: #dd835f; }
.barwrap .cat-politics, .stacklegend .cat-politics, .chartfilters .cat-politics { background: #df6666; }
.barwrap .cat-news, .stacklegend .cat-news, .chartfilters .cat-news { background: #8a8a8a; }
.blabels { display: flex; margin-top: 7px; }
.blabels span { flex: 1; text-align: center; font-size: 10px; color: var(--faint); overflow: hidden; white-space: nowrap; }
.stacklegend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}
.stacklegend .legitem {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.stacklegend .legitem:hover { color: var(--text); }
.stacklegend .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05);
}
.stacktip {
  display: none;
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 132px;
  max-width: 230px;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(28, 28, 28, .96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.stacktip .tiptime {
  margin-bottom: 3px;
  color: var(--faint);
  font-size: 10.5px;
}
.stacktip .tipdetail { margin-top: 3px; color: var(--muted); }

.linewrap { position: relative; height: 150px; }
.linewrap svg { width: 100%; height: 100%; display: block; }
.linewrap .line { fill: none; stroke: #5fa8dd; stroke-width: 2; }
.linewrap .gline-svg { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.linewrap .dot { fill: #5fa8dd; stroke: var(--card); stroke-width: 2; }
.linewrap .lbl { position: absolute; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; background: rgba(32, 32, 32, .8); padding: 0 3px; border-radius: 3px; }
.linewrap .lbl.max { top: 2px; left: 4px; }
.linewrap .lbl.min { bottom: 2px; left: 4px; }
.linewrap .lbl.last { top: 2px; right: 4px; font-weight: 650; color: var(--muted); }
.linewrap .lbl.rmax { top: 2px; right: 4px; color: #f0c95a; }
.linewrap .lbl.rmin { bottom: 2px; right: 4px; color: #f0c95a; }

/* ---------- progress ---------- */
.progress { height: 4px; border-radius: 2px; background: var(--gray-bg); overflow: hidden; margin-top: 9px; }
.progress > div { height: 100%; border-radius: 2px; background: linear-gradient(90deg, #2383e2, #4a9bea); transition: width .4s ease; }
.progress > div.over { background: linear-gradient(90deg, #d9554b, #ff7369); }

/* ---------- toggles & code ---------- */
details.report { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
details.report summary {
  cursor: pointer; padding: 11px 14px; font-weight: 570; font-size: 13.5px;
  list-style: none; display: flex; align-items: center; gap: 9px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
details.report summary:hover { background: var(--hover); }
details.report summary::-webkit-details-marker { display: none; }
details.report summary::before {
  content: "▶"; font-size: 8.5px; color: var(--faint);
  transition: transform .15s;
}
details.report[open] summary::before { transform: rotate(90deg); }
details.report .body { padding: 0 14px 14px; }
pre.mono {
  background: #1a1a1a; border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; margin: 0; overflow: auto; max-height: 55vh;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cfcfcd;
  -webkit-overflow-scrolling: touch;
}

.warnbox {
  display: flex; gap: 10px; align-items: baseline;
  background: var(--amber-bg); border-radius: 8px;
  color: var(--amber); padding: 11px 14px; font-size: 13px;
  margin-top: 10px;
}

.kv { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; font-variant-numeric: tabular-nums; }
.kv .k { color: var(--muted); margin-right: 5px; }

/* ---------- bots ---------- */
.posbox { background: var(--card2); border-radius: 6px; padding: 10px 13px; margin: 10px 0; }
.totrow { display: flex; gap: 4px 20px; flex-wrap: wrap; align-items: center; font-size: 13px; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.preset-mini { display: grid; gap: 4px; margin: 8px 0 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.preset-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
}
.preset-row.active { color: var(--text); }
@media (max-width: 520px) {
}

/* ---------- toast / auth ---------- */
#toast {
  position: fixed; z-index: 50;
  left: 50%; transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  background: #2a1d1c; color: var(--neg); border: 1px solid rgba(255, 115, 105, .4);
  padding: 10px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
@media (min-width: 920px) { #toast { bottom: 28px; } }

.authgate {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 15, 15, .88);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.authcard { width: min(380px, 92vw); padding: 22px; }
.authcard h2 { margin: 0 0 6px; font-size: 16px; }
.authcard p { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.authcard input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font: inherit;
}
.authcard input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.authcard .btn { width: 100%; }

/* multi-series time chart (final minute) */
.linewrap.tall { height: 300px; margin-bottom: 18px; }
.linewrap.zoomable {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.linewrap.zoomable.dragging { cursor: grabbing; }
.linewrap.tv-line {
  position: relative;
  height: 360px;
  margin-bottom: 12px;
  overflow: visible;
}
.linewrap.tv-line .chart-render-target {
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
}
.linewrap.tv-line .tv-band-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.linewrap.tv-line .tv-badband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(229, 72, 77, .14);
  border-left: 1px solid rgba(229, 72, 77, .38);
  border-right: 1px solid rgba(229, 72, 77, .38);
}
.linewrap.tv-line table {
  font-family: inherit;
}
.linewrap .badband { fill: rgba(229, 72, 77, .13); stroke: rgba(229, 72, 77, .35); stroke-width: .3; }
.linewrap .gline-svg.zero { stroke: rgba(255, 255, 255, .22); stroke-dasharray: 3 3; }
.linewrap .right-axis { stroke: rgba(210, 217, 228, .30); stroke-width: .6; }
.linewrap .model-line.emphasis { filter: drop-shadow(0 0 2px rgba(255, 255, 255, .12)); }
.linewrap .model-line.muted { filter: none; }
.linewrap .price-line { filter: drop-shadow(0 0 2px rgba(210, 217, 228, .14)); }
.linewrap .price-dot { stroke: var(--card); stroke-width: 1.6; }
.linewrap .xticks { position: absolute; left: 0; right: 0; bottom: -16px; height: 14px; }
.linewrap .xtick { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--muted, #8b93a1); white-space: nowrap; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; font-size: 12px; color: var(--muted, #8b93a1); }
.legend.chartlegend { row-gap: 7px; }
.legend .legitem {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px; max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  background: rgba(255, 255, 255, .025);
}
.legend .legitem.strong {
  color: var(--text);
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .045);
}
.legend .legitem.dimmed { opacity: .62; }
.legend .priceleg {
  border-style: dashed;
  color: #cbd2dd;
}
.legend .incidentleg { opacity: .72; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.legend .lineswatch { width: 18px; height: 3px; border-radius: 2px; }
.legend .markerswatch { border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
.legend .badswatch { background: rgba(229, 72, 77, .25); border: 1px solid rgba(229, 72, 77, .5); }

.linewrap .hovercursor { display: none; position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); pointer-events: none; }
.linewrap .hovertip { display: none; position: absolute; z-index: 5; background: #1c2129; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 8px 10px; font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.linewrap .hovertip .tiptime { color: var(--muted, #8b93a1); margin-bottom: 4px; }
.linewrap .hovertip .swatch { width: 8px; height: 8px; display: inline-block; border-radius: 2px; margin-right: 6px; }
.linewrap .hovertip .tiprow { line-height: 1.45; }
.linewrap .hovertip .mutedrow { opacity: .58; }
.linewrap .hovertip .tiprow.price { padding-top: 3px; margin-top: 3px; border-top: 1px solid rgba(255,255,255,.08); color: #cbd2dd; }
.linewrap .hovertip .tipband { color: #e5484d; margin-top: 4px; max-width: 320px; white-space: normal; }
@media (max-width: 620px) {
  .linewrap.tall { height: 260px; }
  .linewrap.tv-line { height: 300px; }
  .legend.chartlegend { max-height: 116px; overflow: auto; padding-right: 2px; }
  .legend .legitem { font-size: 11.5px; padding: 2px 6px; }
  .linewrap .hovertip { max-width: calc(100vw - 48px); white-space: normal; }
}

/* --- pipeline tab --- */
.pcol { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pcol-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.parrow { color: var(--muted); font-size: 22px; align-self: center; padding: 0 2px; }
.pnode { background: var(--bg-card, rgba(255,255,255,.03)); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.pnode-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 3px; }
.pbar { height: 6px; border-radius: 3px; background: var(--gray-bg); margin-top: 6px; overflow: hidden; }
.pbar-fill { height: 100%; background: var(--pos); border-radius: 3px; }
@media (max-width: 900px) {
  .parrow { transform: rotate(90deg); justify-self: center; padding: 2px 0; }
}

/* --- finalminute folds (collapsed deep-dive sections) --- */
details.fold { margin-top: 14px; }
details.fold > summary { font-size: 15px; font-weight: 600; }
details.fold > summary .hint { font-weight: 400; margin-left: 8px; }
details.fold > .body { padding-top: 10px; }

/* --- real/paper пилюли на карточках стримов --- */
.pill.real { background: rgba(51,209,122,.18); color: #7dffb8; border: 1px solid rgba(51,209,122,.55); font-weight: 700; }
.pill.paper { opacity: .7; }
.streams-real-head { margin-top: 6px; }

.strategy-evidence { font-size: 11px; color: var(--faint); margin-top: 6px; }

/* --- тайлы сделок real-стримов: фоновая подсветка --- */
.trade-tile.real-stream { background: rgba(51,209,122,.07); border-color: rgba(51,209,122,.35); }
.trade-tile.real-stream:hover { background: rgba(51,209,122,.12); }
.badge.realmoney { background: rgba(51,209,122,.18); color: #7dffb8; border: 1px solid rgba(51,209,122,.45); }

.strategy-metrics.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.buy-target { color: var(--faint); font-style: normal; font-size: 11px; }

.era-tag { color: var(--faint); font-style: normal; font-size: 9px; text-transform: none; letter-spacing: 0; }

/* --- границы эр на графике --- */
.tv-eraline {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 2px dashed rgba(210,217,228,.45); pointer-events: auto; z-index: 3;
}
.tv-eraline span {
  position: absolute; top: 2px; left: 4px; white-space: nowrap;
  font-size: 10px; color: var(--faint);
  background: rgba(25,25,25,.85); padding: 1px 5px; border-radius: 4px;
}

/* --- problems-панель real-исполнения --- */
.problems-panel { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.problem-row {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.problem-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.problem-row.ok .problem-dot { background: #33d17a; }
.problem-row.warn .problem-dot { background: #f2b84b; }
.problem-row.bad .problem-dot { background: #ff5d5d; }
.problem-row.bad { border-color: rgba(255,93,93,.4); }
.problem-row.warn { border-color: rgba(242,184,75,.35); }
.problem-title { font-weight: 650; }
.problem-value { font-variant-numeric: tabular-nums; }
.problem-hint { color: var(--faint); font-style: normal; font-size: 12px; }
