:root {
  --bg: #0d1014;
  --panel: #141920;
  --line: #222a33;
  --text: #d7dde4;
  --muted: #7b8794;
  --up: #26a69a;
  --down: #ef5350;
  --index: #f0b429;
  --accent: #5b9cf6;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 13px/1.4 Inter, system-ui, -apple-system, sans-serif; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel); }
.sym { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.sym small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.kpis { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.kpi { display: flex; flex-direction: column; }
.kpi .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-family: var(--mono); font-size: 13px; }
.v.up { color: var(--up); } .v.down { color: var(--down); }
.tfs { display: flex; gap: 4px; }
.status { font-size: 11px; color: var(--muted); }
.status.bad { color: var(--down); }
form.logout { margin: 0; }

#chart { position: relative; min-height: 0; }
.legend { position: absolute; left: 12px; top: 8px; z-index: 3; pointer-events: none;
  font-family: var(--mono); font-size: 12px; color: var(--muted); }
.legend b { color: var(--text); font-weight: 500; }
.pane-label { position: absolute; left: 12px; z-index: 3; font-size: 11px; color: var(--muted);
  pointer-events: none; text-transform: uppercase; letter-spacing: .04em; }

.tip { position: absolute; z-index: 5; max-width: 360px; padding: 10px 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); display: none; }
.tip { max-height: 60vh; overflow: auto; pointer-events: auto; }
.tip a { color: var(--accent); text-decoration: none; font-weight: 500; }
.news-card { padding: 6px 0; border-bottom: 1px solid var(--line); display: grid; gap: 3px; }
.news-card:last-child { border-bottom: 0; }
.nc-head { display: flex; gap: 8px; align-items: baseline; }
.nc-head .v { font-family: var(--mono); font-weight: 700; }
.nc-meta { color: var(--muted); font-size: 11px; }
.nc-why { font-size: 12px; }
.magf { color: var(--muted); font-size: 11px; display: flex; gap: 6px; align-items: center; margin-left: auto; }
.magf select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 6px; }

/* login */
.login { display: grid; place-items: center; height: 100vh; }
.login form { width: min(320px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.login h1 { margin: 0 0 6px; font-size: 16px; }
.login input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; }
.login .err { color: var(--down); font-size: 12px; min-height: 1em; }
.login button { padding: 8px; background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 700px) {
  .magf { margin-left: 0; }
  .tip { left: 8px !important; right: 8px; max-width: none; }
  header { gap: 6px 12px; }
}
