/* Desert Rose Trading Dashboard — cockpit v5 (elevated) */

:root {
  --bg:                 #121110;
  --surface-lowest:     #0d0c0b;
  --surface-low:        #181614;
  --surface:            #211e1a;
  --surface-high:       #2b2622;
  --on-bg:              #ece8e3;
  --on-surface-variant: #c6c1ba;
  --outline:            #8d877f;
  --outline-variant:    rgba(124, 114, 102, 0.20);
  --hairline:           rgba(124, 114, 102, 0.14);
  --accent:             #e5c099;
  --accent-bright:      #ffddba;
  --accent-deep:        #c79a6a;
  --positive:           #5ed29b;
  --positive-dim:       rgba(94, 210, 155, 0.14);
  --negative:           #f06a6a;
  --negative-dim:       rgba(240, 106, 106, 0.14);
  --warning:            #c9a96e;
  --font-display:       'Bodoni Moda', serif;
  --font-body:          'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:          'Geist Mono', 'JetBrains Mono', 'SF Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg);
  color: var(--on-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* warm-charcoal atmosphere — a soft top-center glow, not flat black */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 50% -10%, #1d1916 0%, #151311 38%, var(--bg) 72%),
    var(--bg);
}
/* fine film grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }
.muted { color: var(--outline); text-align: center; }
.pnl-pos { color: var(--positive); }
.pnl-neg { color: var(--negative); }

/* ============================================================ Login */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-card {
  position: relative;
  background:
    linear-gradient(90deg, rgba(229,192,153,0) 0%, rgba(229,192,153,0.3) 50%, rgba(229,192,153,0) 100%) top / 100% 1px no-repeat,
    linear-gradient(180deg, var(--surface-low), var(--surface-lowest));
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 44px 40px;
  text-align: center;
  width: 360px;
  box-shadow: 0 30px 70px -36px rgba(0,0,0,0.9);
}
.login-card h1 {
  font-family: var(--font-display);
  color: var(--on-bg);
  margin-bottom: 6px;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.login-card .subtitle {
  color: var(--outline);
  margin-bottom: 30px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 500;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 5px;
  color: var(--on-bg);
  font-family: var(--font-body);
  font-size: 15px;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 5px;
  color: #131313;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.login-card button:hover { opacity: 0.88; }
.error { color: var(--negative); margin-bottom: 12px; font-size: 14px; }

/* ============================================================ Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(24,22,20,0.92), rgba(18,17,16,0.82));
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: baseline; gap: 16px; }
.header-left h1 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--on-bg);
}
.header-divider { width: 1px; height: 18px; background: var(--outline-variant); align-self: center; }
.header-left .subtitle { color: var(--outline); font-size: 11px; text-transform: uppercase; letter-spacing: 0.22em; font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 18px; }
.clock { color: var(--on-surface-variant); font-family: var(--font-mono); font-size: 12.5px; display: flex; align-items: center; gap: 12px; letter-spacing: 0.02em; }
.clock .lab { color: var(--outline); }
.clock-divider { width: 1px; height: 14px; background: var(--outline-variant); display: inline-block; }
.tz-select { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--on-surface-variant); background: var(--surface-variant, transparent); border: 1px solid var(--outline-variant); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.tz-select:hover { color: var(--on-surface); border-color: var(--outline); }
.tz-select:focus { outline: none; border-color: var(--outline); }

/* connection pip */
.conn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; color: var(--outline); text-transform: uppercase; }
.conn .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); animation: pip 2.4s infinite; }
.conn.down .pip { background: var(--negative); animation: pulse 1.4s infinite; }
.conn.down { color: var(--negative); }
@keyframes pip { 0% { box-shadow: 0 0 0 0 rgba(94,210,155,0.5);} 70%{ box-shadow: 0 0 0 6px rgba(94,210,155,0);} 100%{ box-shadow:0 0 0 0 rgba(94,210,155,0);} }

