/* ------------------------------------------------------------------
   MarketWire — design tokens
   Light is the base palette. Dark overrides only the tokens; every
   rule below reads colours through var(--…) so the two themes stay in
   step. theme.js resolves "system" into an explicit data-theme before
   first paint, so no @media prefers-color-scheme block is needed here.
   ------------------------------------------------------------------ */
:root{
  color-scheme:light;
  --bg:#f6f8f7;
  --surface:#ffffff;
  --surface-2:#fbfcfa;      /* table headers, subtle tints */
  --surface-3:#f2f7f3;      /* icon wells, chips */
  --surface-hover:#f0f4f1;
  --ink:#192d29;
  --ink-2:#3b4c44;
  --title:#294232;
  --text:#698061;
  --muted:#78857f;
  --muted-2:#97a398;
  --muted-3:#a5afa0;
  --line:#e5eae7;
  --line-2:#f0f2ed;
  --line-strong:#c9d7cb;
  --green:#226551;
  --green-hover:#194f3f;
  --green-ink:#2b6047;
  --green-text:#547460;
  --green-soft:#eaf4ee;
  --green-tint:#edf3ed;
  --green-line:#d8e8da;
  --live:#579568;
  --focus:#60a992;
  --tab-count-bg:#eaf1e9;
  --tab-count-ink:#5e7a60;
  --chip-bg:#f7f9f6;
  --chip-line:#e4eae4;
  --chip-ink:#6f836d;
  --sector-bg:#f5f6fa;
  --sector-line:#e0e3ea;
  --sector-ink:#5d6b86;
  --sector-hover:#9aa6c4;
  --up-bg:#edf5e9;
  --up-ink:#4c7d55;
  --down-bg:#f7f1ec;
  --down-ink:#a4785f;
  --neutral-bg:#f1f3ed;
  --neutral-ink:#8a978a;
  --warn-bg:#fffaf0;
  --warn-line:#e5dbbc;
  --warn-ink:#8b7851;
  --error-ink:#a96f53;
  --status-pending-bg:#faf5ea;
  --status-pending-ink:#9e855f;
  --status-error-bg:#fbf0e8;
  --status-error-ink:#ad795c;
  --status-access-bg:#f0edf5;
  --status-access-ink:#878294;
  --note-bg:#eaf0e3;
  --note-line:#e0e8d6;
  --note-ink:#607151;
  --note-text:#8b997d;
  --note-icon:#859b71;
  --switch-off:#d6dfd7;
  --switch-on:#377453;
  --health-idle:#c3b391;
  --health-ok:#78a47c;
  --health-bad:#c59178;
  --toast-bg:#203e2a;
  --toast-ink:#e6efdf;
  --toast-line:#3c5940;
  --backdrop:#10271d66;
  --topbar-bg:#ffffffdb;
  --shadow:0 2px 8px #15291e03;
  --shadow-hover:0 6px 22px #23372009;
  --shadow-dialog:0 20px 80px #102e2733;
  --skeleton:linear-gradient(90deg,var(--surface),#f3f6f0,var(--surface));
  /* sidebar has its own dark palette in both themes */
  --sb-bg:#102e27;
  --sb-ink:#c2d1ca;
  --sb-text:#b5c8bd;
  --sb-muted:#839b8f;
  --sb-hover:#24473b;
  --sb-active:#345a45;
  --sb-line:#2d473b;
  --sb-mark-bg:#42735a;
  --sb-mark-ink:#d9f1dc;
  --radius:12px;
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ink);
  background:var(--bg);
  font-synthesis:none;
  font-size:14px;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0c1411;
  --surface:#131d19;
  --surface-2:#172320;
  --surface-3:#1b2925;
  --surface-hover:#1c2925;
  --ink:#e6ede8;
  --ink-2:#cfd9d3;
  --title:#e4ebe6;
  --text:#b3c1b8;
  --muted:#8a9a91;
  --muted-2:#748479;
  --muted-3:#657469;
  --line:#22302a;
  --line-2:#1d2925;
  --line-strong:#33463d;
  --green:#3a9873;
  --green-hover:#46ab84;
  --green-ink:#86d0ac;
  --green-text:#8fbfa4;
  --green-soft:#17302a;
  --green-tint:#132420;
  --green-line:#2a4a3c;
  --live:#5ec287;
  --focus:#6fc7a4;
  --tab-count-bg:#1c2f27;
  --tab-count-ink:#9ccaa9;
  --chip-bg:#182420;
  --chip-line:#2a3a32;
  --chip-ink:#9fb5a4;
  --sector-bg:#1a2030;
  --sector-line:#2b3448;
  --sector-ink:#a7b4d2;
  --sector-hover:#6f80ad;
  --up-bg:#16301f;
  --up-ink:#7fce90;
  --down-bg:#33251b;
  --down-ink:#d9a37f;
  --neutral-bg:#1e2823;
  --neutral-ink:#93a597;
  --warn-bg:#2a2416;
  --warn-line:#4a3e22;
  --warn-ink:#d6bb7a;
  --error-ink:#e09a78;
  --status-pending-bg:#2a2416;
  --status-pending-ink:#d0b27a;
  --status-error-bg:#33221a;
  --status-error-ink:#e2a07e;
  --status-access-bg:#241f33;
  --status-access-ink:#b7aed0;
  --note-bg:#152119;
  --note-line:#223327;
  --note-ink:#b9cba6;
  --note-text:#8ea184;
  --note-icon:#9bb984;
  --switch-off:#2c3a33;
  --switch-on:#3f9a72;
  --health-idle:#8a7a55;
  --health-ok:#5fb56b;
  --health-bad:#d1875e;
  --toast-bg:#1f3a2a;
  --toast-ink:#e6efdf;
  --toast-line:#3f6a4c;
  --backdrop:#000000a6;
  --topbar-bg:#0c1411d9;
  --shadow:0 2px 8px #00000033;
  --shadow-hover:0 8px 26px #00000055;
  --shadow-dialog:0 24px 80px #000000aa;
  --skeleton:linear-gradient(90deg,var(--surface),#1b2823,var(--surface));
  --sb-bg:#0a1310;
  --sb-ink:#b9c8c0;
  --sb-text:#aebfb4;
  --sb-muted:#6f8378;
  --sb-hover:#17261f;
  --sb-active:#1f382c;
  --sb-line:#1b2a23;
  --sb-mark-bg:#2f6b4c;
  --sb-mark-ink:#d9f1dc;
}

/* ---------- base ---------- */
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);transition:background-color .25s,color .25s}
button,input,select{font:inherit}
button,a,input,select{-webkit-tap-highlight-color:transparent}
button{cursor:pointer;color:inherit}
button:disabled{cursor:wait;opacity:.65}
a{color:inherit;text-decoration:none}
input,select{min-width:0}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
button svg{flex-shrink:0}
svg.icon{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle}
[hidden]{display:none!important}
/* Long unbroken tokens (filing ids, URLs) wrap instead of widening the page */
.story-title,.story-summary,.detail-title,.detail-summary,.story-meta,.notice,.muted,.coverage-list li,.evidence-link,.empty-state p,.form-error,.target-facts,.trend-empty,.watch-empty,.rail-footnote,#result-count,.stat-note{overflow-wrap:anywhere}
td{overflow-wrap:break-word}
::selection{background:var(--green);color:#fff}
*{scrollbar-width:thin;scrollbar-color:var(--line-strong) transparent}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--line-strong);border-radius:10px;border:3px solid var(--bg)}
::-webkit-scrollbar-track{background:transparent}

