:root {
  --bg: #0f1419; --panel: #161d25; --panel2: #1c2530; --line: #2a3542; --text: #dfe6ee; --muted: #8b98a8;
  --accent: #4a9eff; --crit: #d64545; --und: #e0a030; --ok: #3a9d5d; --nd: #8a929c;
  --obs: #4a9eff; --ext: #a67cf0; --team: #2bb3a3; --prob: #e0a030;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted, .opt { color: var(--muted); }
.opt { font-size: 12px; margin-left: 4px; }
a { color: var(--accent); }

/* верхняя панель */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: #0b1016; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }
.spacer { flex: 1; }
.badge { padding: 2px 8px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--line); }
.chip.ok { color: #8fd4a6; } .chip.stale, .chip.no_data { color: var(--und); } .chip.error, .chip.paused { color: #ff8b8b; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.toggle { font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.bell { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.bell .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--line); font-size: 12px; }
.bell.has .count { background: var(--crit); color: #fff; }

/* раскладка */
.layout { display: grid; grid-template-columns: 330px 1fr; gap: 14px; padding: 14px 16px; }
.side { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 70px); overflow: auto; }
main { min-width: 0; }
form { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
input, select { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; color: var(--text); }
input[type=checkbox], input[type=range] { padding: 0; }
input[type=datetime-local] { color-scheme: dark; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--panel2); border: 0; padding: 6px 4px; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--accent); color: #fff; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.presets button { background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.presets button:hover { border-color: var(--accent); }
details { border-top: 1px dashed var(--line); padding-top: 6px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details > label, details > div, details > p { margin-top: 6px; }
.ov-row { display: grid; grid-template-columns: 1fr 110px; gap: 6px; align-items: center; font-size: 12px; margin-top: 4px; }
.ov-row input { grid-column: 1 / 3; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 9px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: .6; cursor: wait; }
.progress { font-size: 12px; color: var(--muted); }
.progress .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.err { color: #ff8b8b; font-size: 13px; white-space: pre-wrap; }
.side-sec { margin-top: 12px; }
.side-sec h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; cursor: pointer; font-size: 12px; background: var(--panel); }
.list li:hover { border-color: var(--accent); }
.list li .s { float: right; color: var(--muted); }

/* карточки */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.card h2 { font-size: 15px; margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.c-critical { background: var(--crit); } .c-undesirable { background: var(--und); } .c-acceptable { background: var(--ok); } .c-no_data { background: var(--nd); }
.ctrls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.ctrls input[type=number] { width: 80px; }
.ctrls button { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px; cursor: pointer; }
.empty { max-width: 760px; padding: 20px 6px; }
.empty h1 { font-size: 22px; }
.banner { border: 1px solid var(--und); background: #2a2310; color: #f0d08a; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* рекомендация */
.rec .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.rec .title { font-size: 18px; font-weight: 700; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.pill.preferred, .pill.equivalent { background: #1d3b28; color: #8fd4a6; }
.pill.insufficient_basis { background: #33363b; color: #cfd5dc; }
.pill.no_window, .pill.not_recommended { background: #3d1c1c; color: #ff9b9b; }
.pill.worse { background: #2a3542; color: #cfd5dc; }
.pill.requires_review { background: #33363b; color: #cfd5dc; }
.pill.low { background: #3a2d10; color: #f0c060; }
.rec ul { margin: 6px 0; padding-left: 18px; }
.rec li { margin: 3px 0; }
.rec .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rec .actions button, .rec .actions a { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; text-decoration: none; color: var(--text); font-size: 13px; }
.rec .actions button.watch { border-color: var(--accent); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flag { font-size: 12px; padding: 1px 7px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); }
.flag.warn { border-color: var(--und); color: #f0c060; }

/* шкала и карта */
#timeline { height: 520px; }
#map { height: 430px; }

/* таблица окон */
.tablewrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; background: var(--panel2); text-align: left; font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 5px 6px; border-bottom: 1px solid #202a35; white-space: nowrap; }
.tbl tr { cursor: pointer; }
.tbl tr:hover td { background: #1b2430; }
.tbl tr.sel td { background: #1d2f47; }
.tbl tr.rec td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.tbl .num { text-align: right; }
.tbl .z { color: #4c5866; }
.cl { display: inline-block; min-width: 26px; text-align: right; }
.cl.critical { color: #ff8b8b; font-weight: 600; } .cl.undesirable { color: #f0c060; } .cl.no_data { color: #b8c0ca; }
.win-detail { background: var(--panel2); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.ivs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.iv { font-size: 12px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; background: var(--panel); }
.iv.critical { border-color: var(--crit); } .iv.undesirable { border-color: var(--und); } .iv.no_data { border-color: var(--nd); }

/* вкладки */
.tabs { display: flex; gap: 4px; margin-bottom: -1px; }
.tabs button { background: var(--panel2); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--panel); color: var(--accent); }
.tabpane { border-top-left-radius: 0; }
.tabpane h3 { font-size: 14px; margin: 8px 0 6px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 12.5px; text-decoration: none; color: var(--text); display: inline-block; }
.btn.primary { background: var(--accent); color: #fff; border: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; font-size: 12.5px; }
.kv b { color: var(--muted); font-weight: 500; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
pre.mono { white-space: pre-wrap; background: var(--panel2); padding: 8px; border-radius: 6px; }

/* выдвижная панель */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); border-left: 1px solid var(--line);
  z-index: 40; overflow: auto; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.drawer-h { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; font-size: 15px; }
.drawer-h button { background: none; border: 0; font-size: 22px; cursor: pointer; }
#drawerBody { padding: 12px 14px; }
.ev { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; margin-bottom: 10px; background: var(--panel2); }
.ev .h { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.kind { font-size: 11px; font-weight: 700; letter-spacing: .4px; padding: 1px 7px; border-radius: 4px; }
.kind.observation, .kind.message, .kind.catalog, .kind.elements { background: #16324f; color: #8ec3ff; }
.kind.forecast_external { background: #2d2147; color: #cbb2ff; }
.kind.forecast_team, .kind.geometry, .kind.forecast_baseline { background: #123a36; color: #7fe0d3; }
.kind.probability { background: #3a2d10; color: #f0c060; }
.layer { font-size: 11px; color: var(--muted); }
.alert { border-left: 4px solid var(--line); padding: 6px 10px; margin-bottom: 8px; background: var(--panel2); border-radius: 0 6px 6px 0; font-size: 13px; }
.alert.critical { border-left-color: var(--crit); } .alert.warning { border-left-color: var(--und); } .alert.info { border-left-color: var(--accent); }
.alert .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.alert.acked { opacity: .55; }

/* всплывающие */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 8px 12px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.toast.critical { border-left-color: var(--crit); } .toast.warning { border-left-color: var(--und); }

/* простой экран */
.step { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.step b { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
  text-align: center; line-height: 20px; font-size: 12px; margin-right: 6px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.two button { padding: 8px 4px; font-size: 13.5px; }
label.check { align-items: flex-start; font-size: 12.5px; color: var(--text); }
label.check .muted { font-size: 11.5px; }
.examples { display: flex; flex-direction: column; gap: 6px; }
.examples button { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; cursor: pointer; }
.examples button:hover { border-color: var(--accent); }
.examples b { display: block; font-size: 13px; }
.examples span { font-size: 12px; color: var(--muted); }
.howto { padding-left: 20px; font-size: 15px; } .howto li { margin: 8px 0; }
.legend.big { font-size: 13.5px; gap: 16px; margin: 14px 0; } .legend.big i { width: 14px; height: 14px; }
.c-best { background: #58d68d; box-shadow: 0 0 0 2px #fff inset; }

.answer .verdict { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer .big { font-size: 22px; font-weight: 700; }
.answer .sub { color: var(--muted); font-size: 13px; }
.answer ul.reasons { list-style: none; padding: 0; margin: 10px 0 4px; }
.answer ul.reasons li { margin: 6px 0; padding-left: 22px; position: relative; font-size: 14px; }
.answer ul.reasons li i { position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 3px; }
.answer .note { font-size: 13px; color: #f0c060; margin-top: 6px; }
.answer .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.answer .actions button, .answer .actions a { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  cursor: pointer; text-decoration: none; color: var(--text); font-size: 13px; }
.answer .actions .main { background: var(--accent); border-color: var(--accent); color: #fff; }

.strip { display: flex; gap: 2px; height: 34px; margin-top: 6px; }
.strip .cell { flex: 1 1 0; min-width: 0; border-radius: 2px; cursor: pointer; position: relative; opacity: .85; }
input { min-width: 0; }
.strip .cell:hover { opacity: 1; transform: scaleY(1.08); }
.strip .cell.sel { outline: 2px solid #fff; outline-offset: 1px; opacity: 1; }
.strip .cell.best::after { content: "★"; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: #58d68d; font-size: 13px; }
.strip .cell.plan::before { content: "план"; position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 10px; }
.s-best { background: #58d68d; } .s-good { background: #3a9d5d; } .s-worse { background: #e0a030; }
.s-bad { background: #d64545; } .s-nodata { background: #8a929c; }
.strip-axis { position: relative; height: 18px; font-size: 11px; color: var(--muted); margin: 18px 0 4px; }
.strip-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.variant { background: var(--panel2); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.variant .vh { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.variant .vh b { font-size: 16px; }
.variant ul { list-style: none; padding: 0; margin: 4px 0; }
.variant li { margin: 5px 0; padding-left: 20px; position: relative; }
.variant li i { position: absolute; left: 0; top: 5px; width: 11px; height: 11px; border-radius: 3px; }
.variant .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.details-btn { width: 100%; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; padding: 10px; cursor: pointer;
  color: var(--muted); margin-bottom: 14px; font-size: 13.5px; }
.details-btn:hover { color: var(--text); border-color: var(--accent); }
.help h4 { margin: 14px 0 4px; font-size: 14px; }
.help p, .help li { font-size: 13.5px; }
.help ul { padding-left: 18px; }

@media (max-width: 900px) {
  .strip { gap: 1px; }
  .layout { grid-template-columns: 1fr; padding: 10px; }
  .side { position: static; max-height: none; }
  .top { flex-wrap: wrap; }
  #timeline { height: 460px; }
}