/* ============================================================ Badges */
.badge { padding: 6px 13px; border-radius: 3px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; }
.badge-ok { background: var(--positive-dim); border: 1px solid rgba(94,210,155,0.5); color: var(--positive); }
.badge-halt { background: var(--negative-dim); border: 1px solid var(--negative); color: var(--negative); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.btn-logout { font-family: var(--font-body); font-size: 13px; color: var(--outline); border: none; background: none; padding: 4px 0; cursor: pointer; text-decoration: none; transition: color 0.15s; }
.btn-logout:hover { color: var(--accent); }

/* ============================================================ Main */
main { padding: 26px 28px 60px; max-width: 1680px; margin: 0 auto; }

/* ============================================================ Status bar */
.status-bar { display: flex; align-items: center; gap: 26px; padding: 10px 2px 4px; margin-bottom: 26px; }
.status-bar-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18em; color: var(--outline); white-space: nowrap; }
.status-bar-items { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.status-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--on-surface-variant); }
.status-age { color: var(--outline); font-family: var(--font-mono); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-ok { background: var(--positive); box-shadow: 0 0 7px rgba(94,210,155,0.55); }
.dot-silent { background: var(--negative); box-shadow: 0 0 7px rgba(240,106,106,0.55); animation: pulse 2s infinite; }
.dot-unknown { background: var(--outline); }

/* ============================================================ Halt bar */
.halt-bar { background: var(--negative-dim); border: 1px solid var(--negative); border-radius: 5px; padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; color: var(--negative); margin-bottom: 26px; }

/* ============================================================ Buttons */
.btn { padding: 6px 14px; border-radius: 5px; border: 1px solid var(--outline-variant); background: var(--surface); color: var(--on-surface-variant); font-family: var(--font-body); font-size: 14px; cursor: pointer; text-decoration: none; transition: color 0.15s, border-color 0.15s; }
.btn:hover { color: var(--accent); border-color: var(--accent); }
.btn-small { padding: 4px 11px; font-size: 12px; }
.btn-resume { background: var(--positive); color: #0c0b0a; border: none; font-weight: 600; }
.btn-resume:hover { opacity: 0.88; }
.btn-resume:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-resume-confirm { background: var(--negative) !important; color: #fff !important; animation: pulse 1s infinite; }

/* ============================================================ Cards */
.card {
  position: relative;
  background:
    linear-gradient(90deg, rgba(229,192,153,0) 0%, rgba(229,192,153,0.28) 50%, rgba(229,192,153,0) 100%) top / 100% 1px no-repeat,
    linear-gradient(180deg, var(--surface-low), var(--surface-lowest));
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 18px 40px -28px rgba(0,0,0,0.8);
  animation: rise 0.55s cubic-bezier(0.2,0.7,0.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* corner-bracket motif */
.bracket-panel::before, .bracket-panel::after { content: ''; position: absolute; width: 13px; height: 13px; pointer-events: none; }
.bracket-panel::before { top: 6px; left: 6px; border-top: 1px solid rgba(229,192,153,0.45); border-left: 1px solid rgba(229,192,153,0.45); }
.bracket-panel::after  { bottom: 6px; right: 6px; border-bottom: 1px solid rgba(229,192,153,0.45); border-right: 1px solid rgba(229,192,153,0.45); }

.card h2 { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 16px; }
.card h2 .count { color: var(--outline); font-weight: 500; margin-left: 6px; }
.card-header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-header-row h2 { margin: 0; }

/* page-load stagger */
.d1 { animation-delay: 0.04s; } .d2 { animation-delay: 0.10s; } .d3 { animation-delay: 0.16s; }
.d4 { animation-delay: 0.22s; } .d5 { animation-delay: 0.28s; } .d6 { animation-delay: 0.34s; }

/* ============================================================ Hero */
.hero-panel { padding: 26px 28px 22px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: stretch; }
.hero-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18em; color: var(--outline); margin-bottom: 10px; }
.hero-figure { display: flex; align-items: flex-start; gap: 14px; }
.hero-caret { font-size: 26px; margin-top: 10px; line-height: 1; }
.hero-pnl { font-family: var(--font-mono); font-size: 72px; font-weight: 600; line-height: 0.92; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-delta { margin-top: 14px; display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 13px; }
.hero-delta .pill { padding: 3px 9px; border-radius: 999px; font-weight: 600; font-size: 12px; background: var(--positive-dim); color: var(--positive); }
.hero-delta .pill.neg { background: var(--negative-dim); color: var(--negative); }
.hero-delta .since { color: var(--outline); }
.hero-divider { height: 1px; background: var(--hairline); margin: 20px 0 16px; }

.substats { display: flex; gap: 48px; align-items: flex-start; flex-wrap: wrap; }
.pnl-stats { display: grid; grid-template-columns: auto auto; gap: 18px 40px; }
.stat-label { display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--outline); margin-bottom: 3px; }
.stat-value { display: block; font-family: var(--font-mono); font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--on-bg); }
.last-fill-relative { display: block; font-family: var(--font-mono); font-size: 21px; color: var(--on-bg); }

/* Margin block (3rd substats column): six margin/equity fields in a 2×3 grid.
   Col 1 = margin usage (used / free / % used), col 2 = equity & cushion
   (maintenance req / actual equity / buffer to maintenance). */
.substats .margin-grid { display: grid; grid-template-columns: auto auto; gap: 18px 30px; }
.pnl-warn { color: #e3b341; }

.hero-chart-wrap { display: flex; flex-direction: column; }
.hero-chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 12px; }
.hero-chart-title { font-family: var(--font-mono); font-size: 10.5px; color: var(--outline); text-transform: uppercase; letter-spacing: 0.14em; }
.ref-group { display: flex; align-items: center; gap: 8px; }
.ref-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--outline); }
.equity-unmarked { font-family: var(--font-mono); font-size: 10px; text-align: right; color: var(--warning); }
.equity-unmarked.hidden { display: none; }
.hero-chart { flex: 1; position: relative; min-height: 150px; }

/* ============================================================ Controls */
.select-small { font-family: var(--font-mono); font-size: 12px; padding: 4px 9px; background: var(--surface); color: var(--on-surface-variant); border: 1px solid var(--outline-variant); border-radius: 4px; cursor: pointer; transition: border-color 0.15s; }
.select-small:hover, .select-small:focus { outline: none; border-color: var(--accent); }
.filter-inline { display: flex; align-items: center; gap: 7px; margin-left: auto; }

/* ============================================================ Layout */
.markets-grid { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; margin-bottom: 22px; }
.markets-left { display: flex; flex-direction: column; gap: 22px; }
.markets-left .card { margin-bottom: 0; }
.intent-alphas-table { margin-top: 0; }
/* Weak cross-card column grid: dense, left-anchored columns (fixed widths, the
   table does NOT stretch to fill the wide card) with a shared first-column
   width so the second column lines up across Positions, Alpha Intent, Trades. */
.aligned-cols { table-layout: fixed; width: 100%; }
.ac-1 { width: 175px; }
/* Alpha Intent + Trades side by side, each filling half the row. */
.markets-row { display: flex; gap: 22px; align-items: flex-start; }
.markets-row > .card { flex: 1 1 0; min-width: 0; }
/* Positions target that differs from actual qty = a pending trade. */
.qty-mismatch { font-weight: 700; }

/* ============================================================ Tables */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--outline); background: var(--surface-low); }
td { padding: 8px 12px; border-bottom: 1px solid var(--hairline); font-size: 14.5px; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(229,192,153,0.05); }
th.num, td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sym { font-family: var(--font-mono); font-weight: 600; }
.side-col { font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: 0.05em; }
tr.buy .side-col { color: var(--positive); }
tr.sell .side-col { color: var(--negative); }
tr.buy td:first-child  { box-shadow: inset 2px 0 0 rgba(94,210,155,0.5); }
tr.sell td:first-child  { box-shadow: inset 2px 0 0 rgba(240,106,106,0.5); }
.ts { font-family: var(--font-mono); font-size: 13px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.time-rel { color: var(--on-surface-variant); }
.id-col { color: var(--outline); font-family: var(--font-mono); font-size: 12px; }

/* ============================================================ Blotter scroll */
.blotter-scroll { max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(124,114,102,0.5) transparent; }
.blotter-scroll thead th { position: sticky; top: 0; background: var(--surface-low); z-index: 1; }
.blotter-scroll::-webkit-scrollbar { width: 5px; }
.blotter-scroll::-webkit-scrollbar-track { background: transparent; }
.blotter-scroll::-webkit-scrollbar-thumb { background: rgba(124,114,102,0.4); border-radius: 3px; }
.blotter-scroll::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* ============================================================ Slippage stat row */
.stat-row { display: flex; flex-wrap: wrap; gap: 36px; align-items: flex-end; }
.stat-row .stat-value { font-size: 22px; }

/* ============================================================ Position history (single multi-line chart + clickable legend) */
.ph-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ph-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--outline-variant); border-radius: 999px; background: var(--surface); color: var(--on-surface-variant); font-family: var(--font-mono); font-size: 11.5px; cursor: pointer; transition: opacity 0.12s, border-color 0.12s; }
.ph-chip:hover { border-color: var(--outline); }
.ph-chip.off { opacity: 0.4; }
.ph-chip .ph-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ph-chip.off .ph-dot { background: var(--outline) !important; }
.ph-chip-sym { font-weight: 600; }
.ph-chip-cur { font-variant-numeric: tabular-nums; }
.ph-chart-wrap { position: relative; height: 240px; }
.ph-chart-wrap.hidden { display: none; }

