    :root {
      --bg:        #0f0f0f;
      --surface:   #1a1a1a;
      --border:    #2a2a2a;
      --text:      #e8e8e8;
      --text-dim:  #888;
      --green:     #22c55e;
      --red:       #ef4444;
      --yellow:    #f59e0b;
      --blue:      #3b82f6;
      --accent:    #6366f1;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 14px;
      min-height: 100vh;
    }

    /* Nav */
    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      display: flex;
      gap: 2px;
      padding: 0 8px;
      overflow-x: auto;
    }
    nav a {
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 12px 14px;
      color: var(--text-dim);
      text-decoration: none;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      border-bottom: 2px solid transparent;
      transition: color .15s, border-color .15s;
    }
    nav a.router-link-active {
      color: var(--text);
      border-bottom-color: var(--accent);
    }

    /* Layout */
    main { padding: 16px; max-width: 900px; margin: 0 auto; }

    /* Cards */
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 16px;
      margin-bottom: 12px;
    }
    .card-title {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: var(--text-dim);
      margin-bottom: 10px;
    }

    /* KPI grid */
    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }
    .kpi {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 14px;
    }
    .kpi-label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
    .kpi-value { font-size: 22px; font-weight: 700; }

    /* Tables */
    .table-wrap { overflow-x: auto; }
    table { width: 100%; border-collapse: collapse; font-size: 12px; }
    th {
      text-align: left;
      padding: 6px 8px;
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .05em;
      color: var(--text-dim);
      border-bottom: 1px solid var(--border);
    }
    td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
    tr:last-child td { border-bottom: none; }
    tr:hover td { background: rgba(255,255,255,.03); }

    /* Heatmap */
    .heatmap {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
      gap: 6px;
    }
    .heatmap-cell {
      border-radius: 8px;
      padding: 10px 8px;
      text-align: center;
      cursor: pointer;
      transition: opacity .15s;
    }
    .heatmap-cell:hover { opacity: .8; }
    .heatmap-cell .sym { font-weight: 700; font-size: 13px; }
    .heatmap-cell .pnl { font-size: 11px; margin-top: 2px; }

    /* P&L colors */
    .pos-strong { background: #166534; color: #bbf7d0; }
    .pos-mid    { background: #14532d; color: #86efac; }
    .pos-weak   { background: #052e16; color: #4ade80; }
    .neutral    { background: #1f1f1f; color: var(--text-dim); }
    .neg-weak   { background: #2d0a0a; color: #fca5a5; }
    .neg-mid    { background: #450a0a; color: #f87171; }
    .neg-strong { background: #7f1d1d; color: #fecaca; }

    .green  { color: var(--green); }
    .red    { color: var(--red); }
    .yellow { color: var(--yellow); }
    .dim    { color: var(--text-dim); }

    /* Badge */
    .badge {
      display: inline-block;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 600;
    }
    .badge-open    { background: #1e3a5f; color: #93c5fd; }
    .badge-stale   { background: #3b2800; color: #fcd34d; }
    .badge-closed  { background: #1a1a1a; color: #888; }
    .badge-green   { background: #052e16; color: #86efac; }
    .badge-red     { background: #450a0a; color: #f87171; }

    /* Chart containers */
    .chart-wrap { position: relative; height: 220px; }

    /* Sector donut */
    .donut-wrap { position: relative; height: 180px; width: 180px; margin: 0 auto; }

    /* Filter bar */
    .filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
    .filters select, .filters input {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 6px 10px;
      border-radius: 6px;
      font-size: 12px;
      outline: none;
    }

    /* Spinner */
    .spinner {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 40px;
      color: var(--text-dim);
      font-size: 13px;
    }

    /* Signal detail */
    .detail-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 12px;
    }
    .detail-row { display: flex; flex-direction: column; gap: 2px; }
    .detail-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
    .detail-value { font-size: 14px; font-weight: 600; }

    .thesis-box {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px;
      font-size: 12px;
      line-height: 1.6;
      color: var(--text-dim);
    }

    .back-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: none;
      border: none;
      color: var(--accent);
      cursor: pointer;
      font-size: 13px;
      padding: 0;
      margin-bottom: 14px;
    }

    /* Scan results modal */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.75);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      width: 100%;
      max-width: 640px;
      min-height: 220px;
      max-height: 88vh;
      overflow-y: auto;
      padding: 20px 16px 24px;
    }
    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
    }
    .modal-title { font-size: 15px; font-weight: 700; }
    .modal-close {
      background: none;
      border: none;
      color: var(--text-dim);
      font-size: 18px;
      cursor: pointer;
      line-height: 1;
      padding: 2px 6px;
    }
    .modal-nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }
    .modal-nav-label { font-size: 14px; font-weight: 600; }
    .modal-nav button {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 6px 14px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 12px;
    }
    .modal-nav button:disabled { opacity: .3; cursor: not-allowed; }
    .run-block { margin-bottom: 20px; }
    .run-time-row {
      display: flex;
      gap: 8px;
      align-items: center;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-dim);
      margin-bottom: 8px;
      padding-bottom: 6px;
      border-bottom: 1px solid var(--border);
    }
    .rec-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 12px;
      margin-bottom: 6px;
    }
    .rec-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 4px;
    }
    .rec-left { display: flex; align-items: center; gap: 8px; }
    .rec-rank { font-size: 11px; color: var(--text-dim); min-width: 18px; }
    .rec-right { text-align: right; }
    .rec-meta { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; }

    @media (max-width: 480px) {
      .detail-grid { grid-template-columns: 1fr; }
      .kpi-value   { font-size: 18px; }
    }

/* ── Layout utilities ─────────────────────────────────────── */
.flex-between        { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:8px; }
.flex-between-center { display:flex; justify-content:space-between; align-items:center; }
.flex-center-wrap    { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.flex-row            { display:flex; gap:10px; }
.flex-row-sm         { display:flex; gap:6px; align-items:center; }
.grid-2col           { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* ── Spacing utilities ────────────────────────────────────── */
.mb-0  { margin-bottom:0; }
.mb-sm { margin-bottom:8px; }
.mb-md { margin-bottom:12px; }
.mb-lg { margin-bottom:14px; }
.mb-xl { margin-bottom:16px; }
.mt-sm { margin-top:8px; }
.mt-md { margin-top:10px; }
.mt-lg { margin-top:14px; }
.p-sm  { padding:8px; }

/* ── Typography utilities ─────────────────────────────────── */
.heading-xl   { font-size:24px; font-weight:700; }
.heading-lg   { font-size:22px; font-weight:700; }
.text-lg      { font-size:16px; }
.text-md      { font-size:14px; }
.text-sm      { font-size:13px; }
.text-xs      { font-size:12px; }
.text-2xs     { font-size:11px; }
.text-3xs     { font-size:10px; }
.font-bold    { font-weight:700; }
.font-semi    { font-weight:600; }
.text-right   { text-align:right; }
.text-center  { text-align:center; }
.nowrap       { white-space:nowrap; }
.clickable    { cursor:pointer; }
.line-relaxed { line-height:1.6; }
.line-snug    { line-height:1.5; }
.uppercase-label { font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); margin-bottom:3px; }

/* ── Tab bar system ───────────────────────────────────────── */
.tab-bar { display:flex; gap:2px; margin-bottom:12px; border-bottom:1px solid var(--border); }
.tab-btn { background:none; border:none; padding:10px 16px; font-size:13px; font-weight:600; cursor:pointer; color:var(--text-dim); border-bottom:2px solid transparent; }
.tab-btn.tab-active { color:var(--text); border-bottom-color:var(--accent); }

/* ── View toggle buttons ──────────────────────────────────── */
.view-toggle         { padding:4px 12px; border-radius:6px; border:1px solid var(--border); cursor:pointer; font-size:12px; font-weight:600; }
.view-toggle.toggle-active   { background:var(--accent); color:#fff; }
.view-toggle.toggle-inactive { background:var(--surface); color:var(--text-dim); }

/* ── Form inputs ──────────────────────────────────────────── */
.form-input { width:100%; padding:6px 8px; background:#1e2028; border:1px solid #374151; border-radius:6px; color:var(--text); font-size:14px; box-sizing:border-box; }
.form-input-lg { width:100%; padding:8px 10px; background:#1e2028; border:1px solid #374151; border-radius:6px; color:var(--text); font-size:14px; box-sizing:border-box; }
.input-wrap      { flex:1; min-width:100px; }
.input-wrap-wide { flex:1; min-width:120px; }
.input-label     { font-size:11px; color:var(--text-dim); margin-bottom:4px; }

/* ── Trade form buttons ───────────────────────────────────── */
.trade-mode-btn      { padding:5px 14px; border-radius:6px; cursor:pointer; color:#fff; font-weight:600; font-size:12px; border:2px solid transparent; }
.trade-mode-paper    { background:#6366f1; }
.trade-mode-inactive { background:#374151; }
.live-trade-btn        { padding:6px 16px; border-radius:6px; cursor:pointer; font-weight:700; font-size:13px; }
.live-trade-btn.live-active   { background:#b45309; color:#fef3c7; border:2px solid #f59e0b; box-shadow:0 0 0 3px rgba(245,158,11,.35); }
.live-trade-btn.live-inactive { background:#374151; color:#9ca3af; border:2px solid transparent; }
.side-btn          { padding:5px 20px; border-radius:6px; border:none; cursor:pointer; color:#fff; font-weight:700; font-size:13px; }
.side-btn-buy      { background:#16a34a; }
.side-btn-sell     { background:#dc2626; }
.side-btn-inactive { background:#374151; }
.trade-submit-btn  { padding:8px 22px; border-radius:6px; border:none; cursor:pointer; color:#fff; font-weight:700; font-size:14px; }
.trade-submit-btn:disabled { opacity:0.5; cursor:not-allowed; }
.live-warning-text { font-size:11px; font-weight:600; color:#f59e0b; align-self:center; }

/* ── Alert / status boxes ─────────────────────────────────── */
.alert-box   { padding:8px 12px; border-radius:8px; font-size:12px; font-weight:600; }
.alert-paper { background:rgba(59,130,246,.12); color:#3b82f6; border:1px solid rgba(59,130,246,.3); }
.alert-live  { background:rgba(245,158,11,.12); color:#f59e0b; border:1px solid rgba(245,158,11,.3); }
.warning-box { padding:10px 12px; border-radius:8px; background:rgba(245,158,11,.1); border:1px solid rgba(245,158,11,.3); font-size:12px; color:#f59e0b; line-height:1.5; }
.result-box { margin-top:10px; font-size:13px; padding:8px 10px; border-radius:6px; }
.result-ok  { background:rgba(34,197,94,.12); color:#22c55e; }
.result-err { background:rgba(239,68,68,.12); color:#ef4444; }
.info-box   { padding:10px 12px; border-radius:8px; background:#1e2028; border:1px solid #374151; }

/* ── Signal detail header ─────────────────────────────────── */
.signal-header    { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.signal-pnl       { text-align:right; }
.signal-symbol    { font-size:24px; font-weight:700; }
.signal-pnl-value { font-size:22px; font-weight:700; }
.signal-pnl-sub   { font-size:11px; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state { text-align:center; padding:20px; font-size:12px; }

/* ── Chart containers ─────────────────────────────────────── */
.chart-sm { position:relative; height:140px; }

/* ── Scan / run cards ─────────────────────────────────────── */
.section-divider { width:1px; background:var(--border); align-self:stretch; }

/* ── Verdict badge variants ───────────────────────────────── */
.badge-affirm  { background:rgba(34,197,94,.15);  color:#22c55e; }
.badge-pending { background:rgba(245,158,11,.15); color:#f59e0b; }
.badge-exit    { background:rgba(239,68,68,.15);  color:#ef4444; }

/* ── Verdict text colors ──────────────────────────────────── */
.text-affirm  { color:#22c55e; }
.text-pending { color:#f59e0b; }
.text-exit    { color:#ef4444; }

/* ── Confirm modal detail grid ────────────────────────────── */
.confirm-grid        { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.confirm-field-label { font-size:10px; text-transform:uppercase; letter-spacing:.05em; margin-bottom:3px; color:var(--text-dim); }
.confirm-field-value { font-size:18px; font-weight:700; }

/* ── Revalidation section ─────────────────────────────────── */
.reval-strip { display:flex; gap:12px; align-items:center; margin-bottom:14px; flex-wrap:wrap; }
.exit-votes  { font-size:13px; font-weight:700; color:#f59e0b; }

/* ── Additional utilities ─────────────────────────────────── */
.mb-xs { margin-bottom:4px; }
.mb-2xs { margin-bottom:2px; }
.line-snug { line-height:1.5; }

/* ── Modal action buttons ─────────────────────────────────── */
.modal-btn { flex:1; padding:9px; border-radius:8px; border:1px solid #374151; background:#1a1a1a; color:var(--text); font-size:14px; cursor:pointer; }

/* ── Ghost button (inline clear/action button) ────────────── */
.ghost-btn { background:none; border:none; color:var(--text-dim); font-size:12px; cursor:pointer; padding:0; }
.ghost-btn-sm { background:none; border:1px solid var(--border); color:var(--text-dim); border-radius:4px; padding:2px 7px; cursor:pointer; font-size:11px; }

/* ── Scan info box row ────────────────────────────────────── */
.scan-info-row { display:flex; gap:16px; }
.scan-stat-value { font-size:18px; font-weight:700; }

/* ── Signal name in scan results ──────────────────────────── */
.rec-symbol { font-size:14px; font-weight:700; }

/* ── Order detail right column ────────────────────────────── */
.order-side-col { text-align:right; display:flex; flex-direction:column; gap:4px; align-items:flex-end; }

/* ── Telegram gate screen ─────────────────────────────────── */
.telegram-gate { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:100vh; gap:16px; padding:24px; text-align:center; }
.telegram-gate-emoji { font-size:48px; }
.telegram-gate-title { font-size:18px; font-weight:700; }
.telegram-gate-body  { font-size:13px; color:var(--text-dim); max-width:280px; line-height:1.6; }

/* ── Flex center small ────────────────────────────────────── */
.flex-center-sm { display:flex; align-items:center; gap:8px; }

/* ── Sector allocation chart wrapper ─────────────────────── */
.flex-chart { flex:1; min-width:150px; }

/* ── Allocation row ───────────────────────────────────────── */
.alloc-row { display:flex; justify-content:space-between; padding:4px 0; font-size:12px; border-bottom:1px solid var(--border); }

/* ── View toggle group ────────────────────────────────────── */
.view-toggle-group { margin-left:auto; display:flex; gap:6px; }

/* ── Sort dropdown ────────────────────────────────────────── */
.sort-select { background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:6px; padding:5px 10px; cursor:pointer; font-size:12px; }

/* ── Signal filter indicator ──────────────────────────────── */
.filter-indicator { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-dim); }

/* ── Heatmap symbol row ────────────────────────────────────── */
.heatmap-sym-row { display:flex; justify-content:center; align-items:center; gap:4px; }
