*{box-sizing:border-box;margin:0;padding:0;}
html,body{background:#0f1117;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:13px;color:#e2e8f0;min-height:100vh;}

/* ── TOP BAR ─────────────────────────────────────────────────── */
.topbar{background:#161b27;border-bottom:1px solid #2d3748;padding:0 20px;height:52px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:100;}
.logo{font-size:16px;font-weight:700;color:#fff;letter-spacing:-0.5px;}
.tbl{display:flex;align-items:center;gap:16px;}

.pill{padding:3px 10px;border-radius:20px;font-size:11px;font-weight:600;background:#2d1b1b;color:#f87171;border:1px solid #7f1d1d;display:inline-flex;align-items:center;gap:5px;}
.pill.open{background:#0f2b1f;color:#34d399;border-color:#065f46;}

.dot{width:6px;height:6px;border-radius:50%;background:#f87171;display:inline-block;flex-shrink:0;}
.dot.open{background:#34d399;box-shadow:0 0 5px #34d399;}

.dot-live{width:6px;height:6px;border-radius:50%;background:#34d399;display:inline-block;box-shadow:0 0 5px #34d399;}
.live{display:inline-flex;align-items:center;gap:5px;font-size:11px;color:#475569;}

.acct-row{display:flex;gap:20px;align-items:center;}
.benchmark-row{display:flex;gap:20px;align-items:center;margin-right:4px;}
.benchai{min-width:64px;}
.benchv{font-size:14px;font-weight:700;color:#f1f5f9;margin-top:1px;}
.benchc{font-size:12px;margin-top:2px;color:#94a3b8;font-weight:600;}
.benchc.up{color:#34d399;}
.benchc.dn{color:#f87171;}
.benchc.flat{color:#94a3b8;}
.ai{text-align:right;}
.al{font-size:10px;color:#64748b;text-transform:uppercase;letter-spacing:0.05em;}
.av{font-size:14px;font-weight:700;color:#f1f5f9;margin-top:1px;}
.av.g{color:#34d399;}
.av.r{color:#f87171;}

/* ── LAYOUT ──────────────────────────────────────────────────── */
.layout{display:grid;grid-template-columns:270px 1fr;min-height:calc(100vh - 52px);}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar{background:#161b27;border-right:1px solid #2d3748;padding:16px;overflow-y:auto;}
.ss{margin-bottom:18px;}
.sh{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;}
.st{font-size:10px;text-transform:uppercase;letter-spacing:0.08em;color:#64748b;font-weight:600;}
.sc{font-size:10px;color:#64748b;}

/* Watchlist items */
.wl-list{list-style:none;}
.wl-item{display:flex;align-items:center;justify-content:space-between;padding:8px 10px;border-radius:8px;margin-bottom:3px;border:1px solid transparent;cursor:default;}
.wl-item.active{background:#1a2540;border-color:#3b82f6;}
.wl-item:not(.active):hover{background:#1e2535;}

.wl-left{display:flex;align-items:center;gap:9px;}
.wl-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
/* All stage dot colors */
.wl-dot,.stage-Watching{background:#64748b;}
.stage-CSP-Pending{background:#fbbf24;}
.stage-CSP-Active{background:#3b82f6;}
.stage-Assigned{background:#f97316;}
.stage-CC-Pending{background:#fbbf24;}
.stage-CC-Active{background:#10b981;}

.wl-ticker{font-weight:700;font-size:13px;color:#f1f5f9;}
.wl-price{font-size:11px;color:#64748b;margin-top:1px;}
.wl-price .up{color:#34d399;}
.wl-price .dn{color:#f87171;}
.wl-price .flat{color:#94a3b8;}

.wl-right{display:flex;align-items:center;gap:6px;}

/* Badges */
.badge{font-size:10px;padding:2px 7px;border-radius:10px;font-weight:600;}
.badge-watch   {background:#1e293b;color:#64748b;}
.badge-pending {background:#2d1f00;color:#fbbf24;border:1px solid #78350f;}
.badge-csp     {background:#1e3a5f;color:#60a5fa;}
.badge-assigned{background:#431407;color:#fb923c;}
.badge-cc      {background:#064e3b;color:#34d399;}

.xbtn{width:18px;height:18px;border-radius:4px;background:#1e293b;border:none;color:#64748b;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0;transition:background 0.15s,color 0.15s;}
.xbtn:hover{background:#3d1f1f;color:#f87171;}

.wl-inline-err{font-size:10px;color:#f87171;padding:3px 10px 5px 10px;}
.wl-loading{padding:10px 4px;color:#64748b;font-size:12px;}

/* Stage legend */
.legend-row{display:flex;align-items:center;gap:8px;padding:4px 0;border-bottom:1px solid #1e293b;}
.legend-row:last-child{border-bottom:none;}
.legend-desc{font-size:10px;color:#64748b;}

/* ADD TICKER */
.add-section{margin-top:10px;}
.add-row{display:flex;gap:6px;}
.add-input{flex:1;background:#0f1117;border:1px solid #2d3748;border-radius:6px;padding:7px 10px;color:#f1f5f9;font-size:12px;text-transform:uppercase;outline:none;transition:border-color 0.15s;}
.add-input:focus{border-color:#3b82f6;}
.add-input::placeholder{text-transform:none;color:#475569;}
.add-input:disabled{opacity:0.45;cursor:not-allowed;}
.add-btn{padding:7px 13px;border-radius:6px;background:#1e3a5f;border:1px solid #3b82f6;color:#60a5fa;font-size:11px;font-weight:600;cursor:pointer;white-space:nowrap;transition:opacity 0.15s;}
.add-btn:disabled{opacity:0.35;cursor:not-allowed;}
.add-btn:not(:disabled):hover{opacity:0.8;}

.validate-msg{min-height:16px;font-size:10px;margin-top:5px;padding-left:2px;}
.validate-msg.ok{color:#34d399;}
.validate-msg.err{color:#f87171;}
.validate-msg.checking{color:#64748b;}

/* SIDEBAR CONFIG SUMMARY */
.divider{height:1px;background:#2d3748;margin:16px 0;}
.cfgrow{display:flex;justify-content:space-between;align-items:center;padding:5px 0;border-bottom:1px solid #1e293b;}
.cfgrow:last-child{border-bottom:none;}
.ck{font-size:11px;color:#64748b;}
.cv{font-size:11px;color:#f1f5f9;font-weight:600;}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.content{padding:18px;background:#0f1117;overflow-y:auto;}

/* STAT ROW */
.statrow{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:16px;}
.stat{background:#161b27;border:1px solid #2d3748;border-radius:10px;padding:13px 14px;}
.slabel{font-size:10px;color:#64748b;text-transform:uppercase;letter-spacing:0.05em;}
.sval{font-size:20px;font-weight:700;margin-top:5px;}
.sval.g{color:#34d399;}
.sval.b{color:#60a5fa;}
.sval.w{color:#f1f5f9;}
.sval.r{color:#f87171;}
.ssub{font-size:10px;color:#475569;margin-top:3px;}

/* PANELS */
.panel{background:#161b27;border:1px solid #2d3748;border-radius:10px;margin-bottom:14px;overflow:hidden;}
.ph{padding:12px 16px;border-bottom:1px solid #2d3748;display:flex;align-items:center;justify-content:space-between;}
.pt{font-size:13px;font-weight:600;color:#f1f5f9;}
.ph-sub{font-size:11px;color:#475569;}
.pbtn{padding:5px 12px;border-radius:6px;border:1px solid #2d3748;background:transparent;color:#94a3b8;font-size:11px;cursor:pointer;transition:border-color 0.15s,color 0.15s;}
.pbtn:hover{border-color:#60a5fa;color:#60a5fa;}

/* EARLY CLOSE ALERT BANNER */
.early-close-banner{display:flex;align-items:center;gap:10px;padding:10px 16px;background:#2a1f0a;border-bottom:1px solid #78350f;font-size:12px;color:#fbbf24;}
.early-close-banner strong{color:#fde68a;}

/* POSITIONS TABLE */
table{width:100%;border-collapse:collapse;}
th{font-size:10px;text-transform:uppercase;letter-spacing:0.06em;color:#64748b;padding:10px 14px;text-align:left;font-weight:500;border-bottom:1px solid #2d3748;white-space:nowrap;}
td{padding:11px 14px;border-bottom:1px solid #1e293b;font-size:12px;color:#cbd5e1;vertical-align:middle;white-space:nowrap;}
tr:last-child td{border-bottom:none;}
tr:hover td{background:rgba(255,255,255,0.015);}
.alert-row td{background:#2a1f0a !important;}
.alert-row:hover td{background:#31250e !important;}

.tkr{font-weight:700;color:#f1f5f9;font-size:13px;}
.sbadge{font-size:10px;padding:3px 8px;border-radius:10px;font-weight:600;}
.sbadge.CSP{background:#1e3a5f;color:#60a5fa;}
.sbadge.CC{background:#064e3b;color:#34d399;}
.pp{color:#34d399;font-weight:600;}
.pn{color:#f87171;font-weight:600;}
.g{color:#34d399;}
.y{color:#fbbf24;}
.r{color:#f87171;}
.dim{color:#64748b;}

.progwrap{background:#1e293b;border-radius:20px;height:5px;width:72px;overflow:hidden;display:inline-block;vertical-align:middle;}
.progbar{height:100%;border-radius:20px;transition:width 0.4s;}
.progbar.g{background:#34d399;}
.progbar.y{background:#fbbf24;}
.pct{font-size:11px;margin-left:6px;font-weight:600;vertical-align:middle;}

.actbtn{padding:4px 10px;border-radius:6px;border:1px solid #2d3748;background:transparent;color:#94a3b8;font-size:11px;cursor:pointer;transition:border-color 0.15s,color 0.15s,background 0.15s;}
.actbtn:hover:not(:disabled){border-color:#94a3b8;color:#f1f5f9;}
.actbtn:disabled{opacity:0.4;cursor:not-allowed;}
.actbtn.pulse{border-color:#fbbf24;color:#fbbf24;background:#2a1f0a;}
.actbtn.pulse:hover{background:#3a2a0e;}

/* ORDER STATUS BADGE */
.order-status{font-size:10px;padding:2px 7px;border-radius:8px;font-weight:600;}
.order-status.new,.order-status.accepted,.order-status.pending_new{background:#1e3a5f;color:#60a5fa;}
.order-status.held{background:#2d1f00;color:#fbbf24;}
.order-status.filled{background:#064e3b;color:#34d399;}
.order-status.canceled,.order-status.cancelled{background:#2d1b1b;color:#f87171;}

/* SCANNER GRID */
.scangrid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:16px;}
.scancard{background:#0f1117;border:1px solid #2d3748;border-radius:10px;padding:14px;}
.scancard.top-pick{border-color:#3b82f6;border-width:1.5px;}

.sc-ticker{font-size:16px;font-weight:700;color:#f1f5f9;margin-bottom:2px;display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.sc-rank{font-size:9px;background:#1e3a5f;color:#60a5fa;padding:2px 7px;border-radius:10px;font-weight:700;}
.sc-score{font-size:10px;padding:2px 7px;border-radius:10px;font-weight:700;margin-left:auto;}
.sc-score.g{background:#064e3b;color:#34d399;}
.sc-score.y{background:#2d1f00;color:#fbbf24;}
.sc-score.r{background:#2d1b1b;color:#f87171;}
.sc-sub{font-size:11px;color:#64748b;margin-bottom:10px;}

.sc-row{display:flex;justify-content:space-between;padding:4px 0;font-size:11px;border-bottom:1px solid #1e293b;}
.sc-row:last-of-type{border-bottom:none;}
.sc-k{color:#64748b;}
.sc-v{color:#cbd5e1;font-weight:500;}
.sc-v.g{color:#34d399;}
.sc-v.y{color:#fbbf24;}
.sc-v.r{color:#f87171;}

.scanbtn{margin-top:12px;width:100%;padding:8px;border-radius:7px;background:#1e3a5f;border:1px solid #3b82f6;color:#60a5fa;font-size:12px;font-weight:600;cursor:pointer;transition:opacity 0.15s;}
.scanbtn:hover:not(:disabled){opacity:0.8;}
.scanbtn:disabled{background:#1e293b;border-color:#2d3748;color:#475569;cursor:not-allowed;}

.warn-row{display:flex;align-items:center;gap:6px;margin-top:8px;padding:5px 8px;background:#2d1b1b;border-radius:6px;font-size:10px;color:#f87171;}

/* EARNINGS WARNING */
.scancard.earnings-risk{border-color:#92400e;border-width:1.5px;opacity:0.88;}
.sc-earnings-badge{font-size:9px;background:#2d1b00;color:#fbbf24;padding:2px 7px;border-radius:10px;font-weight:700;border:1px solid #92400e;}
.earnings-warn-row{display:flex;align-items:flex-start;gap:6px;margin-bottom:8px;padding:6px 8px;background:#2d1b00;border:1px solid #92400e;border-radius:6px;font-size:10px;color:#fbbf24;line-height:1.4;}
.scanbtn.earnings-btn{background:#2d1b00;border-color:#92400e;color:#fbbf24;}
.scanbtn.earnings-btn:hover:not(:disabled){opacity:0.8;}

/* DAILY AUTO SCAN */
.auto-meta{padding:10px 16px;border-bottom:1px solid #1e293b;font-size:11px;color:#94a3b8;}
.auto-card{position:relative;}
.auto-notes{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;}
.auto-note{font-size:10px;padding:3px 7px;border-radius:999px;background:#1e293b;color:#94a3b8;border:1px solid #334155;}

/* CONFIG PANEL */
.cfgbody{padding:16px;}
.cfggrid{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.cfield{display:flex;flex-direction:column;gap:6px;}
.cfl{font-size:11px;color:#64748b;}
.cfi{background:#0f1117;border:1px solid #2d3748;border-radius:7px;padding:8px 10px;color:#f1f5f9;font-size:12px;font-family:inherit;outline:none;transition:border-color 0.15s;}
.cfi:focus{border-color:#3b82f6;}
.toggle-row{display:flex;align-items:center;gap:10px;min-height:36px;padding:0 2px;color:#cbd5e1;font-size:12px;}
.toggle-row input{accent-color:#3b82f6;}

.chips{display:flex;gap:5px;flex-wrap:wrap;margin-top:2px;}
.chip{padding:4px 11px;border-radius:20px;border:1px solid #2d3748;font-size:11px;color:#64748b;cursor:pointer;transition:all 0.15s;user-select:none;}
.chip.on{border-color:#3b82f6;background:#1e3a5f;color:#60a5fa;font-weight:600;}
.chip:not(.on):hover{border-color:#475569;color:#94a3b8;}

.savebtn{padding:9px 22px;border-radius:7px;background:#1e3a5f;border:1px solid #3b82f6;color:#60a5fa;font-size:12px;font-weight:600;cursor:pointer;transition:opacity 0.15s;}
.savebtn:hover{opacity:0.8;}
.save-msg{font-size:11px;color:#34d399;}

/* ── MODALS ──────────────────────────────────────────────────── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.72);display:flex;align-items:center;justify-content:center;z-index:1000;}
.modal{background:#1e2535;border:1px solid #2d3748;border-radius:12px;padding:22px 26px;min-width:320px;max-width:480px;width:100%;}
.modal-text{font-size:14px;color:#f1f5f9;margin-bottom:18px;}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px;}

/* ORDER MODAL */
.modal-order{min-width:400px;max-width:520px;}
.modal-header{margin-bottom:16px;}
.modal-title{font-size:15px;font-weight:700;color:#f1f5f9;letter-spacing:-0.3px;}
.modal-subtitle{font-size:10px;color:#64748b;margin-top:3px;}

.order-summary{background:#0f1117;border:1px solid #2d3748;border-radius:8px;padding:12px;margin-bottom:4px;}
.order-sum-row{display:flex;justify-content:space-between;align-items:center;padding:4px 0;font-size:12px;border-bottom:1px solid #1e293b;}
.order-sum-row:last-child{border-bottom:none;}
.order-sum-row span{color:#64748b;}
.order-sum-row strong{color:#f1f5f9;}
.order-sum-row strong.g{color:#34d399;}
.order-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:10px 0 8px 0;}
.order-edit-field{display:flex;flex-direction:column;gap:6px;font-size:11px;color:#64748b;}
.order-edit-input{background:#111827;border:1px solid #2d3748;border-radius:7px;padding:8px 10px;color:#f1f5f9;font-size:12px;font-family:inherit;outline:none;transition:border-color 0.15s;}
.order-edit-input:focus{border-color:#3b82f6;}
.order-edit-help{font-size:10px;color:#64748b;margin-bottom:6px;line-height:1.4;}

.order-error{min-height:20px;font-size:11px;color:#f87171;margin-top:8px;padding-left:2px;}

.btn-danger{background:#7f1d1d;border:1px solid #f87171;border-radius:7px;color:#f87171;font-size:12px;font-weight:600;padding:7px 16px;cursor:pointer;transition:opacity 0.15s;}
.btn-danger:hover:not(:disabled){opacity:0.8;}
.btn-danger:disabled{opacity:0.5;cursor:not-allowed;}

.btn-place{background:#1e3a5f;border:1px solid #3b82f6;border-radius:7px;color:#60a5fa;font-size:12px;font-weight:600;padding:7px 16px;cursor:pointer;transition:opacity 0.15s,background 0.2s,color 0.2s;}
.btn-place:hover:not(:disabled){opacity:0.85;}
.btn-place:disabled{opacity:0.5;cursor:not-allowed;}

/* MISC */
.empty-state{padding:28px 16px;color:#64748b;font-size:12px;text-align:center;}
.scan-loading{padding:28px 16px;color:#64748b;font-size:12px;text-align:center;}

@keyframes spin{to{transform:rotate(360deg);}}
.spinner{display:inline-block;width:10px;height:10px;border:2px solid #2d3748;border-top-color:#3b82f6;border-radius:50%;animation:spin 0.7s linear infinite;vertical-align:middle;margin-right:5px;}

::-webkit-scrollbar{width:5px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:#2d3748;border-radius:3px;}