/* ============================================================ Order book rail */
.ob-rail .card-header-row { margin-bottom: 12px; position: relative; }
.ob-scroll { max-height: 560px; overflow-y: auto; }
.ob-sym { font-family: var(--font-mono); font-weight: 600; }
.ob-sym .ob-sub { display: block; font-size: 10px; font-weight: 400; color: var(--outline); letter-spacing: 0.02em; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ob-phase { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; white-space: nowrap; }
.ob-phase-live   { color: var(--positive); background: var(--positive-dim); }
.ob-phase-trans  { color: var(--accent);   background: rgba(229,192,153,0.12); }
.ob-phase-stop   { color: var(--negative); background: var(--negative-dim); }
.ob-phase-closed { color: var(--outline);  background: rgba(141,135,127,0.12); }
.ob-bid, .ob-ask { line-height: 1.2; }
.ob-px { display: block; font-variant-numeric: tabular-nums; font-weight: 500; }
.ob-sz { display: block; font-size: 11px; color: var(--outline); font-variant-numeric: tabular-nums; margin-top: 2px; }
.ob-bid .ob-px { color: var(--positive); }
.ob-ask .ob-px { color: var(--negative); }
.ob-upd { color: var(--outline); font-size: 13px; }

/* per-row hide — dedicated trailing column */
.ob-x-cell { width: 34px; padding: 0 6px 0 2px; text-align: center; }
.ob-x { width: 24px; height: 24px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--outline); cursor: pointer; font-size: 13px; line-height: 1; opacity: 0; transition: 0.12s; display: inline-flex; align-items: center; justify-content: center; }
.ob-row:hover .ob-x { opacity: 0.6; }
.ob-x:hover { opacity: 1 !important; color: var(--negative); background: var(--negative-dim); border-color: rgba(240,106,106,0.45); }

