:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #262b36;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #3b82f6;
  --ok: #22c55e;
  --err: #ef4444;
  --code-bg: #10131a;
  --soft-bg: #232833;
  --chip-bg: #1e293b;
  --chip-text: #93c5fd;
  --text-soft: #cbd5e1;
  --text-dim: #94a3b8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 16px; margin: 0; }
.topnav { display: flex; gap: 8px; flex-wrap: wrap; }
.topnav a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.topnav a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.topright { display: flex; align-items: center; gap: 8px; margin-left: auto; }
main { max-width: 960px; margin: 0 auto; padding: 20px; }
main.wide { max-width: 1440px; }
section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto;
}
section h2 { margin: 0 0 12px; font-size: 15px; }
label { display: block; margin: 8px 0 4px; color: var(--muted); font-size: 13px; }
input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
input, select, textarea { width: 100%; }
textarea { min-height: 64px; font-family: ui-monospace, monospace; }
button {
  background: var(--accent);
  border-color: var(--accent);
  cursor: pointer;
  color: #fff;
}
button.secondary { background: var(--soft-bg); border-color: var(--border); color: var(--text); }
button.danger { background: #3a1d22; border-color: #6b2b33; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { flex: 0 0 auto; }
.tab { background: var(--soft-bg); border-color: var(--border); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.navlink { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.params { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.params-cell { cursor: help; white-space: nowrap; color: var(--chip-text); }
table.nowrap th, table.nowrap td { white-space: nowrap; }
.guide { font-size: 14px; line-height: 1.55; }
.guide h4 { margin: 14px 0 6px; font-size: 14px; }
.guide p { margin: 8px 0; }
.guide ol { margin: 6px 0 6px 18px; padding: 0; }
.guide code { background: var(--code-bg); padding: 1px 5px; border-radius: 5px; color: var(--text-soft); }
.badge { display: inline-block; background: var(--chip-bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--chip-text); white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag.buy { background: #052e1a; color: #4ade80; border: 1px solid #14532d; }
.tag.sell { background: #3a1d22; color: #f87171; border: 1px solid #6b2b33; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.flow .step { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: #10131a; text-align: center; font-size: 12px; line-height: 1.3; }
.flow .entry { border-color: #1d4ed8; background: #0b1a33; color: #93c5fd; }
.flow .hold { border-color: #334155; color: #cbd5e1; }
.flow .exit-good { border-color: #14532d; background: #052e1a; color: #4ade80; }
.flow .exit-bad { border-color: #6b2b33; background: #2a1417; color: #fca5a5; }
.flow .arrow, .flow .or { color: var(--muted); }
.gain { color: #4ade80; }
.loss { color: #f87171; }
.dot { font-size: 12px; }
.dot.on { color: var(--ok); }
.dot.off { color: #6b7280; }
.dot.err { color: var(--err); }
.dot.warn { color: #f59e0b; }
.dot.idle { color: #f59e0b; }
.dash-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.subs { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.subs h2 { margin: 0 0 8px; font-size: 14px; }
.subs-list { list-style: none; margin: 0; padding: 0; }
.subs-list li { padding: 4px 0; }
.subs-list a { text-decoration: none; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.feed-head h2 { margin: 0; }
#feed-body section { margin-top: 12px; }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 13px; }
.ok { color: var(--ok); }
.err { color: var(--err); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
code { color: var(--muted); }
/* Университет: матрицы исследований */
table.uni th, table.uni td { text-align: center; padding: 5px 8px; }
table.uni td.k, table.uni th:first-child { text-align: left; }
table.uni td.bad { color: #f87171; }
table.uni td.weak { color: #fbbf24; }
table.uni td.good { color: #4ade80; }
main section h2 { margin-top: 22px; }
.note {
  margin: 8px 0 20px; padding: 10px 12px; background: #10131a;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 13px; line-height: 1.5;
}
.note b { color: var(--text); }
ul.uniextra { margin: 8px 0 0; padding-left: 18px; }
ul.uniextra li { margin: 3px 0; color: var(--muted); }
ul.uniextra li b { color: var(--text); }
a { color: var(--accent); }
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .6);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; width: 100%; max-width: 420px;
}
.modal-box h3 { margin: 0 0 12px; font-size: 15px; }
.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 20px; margin-top: 4px; }
.card .broker { font-weight: 600; }
.card .total { font-size: 18px; margin-top: 4px; }
.card .pos-line { font-size: 12px; margin-top: 2px; }
header a { margin-left: 10px; }

/* Аналоговые часы: Москва + локальный пояс пользователя */
.clock-strip { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 16px; }
.clock-card {
  display: flex; align-items: center; gap: 12px; min-width: 210px;
  background: #fff; color: #0f172a; border: 1px solid #cbd5e1;
  border-radius: 14px; padding: 10px 14px 10px 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
.clock {
  width: 94px; height: 94px; flex: 0 0 94px; border-radius: 50%;
  background: #fff; border: 2px solid #0f172a; position: relative;
}
.clock-face { position: absolute; inset: 0; }
.clock-num {
  position: absolute; font-size: 11px; font-weight: 700; line-height: 1;
  color: #0f172a; transform: translate(-50%, -50%);
}
.clock-num.n12 { left: 50%; top: 12%; }
.clock-num.n3 { left: 88%; top: 50%; }
.clock-num.n6 { left: 50%; top: 88%; }
.clock-num.n9 { left: 12%; top: 50%; }
.clock-tick {
  position: absolute; left: 50%; top: 5px; width: 1px; height: 5px;
  background: #64748b; transform-origin: 50% 42px; transform: translateX(-50%) rotate(var(--r));
}
.clock-hand {
  position: absolute; left: 50%; bottom: 50%; transform-origin: 50% 100%;
  background: #0f172a; border-radius: 3px; z-index: 2;
}
.clock-hand.hour { width: 4px; height: 24px; margin-left: -2px; }
.clock-hand.minute { width: 2px; height: 33px; margin-left: -1px; }
.clock-hand.second { width: 1px; height: 37px; margin-left: -.5px; background: #dc2626; z-index: 3; }
.clock-pin {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #dc2626;
  border: 1px solid #0f172a; z-index: 4;
}
.clock-meta { min-width: 0; }
.clock-title { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.clock-zone { font-size: 11px; color: #475569; margin-top: 2px; white-space: nowrap; }
.clock-digital { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; margin-top: 6px; }
@media (max-width: 700px) {
  .clock-card { flex: 1 1 100%; }
}

/* Полоска итогов по брокерам между часами и счетами */
.broker-totals {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0 0 16px;
}
.broker-total {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px;
}
.broker-total .broker-name { color: var(--muted); font-size: 12px; }
.broker-total .broker-sum {
  color: var(--text); font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.broker-total .broker-currency { color: var(--muted); font-size: 11px; }
.broker-total { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.broker-total-top { display: flex; align-items: baseline; gap: 8px; }
.broker-breakdown { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.broker-total-summary { border-color: var(--accent); background: rgba(56, 189, 248, .08); }
.broker-total-summary { margin-left: auto; }
@media (max-width: 700px) {
  .broker-total-summary { margin-left: 0; }
}
.broker-logo {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; line-height: 1;
}
.broker-logo.tbank, .broker-logo.tinkoff { background: #ffdd2d; color: #111; }
.broker-logo.bcs { background: #0b4ea2; color: #fff; }
.broker-logo.crypto { background: #000; color: #fff; font-size: 7px; letter-spacing: -.02em; }
.prep-cell { min-width: 150px; }
.prep-svg { display: block; width: 150px; height: 42px; overflow: visible; }
.prep-line { stroke: #475569; stroke-width: 1; }
.prep-dot { fill: #38bdf8; stroke: #0f172a; stroke-width: 1; }
.prep-dot.prep-0 { fill: #f59e0b; }
.prep-dot.prep-1 { fill: #38bdf8; }
.prep-dot.prep-2 { fill: #22c55e; }
.prep-day { fill: #94a3b8; font-size: 8px; }
.prep-day.prep-today { fill: #f8fafc; font-weight: 700; }
.broker-total-summary { margin-left: auto; }
.prep-dot.prep-3 { fill: #a78bfa; }

.trade-why summary { cursor: pointer; color: var(--accent); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-note { max-width: 420px; white-space: normal; line-height: 1.35; margin-top: 6px; color: var(--text-soft); }
.trade-meta { margin-top: 4px; color: var(--text-dim); font-size: 11px; white-space: normal; }
.trade-link { display: inline-block; margin-top: 6px; color: var(--accent); font-size: 12px; }

/* Ребаланс: страница, прогресс, предупреждения */
.rebalance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rebalance-head h2 { margin: 0; }
.rebalance-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-real { background: #3a1d22; border-color: #6b2b33; color: #fca5a5; }
.badge-paper { background: #0b1a33; border-color: #1d4ed8; color: #93c5fd; }
.badge-ok { background: #052e1a; border-color: #14532d; color: #4ade80; }
.badge-warn { background: #2a2410; border-color: #6b5a1f; color: #fbbf24; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.progress { height: 10px; background: #10131a; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.warn-box { margin-top: 10px; padding: 10px 12px; border: 1px solid #6b2b33; background: #2a1417; border-radius: 8px; color: #fca5a5; font-size: 13px; }
.warn-box p { margin: 4px 0; }
.warn-box table { color: var(--text); margin-top: 6px; }
.run-detail-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.run-detail-box h3 { margin: 0 0 8px; font-size: 14px; }

/* Расчет по бумаге: формула + мини-графики */
.calc-detail { margin-top: 12px; }
.calc-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #10131a; }
.calc-card h3 { margin: 0 0 8px; font-size: 14px; }
.calc-formula { font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.65; color: var(--text-soft); white-space: pre-wrap; }
.calc-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.calc-chart { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.calc-chart h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.calc-chart svg { width: 100%; height: 90px; display: block; }
.calc-chart .axis { stroke: #334155; stroke-width: 1; }
.calc-chart .line { fill: none; stroke: #3b82f6; stroke-width: 2; }
.calc-chart .bar { fill: #3b82f6; }
.calc-chart .bar-label { fill: #9aa3b2; font-size: 8px; text-anchor: middle; }
.calc-chart .marker { fill: #22c55e; }
@media (max-width: 800px) { .calc-charts { grid-template-columns: 1fr; } }


/* Светлая тема */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --border: #d6deea;
  --text: #172033;
  --muted: #64748b;
  --accent: #2563eb;
  --ok: #15803d;
  --err: #dc2626;
  --code-bg: #f1f5f9;
  --soft-bg: #eef2f7;
  --chip-bg: #eff6ff;
  --chip-text: #1d4ed8;
  --text-soft: #334155;
  --text-dim: #64748b;
}
html[data-theme="light"] header { background: rgba(255, 255, 255, .85); }
html[data-theme="light"] .tag.buy { background: #dcfce7; color: #166534; border-color: #86efac; }
html[data-theme="light"] .tag.sell { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
html[data-theme="light"] .flow .entry { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
html[data-theme="light"] .flow .hold { color: #334155; border-color: #cbd5e1; }
html[data-theme="light"] .flow .exit-good { background: #dcfce7; color: #166534; border-color: #86efac; }
html[data-theme="light"] .flow .exit-bad { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
html[data-theme="light"] .gain { color: #15803d; }
html[data-theme="light"] .loss { color: #b91c1c; }
html[data-theme="light"] .note { background: #f8fafc; }
html[data-theme="light"] .warn-box { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
html[data-theme="light"] .badge-real { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
html[data-theme="light"] .badge-paper { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
html[data-theme="light"] .badge-ok { background: #dcfce7; border-color: #86efac; color: #166534; }
html[data-theme="light"] .badge-warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
html[data-theme="light"] .progress { background: #e2e8f0; }
html[data-theme="light"] .calc-card { background: #f8fafc; }
html[data-theme="light"] .calc-formula { color: #334155; }
html[data-theme="light"] .calc-chart .axis { stroke: #cbd5e1; }
html[data-theme="light"] .calc-chart .bar-label { fill: #64748b; }
html[data-theme="light"] .prep-line { stroke: #94a3b8; }
html[data-theme="light"] .prep-day { fill: #64748b; }
html[data-theme="light"] .prep-day.prep-today { fill: #0f172a; }
html[data-theme="light"] .prep-dot { stroke: #ffffff; }
html[data-theme="light"] table.uni td.bad { color: #b91c1c; }
html[data-theme="light"] table.uni td.weak { color: #b45309; }
html[data-theme="light"] table.uni td.good { color: #15803d; }
html[data-theme="light"] .guide svg rect { fill: #f8fafc; stroke: #cbd5e1; }
html[data-theme="light"] .guide svg text { fill: #172033; }
html[data-theme="light"] .guide svg path,
html[data-theme="light"] .guide svg line { stroke: #94a3b8; }
html[data-theme="light"] .modal { background: rgba(15, 23, 42, .35); }
html[data-theme="light"] button.danger { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
html[data-theme="light"] .clock-card { box-shadow: 0 6px 18px rgba(15, 23, 42, .10); }

/* Монитор новостей */
.table-toolbar { display:flex; align-items:center; gap:8px; margin:8px 0 10px; }
.table-toolbar select { min-width:220px; }
.pager { display:flex; align-items:center; gap:8px; margin:10px 0 4px; }
.pager button { padding:4px 10px; }
.news-toolbar { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:16px; }
.news-toolbar h2 { margin:0 0 4px; }
.news-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.news-card { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:16px; min-width:0; }
.news-card.health-ok { border-top:3px solid var(--ok); }
.news-card.health-warn { border-top:3px solid #f59e0b; }
.news-card.health-error { border-top:3px solid var(--err); }
.news-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.news-card-head h2 { margin:0 0 2px; font-size:16px; }
.news-health { font-size:11px; text-transform:uppercase; letter-spacing:.04em; padding:3px 8px; border-radius:999px; border:1px solid var(--border); white-space:nowrap; }
.news-health.ok { color:var(--ok); border-color:var(--ok); }
.news-health.warn { color:#b45309; border-color:#f59e0b; }
.news-health.error { color:var(--err); border-color:var(--err); }
.news-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:16px 0 14px; }
.news-metric { background:var(--code-bg); border:1px solid var(--border); border-radius:9px; padding:9px 10px; }
.news-metric-label { color:var(--muted); font-size:11px; display:flex; align-items:center; gap:5px; }
.news-metric-value { font-size:20px; font-weight:700; margin-top:2px; font-variant-numeric:tabular-nums; }
.news-metric-sub { color:var(--muted); font-size:10px; margin-top:1px; }
.news-info { position:relative; display:inline-flex; align-items:center; justify-content:center; width:14px; height:14px; flex:none; border:1px solid var(--border); border-radius:50%; color:var(--muted); font-size:10px; line-height:1; cursor:help; user-select:none; }
.news-info::after { content:attr(data-tip); display:none; position:absolute; left:50%; top:calc(100% + 7px); width:min(260px,70vw); padding:8px 10px; border:1px solid var(--border); border-radius:8px; background:var(--panel); color:var(--text); box-shadow:0 8px 24px rgba(0,0,0,.25); font-size:11px; font-weight:400; line-height:1.35; text-align:left; white-space:normal; transform:translateX(-50%); z-index:50; pointer-events:none; }
.news-info::before { content:""; display:none; position:absolute; left:50%; top:calc(100% + 2px); border:5px solid transparent; border-bottom-color:var(--border); transform:translateX(-50%); z-index:51; pointer-events:none; }
.news-info:hover::after, .news-info:focus::after { display:block; }
.news-info:hover::before, .news-info:focus::before { display:block; }
.news-pipeline { display:flex; align-items:stretch; flex-wrap:wrap; gap:4px; padding:4px 0 10px; }
.news-step { flex:1; min-width:64px; background:var(--code-bg); border:1px solid var(--border); border-radius:7px; padding:6px; }
.news-step.err { border-color:var(--err); }
.news-step.muted-step { opacity:.55; }
.news-step-label { font-size:10px; color:var(--muted); display:flex; align-items:center; gap:4px; }
.news-step-time { font-size:11px; margin-top:2px; white-space:nowrap; }
.news-arrow { align-self:center; color:var(--muted); font-size:12px; }
.news-spark { margin:2px 0 12px; }
.news-spark svg { display:block; width:100%; height:42px; }
.news-spark-bar { fill:var(--accent); opacity:.75; }
.news-spark-labels { display:flex; justify-content:space-between; font-size:10px; }
.news-daily { display:grid; gap:10px; margin:4px 0 14px; }
.news-daily-chart { background:var(--code-bg); border:1px solid var(--border); border-radius:9px; padding:8px 10px 9px; }
.news-daily-head { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; }
.news-daily-title { color:var(--muted); font-size:11px; font-weight:600; }
.news-daily-legend { display:flex; flex-wrap:wrap; gap:7px; color:var(--muted); font-size:10px; }
.news-daily-legend-item { display:inline-flex; align-items:center; gap:4px; white-space:nowrap; }
.news-daily-dot { display:inline-block; width:7px; height:7px; border-radius:2px; }
.news-series-received { background:#3b82f6; }
.news-series-processed { background:#22c55e; }
.news-series-linked { background:#a855f7; }
.news-series-validated { background:#f59e0b; }
.news-series-executed { background:#ef4444; }
.news-daily-chart { position:relative; }
.news-line-svg { display:block; width:100%; height:150px; overflow:visible; }
.news-line-grid { stroke:var(--border); stroke-width:.7; opacity:.55; }
.news-line-path { fill:none; stroke-width:2.2; stroke-linejoin:round; stroke-linecap:round; }
.news-line-dot { stroke:var(--panel); stroke-width:1.5; }
.news-line-label { fill:var(--muted); font-size:10px; }
.news-line-hit { fill:transparent; cursor:crosshair; pointer-events:all; }
.news-line-hit:focus { outline:none; }
.news-line-guide { stroke:var(--muted); stroke-width:1; stroke-dasharray:3 3; display:none; pointer-events:none; }
.news-line-tip { display:none; position:absolute; top:2px; left:0; transform:translateX(-50%); min-width:150px; padding:7px 9px; border:1px solid var(--border); border-radius:8px; background:var(--panel); box-shadow:0 8px 24px rgba(0,0,0,.25); z-index:20; pointer-events:none; font-size:10px; }
.news-line-tip.show { display:block; }
.news-line-tip-head { color:var(--muted); margin-bottom:4px; white-space:nowrap; }
.news-line-tip-row { display:flex; align-items:center; gap:5px; line-height:1.45; }
.news-line-tip-dot { width:7px; height:7px; border-radius:50%; flex:none; }
.news-line-tip-value { margin-left:auto; padding-left:10px; font-variant-numeric:tabular-nums; }
.news-line-path.news-series-received, .news-line-dot.news-series-received { stroke:#3b82f6; }
.news-line-path.news-series-processed, .news-line-dot.news-series-processed { stroke:#22c55e; }
.news-line-path.news-series-linked, .news-line-dot.news-series-linked { stroke:#a855f7; }
.news-line-path.news-series-validated, .news-line-dot.news-series-validated { stroke:#f59e0b; }
.news-line-path.news-series-executed, .news-line-dot.news-series-executed { stroke:#ef4444; }
.news-line-dot.news-series-received { fill:#3b82f6; }
.news-line-dot.news-series-processed { fill:#22c55e; }
.news-line-dot.news-series-linked { fill:#a855f7; }
.news-line-dot.news-series-validated { fill:#f59e0b; }
.news-line-dot.news-series-executed { fill:#ef4444; }
.news-line-tip-dot.news-series-received { background:#3b82f6; }
.news-line-tip-dot.news-series-processed { background:#22c55e; }
.news-line-tip-dot.news-series-linked { background:#a855f7; }
.news-line-tip-dot.news-series-validated { background:#f59e0b; }
.news-line-tip-dot.news-series-executed { background:#ef4444; }
.news-foot { display:flex; justify-content:space-between; gap:10px; border-top:1px solid var(--border); padding-top:9px; font-size:12px; flex-wrap:wrap; }
.news-foot-main { font-weight:600; display:inline-flex; align-items:center; gap:5px; }
.news-error { margin-top:8px; padding:7px 9px; border:1px solid var(--err); border-radius:7px; color:var(--err); font-size:12px; }
.news-warn { margin-top:8px; padding:7px 9px; border:1px solid #f59e0b; border-radius:7px; color:#b45309; font-size:12px; }
/* Баннер «обрыв обработки» на дашборде */
.pipeline-alert {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; line-height: 1.35;
}
.pipeline-alert.warn { border: 1px solid #f59e0b; background: #2a2110; color: #fcd34d; }
.pipeline-alert.error { border: 1px solid var(--err); background: #2a1417; color: #fca5a5; }
.pipeline-alert.ok { border: 1px solid #21402d; background: #0e1f15; color: #86efac; font-size: 12px; padding: 6px 10px; }
.pipeline-alert-dot { color: var(--ok); font-size: 13px; }
.pipeline-alert-icon { font-size: 15px; }
.pipeline-alert-link { margin-left: auto; color: inherit; text-decoration: underline; white-space: nowrap; }
html[data-theme="light"] .pipeline-alert.warn { background: #fffbeb; color: #92400e; }
html[data-theme="light"] .pipeline-alert.error { background: #fef2f2; color: #991b1b; }
html[data-theme="light"] .pipeline-alert.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
@media (max-width: 900px) { .news-grid { grid-template-columns:1fr; } .news-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.qr-box { display:inline-block; margin:10px 0; padding:10px; background:#fff; border-radius:10px; line-height:0; }
.qr-box svg { display:block; width:180px; height:180px; }

.horizon-badge, .news-horizon {
  display:inline-block; padding:1px 6px; border-radius:6px;
  font-size:10px; font-weight:600; background:rgba(59,130,246,.12);
  color:#2563eb; border:1px solid rgba(59,130,246,.3);
}
.horizon-badge { margin-left:6px; }
.news-signals { margin-top:10px; border-top:1px solid var(--border); padding-top:6px; }
.news-signal-row { display:flex; align-items:center; gap:8px; font-size:12px; padding:2px 0; }
.news-signal-ticker { font-weight:600; }

/* Кнопка закрытия лота: зелёная, если PnL покрывает комиссию за круг. */
.lot-close {
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--soft-bg);
  color: var(--text-soft);
}
.lot-close.good {
  background: rgba(34, 197, 94, 0.18); color: #4ade80;
  border-color: rgba(34, 197, 94, 0.5);
}
.lot-close.bad {
  background: rgba(239, 68, 68, 0.16); color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}
.lot-chart-btn {
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--soft-bg);
  color: var(--text-soft); margin-right: 4px;
}
.lot-chart-btn:hover {
  border-color: rgba(96, 165, 250, 0.6); color: #93c5fd;
}

/* Мини-график в подсказке кнопки закрытия. */
.lot-pnl {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.lot-chart-tip {
  position: absolute; z-index: 60; width: 320px;
  max-width: calc(100vw - 16px); padding: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); pointer-events: none;
}
.lot-chart-head {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; margin-bottom: 6px;
}
.lot-chart svg { display: block; width: 100%; height: auto; }
.lot-forecast {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px; line-height: 1.35;
}

.agent-report {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(128,128,128,.25);
  border-radius: 8px;
  padding: 16px;
  max-height: 70vh;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}
