:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #262b36;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #3b82f6;
  --ok: #22c55e;
  --err: #ef4444;
}
* { 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: #10131a;
  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: #232833; border-color: var(--border); }
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: #232833; 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: #93c5fd; }
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: #10131a; padding: 1px 5px; border-radius: 5px; color: #cbd5e1; }
.badge { display: inline-block; background: #1e293b; border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: #93c5fd; 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; }