/* contract selector */
.ob-filter-btn { display: inline-flex; align-items: center; gap: 6px; }
.ob-filter-panel { position: absolute; right: 0; top: 32px; width: 252px; background: var(--surface); border: 1px solid var(--outline-variant); border-radius: 7px; box-shadow: 0 22px 54px -16px rgba(0,0,0,0.9); padding: 9px; z-index: 30; }
.ofp-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; }
.ofp-head span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--outline); }
.ofp-head a { font-size: 11px; color: var(--accent); cursor: pointer; text-decoration: none; }
.ofp-search { padding: 0 2px 8px; }
.ofp-search input { width: 100%; padding: 7px 10px; background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 5px; color: var(--on-bg); font-family: var(--font-mono); font-size: 12.5px; }
.ofp-search input::placeholder { color: var(--outline); }
.ofp-search input:focus { outline: none; border-color: var(--accent); }
.ofp-list { max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(124,114,102,0.5) transparent; }
.ofp-list::-webkit-scrollbar { width: 5px; }
.ofp-list::-webkit-scrollbar-thumb { background: rgba(124,114,102,0.4); border-radius: 3px; }
.ofp-item { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; cursor: pointer; font-family: var(--font-mono); font-size: 13px; }
.ofp-item:hover { background: rgba(229,192,153,0.06); }
.ofp-item input { accent-color: var(--accent); cursor: pointer; }
.ofp-item .ofp-sub { color: var(--outline); font-size: 10.5px; margin-left: auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.ofp-empty { padding: 14px; text-align: center; color: var(--outline); font-size: 12px; font-family: var(--font-mono); }

/* legend */
.ob-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--outline); }
.ob-legend span { display: inline-flex; align-items: center; gap: 6px; }
.phase-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.phase-dot.live   { background: var(--positive); }
.phase-dot.trans  { background: var(--accent); }
.phase-dot.stop   { background: var(--negative); }
.phase-dot.closed { background: var(--outline); }

