/* ── Night desk — tokens ─────────────────────────────────────────── */
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/spacegrotesk.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/plexmono-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/plexmono-600.woff2") format("woff2");
  font-weight: 600; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0B0E14;
  --panel: #121722;
  --panel-2: #1A2130;
  --line: #222B3D;
  --ink: #E9EDF5;
  --ink-2: #9AA5BC;
  --ink-3: #5E6880;
  --accent: #E8B04A;
  --accent-deep: #BD861A;
  --up: #3DD68C;
  --up-mark: #23A366;
  --down: #F4776F;
  --down-mark: #E85D57;
  --blue: #5B8FD9;
  --radius: 12px;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 15px; line-height: 1.5;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--ink-3); }

/* ── Shell ───────────────────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 96px; }
@media (min-width: 900px) { .wrap { padding-bottom: 32px; } }

header.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.wordmark {
  font-family: var(--disp); font-weight: 700; font-size: 17px; letter-spacing: .02em;
  white-space: nowrap;
}
.wordmark em { font-style: normal; color: var(--accent); }

.pulse { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.refresh-in { white-space: nowrap; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(61,214,140,.5); animation: beat 2.4s ease-out infinite; }
.pulse-dot.off { background: var(--down); animation: none; }
.pulse-dot.halt { background: var(--accent); animation: none; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgba(61,214,140,.45); } 70% { box-shadow: 0 0 0 9px rgba(61,214,140,0); } 100% { box-shadow: 0 0 0 0 rgba(61,214,140,0); } }

.top-equity { margin-left: auto; text-align: right; }
.top-equity .num { font-weight: 600; font-size: 14px; }
.refresh-in { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* nav */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
nav.tabs button {
  flex: 1; background: none; border: 0; color: var(--ink-3);
  font-family: var(--disp); font-size: 11px; font-weight: 500; letter-spacing: .04em;
  padding: 10px 2px 12px; display: flex; flex-direction: column; gap: 3px; align-items: center;
}
nav.tabs button .glyph { font-size: 17px; line-height: 1; font-family: var(--mono); }
nav.tabs button.active { color: var(--accent); }
@media (min-width: 900px) {
  nav.tabs { position: static; background: none; border: 0; backdrop-filter: none;
    max-width: 1080px; margin: 18px auto 0; padding: 0 16px; gap: 8px; justify-content: flex-start; }
  nav.tabs button { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: 13px;
    padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
  nav.tabs button.active { border-color: var(--accent-deep); background: color-mix(in srgb, var(--accent-deep) 12%, var(--panel)); }
}

.stale-banner {
  display: none; margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent); font-size: 13px;
}
.stale-banner.show { display: block; }