/* ---------- sidebar ---------- */
.sidebar{width:234px;background:var(--sb-bg);color:var(--sb-ink);position:fixed;inset:0 auto 0 0;z-index:30;padding:34px 20px 22px;display:flex;flex-direction:column;overflow-y:auto}
.brand{display:flex;align-items:center;gap:10px;color:#fff;font-size:25px;letter-spacing:-1px;font-weight:680}
.brand-dot{color:#9ccea7}
.brand-mark{width:31px;height:32px;border-radius:8px;background:var(--sb-mark-bg);color:var(--sb-mark-ink);display:inline-flex;align-items:center;padding-left:4px;font-size:27px;font-weight:700;letter-spacing:-5px}
.brand-mark span{font-size:24px;position:relative;top:-2px}
.workspace-label{font-size:8px;letter-spacing:1.35px;color:var(--sb-muted);margin:17px 0 42px;white-space:nowrap}
.nav-label{font-size:10px;color:var(--sb-muted);letter-spacing:1.5px;margin:0 14px 13px}
.nav-item{display:flex;align-items:center;gap:12px;min-height:44px;width:100%;padding:12px 13px;margin-bottom:5px;border:0;border-radius:7px;background:transparent;color:var(--sb-text);text-align:left;font-size:13px;font-weight:450;transition:background .15s,color .15s}
.nav-item svg{width:18px;height:18px}
.nav-item:hover{background:var(--sb-hover);color:#fff}
.nav-item.active{background:var(--sb-active);color:#fff}
.nav-item.active:after{content:'';height:6px;width:6px;border-radius:50%;background:#b2d4a6;margin-left:auto}
.nav-separator{height:1px;background:var(--sb-line);margin:22px 12px}
.sidebar-section{font-size:9px;color:var(--sb-muted);letter-spacing:1.4px;margin:35px 13px 17px}
.priority-nav-item{display:flex;gap:10px;align-items:center;background:none;border:0;width:100%;text-align:left;color:var(--sb-text);padding:9px 13px;font-size:12px;border-radius:6px}
.priority-nav-item:hover{color:#fff;background:var(--sb-hover)}
.provider-dot{width:7px;height:7px;border-radius:50%;background:var(--provider-color,#81b394);display:inline-block;flex-shrink:0}
.sidebar-bottom{margin-top:auto;border-top:1px solid var(--sb-line);padding:22px 2px 0;display:flex;align-items:center;gap:10px}
.personal-avatar{width:33px;height:33px;display:grid;place-items:center;background:#49644d;border:1px solid #6a816d;color:#e0eccb;border-radius:50%;font-size:13px}
.sidebar-bottom strong{display:block;font-size:11px;font-weight:500;color:#e5ede7}
.sidebar-bottom span{font-size:10px;color:var(--sb-muted);display:block;margin-top:5px}
.workspace-dot{width:6px;height:6px;background:#99c491;border-radius:50%;margin-left:auto}
.sidebar-backdrop{position:fixed;inset:0;background:var(--backdrop);z-index:25;opacity:0;pointer-events:none;transition:opacity .2s;backdrop-filter:blur(2px)}
.sidebar-backdrop.show{opacity:1;pointer-events:auto}

/* ---------- shell / topbar ---------- */
.shell{margin-left:234px;min-width:0;overflow-x:clip}
.topbar{height:75px;background:var(--topbar-bg);border-bottom:1px solid var(--line);padding:0 38px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:15;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.breadcrumb{display:flex;gap:14px;align-items:center;font-size:12px;color:var(--muted)}
.breadcrumb strong{font-weight:500;color:var(--ink-2)}
.slash{color:var(--line-strong)}
.topbar-right{display:flex;gap:21px;align-items:center}
.timezone{font-size:10px;color:var(--muted)}
.monitor-pill{border:1px solid var(--line);border-radius:25px;padding:7px 10px;display:flex;align-items:center;gap:6px;color:var(--green-text);font-size:10px;background:var(--surface)}
.live-dot{width:6px;height:6px;background:var(--live);box-shadow:0 0 0 3px color-mix(in srgb,var(--live) 18%,transparent);border-radius:50%;display:inline-block}
.icon-button{border:0;background:transparent;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border-radius:6px;color:var(--muted);transition:background .15s,color .15s}
.icon-button:hover{background:var(--surface-hover);color:var(--green-ink)}
.mobile-menu{display:none}
.theme-toggle{position:relative;width:34px;height:34px;border:1px solid var(--line);border-radius:50%;background:var(--surface)}
.theme-toggle svg{width:16px;height:16px;position:absolute;transition:transform .35s cubic-bezier(.2,.8,.2,1),opacity .2s}
.theme-toggle .sun{opacity:1;transform:rotate(0) scale(1)}
.theme-toggle .moon{opacity:0;transform:rotate(-90deg) scale(.5)}
[data-theme="dark"] .theme-toggle .sun{opacity:0;transform:rotate(90deg) scale(.5)}
[data-theme="dark"] .theme-toggle .moon{opacity:1;transform:rotate(0) scale(1)}

/* ---------- page heading ---------- */
main{max-width:1660px;margin:auto;padding:34px 38px 20px;outline:none}
.page-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:27px}
.eyebrow{font-size:9px;letter-spacing:1.5px;color:var(--muted);font-weight:600;margin-bottom:10px}
h1{font-size:30px;letter-spacing:-1.05px;font-weight:600;margin:0 0 9px;line-height:1.2}
.page-heading p{margin:0;font-size:12px;color:var(--muted);line-height:1.7}
.heading-actions{display:flex;gap:9px}
.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 15px;border:1px solid var(--line);border-radius:7px;font-size:11px;font-weight:550;white-space:nowrap;min-height:36px;transition:background .15s,border-color .15s,transform .1s}
.button:active{transform:translateY(1px)}
.button svg{width:15px;height:15px}
.primary{background:var(--green);border-color:var(--green);color:#fff;box-shadow:0 2px 3px #133e1410}
.primary:hover{background:var(--green-hover);border-color:var(--green-hover)}
.secondary{background:var(--surface);color:var(--text)}
.secondary:hover{background:var(--surface-hover)}

/* ---------- stats ---------- */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:24px}
.stat-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:17px 19px 15px;box-shadow:var(--shadow);transition:border-color .15s,box-shadow .15s}
.stat-card:hover{border-color:var(--line-strong);box-shadow:var(--shadow-hover)}
.stat-top{display:flex;align-items:center;justify-content:space-between;font-size:11px;font-weight:500;color:var(--muted)}
.stat-icon{display:grid;place-items:center;width:29px;height:29px;border-radius:8px;color:var(--green-text);background:var(--surface-3)}
.stat-icon svg{width:16px;height:16px}
.stat-value{font-size:29px;font-weight:600;letter-spacing:-1px;line-height:1.4;margin:6px 0 3px;font-variant-numeric:tabular-nums}
.stat-value small{font-size:14px;font-weight:400;color:var(--muted-2);letter-spacing:0}
.stat-note{font-size:10px;color:var(--muted-2);line-height:1.6}
.stat-note strong{color:var(--green-text);font-weight:500}

/* ---------- priority strip ---------- */
.priority-strip{display:flex;align-items:center;gap:18px;background:var(--green-tint);border:1px solid var(--green-line);border-radius:8px;min-height:53px;padding:10px 16px;margin-bottom:26px}
.priority-label{font-size:11px;font-weight:600;white-space:nowrap;color:var(--green-text)}
.sparkle{color:#95ad62;font-size:17px;margin-right:5px}
#priority-chips{display:flex;align-items:center;flex-wrap:wrap;gap:8px;flex:1}
.provider-chip{display:inline-flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid var(--line);background:color-mix(in srgb,var(--surface) 75%,transparent);border-radius:5px;font-size:10px;color:var(--text);transition:border-color .15s,background .15s}
.provider-chip:hover,.provider-chip.selected{border-color:var(--provider-color,var(--green));background:var(--surface)}
.provider-chip .provider-dot{height:6px;width:6px}
.text-button{background:none;border:0;color:var(--green-text);font-size:10px;font-weight:550;padding:5px;white-space:nowrap}
.text-button:hover{text-decoration:underline}

/* ---------- feed ---------- */
.feed-layout{display:grid;grid-template-columns:minmax(0,1fr) 258px;gap:25px}
.feed-main{min-width:0}
.feed-tabs{display:flex;border-bottom:1px solid var(--line);gap:23px;overflow-x:auto;scrollbar-width:none}
.feed-tabs::-webkit-scrollbar{display:none}
.feed-tab{background:none;border:0;color:var(--muted);padding:0 0 15px;font-size:11px;white-space:nowrap;position:relative;transition:color .15s}
.feed-tab:hover{color:var(--ink-2)}
.feed-tab.active{color:var(--green-ink);font-weight:600}
.feed-tab.active:after{content:'';height:2px;position:absolute;bottom:0;left:0;right:0;background:var(--green);border-radius:2px 2px 0 0}
.tab-count{font-size:9px;background:var(--tab-count-bg);color:var(--tab-count-ink);border-radius:4px;margin-left:5px;padding:2px 5px}
.filter-bar{padding:17px 0 0}
.search-field{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--line);min-height:40px;border-radius:7px;padding:0 12px;flex:1;transition:border-color .15s,box-shadow .15s}
.search-field svg{color:var(--muted-2);width:16px;height:16px}
.search-field input{border:0;background:transparent;color:var(--ink);width:100%;padding:11px 0;font-size:11px;outline:none}
.search-field input::placeholder{color:var(--muted-2)}
.search-field:focus-within{border-color:var(--focus);box-shadow:0 0 0 3px color-mix(in srgb,var(--focus) 14%,transparent)}
kbd{font:10px inherit;color:var(--muted-2);border:1px solid var(--line);padding:1px 5px;border-radius:3px}
.filter-row{display:flex;align-items:center;gap:9px;margin-top:10px}
.filter-row select,.section-toolbar select,#extra-filters select{border:1px solid var(--line);background:var(--surface);border-radius:6px;padding:8px 25px 8px 10px;color:var(--text);font-size:10px;max-width:190px;height:33px}
.filter-button{padding:7px 9px;font-weight:400;background:var(--surface);font-size:10px;color:var(--text);min-height:33px}
.toggle-label{display:flex;align-items:center;gap:7px;font-size:11px;white-space:nowrap;cursor:pointer;color:var(--text);margin-left:auto}
.toggle-label input{position:absolute;opacity:0;width:1px;height:1px}
.switch{width:29px;height:17px;background:var(--switch-off);border-radius:15px;padding:3px;display:inline-flex;align-items:center;transition:background .2s}
.switch:after{content:'';width:11px;height:11px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #0003;transition:transform .2s}
.toggle-label input:checked+.switch{background:var(--switch-on)}
.toggle-label input:checked+.switch:after{transform:translateX(12px)}
.toggle-label input:focus-visible+.switch{outline:3px solid var(--focus);outline-offset:3px}
.small-info{font-family:serif;font-size:8px;border:1px solid var(--muted-2);color:var(--muted-2);border-radius:50%;width:11px;height:11px;display:inline-grid;place-items:center}
#extra-filters{display:flex;gap:12px;margin-top:12px}
.feed-caption{display:flex;justify-content:space-between;align-items:center;margin:20px 0 12px;font-size:10px;color:var(--muted)}
.sort-label{color:var(--muted)}

/* ---------- story cards ---------- */
.story-card{border:1px solid var(--line);background:var(--surface);border-radius:9px;margin-bottom:11px;padding:18px 20px 14px;transition:box-shadow .18s,border-color .18s,transform .18s;position:relative}
.story-card:hover{border-color:var(--line-strong);box-shadow:var(--shadow-hover);transform:translateY(-1px)}
.story-meta{display:flex;align-items:center;gap:7px;font-size:9px;color:var(--muted);flex-wrap:wrap}
.source-name{font-weight:600;color:var(--text)}
.source-avatar{width:17px;height:17px;border-radius:4px;display:inline-grid;place-items:center;background:color-mix(in srgb,var(--provider-color,#529761) 14%,var(--surface));color:var(--provider-color,#529761);font-size:9px;font-weight:700}
.meta-dot{color:var(--line-strong)}
.category-tag{font-size:8px;border:1px solid var(--line);color:var(--muted);padding:2px 5px;border-radius:3px;background:var(--surface-2)}
.story-time{margin-left:auto;white-space:nowrap;font-size:9px}
.story-title{margin:12px 0 7px;font-size:15px;line-height:1.55;letter-spacing:-.15px;font-weight:550;color:var(--title)}
.story-title button{font:inherit;line-height:inherit;text-align:left;background:none;padding:0;border:0;color:inherit;display:block;width:100%;transition:color .15s}
.story-title button:hover{color:var(--green-ink)}
.story-summary{margin:0 0 14px;line-height:1.8;font-size:10px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.story-footer{display:flex;align-items:center;gap:7px;margin-top:12px}
.stock-chip{border:1px solid var(--chip-line);color:var(--chip-ink);border-radius:4px;padding:3px 6px;font-size:8px;letter-spacing:.25px;background:var(--chip-bg);cursor:pointer;transition:border-color .15s}
.stock-chip:hover{border-color:var(--green-text)}
.stock-chip.fno{border-color:var(--green-line);color:var(--up-ink);background:var(--up-bg)}
.sector-chip{border:1px solid var(--sector-line);color:var(--sector-ink);border-radius:4px;padding:3px 6px;font-size:8px;letter-spacing:.25px;background:var(--sector-bg);cursor:pointer}
.sector-chip:hover{border-color:var(--sector-hover)}
.more-sources{font-size:9px;color:var(--muted);background:none;border:0;cursor:pointer}
.card-actions{margin-left:auto;display:flex;align-items:center;gap:5px}
.card-actions .icon-button{height:22px;width:24px;color:var(--muted-2)}
.card-actions svg{height:14px;width:14px}
.card-actions .saved{color:var(--green-ink);background:var(--green-soft)}

/* ---------- context rail ---------- */
.trend-row{display:flex;align-items:center;gap:8px;padding:11px 0;border-bottom:1px solid var(--line-2);font-size:10px;color:var(--text);background:none;border-left:0;border-right:0;border-top:0;width:100%;text-align:left;cursor:pointer}
.trend-row:last-child{border-bottom:0}
.trend-row:hover .trend-name{color:var(--green-ink)}
.trend-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:550}
.trend-count{color:var(--muted-2);font-size:9px;white-space:nowrap}
.trend-delta{font-size:9px;font-weight:600;white-space:nowrap;padding:2px 6px;border-radius:4px;background:var(--neutral-bg);color:var(--neutral-ink);font-variant-numeric:tabular-nums}
.trend-delta.up{background:var(--up-bg);color:var(--up-ink)}
.trend-delta.down{background:var(--down-bg);color:var(--down-ink)}
.trend-empty{padding:8px 0 18px;color:var(--muted);font-size:10px;line-height:1.8}
.context-rail{padding-top:1px}
.rail-card{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:18px 16px 0;margin-bottom:18px}
.rail-heading{display:flex;align-items:center;justify-content:space-between;gap:6px}
.rail-heading h2{font-size:12px;font-weight:600;margin:0;letter-spacing:-.1px}
.rail-heading .icon-button{width:18px;height:18px;border:1px solid var(--line);font-size:15px;color:var(--muted)}
.rail-subtitle{font-size:9px;color:var(--muted-2);margin:7px 0 18px}
.rail-link{border:0;border-top:1px solid var(--line-2);background:none;display:flex;width:100%;justify-content:space-between;padding:13px 0;color:var(--green-text);font-size:9px}
.rail-link:hover{color:var(--green-ink)}
.watch-item{display:flex;align-items:center;gap:9px;padding:12px 0;border-bottom:1px solid var(--line-2);cursor:pointer}
.watch-avatar{width:29px;height:29px;border:1px solid var(--line);border-radius:7px;display:grid;place-items:center;font-size:10px;font-weight:600;color:var(--text);background:var(--surface-2)}
.watch-name{flex:1;min-width:0}
.watch-name strong{font-size:10px;font-weight:550;display:block;color:var(--title)}
.watch-name span{color:var(--muted-2);font-size:8px;display:block;margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:145px}
.watch-empty{padding:10px 0 23px;color:var(--muted);font-size:10px;line-height:1.8}
.watch-empty button{display:block;margin-top:10px;font-size:10px}
.small-live{display:flex;align-items:center;gap:5px;font-size:8px;color:var(--muted)}
.small-live .live-dot{width:4px;height:4px;box-shadow:none}
.activity-row{display:flex;align-items:center;gap:8px;margin:18px 0;font-size:10px;color:var(--text)}
.activity-row span:nth-child(2){flex:1}
.activity-row small{font-size:9px;color:var(--muted-2)}
.health-dot{width:6px;height:6px;border-radius:50%;background:var(--health-idle)}
.health-dot.ok{background:var(--health-ok)}
.health-dot.error,.health-dot.blocked,.health-dot.parse_error{background:var(--health-bad)}
.editor-note{background:var(--note-bg);border:1px solid var(--note-line);border-radius:10px;padding:22px 19px 20px;color:var(--note-ink)}
.note-icon{color:var(--note-icon);margin-bottom:13px}
.editor-note h3{font-size:15px;line-height:1.5;letter-spacing:-.2px;margin:0 0 10px;font-weight:500}
.editor-note p{font-size:10px;line-height:1.9;color:var(--note-text);margin:0 0 22px}
.editor-note>span{font-size:7px;letter-spacing:1px;color:var(--note-text)}
.rail-footnote{font-size:9px;line-height:1.8;color:var(--muted-3);padding:17px 9px}
.page-footer{border-top:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:15px;margin-top:27px;padding-top:18px;color:var(--muted-2);font-size:9px}
.footer-mark{font-size:15px;color:var(--green-text);letter-spacing:-3px;margin-right:9px}

/* ---------- empty, notices, tables ---------- */
.empty-state{text-align:center;background:var(--surface);border:1px dashed var(--line-strong);border-radius:10px;padding:48px 25px;color:var(--muted)}
.empty-state svg{width:31px;height:31px;margin-bottom:10px}
.empty-state h3{font-size:16px;font-weight:500;color:var(--title);margin:8px}
.empty-state p{font-size:12px;line-height:1.8;max-width:410px;margin:12px auto}
.empty-state .button{margin:7px}
.load-more-wrap{display:flex;justify-content:center;padding:12px}
.load-more-wrap button{font-size:11px}
.notice{padding:12px 15px;border:1px solid var(--warn-line);background:var(--warn-bg);color:var(--warn-ink);border-radius:7px;margin-bottom:20px;font-size:11px;line-height:1.7}
.section-toolbar{display:flex;align-items:center;gap:15px;margin:22px 0 18px}
.section-toolbar .search-field{max-width:520px}
.table-card{border:1px solid var(--line);border-radius:10px;background:var(--surface);margin-top:15px;overflow:auto}
table{width:100%;border-collapse:collapse;text-align:left}
th{font-size:9px;letter-spacing:.5px;text-transform:uppercase;color:var(--muted);background:var(--surface-2);font-weight:500;white-space:nowrap}
th,td{padding:14px 18px;border-bottom:1px solid var(--line-2)}
td{font-size:11px;color:var(--text)}
td strong{display:block;color:var(--title);font-weight:550;margin-bottom:5px}
td small{display:block;color:var(--muted-2);font-size:9px;line-height:1.6;max-width:360px}
tbody tr:hover{background:var(--surface-2)}
tbody tr:last-child td{border-bottom:0}
.status-badge{display:inline-flex;align-items:center;gap:5px;border-radius:4px;padding:4px 7px;font-size:9px;white-space:nowrap;color:var(--status-pending-ink);background:var(--status-pending-bg);border:0}
.status-badge.ok{color:var(--up-ink);background:var(--up-bg)}
.status-badge.blocked,.status-badge.error,.status-badge.parse_error{color:var(--status-error-ink);background:var(--status-error-bg)}
.status-badge.needs_access{color:var(--status-access-ink);background:var(--status-access-bg)}
.status-badge.paused,.status-badge.pending{color:var(--neutral-ink);background:var(--neutral-bg)}
.coverage-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:20px}
.coverage-card{padding:23px;background:var(--surface);border:1px solid var(--line);border-radius:10px}
.coverage-card h2{font-size:16px;font-weight:550;margin:0 0 10px}
.coverage-card p{font-size:12px;color:var(--muted);line-height:1.8}
.coverage-number{font-size:32px;font-weight:600;letter-spacing:-1px;margin:13px 0;font-variant-numeric:tabular-nums}
.coverage-number small{font-size:13px;color:var(--muted-2);font-weight:400;letter-spacing:0}
.coverage-list{list-style:none;padding:0;margin:15px 0}
.coverage-list li{display:flex;justify-content:space-between;gap:20px;padding:12px 0;border-bottom:1px solid var(--line-2);font-size:12px;color:var(--text)}
.coverage-list li:last-child{border-bottom:0}
.coverage-card .button{margin-top:10px}
.muted{color:var(--muted);font-size:12px;line-height:1.8}
.pill-filter{display:inline-flex;align-items:center;gap:10px;margin-bottom:10px;padding:6px 9px;border-radius:5px;color:var(--green-ink);background:var(--green-soft);font-size:10px}
.pill-filter button{border:0;background:none;font-size:15px;padding:0;color:var(--green-text)}

/* ---------- toast & dialogs ---------- */
.toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);background:var(--toast-bg);color:var(--toast-ink);border:1px solid var(--toast-line);padding:13px 21px;border-radius:8px;box-shadow:0 5px 22px #173c2040;z-index:100;font-size:12px;max-width:calc(100vw - 30px)}
dialog{border:1px solid var(--line);border-radius:14px;padding:0;background:var(--surface);color:var(--ink);box-shadow:var(--shadow-dialog);max-height:90vh}
dialog::backdrop{background:var(--backdrop);backdrop-filter:blur(3px)}
.story-dialog{width:720px;max-width:calc(100vw - 30px);padding:28px}
.form-dialog{width:480px;max-width:calc(100vw - 30px);padding:27px}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:17px}
.dialog-heading h2{font-size:19px;font-weight:550;margin:0;letter-spacing:-.5px}
.dialog-heading .close-dialog{font-size:25px}
.detail-title{font-size:24px;letter-spacing:-.5px;line-height:1.5;margin:20px 0;color:var(--title)}
.detail-summary{font-size:13px;line-height:1.9;color:var(--text)}
.detail-section{margin-top:23px;padding-top:20px;border-top:1px solid var(--line)}
.detail-section h3{font-size:12px;font-weight:600}
.evidence-link{display:flex;align-items:center;gap:12px;border:1px solid var(--line);border-radius:7px;padding:12px;margin:9px 0;color:var(--green-text);font-size:12px;transition:background .15s,border-color .15s}
.evidence-link:hover{background:var(--surface-2);border-color:var(--line-strong)}
.evidence-link small{font-size:9px;color:var(--muted-2);display:block;margin-top:4px}
.evidence-link>span{flex:1}
.detail-facts{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin-top:20px}
.detail-facts small{font-size:9px;color:var(--muted-2);display:block;margin-bottom:5px}
.detail-facts span{font-size:11px;color:var(--text)}
.form-dialog label,.form-dialog .form-field{display:flex;flex-direction:column;gap:7px;margin:15px 0;color:var(--text);font-size:11px}
.form-dialog input,.form-dialog select{border:1px solid var(--line);background:var(--surface-2);padding:10px 11px;border-radius:6px;color:var(--ink);font-size:12px;width:100%}
.form-dialog input:focus,.form-dialog select:focus{border-color:var(--focus);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--focus) 14%,transparent)}
.form-row{display:flex;gap:13px}
.form-row label{flex:1}
.form-dialog .primary{margin-top:15px;width:100%}
.form-error{color:var(--error-ink);font-size:11px;line-height:1.7}
.segmented{display:flex;border:1px solid var(--line);border-radius:7px;overflow:hidden;background:var(--surface-2)}
.segmented button{flex:1;border:0;background:transparent;padding:9px 6px;font-size:11px;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:background .15s,color .15s}
.segmented button svg{width:14px;height:14px}
.segmented button+button{border-left:1px solid var(--line)}
.segmented button[aria-pressed="true"]{background:var(--green);color:#fff}
.skip-link{position:absolute;left:-9999px;top:10px;z-index:200;background:var(--surface);padding:10px}
.skip-link:focus{left:10px}
.skeleton{height:158px;border:1px solid var(--line);border-radius:9px;background:var(--skeleton);background-size:200%;animation:shimmer 1.8s infinite;margin:12px 0}
@keyframes shimmer{to{background-position:-200%}}
.spinning svg{animation:spin 1.3s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- broker targets ---------- */
.target-toolbar{flex-wrap:wrap}
.target-toolbar select{max-width:220px}
.target-toggles{flex-wrap:wrap;margin:16px 0}
.target-facts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;padding:18px 0}
.target-facts small{display:block;color:var(--muted);font-size:10px;letter-spacing:.08em;margin-bottom:6px}
.target-facts strong{font-size:19px;font-variant-numeric:tabular-nums}
.target-status{font-size:12px;color:var(--green-ink);margin:12px 0}
.target-status.needs-review{color:var(--warn-ink)}
.target-card .story-footer{flex-wrap:wrap;gap:18px}
.target-card .story-summary{display:block;-webkit-line-clamp:unset}
.target-card{margin-bottom:14px}

/* ---------- mobile bottom navigation ---------- */
.bottom-nav{display:none;position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--topbar-bg);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom));grid-template-columns:repeat(5,1fr)}
.bottom-nav button{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 2px;font-size:9px;color:var(--muted);border-radius:8px;min-height:48px;transition:color .15s,background .15s}
.bottom-nav button svg{width:20px;height:20px}
.bottom-nav button.active{color:var(--green-ink)}
.bottom-nav button.active svg{stroke-width:2.1}
.bottom-nav button:active{background:var(--surface-hover)}

/* ---------- responsive ---------- */
@media(min-width:1500px){
  .feed-layout{grid-template-columns:minmax(0,1fr) 295px;gap:30px}
  .story-title{font-size:17px}
  .story-summary{font-size:12px}
  .story-card{padding:21px 24px}
  .rail-card{padding:22px 20px 0}
  .stat-card{padding:20px 24px}
  .stat-value{font-size:34px}
  .rail-subtitle,.watch-empty,.rail-link,.editor-note p{font-size:11px}
}
@media(max-width:1150px){
  .sidebar{width:205px;padding-left:15px;padding-right:15px}
  .brand{font-size:23px}
  .workspace-label{font-size:7px;letter-spacing:1px}
  .shell{margin-left:205px}
  .topbar{padding:0 25px}
  main{padding:28px 25px}
  .feed-layout{grid-template-columns:minmax(0,1fr) 224px;gap:18px}
  .feed-tabs{gap:17px}
  .priority-strip{gap:10px;padding:10px}
  .provider-chip{padding:5px 7px;font-size:9px}
  .priority-label{font-size:10px}
  .priority-strip>.text-button{display:none}
  .stats-grid{gap:10px}
  .stat-card{padding:14px}
  .stat-value{font-size:26px}
  .filter-row select{max-width:132px}
  .filter-button{font-size:0}
  .toggle-label{font-size:10px}
  .story-card{padding:16px}
  .story-time{font-size:8px}
}
@media(max-width:960px){
  .context-rail{display:none}
  .feed-layout{display:block}
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .priority-strip{flex-wrap:wrap}
  .page-heading{align-items:flex-start}
  h1{font-size:26px}
  .heading-actions .secondary{display:none}
  .topbar-right{gap:13px}
  .timezone{display:none}
  .coverage-grid{grid-template-columns:1fr}
  .page-footer{font-size:8px}
  .stat-card{padding:18px}
  .feed-tabs{gap:27px}
}
@media(max-width:650px){
  .sidebar{transform:translateX(-100%);transition:transform .22s cubic-bezier(.2,.8,.2,1);width:min(280px,84vw);padding-top:26px}
  .sidebar.open{transform:translateX(0);box-shadow:10px 0 50px #00000055}
  .shell{margin-left:0}
  .mobile-menu{display:inline-flex}
  .topbar{height:58px;padding:0 14px}
  .breadcrumb{gap:8px;font-size:10px}
  .breadcrumb>span:not(.slash){display:none}
  .breadcrumb .slash{display:none}
  .breadcrumb strong{font-size:13px}
  .topbar-right{gap:8px}
  .monitor-pill{font-size:8px;padding:6px 8px}
  .topbar-right>.icon-button{width:22px}
  .topbar-right>.theme-toggle{width:32px;height:32px}
  main{padding:22px 16px calc(84px + env(safe-area-inset-bottom))}
  .page-heading{gap:12px;margin-bottom:20px}
  .eyebrow{font-size:7px;letter-spacing:1.2px;margin-bottom:9px}
  h1{font-size:24px}
  .page-heading p{font-size:10px;max-width:230px;line-height:1.8}
  .heading-actions .primary{font-size:0;width:36px;height:36px;padding:7px;margin-top:17px;min-height:36px;border-radius:50%}
  .heading-actions .primary svg{width:15px;height:15px}
  .stats-grid{gap:10px;margin-bottom:18px}
  .stat-card{padding:14px}
  .stat-value{font-size:24px}
  .stat-top{font-size:9px}
  .stat-icon{height:25px;width:25px}
  .stat-note{font-size:8px}
  .priority-strip{gap:9px;padding:12px;margin-bottom:20px}
  .priority-label{width:100%;font-size:10px}
  #priority-chips{gap:6px}
  .provider-chip{font-size:9px;padding:6px 8px;min-height:32px}
  .feed-tabs{gap:20px;margin:0 -16px;padding:0 16px}
  .feed-tab{font-size:11px;padding-bottom:12px;min-height:40px}
  .filter-row{gap:7px;flex-wrap:wrap}
  .filter-row select{font-size:10px;padding-left:8px;max-width:130px;height:36px}
  .toggle-label{font-size:10px}
  .filter-button{padding:7px;width:36px;min-height:36px}
  .small-info{display:none}
  .search-field{min-height:42px}
  .search-field input{font-size:12px}
  .feed-caption{font-size:9px}
  .story-card{padding:15px 14px;border-radius:12px}
  .story-card:hover{transform:none}
  .story-meta{font-size:8px;gap:5px}
  .story-title{font-size:14px;line-height:1.55;margin-top:11px}
  .story-summary{font-size:10px;line-height:1.8}
  .story-time{font-size:8px}
  .stock-chip{font-size:8px;padding:4px 6px}
  .category-tag{display:none}
  .more-sources{font-size:8px}
  .card-actions .icon-button{height:30px;width:30px}
  .page-footer{display:block;font-size:8px;line-height:2}
  .page-footer>span{display:block}
  .section-toolbar{flex-wrap:wrap;gap:10px}
  .section-toolbar .search-field{flex-basis:100%}
  .section-toolbar .button{margin-left:auto}
  th,td{padding:12px}
  .form-dialog,.story-dialog{padding:21px}
  dialog{max-height:calc(100dvh - 24px);margin:auto}
  .detail-title{font-size:21px}
  .detail-facts{grid-template-columns:1fr}
  .story-footer{flex-wrap:wrap}
  .card-actions{margin-left:auto}
  .form-row{display:block}
  .stock-table th{white-space:nowrap}
  .toast{bottom:calc(76px + env(safe-area-inset-bottom));font-size:11px;padding:11px 16px}
  .bottom-nav{display:grid}
  .table-card th:first-child,.table-card td:first-child{position:sticky;left:0;background:var(--surface);box-shadow:1px 0 0 var(--line-2);z-index:1}
  .table-card td:first-child strong,.table-card td:first-child small,.table-card td:first-child .text-button{width:42vw;white-space:normal;text-align:left}
  .table-card th:first-child{background:var(--surface-2)}
  .table-card tbody tr:hover td:first-child{background:var(--surface-2)}
  .table-card{-webkit-overflow-scrolling:touch}
  .load-more-wrap button{width:100%;min-height:44px}
}
@media(max-width:700px){
  .target-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
  .target-toolbar select{max-width:100%;flex:1}
  .target-toggles{align-items:flex-start}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* ---------- paper-trading desk & forecasts ---------- */
.pnl.up{color:var(--up-ink)}
.pnl.down{color:var(--status-error-ink)}
.desk-heading{font-size:13px;font-weight:600;color:var(--title);margin:22px 0 4px;letter-spacing:-.2px}
.desk-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.trade-card{padding-bottom:18px}
.trade-form label{display:flex;flex-direction:column;gap:5px;margin:10px 0;color:var(--text);font-size:10px}
.trade-form input,.trade-form select{border:1px solid var(--line);background:var(--surface-2);padding:8px 9px;border-radius:6px;color:var(--ink);font-size:11px;width:100%;min-width:0}
.trade-form input:focus,.trade-form select:focus{border-color:var(--focus);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--focus) 14%,transparent)}
.trade-form .form-row{gap:9px}
.trade-form .primary{width:100%;margin-top:6px}
.trade-quote{font-size:10px;line-height:1.7;margin:8px 0 4px;min-height:32px}
.trade-quote strong{color:var(--title)}
.quote-cell{display:flex;flex-direction:column;align-items:flex-end;font-variant-numeric:tabular-nums}
.quote-cell strong{color:var(--title);font-size:12px}
.quote-cell .pnl{font-size:10px}
.market-phase{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--title);font-weight:550;margin-bottom:8px}
.market-phase small{margin-left:auto;font-weight:400;color:var(--muted-2);font-size:9px}
.live-dot.off{background:var(--muted-3);box-shadow:none;animation:none}
.bot-state{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.bot-state small{font-size:9px;color:var(--muted-2)}
.coverage-list.compact li{padding:9px 0;font-size:11px}
.coverage-list.compact li span:first-child{display:flex;flex-direction:column;gap:2px}
.coverage-list.compact small{font-size:9px;color:var(--muted-2)}
.status-badge.error{color:var(--status-error-ink);background:var(--status-error-bg)}
.category-tag.source-bot{background:var(--sector-bg);border-color:var(--sector-line)}
.category-tag.source-system{opacity:.8}
.card-actions{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.card-actions .button{font-size:10px;padding:8px 11px}
#trading-panel td .button{font-size:10px;padding:6px 10px}
#trading-panel td,#forecast-content td{font-variant-numeric:tabular-nums;white-space:nowrap}
#trading-panel td small,#forecast-content td small{white-space:normal}
.chain-table tr.atm td,#trading-panel tr.atm td{background:var(--green-soft)}
.text-button.price{font-size:11px;font-variant-numeric:tabular-nums;padding:2px 6px;border:1px solid transparent;border-radius:4px}
.text-button.price:hover{border-color:var(--green-line);background:var(--surface);text-decoration:none}
.equity-card{padding:18px 20px 12px;color:var(--green)}
.equity-card .rail-heading{margin-bottom:8px;color:var(--title)}
.equity-card .rail-heading h2{font-size:13px;margin:0}
.sparkline{width:100%;height:120px;display:block}
.spark-range{display:flex;justify-content:space-between;font-size:9px;color:var(--muted-2);margin-top:4px}
.toggle-label.inline{margin-left:0;margin:6px 0;font-size:11px}
.check-row{display:flex;gap:16px;flex-wrap:wrap}
.form-field>span{font-size:11px;font-weight:600;color:var(--title)}
.form-subhead{display:block;margin:18px 0 -6px;font-size:10px;font-weight:600;letter-spacing:.3px;text-transform:uppercase;color:var(--muted-2)}
@media(max-width:1150px){.desk-grid{gap:14px}}
@media(max-width:760px){.desk-grid{grid-template-columns:1fr}.desk-layout{grid-template-columns:1fr}}
@media(max-width:960px){.desk-layout .context-rail{display:block;margin-top:22px}.desk-layout .rail-card{padding-bottom:14px}}
.coverage-list.compact li span:first-child{flex-shrink:0;min-width:64px}
.coverage-list.compact li span:last-child{text-align:right}

.bot-list .bot-row{flex-direction:column;align-items:stretch;gap:6px}
.bot-row-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.bot-row-head>span{display:flex;flex-direction:column;gap:2px}
.bot-row-head .toggle-label{margin:0}
.bot-row-facts{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.bot-row-facts small{font-size:9px;color:var(--muted-2)}
.bot-list .bot-row .text-button{align-self:flex-start;padding-left:0}
.desk-toolbar{flex-wrap:wrap;gap:10px;margin-top:14px}
.desk-toolbar .card-actions{margin:0}
.scorecard-totals{grid-template-columns:repeat(3,1fr);margin:12px 0 16px}
@media(max-width:960px){.scorecard-totals{grid-template-columns:1fr}}

.runner-card{margin:18px 0 6px}
.runner-card .rail-heading{margin-bottom:6px}
.runner-card .rail-heading .toggle-label{margin-left:auto}
.inline-field{display:inline-flex;align-items:center;gap:6px;font-size:10px;color:var(--text)}
.inline-field input{border:1px solid var(--line);background:var(--surface-2);border-radius:6px;padding:6px 8px;font-size:11px;color:var(--ink)}
.log-details{margin:10px 0}
.log-details summary{font-size:11px;color:var(--green-text);cursor:pointer}
.log-tail{font-size:10px;line-height:1.5;background:var(--surface-2);border:1px solid var(--line);border-radius:6px;padding:10px;overflow:auto;max-height:260px;white-space:pre-wrap;word-break:break-word;color:var(--ink-2)}

/* ---------- accounts & login ---------- */
.login-body{display:grid;place-items:center;min-height:100vh;padding:20px;background:var(--bg)}
.login-card{width:400px;max-width:100%;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:30px;box-shadow:var(--shadow-dialog)}
.login-card .brand{margin-bottom:18px;display:inline-flex}
.login-card h1{font-size:24px;letter-spacing:-.5px;margin:6px 0 4px;color:var(--title)}
.login-card label{display:flex;flex-direction:column;gap:6px;margin:14px 0;font-size:11px;color:var(--text)}
.login-card input{border:1px solid var(--line);background:var(--surface-2);padding:11px 12px;border-radius:7px;font-size:13px;color:var(--ink)}
.login-card input:focus{border-color:var(--focus);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--focus) 14%,transparent)}
.login-card .primary{width:100%;margin-top:6px}
#logout-button{margin-left:auto;font-size:16px}
.users-dialog{width:640px}
.users-dialog .table-card{margin:8px 0 18px}
/* Long account and recipient lists scroll inside the dialog instead of pushing the forms off screen */
#users-list>.table-card,#telegram-admin>.table-card{max-height:min(330px,40vh);overflow:auto}
#users-list>.table-card thead th,#telegram-admin>.table-card thead th{position:sticky;top:0;z-index:2;background:var(--surface-2);box-shadow:0 1px 0 var(--line)}
.access-form{margin:0 0 18px}
.access-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:6px 14px;margin:10px 0 14px}
.form-dialog label.access-row{display:flex;flex-direction:row;gap:10px;align-items:flex-start;margin:4px 0;cursor:pointer;font-size:12px}
.form-dialog .access-row input{width:auto;margin-top:2px;padding:0}
.access-row span{display:flex;flex-direction:column}
.access-row small{color:var(--muted)}
.forecast-panel{margin-top:16px}
#forecast-tabs{margin-top:6px}

/* --- Bots tab: one card per strategy, and a per-bot history view ---------------------- */
.bot-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:16px;margin-top:14px}
.bot-card{display:flex;flex-direction:column;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px 14px;box-shadow:var(--shadow);cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .15s}
.bot-card:hover{border-color:var(--line-strong);box-shadow:var(--shadow-hover)}
.bot-card:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.bot-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.bot-card-head h3,.bot-history-title h3{font-size:15px;font-weight:600;color:var(--title);margin:2px 0 3px;letter-spacing:-.2px;line-height:1.2}
.bot-card-head small,.bot-history-title small{font-size:10px;color:var(--muted-2)}
.bot-style{display:inline-block;font-size:9px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;color:var(--green-ink);background:var(--green-tint);border:1px solid var(--green-line);border-radius:4px;padding:2px 6px}
.bot-card-controls{display:flex;align-items:center;gap:10px;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}
.bot-card-controls .toggle-label{margin:0}
.bot-summary{font-size:11.5px;line-height:1.55;color:var(--text);margin:0}
.bot-kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;padding:12px 0;border-top:1px solid var(--line-2);border-bottom:1px solid var(--line-2)}
.bot-kpis>div{display:flex;flex-direction:column;gap:2px;min-width:0}
.bot-kpis small{font-size:9px;color:var(--muted-2);text-transform:uppercase;letter-spacing:.3px}
.bot-kpis strong{font-size:14px;font-weight:600;color:var(--title);font-variant-numeric:tabular-nums;white-space:nowrap}
.bot-kpis strong .pnl{font-size:inherit}
.bot-kpis span{font-size:9.5px;color:var(--muted)}
.pnl-bars{width:100%;height:64px;display:block;overflow:visible}
.pnl-bars line{stroke:var(--line-strong);stroke-width:.4;vector-effect:non-scaling-stroke}
.pnl-bars rect.up{fill:var(--up-ink)}
.pnl-bars rect.down{fill:var(--down-ink)}
.pnl-bars rect.flat{fill:var(--line-strong)}
.pnl-bars rect.idle{opacity:.45}
.pnl-bars.empty{display:flex;align-items:center;justify-content:center;border:1px dashed var(--line);border-radius:8px;color:var(--muted-2);font-size:10px}
.bot-card .spark-range{margin-top:2px}
.bot-card-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-top:auto}
.bot-card-foot small{font-size:9.5px;color:var(--muted-2)}
.bot-card-actions{display:flex;gap:4px}
.bot-card-actions .text-button{display:inline-flex;align-items:center;gap:4px}
.bot-card-actions .icon{width:12px;height:12px}
.bot-history-head{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin:14px 0 18px}
.bot-history-head>.text-button{display:inline-flex;align-items:center;gap:4px;padding-left:0}
.bot-history-head>.text-button .icon{transform:rotate(180deg);width:13px;height:13px}
.bot-history-title{flex:1;min-width:200px}
.bot-history-head .bot-card-controls .button{padding:7px 11px}
.bot-stats{grid-template-columns:repeat(5,1fr);margin-bottom:18px}
.stat-card.compact{padding:13px 15px 12px}
.stat-card.compact .stat-value{font-size:18px}
.bot-how{border:1px solid var(--line);border-radius:10px;background:var(--surface-2);padding:12px 16px;margin-bottom:6px}
.bot-how summary{font-size:12px;font-weight:600;color:var(--title);cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px}
.bot-how summary::-webkit-details-marker{display:none}
.bot-how summary:before{content:'';width:6px;height:6px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:rotate(-45deg);transition:transform .15s}
.bot-how[open] summary:before{transform:rotate(45deg)}
.bot-how .bot-summary{margin:10px 0 12px}
.bot-how dl{display:grid;grid-template-columns:repeat(2,1fr);gap:12px 22px;margin:0}
.bot-how dt{font-size:9.5px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--green-ink);margin-bottom:3px}
.bot-how dd{margin:0;font-size:11px;line-height:1.55;color:var(--text)}
.bot-history-grid{display:grid;grid-template-columns:1fr;gap:8px;align-items:start;min-width:0}
.bot-history-grid>section{min-width:0}
.bot-history-grid .desk-heading{margin-top:12px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.bot-history-grid .desk-heading small{font-weight:400;font-size:10px}
.bot-history-grid .table-card{margin-top:8px}
.bot-history-grid tr.idle td{color:var(--muted-2)}
.bot-history-grid tr.idle td strong{color:var(--muted)}
.bot-noline{margin:8px 0 0;font-size:11px}
.decision-timeline{list-style:none;margin:8px 0 0;padding:0 0 0 14px;border-left:2px solid var(--line);display:flex;flex-direction:column;gap:12px}
.decision-timeline li{position:relative;display:grid;grid-template-columns:62px minmax(0,1fr);gap:10px;align-items:start}
.decision-timeline li>div{min-width:0}
.decision-timeline li:before{content:'';position:absolute;left:-19px;top:5px;width:8px;height:8px;border-radius:50%;background:var(--line-strong);border:2px solid var(--surface)}
.decision-timeline li.ok:before{background:var(--up-ink)}
.decision-timeline li.error:before{background:var(--status-error-ink)}
.decision-timeline time{font-size:10px;color:var(--muted-2);font-variant-numeric:tabular-nums;padding-top:4px}
.decision-timeline p{margin:5px 0 0;font-size:11px;line-height:1.5;color:var(--text)}
.decision-timeline small{display:block;margin-top:3px;font-size:9.5px;color:var(--muted-2);line-height:1.45;word-break:break-word}
@media(max-width:1150px){.bot-stats{grid-template-columns:repeat(3,1fr)}}
@media(max-width:650px){
  .bot-grid{grid-template-columns:1fr;gap:12px}
  .bot-card{padding:15px 15px 12px}
  .bot-kpis{grid-template-columns:repeat(2,1fr)}
  .bot-stats{grid-template-columns:repeat(2,1fr);gap:10px}
  .bot-how dl{grid-template-columns:1fr}
  .bot-history-head{gap:10px}
  .bot-history-head .bot-card-controls{width:100%;justify-content:flex-start}
  .decision-timeline li{grid-template-columns:1fr}
  .decision-timeline time{padding-top:0}
}

/* --- Script bots: grouped cards and the editor -------------------------------------------- */
.bot-group{margin-top:6px}
.bot-group+.bot-group{margin-top:26px}
.bot-group-head{display:flex;justify-content:space-between;align-items:flex-end;gap:14px;flex-wrap:wrap}
.bot-group-head .desk-heading{margin:10px 0 2px}
.bot-group-head p{margin:0;font-size:11px}
.bot-group .bot-grid{margin-top:12px}
.script-empty{margin-top:12px}
.script-layout{display:grid;grid-template-columns:minmax(0,3fr) minmax(280px,2fr);gap:20px;align-items:start;margin-top:4px}
.script-editor-col{min-width:0}
.code-editor{display:grid;grid-template-columns:44px 1fr;border:1px solid var(--line);border-radius:10px;background:var(--surface);overflow:hidden;box-shadow:var(--shadow)}
.code-editor:focus-within{border-color:var(--green-line)}
.code-editor.has-error{border-color:var(--status-error-ink)}
.code-gutter,.code-editor textarea{margin:0;font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;padding:12px 0}
.code-gutter{background:var(--surface-2);color:var(--muted-3);text-align:right;padding-right:10px;overflow:hidden;user-select:none;border-right:1px solid var(--line-2);white-space:pre}
.code-gutter span.err{color:var(--status-error-ink);font-weight:700}
.code-editor textarea{border:0;outline:0;resize:vertical;min-height:420px;width:100%;padding-left:12px;padding-right:12px;color:var(--title);background:transparent;white-space:pre;overflow:auto;tab-size:4}
.code-editor textarea[readonly]{color:var(--text)}
.script-error{margin:8px 0 0;font-size:11px}
.script-ref{margin-top:14px}
.script-ref dl{grid-template-columns:1fr}
.script-ref code{font:11px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--surface-3);border-radius:4px;padding:1px 5px;color:var(--title)}
.script-side .trade-form{margin:0}
.script-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.script-actions .button{display:inline-flex;align-items:center;gap:6px}
.button.danger{color:var(--status-error-ink)}
/* Exit-all sits in the Positions summary line: unmistakable, but not competing with the order form. */
.button.exit-all{margin-left:.6rem;border-color:var(--status-error-ink);font-weight:600;padding:.25rem .7rem}
.button.exit-all:hover:not(:disabled){background:var(--status-error-ink);color:var(--surface)}
.script-note{font-size:11px;margin:12px 0 0}
.script-summary{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:16px}
.script-summary>div{display:flex;flex-direction:column;gap:2px;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:12px 14px}
.script-summary small{font-size:9px;text-transform:uppercase;letter-spacing:.3px;color:var(--muted-2)}
.script-summary strong{font-size:16px;font-weight:600;color:var(--title);font-variant-numeric:tabular-nums}
.script-summary span{font-size:9.5px;color:var(--muted)}
@media(max-width:1150px){.script-layout{grid-template-columns:1fr}}
@media(max-width:650px){.code-editor textarea{min-height:300px;font-size:11.5px}.script-summary{grid-template-columns:1fr 1fr}.bot-group-head .button{width:100%;justify-content:center}}

/* --- Decision-time ranking block ---------------------------------------------------------- */
.open-model-block{border:1px solid var(--green-line);background:var(--green-tint);border-radius:12px;padding:6px 18px 16px;margin-bottom:22px}
.open-model-block .desk-heading{margin-top:12px}
.open-model-block .desk-heading small{font-weight:400;font-size:10px;margin-left:6px}
.desk-subheading{font-size:12px;font-weight:600;color:var(--title);margin:14px 0 4px}
.open-model-note{margin:0 0 18px;font-size:11px}

/* --- Forecast health: stale prediction or failed pipeline run ------------------------------ */
.health-notice{margin:0 0 14px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.health-notice.error{border-color:var(--status-error-ink);background:var(--status-error-bg);color:var(--status-error-ink)}
.health-notice.warning{border-color:var(--warn-line);background:var(--warn-bg);color:var(--warn-ink)}
.health-notice .text-button{color:inherit;text-decoration:underline}
.health-notice .icon{width:13px;height:13px;vertical-align:-2px}
.health-pill{gap:5px}
.health-pill.error{color:var(--status-error-ink);background:var(--status-error-bg)}
.health-pill.warning{color:var(--warn-ink);background:var(--warn-bg)}
.health-pill .icon{width:12px;height:12px}

/* --- script backtest: controls, summary, candle chart with entries/exits --- */
.bt-controls{margin-top:18px;padding-top:14px;border-top:1px dashed var(--line)}
.bt-controls .button{width:100%;justify-content:center;margin-top:4px}
.bt-progress{height:4px;margin-top:8px;border-radius:2px;background:var(--line);overflow:hidden}
.bt-progress span{display:block;height:100%;background:var(--green);transition:width .6s ease}
.bt-results{margin-top:28px}
.bt-summary{grid-template-columns:repeat(3,1fr)}
.bt-chart-card{margin-top:16px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px 16px 10px}
.bt-chart-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.bt-chart-head .desk-heading{margin:0}
.bt-chart-head small{display:block;margin-top:3px;font-size:10px}
.bt-zoom{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted)}
.bt-zoom select{font:inherit;font-size:11px;padding:5px 8px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text)}
.bt-legend{display:flex;gap:16px;flex-wrap:wrap;margin:10px 0 6px;font-size:10px;color:var(--muted)}
.bt-legend span{display:inline-flex;align-items:center;gap:6px}
.bt-swatch{display:inline-block;width:10px;height:10px;border-radius:2px}
.bt-swatch.call{background:var(--up-ink);clip-path:polygon(50% 0,0 100%,100% 100%)}
.bt-swatch.put{background:var(--status-error-ink);clip-path:polygon(0 0,100% 0,50% 100%)}
.bt-swatch.win{background:var(--up-ink);border-radius:50%}
.bt-swatch.loss{background:var(--status-error-ink);border-radius:50%}
.bt-swatch.line{height:0;width:16px;border-top:2px dashed var(--muted-2);border-radius:0}
.bt-chart{position:relative}
.bt-chart svg{width:100%;height:auto;display:block;font-family:inherit}
.bt-grid{stroke:var(--line);stroke-width:1}
.bt-sep{stroke:var(--line);stroke-width:1;stroke-dasharray:3 4}
.bt-axis{fill:var(--muted-2);font-size:10px;font-variant-numeric:tabular-nums}
.bt-wick{stroke-width:1}.bt-wick.up{stroke:var(--up-ink)}.bt-wick.down{stroke:var(--status-error-ink)}
.bt-body.up{fill:var(--up-ink)}.bt-body.down{fill:var(--status-error-ink)}
.bt-vol{opacity:.28}.bt-vol.up{fill:var(--up-ink)}.bt-vol.down{fill:var(--status-error-ink)}
.bt-link{stroke-width:1.5;stroke-dasharray:4 3;opacity:.75}.bt-link.win{stroke:var(--up-ink)}.bt-link.loss{stroke:var(--status-error-ink)}
.bt-mark text{font-size:9.5px;font-weight:600;fill:var(--title);paint-order:stroke;stroke:var(--surface);stroke-width:3px;stroke-linejoin:round}
.bt-mark.entry.call polygon{fill:var(--up-ink);stroke:var(--surface);stroke-width:1.5}
.bt-mark.entry.put polygon{fill:var(--status-error-ink);stroke:var(--surface);stroke-width:1.5}
.bt-mark.exit circle{fill:var(--surface);stroke-width:2}.bt-mark.exit line{stroke-width:1.6}
.bt-mark.exit.win circle,.bt-mark.exit.win line{stroke:var(--up-ink)}.bt-mark.exit.loss circle,.bt-mark.exit.loss line{stroke:var(--status-error-ink)}
.bt-mark:hover polygon,.bt-mark:hover circle{filter:brightness(1.15);transform-box:fill-box;transform-origin:center;transform:scale(1.25)}
.bt-cross{stroke:var(--muted-2);stroke-width:1;stroke-dasharray:2 3;pointer-events:none}
.bt-hit{cursor:crosshair}
.bt-tip{position:absolute;z-index:3;pointer-events:none;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:8px 10px;box-shadow:0 8px 24px rgba(0,0,0,.14);font-size:10.5px;color:var(--text);display:flex;flex-direction:column;gap:3px;min-width:180px;max-width:280px}
.bt-tip strong{color:var(--title);font-size:11px}
.bt-tip span{font-variant-numeric:tabular-nums;color:var(--muted)}
.bt-tip-mark{margin-top:4px;padding:5px 7px;border-radius:6px;font-weight:600;display:flex;flex-direction:column;gap:2px}
.bt-tip-mark small{font-weight:400;color:var(--muted);white-space:normal}
.bt-tip-mark.call,.bt-tip-mark.win{background:var(--up-bg);color:var(--up-ink)}
.bt-tip-mark.put,.bt-tip-mark.loss{background:var(--down-bg);color:var(--status-error-ink)}
.bt-equity{margin-top:16px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px 16px 10px}
.bt-equity .desk-heading{margin-top:0}
.bt-tables{display:grid;grid-template-columns:1fr;gap:20px;align-items:start;margin-top:8px}
.bt-tables tr.idle td{color:var(--muted-2)}
@media(max-width:1150px){.bt-tables{grid-template-columns:1fr}}
@media(max-width:650px){.bt-summary{grid-template-columns:1fr 1fr}.bt-chart-card{padding:10px}}
.bt-tables .table-card{max-height:440px;overflow:auto;overscroll-behavior:contain}
.bt-tables .table-card thead th{position:sticky;top:0;z-index:1;background:var(--surface);box-shadow:0 1px 0 var(--line)}
.bt-symbols{margin-top:14px}
.bt-symbols tr.atm td{background:var(--up-bg)}