/* ============================================================ Responsive */
@media (max-width: 1200px) {
  .hero-grid { grid-template-columns: 1fr; gap: 22px; }
  .markets-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1150px) {
  .markets-row { flex-direction: column; }
}
@media (max-width: 768px) {
  main { padding: 16px; }
  .hero-pnl { font-size: 48px; }
  .substats { gap: 14px 22px; }
  header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .header-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}

/* ============================================================ Price Action */
.pa-grid {
  display: grid;
  /* At most two columns: each track is ~half (minus the 18px gap), so a lone
     card stretches full-width, a pair sits side-by-side, three wrap 2+1. */
  grid-template-columns: repeat(auto-fit, minmax(calc(50% - 9px), 1fr));
  gap: 18px;
}
.pa-card {
  background: var(--surface-low);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pa-card-head { display: flex; align-items: flex-start; gap: 10px; }
.pa-sec { position: relative; }
.pa-sec-btn {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--on-bg);
  border: 1px solid var(--outline-variant); border-radius: 5px;
  padding: 4px 9px; cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 116px;
}
.pa-sec-btn:hover { border-color: var(--accent); }
.pa-sec-caret { color: var(--outline); font-size: 9px; margin-left: auto; }
.pa-sec-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; width: 304px;
  background: var(--surface-high); border: 1px solid var(--outline-variant); border-radius: 6px;
  box-shadow: 0 20px 44px -14px rgba(0,0,0,0.78); padding: 7px;
}
.pa-sec-search {
  width: 100%; box-sizing: border-box; background: var(--surface); color: var(--on-bg);
  border: 1px solid var(--outline-variant); border-radius: 5px; padding: 6px 9px;
  font-family: var(--font-body); font-size: 13px; margin-bottom: 6px;
}
.pa-sec-search:focus { outline: none; border-color: var(--accent); }
.pa-sec-list { max-height: 288px; overflow-y: auto; }
.pa-opt-head { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--accent); padding: 7px 8px 3px; }
.pa-opt { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.pa-opt:hover, .pa-opt.hi { background: var(--surface); }
.pa-opt.sel { background: var(--surface-low); }
.pa-opt-tk { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--on-bg); }
.pa-opt-desc { font-size: 11px; color: var(--outline); }
.pa-opt-empty { padding: 12px 8px; color: var(--outline); font-size: 12px; text-align: left; }
.pa-q { display: flex; gap: 20px; margin-left: auto; align-items: flex-start; }
.pa-q-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pa-q-lab { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--outline); }
.pa-q-px { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--on-bg); line-height: 1.1; }
.pa-q-px.pa-spread { color: var(--on-surface-variant); }
.pa-q-px.pa-ret.pos { color: var(--positive); }
.pa-q-px.pa-ret.neg { color: var(--negative); }
.pa-q-sz { font-family: var(--font-mono); font-size: 11px; color: var(--outline); }
.pa-del {
  background: none; border: none; color: var(--outline); font-size: 18px;
  line-height: 1; cursor: pointer; padding: 0 4px; transition: color 0.15s;
}
.pa-del:hover { color: var(--negative); }
.pa-controls { display: flex; gap: 14px; flex-wrap: wrap; }
.pa-pills { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--outline-variant); border-radius: 6px; padding: 2px; }
.pa-pill {
  background: none; border: none; color: var(--outline); cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; padding: 3px 9px; border-radius: 4px; transition: all 0.12s;
}
.pa-pill:hover { color: var(--on-surface-variant); }
.pa-pill.active { background: var(--surface-high); color: var(--accent); }
.pa-overlays { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pa-hl {
  width: 52px; background: var(--surface); color: var(--on-bg);
  border: 1px solid var(--outline-variant); border-radius: 5px;
  padding: 3px 7px; font-family: var(--font-mono); font-size: 12px;
}
.pa-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pa-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant); border-left-width: 3px; border-radius: 4px;
  padding: 2px 7px; cursor: pointer;
}
.pa-chip b { color: var(--outline); margin-left: 2px; }
.pa-chip:hover b { color: var(--negative); }
.pa-chart { width: 100%; height: 240px; }
.pa-empty { padding: 80px 0; }
td.sym-chartable { cursor: pointer; text-decoration: underline dotted var(--outline-variant); text-underline-offset: 3px; }
td.sym-chartable:hover { color: var(--accent); }
@media (max-width: 768px) {
  .pa-grid { grid-template-columns: 1fr; }
}