section.panel-page { display: none; padding-top: 18px; }
section.panel-page.active { display: block; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.eyebrow { font-family: var(--disp); font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
h2.section-title { font-family: var(--disp); font-weight: 700; font-size: 18px; margin: 22px 0 10px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { padding: 20px 16px; }
.hero .big { font-family: var(--mono); font-weight: 600; font-size: clamp(34px, 8vw, 46px); line-height: 1.05; letter-spacing: -0.01em; }
.hero-deltas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); }
.chip .lbl { font-family: var(--disp); font-size: 11px; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.shadow-chips { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.shadow-chips .chip { border-style: dashed; }

/* chart */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-tip { position: absolute; pointer-events: none; display: none; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--mono);
  font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }
.chart-tip .d { color: var(--ink-3); font-size: 11px; }

/* ── Positions — the price rail is the signature ─────────────────── */
.poz-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .poz-grid { grid-template-columns: 1fr 1fr; } }
.poz { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 18px; }
.poz-head { display: flex; align-items: baseline; gap: 10px; }
.poz-head .sym { font-family: var(--disp); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.poz-head .strat { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.poz-head .pct { margin-left: auto; font-family: var(--mono); font-weight: 600; font-size: 17px; }
.poz-sub { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.poz-sub b { color: var(--ink); font-weight: 600; }

.rail { position: relative; height: 46px; margin: 18px 2px 2px; }
.rail-track { position: absolute; left: 0; right: 0; top: 21px; height: 4px; border-radius: 2px; background: var(--panel-2); }
.rail-locked { position: absolute; top: 21px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--up-mark) 55%, transparent); }
.rail-mark { position: absolute; top: 13px; width: 2px; height: 20px; border-radius: 1px; background: var(--ink-3); }
.rail-mark.stop { background: var(--down-mark); }
.rail-mark.hwm { background: var(--ink-3); opacity: .7; }
.rail-entry { position: absolute; top: 18px; width: 10px; height: 10px; transform: translateX(-50%) rotate(45deg);
  border: 2px solid var(--ink-2); background: var(--bg); }
.rail-now { position: absolute; top: 16px; width: 14px; height: 14px; border-radius: 50%;
  transform: translateX(-50%); border: 2.5px solid var(--bg); }
.rail-lbl { position: absolute; font-family: var(--mono); font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.rail-lbl.top { top: -4px; }
.rail-lbl.bot { top: 36px; }
.poz-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.poz-foot .locked { color: var(--up); }

/* ── Watchlist ───────────────────────────────────────────────────── */
.wl-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.wl-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.wl-row .status-chip { margin-left: auto; }
.wl-row:last-child { border-bottom: 0; }
.wl-sym { font-family: var(--disp); font-weight: 700; font-size: 14.5px; width: 62px; }
.wl-price { font-family: var(--mono); font-size: 13px; width: 88px; text-align: right; }
.wl-chg { font-family: var(--mono); font-size: 12px; width: 64px; text-align: right; }
.wl-rsi { flex: 1; min-width: 70px; max-width: 150px; }
.wl-rsi .bar { height: 4px; border-radius: 2px; background: var(--panel-2); position: relative; margin-top: 4px; }
.wl-rsi .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--blue); }
.wl-rsi .t { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.status-chip { font-family: var(--disp); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap; }
.status-chip.semnal { color: #10131A; background: var(--accent); border-color: var(--accent); animation: glowp 2.2s ease-in-out infinite; }
@keyframes glowp { 0%,100% { box-shadow: 0 0 0 0 rgba(232,176,74,.0);} 50% { box-shadow: 0 0 14px 0 rgba(232,176,74,.45);} }
.status-chip.aproape { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 55%, transparent); }
.status-chip.in-portofoliu { color: var(--up); border-color: color-mix(in srgb, var(--up-mark) 60%, transparent); }
.status-chip.trend-ok { color: var(--ink-2); }
.status-chip.fara-trend, .status-chip.date-insuficiente { opacity: .55; }

/* ── Trades & events ─────────────────────────────────────────────── */
.tr-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.tr-row:last-child { border-bottom: 0; }
.tr-side { font-family: var(--mono); font-size: 15px; width: 22px; text-align: center; color: var(--ink-2); }
.tr-main { flex: 1; min-width: 0; }
.tr-line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tr-line1 .sym { font-family: var(--disp); font-weight: 700; }
.tr-line1 .qp { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.tr-reason { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }
.tr-when { font-family: var(--mono); font-size: 11px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.outcome { font-family: var(--disp); font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; letter-spacing: .05em; }
.outcome.win { color: var(--up); border: 1px solid color-mix(in srgb, var(--up-mark) 60%, transparent); }
.outcome.loss { color: var(--down); border: 1px solid color-mix(in srgb, var(--down-mark) 60%, transparent); }
.outcome.remediere { color: var(--ink-2); border: 1px solid var(--line); }

.ev-row { display: flex; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev-row:last-child { border-bottom: 0; }
.ev-icon { font-family: var(--mono); width: 20px; text-align: center; }
.ev-text { flex: 1; color: var(--ink-2); overflow-wrap: anywhere; }
.ev-text b { color: var(--ink); font-weight: 600; }
.ev-when { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* ── Strategy page ───────────────────────────────────────────────── */
.strategy p { color: var(--ink-2); margin: 8px 0; max-width: 68ch; }
.strategy p b, .strategy li b { color: var(--ink); }
.strategy ul { margin: 8px 0 8px 20px; color: var(--ink-2); }
.strategy li { margin: 4px 0; }
.defs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 12px; }
.def { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.def .k { font-family: var(--disp); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.def .v { font-family: var(--mono); font-weight: 600; font-size: 16px; margin-top: 3px; }
code.ex { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 6px; overflow-wrap: anywhere; }

/* ── Lessons timeline ────────────────────────────────────────────── */
.lessons { position: relative; padding-left: 24px; }
.lessons::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.lesson { position: relative; padding: 0 0 20px; }
.lesson::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--bg); border: 2.5px solid var(--accent-deep); }
.lesson .lid { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.lesson .ld { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 8px; }
.lesson h3 { font-family: var(--disp); font-size: 15px; font-weight: 700; margin: 2px 0 4px; }
.lesson p { color: var(--ink-2); font-size: 13.5px; max-width: 66ch; }

/* ── Login ───────────────────────────────────────────────────────── */
.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 28px; }
.login-card .wordmark { font-size: 22px; }
.login-sub { color: var(--ink-3); font-size: 13px; margin: 6px 0 24px; }
.login-card label { display: block; font-family: var(--disp); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.login-card input { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 15px; }
.login-card input:focus { outline: 2px solid var(--accent-deep); border-color: transparent; }
.login-card button { width: 100%; margin-top: 14px; background: var(--accent); color: #10131A;
  font-family: var(--disp); font-weight: 700; font-size: 15px; border: 0; border-radius: 10px; padding: 12px; }
.login-card button:hover { filter: brightness(1.08); }
.login-err { color: var(--down); font-size: 13px; margin-bottom: 12px; }

footer.foot { margin-top: 28px; color: var(--ink-3); font-size: 12px; font-family: var(--mono);
  display: flex; flex-wrap: wrap; gap: 6px 16px; }
.logout { background: none; border: 1px solid var(--line); color: var(--ink-3); border-radius: 999px;
  padding: 2px 12px; font-size: 12px; }
.empty { color: var(--ink-3); font-size: 13px; padding: 14px 4px; }