/* Export card (Bot decisions): the whole record as a download, with its size and start date */
.export-card{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap;padding:14px 18px;margin:0 0 4px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.export-card-text{display:flex;flex-direction:column;gap:3px;min-width:240px;flex:1 1 320px}
.export-card-text h3{margin:0;font-size:13px;font-weight:600;color:var(--title);letter-spacing:-.2px}
.export-card-text p{margin:0;font-size:11px;line-height:1.6;color:var(--muted)}
.export-card-actions{display:flex;gap:8px;flex:0 0 auto}
.export-card-actions .button .icon{width:14px;height:14px}
@media (max-width:640px){.export-card-actions{width:100%}.export-card-actions .button{flex:1 1 0}}
/* Telegram alerts: the link code card, the admin's status line and the delivery log */
.telegram-code{margin:14px 0;padding:14px 16px;border:1px dashed var(--line);border-radius:var(--radius);background:var(--surface)}
.telegram-code p{margin:0 0 6px;font-size:12px;color:var(--text)}
.code-box{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:26px;letter-spacing:6px;font-weight:600;color:var(--title);margin:8px 0 12px;user-select:all}
.telegram-status{display:flex;flex-direction:column;gap:6px;margin:8px 0 12px}
.telegram-toggles{display:flex;flex-wrap:wrap;gap:4px 24px;margin:2px 0 6px}
.form-dialog .telegram-toggles label.toggle-label,.form-dialog .telegram-status label.toggle-label{flex-direction:row;align-items:center;gap:8px;margin:6px 0;font-size:12px}
.telegram-log{margin-top:12px}
.telegram-log summary{cursor:pointer;font-size:12px;color:var(--muted)}
.telegram-log .table-card{max-height:260px;overflow:auto}
.telegram-log .table-card thead th{position:sticky;top:0;z-index:2;background:var(--surface-2);box-shadow:0 1px 0 var(--line)}
.table-card td .status-badge+small{display:block;margin-top:3px}

/* Live trades (Kite): who may view the log */
.viewers-card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px;margin-top:12px}
.viewers-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:12px}
.viewers-toolbar .search-field{flex:1 1 220px;max-width:340px}
.viewers-count{margin-left:auto;font-size:12px;color:var(--muted)}
.viewers-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.viewer-tile{position:relative;display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--line);border-radius:11px;background:var(--surface);cursor:pointer;transition:background .15s,border-color .15s}
.viewer-tile:hover{background:var(--surface-hover)}
.viewer-tile.on{background:var(--green-soft);border-color:var(--green-line)}
.viewer-tile[hidden]{display:none}
.viewer-avatar{flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:700;color:var(--green-ink);background:var(--chip-bg);border:1px solid var(--chip-line)}
.viewer-name{display:flex;flex-direction:column;min-width:0;flex:1}
.viewer-name strong{font-size:13px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.viewer-name small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.viewer-tile input{position:absolute;opacity:0;width:1px;height:1px}
.viewer-tile input:checked+.switch{background:var(--switch-on)}
.viewer-tile input:checked+.switch:after{transform:translateX(12px)}
.viewer-tile input:focus-visible+.switch{outline:3px solid var(--focus);outline-offset:3px}
.viewers-empty{padding:10px 2px}
.viewers-actions{display:flex;align-items:center;gap:12px;margin-top:14px}
.viewers-actions .button:disabled{opacity:.55;cursor:not-allowed}
.viewers-dirty{font-size:12px;color:var(--muted)}
@media (max-width:640px){.viewers-grid{grid-template-columns:1fr}.viewers-toolbar .search-field{flex-basis:100%;max-width:none}.viewers-toolbar .button{flex:1}.viewers-count{margin-left:0;width:100%}}
#live-main .coverage-list li{gap:14px}
#live-main .coverage-list li>span{flex:none;white-space:nowrap}
#live-main .coverage-list li>strong{text-align:right;overflow-wrap:anywhere}
/* Bot charts tab: session / bot / interval toolbar and the traded-symbol chips */
.chart-toolbar{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-end;margin:0 0 12px}
.chart-toolbar label{display:flex;flex-direction:column;gap:4px;font-size:10px;color:var(--muted)}
.chart-chips{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 14px}
.symbol-chip{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--text);cursor:pointer;text-align:left}
.symbol-chip small{font-size:10px;color:var(--muted)}
.symbol-chip.active{border-color:var(--green-text);box-shadow:0 0 0 2px var(--green-soft)}
.symbol-chip:hover{border-color:var(--green-text)}
.bt-chart-card td.reason{max-width:360px;white-space:normal;font-size:10.5px;color:var(--muted)}
