:root {
    --ink: #0b0d10;
    --surface: #12151a;
    --surface-2: #171b21;
    --line: #232830;
    --line-soft: #1b1f26;
    --text: #e8eaed;
    --text-2: #a7adb7;
    --muted: #747b86;
    --accent: #f5a524;
    --accent-soft: rgba(245, 165, 36, 0.14);
    --up: #3ecf8e;
    --up-soft: rgba(62, 207, 142, 0.12);
    --down: #f0616d;
    --down-soft: rgba(240, 97, 109, 0.12);
    --info: #7aa7ff;
    --radius: 10px;
    --radius-sm: 6px;
    --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
    margin: 0;
    min-height: 100dvh;
    background: var(--ink);
    color: var(--text);
    font: 15px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Top bar */
.bar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 28px;
    height: 60px; padding: 0 28px;
    background: rgba(11, 13, 16, 0.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark {
    display: grid; place-items: center; width: 28px; height: 28px;
    border-radius: 7px; background: var(--accent); color: #1a1205;
    font: 700 12px/1 var(--mono);
}
.bar-nav { display: flex; gap: 4px; }
.bar-nav a {
    padding: 6px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); text-decoration: none; font-size: 14px;
}
.bar-nav a:hover { color: var(--text); background: var(--surface-2); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bar-right form { margin: 0; }
.bar-link {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--text-2); font-size: 14px; text-decoration: none;
}
.bar-link:hover { color: var(--text); }
.pill {
    font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.pill-paper { color: var(--accent); background: var(--accent-soft); }
.user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.user-avatar {
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
    font: 600 12px/1 var(--sans); color: var(--accent);
}
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.ok .live-dot { background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); }
.live.bad .live-dot { background: var(--down); }

/* Page */
.page { max-width: 1360px; margin: 0 auto; padding: 36px 28px 80px; }
.summary h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; }
.lede { margin: 8px 0 0; color: var(--text-2); max-width: 62ch; }
.stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); overflow: hidden;
}
.stat { display: flex; flex-direction: column; gap: 2px; padding: 18px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font: 600 26px/1.25 var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 13px; color: var(--text-2); }
.pos { color: var(--up); }
.neg { color: var(--down); }

.layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px; margin-top: 36px; align-items: start;
}
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.section-head h2 { font-size: 18px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.seg button {
    border: 0; background: none; cursor: pointer;
    padding: 5px 11px; border-radius: 6px; font-size: 13px; color: var(--text-2);
}
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sort select {
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    padding: 6px 10px; font-size: 13px; color: var(--text);
}

/* Trades */
.trade-list { display: flex; flex-direction: column; gap: 10px; }
.trade {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color 160ms ease;
}
.trade:hover { border-color: #2f3540; }
.trade.watch { background: transparent; }
.trade-main {
    display: grid; width: 100%; text-align: left;
    grid-template-columns: 34px minmax(180px, 1.3fr) minmax(220px, 1.1fr) auto;
    align-items: center; gap: 20px; padding: 16px 20px;
    background: none; border: 0; cursor: pointer;
}
.grade {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
    font: 600 14px/1 var(--mono); background: var(--surface-2); color: var(--text-2);
}
.grade-A { background: var(--up-soft); color: var(--up); }
.grade-B { background: var(--accent-soft); color: var(--accent); }
.trade.watch .grade { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.trade-title { display: flex; flex-direction: column; min-width: 0; }
.t-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.t-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.trade-action { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chip {
    align-self: flex-start; font: 600 13px/1 var(--mono);
    padding: 6px 10px; border-radius: 6px;
}
.chip-yes { color: var(--up); background: var(--up-soft); }
.chip-no { color: var(--info); background: rgba(122, 167, 255, 0.12); }
.trade.watch .chip { color: var(--text-2); background: var(--surface-2); }
.odds { display: flex; flex-direction: column; gap: 5px; }
.odds-track { position: relative; height: 6px; border-radius: 3px; background: var(--line-soft); }
.odds-gap { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); border-radius: 3px; }
.odds-mk { position: absolute; top: -4px; width: 3px; height: 14px; border-radius: 2px; transform: translateX(-1px); }
.odds-market { background: var(--text-2); }
.odds-model { background: var(--accent); }
.odds-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.odds-legend b { font-weight: 600; color: var(--text-2); }
.lg-model b { color: var(--accent); }
.trade-nums { display: grid; grid-template-columns: repeat(4, 74px); gap: 6px; text-align: right; }
.num { display: flex; flex-direction: column; }
.num-v { font: 600 15px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.num-l { font-size: 12px; color: var(--muted); }
.trade.watch .num-v { color: var(--text-2); }
.n-stake-l.reason { white-space: normal; }

.trade-detail {
    display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
    padding: 4px 20px 20px 74px;
    animation: open 200ms ease both;
}
@keyframes open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.plan h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.steps, .risks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; color: var(--text-2); }
.steps li::before {
    counter-increment: step; content: counter(step);
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    background: var(--surface-2); font: 600 11px/1 var(--mono); color: var(--text);
}
.steps { counter-reset: step; }
.steps b, .risks b { color: var(--text); font-weight: 600; }
.risks li { font-size: 14px; color: var(--text-2); padding-left: 14px; position: relative; }
.risks li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 2px; background: var(--muted); }

/* Side column */
.side { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 84px; }
.pos-list { display: flex; flex-direction: column; gap: 8px; }
.position {
    padding: 14px 16px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
}
.position-top { display: flex; justify-content: space-between; gap: 12px; }
.position-name { font-size: 14px; font-weight: 550; }
.position-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.position-pnl { font: 600 15px/1.3 var(--mono); white-space: nowrap; }
.verdict {
    display: flex; gap: 10px; align-items: flex-start; margin-top: 10px;
    padding: 9px 11px; border-radius: 8px; font-size: 13px; line-height: 1.4;
}
.verdict b { font-weight: 650; }
.verdict-hold { background: var(--up-soft); color: #bdeed6; }
.verdict-sell { background: var(--accent-soft); color: #fbdcaa; }
.verdict-settled, .verdict-wait { background: var(--surface-2); color: var(--text-2); }

.rec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rec-row + .rec-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.rec-head { display: flex; justify-content: space-between; font-size: 14px; }
.rec-head span:last-child { color: var(--muted); font-size: 13px; }
.rec-bars { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.rec-bar { display: grid; grid-template-columns: 86px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.rec-bar i { display: block; height: 6px; border-radius: 3px; background: var(--muted); }
.rec-bar.won i { background: var(--up); }
.rec-bar b { font: 600 12px var(--mono); color: var(--text); text-align: right; }
.rec-note { font-size: 13px; color: var(--text-2); margin-top: 10px; }

.how h2 { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.how dl { margin: 0; display: grid; grid-template-columns: 70px 1fr; gap: 8px 12px; font-size: 13px; }
.how dt { font-weight: 600; }
.how dd { margin: 0; color: var(--text-2); }

.empty {
    padding: 36px 28px; border: 1px dashed var(--line); border-radius: var(--radius);
    color: var(--text-2); text-align: center;
}
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty button {
    margin-top: 14px; background: var(--surface-2); border: 1px solid var(--line);
    padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.skeleton { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr; }
    .side { position: static; }
    .trade-main { grid-template-columns: 34px 1fr; }
    .trade-action, .trade-nums { grid-column: 2; }
    .trade-nums { grid-template-columns: repeat(4, 1fr); text-align: left; }
    .trade-detail { grid-template-columns: 1fr; padding-left: 74px; }
}
@media (max-width: 720px) {
    .bar { gap: 14px; padding: 0 16px; }
    .bar-nav, .bar-link[href="/terminal"] { display: none; }
    .live #live-text { display: none; }
    .page { padding: 24px 16px 60px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stat:nth-child(3) { border-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
    .trade-main { padding: 14px; gap: 14px; }
    .trade-detail { padding: 4px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Board */
.main-col { display: flex; flex-direction: column; gap: 44px; min-width: 0; }
.section-note { margin: -4px 0 14px; color: var(--text-2); font-size: 14px; max-width: 70ch; }
.risks a { color: var(--accent); }
.prices { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.prices b { color: var(--text-2); font-family: var(--mono); font-weight: 600; }
.prices b.accent { color: var(--accent); }
