/* meshwg panel 2.0 — усе локально, системний шрифт, без зовнішніх ресурсів.
   Ідея: «пульт мережі». Ліворуч — темна рейка з хребтом мережі (S1 ↔ S2), праворуч — робоче поле.
   Три кольори шляхів (напряму / через S1 / через S2) — головна мова всіх графіків і позначок. */
:root {
  color-scheme: light;
  --page: #edf0f3;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --sunk: #e6eaee;
  --ink: #17212b;
  --ink-2: #45525f;
  --muted: #6f7b88;
  --grid: #dfe4e9;
  --axis: #b8c0c8;
  --border: #d5dbe1;
  --accent: #2257c9;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebfb;
  --series-1: #10876a;   /* напряму */
  --series-2: #2f6bdb;   /* через S1 */
  --series-3: #8e4ec6;   /* через S2 */
  --good: #1e9e4a;
  --good-text: #13703a;
  --warning: #d99a0e;
  --warn-soft: #fbf0d2;
  --serious: #e0703c;
  --critical: #c93a3a;
  --bad-soft: #f8e1e1;
  --rail: #17212b;
  --rail-2: #212d39;
  --rail-ink: #e8edf2;
  --rail-muted: #8d9aa7;
  --r-s: 5px;
  --r-m: 8px;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e141a; --surface: #151d25; --surface-2: #1b252f; --sunk: #0b1015;
    --ink: #e3e9ef; --ink-2: #a9b4bf; --muted: #7d8996; --grid: #24303b; --axis: #3a4855; --border: #2a3642;
    --accent: #5b8ef0; --accent-ink: #0b1015; --accent-soft: #1b2a45;
    --series-1: #2db38a; --series-2: #5b8ef0; --series-3: #b07de8;
    --good: #34c46a; --good-text: #5fd68b; --warning: #e8b13a; --warn-soft: #3a2f12; --critical: #ec6a6a; --bad-soft: #3d1c1e;
    --rail: #0a0f14; --rail-2: #151d25; --rail-ink: #e3e9ef; --rail-muted: #7d8996;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e141a; --surface: #151d25; --surface-2: #1b252f; --sunk: #0b1015;
  --ink: #e3e9ef; --ink-2: #a9b4bf; --muted: #7d8996; --grid: #24303b; --axis: #3a4855; --border: #2a3642;
  --accent: #5b8ef0; --accent-ink: #0b1015; --accent-soft: #1b2a45;
  --series-1: #2db38a; --series-2: #5b8ef0; --series-3: #b07de8;
  --good: #34c46a; --good-text: #5fd68b; --warning: #e8b13a; --warn-soft: #3a2f12; --critical: #ec6a6a; --bad-soft: #3d1c1e;
  --rail: #0a0f14; --rail-2: #151d25; --rail-ink: #e3e9ef; --rail-muted: #7d8996;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.small { font-size: 12.5px; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; letter-spacing: -0.005em; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--ink-2); }
::selection { background: var(--accent-soft); }

/* ---------- каркас: рейка + поле ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px 14px;
  background: var(--rail); color: var(--rail-ink); overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 750; color: var(--rail-ink); font-size: 16px; padding: 2px 8px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--rail-muted); padding: 8px 10px; border-radius: var(--r-s); font-weight: 550; }
.nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { text-decoration: none; color: var(--rail-ink); background: var(--rail-2); }
.nav a.on { color: var(--rail-ink); background: var(--rail-2); box-shadow: inset 3px 0 0 var(--series-1); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.where { font-size: 12px; color: var(--rail-muted); }
.side-btns { display: flex; gap: 6px; align-items: center; }
.side button.ghost { color: var(--rail-muted); }
.side button.ghost:hover { color: var(--rail-ink); background: var(--rail-2); filter: none; }
#theme { padding: 6px; display: inline-flex; }
#theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
#theme svg .fill { fill: currentColor; stroke: none; }

/* хребет мережі: два сервери і лінія між ними */
.backbone { padding: 12px 10px; border-radius: var(--r-m); background: var(--rail-2); display: grid; gap: 0; }
.bb-node { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 10px; align-items: center; font-size: 12.5px; }
.bb-node b { font-weight: 650; color: var(--rail-ink); }
.bb-node .d { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--good); background: var(--rail-2); }
.bb-node.up .d { background: var(--good); }
.bb-node.down .d { border-color: var(--critical); border-radius: 2px; transform: rotate(45deg) scale(.85); }
.bb-node .m { grid-column: 2 / 4; color: var(--rail-muted); font-size: 11.5px; }
.bb-node .n { color: var(--rail-muted); font-size: 11.5px; }
.bb-link { margin-left: 5px; width: 2px; height: 18px; background: var(--rail-muted); opacity: .45; }
.bb-link.up { background: var(--good); opacity: .8; }
.bb-sum { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: var(--rail-muted); display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.bb-sum b { color: var(--rail-ink); font-weight: 600; text-align: right; }

@media (min-width: 901px) { body { background: linear-gradient(to right, var(--rail) 232px, var(--page) 232px); } }
main { min-width: 0; width: 100%; max-width: 1320px; padding: 26px 28px 70px; }

/* ---------- блоки ---------- */
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1 1 0; min-width: 0; }
.row > .card.grow { align-self: stretch; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); padding: 18px; }
.section { margin-top: 16px; }
.card .section:first-child { margin-top: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card > .head h2, .card > h2:first-child { margin-bottom: 0; }
.card > h2:first-child { margin-bottom: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.crumb { font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.crumb:hover { color: var(--accent); }
.summary { color: var(--ink-2); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.summary b { color: var(--ink); font-weight: 650; }

/* ---------- кнопки і поля ---------- */
button, .btn { font: inherit; font-weight: 550; cursor: pointer; border-radius: var(--r-s); padding: 7px 13px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); line-height: 1.35; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { text-decoration: none; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--critical); }
button.danger:not(.ghost):hover { background: var(--bad-soft); }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding: 5px 8px; }
button.ghost:hover { background: var(--surface-2); }
button:disabled { opacity: .45; cursor: default; filter: none; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-s); padding: 7px 10px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .btn:focus-within { outline: none; box-shadow: var(--focus); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
label.f input, label.f select { font-weight: 400; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--sunk); border-radius: var(--r-s); }
.seg button { border: 0; border-radius: 4px; padding: 5px 10px; background: transparent; color: var(--ink-2); font-weight: 550; font-size: 13px; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.small-btn { font-size: 12.5px; padding: 5px 10px; }
label.btn { cursor: pointer; }
.btn.disabled { opacity: .4; pointer-events: none; }

/* ---------- стани: значок + текст, ніколи лише колір ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.st.ok { color: var(--good-text); }
.st.ok::before { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.st.bad { color: var(--critical); }
.st.bad::before { background: var(--critical); border-radius: 1px; transform: rotate(45deg) scale(.85); }
.st.warn { color: var(--ink-2); }
.st.warn::before { background: var(--warning); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 550; padding: 1px 7px; border-radius: 4px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--ink); }
.badge.ok { background: color-mix(in srgb, var(--series-1) 16%, transparent); color: var(--ink); }
.badge.zone { display: inline-flex; align-items: center; gap: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.badge.zone button { padding: 0 4px; }

/* ---------- сервери на огляді ---------- */
.srv { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.srv .card { padding: 16px 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv > * { min-width: 0; overflow-wrap: anywhere; }

/* ---------- таблиці ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.click:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
td.num, th.num { text-align: right; }
.nowrap { white-space: nowrap; }

/* пристрої: щільний список із смужкою стану ліворуч */
.devtable td { padding: 9px 10px; vertical-align: middle; }
.devtable td:first-child { padding-left: 14px; position: relative; }
.devtable tr td:first-child::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--grid); }
.devtable tr.on td:first-child::before { background: var(--good); }
.devtable tr.off td:first-child::before { background: var(--critical); opacity: .6; }
.devtable tr.off .dname { color: var(--ink-2); }
.dname { font-weight: 650; }
.dmeta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.parts { display: flex; flex-wrap: wrap; gap: 0 12px; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; padding-left: 32px;
  background: var(--surface) no-repeat 10px 50% / 15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%237d8996' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5'/%3E%3Cpath d='M13 13l4 4'/%3E%3C/svg%3E"); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.pager .pg { display: flex; gap: 4px; align-items: center; }
.pager button { padding: 4px 10px; font-size: 12.5px; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }

.pathchip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 8px 2px 6px; border-radius: 4px; background: var(--surface-2);
  border: 1px solid var(--grid); font-size: 12px; margin: 0 4px 4px 0; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw.p0 { background: var(--series-1); }
.sw.p1 { background: var(--series-2); }
.sw.p2 { background: var(--series-3); }
.sw.rx { background: var(--series-1); }
.sw.tx { background: var(--series-2); }
.sw.idle { background: transparent; border: 1.5px dashed var(--axis); }
.bar { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; margin-top: 4px; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.bar.over > i { background: var(--critical); }
.note-prev { font-size: 12px; color: var(--ink-2); margin-top: 3px; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- плитки показників пристрою ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); overflow: hidden; }
.tile { padding: 14px 16px; border-right: 1px solid var(--grid); }
.tile:last-child { border-right: 0; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 550; }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: -0.01em; }
.tile .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ---------- вкладки картки пристрою ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; border-radius: 0; padding: 9px 14px; color: var(--muted); font-weight: 600; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent; }
.tabs button:hover { color: var(--ink); background: transparent; }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs button .cnt { font-weight: 550; color: var(--muted); margin-left: 4px; }
[data-tab].off { display: none !important; }

/* ---------- піри ---------- */
.peers { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.peer { border: 1px solid var(--border); border-radius: var(--r-m); padding: 12px 12px 10px; background: var(--surface); cursor: pointer; }
.peer:hover { border-color: var(--axis); }
.peer.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.peer .head { margin-bottom: 8px; align-items: center; }
.peer table td, .peer table th { padding: 3px 6px; border: 0; font-size: 12.5px; }
.peer .cur td { font-weight: 650; }
.peer .down td { color: var(--muted); }

/* ---------- зв'язки ---------- */
.lk-table td { vertical-align: middle; padding: 7px 8px; }
.lk-table select { padding: 4px 6px; font-size: 13px; }
.lk-table tr.dirty td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.lk-eff { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; white-space: nowrap; }
.lk-eff .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lk-eff.always .dot { background: var(--series-1); }
.lk-eff.demand .dot { background: transparent; border: 2px solid var(--series-2); }
.lk-eff.deny .dot { background: var(--critical); border-radius: 1px; transform: rotate(45deg) scale(.8); }
.lk-eff.active { font-weight: 650; }
.lk-why { font-size: 11.5px; color: var(--muted); }
.lk-bulk { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); margin-bottom: 12px; font-size: 13px; }
.lk-bulk select { padding: 4px 6px; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-s); cursor: pointer; font-size: 13px; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice label b { display: block; font-weight: 650; }
.choice label span { color: var(--ink-2); font-size: 12px; }
.choice input { margin-top: 3px; }
.pick-list { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-s); padding: 6px 10px; }

/* ---------- графіки ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis line { stroke: var(--axis); }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.s0 { stroke: var(--series-1); }
.chart .ln.s1 { stroke: var(--series-2); }
.chart .ln.s2 { stroke: var(--series-3); }
.chart .dot.s0 { fill: var(--series-1); }
.chart .dot.s1 { fill: var(--series-2); }
.chart .dot.s2 { fill: var(--series-3); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .bf.s0 { fill: var(--series-1); }
.chart .bf.s1 { fill: var(--series-2); }
.chart .bf.s2 { fill: var(--series-3); }
.chart .xh { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.chart .band.b0 { fill: var(--series-1); opacity: .10; }
.chart .band.b1 { fill: var(--series-2); opacity: .10; }
.chart .band.b2 { fill: var(--series-3); opacity: .10; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--r-s); padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 24px rgba(10,20,30,.18); min-width: 140px; }
.tip .t { color: var(--muted); margin-bottom: 4px; }
.tip .r { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip .r b { font-weight: 650; }
.tl { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--sunk); margin-top: 6px; }
.tl i { display: block; height: 100%; }
.tl i.p0 { background: var(--series-1); }
.tl i.p1 { background: var(--series-2); }
.tl i.p2 { background: var(--series-3); }

.events { max-height: 440px; overflow: auto; }
.events td { font-size: 12.5px; padding: 6px 10px; }
.ev-kind { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }

/* ---------- вхід ---------- */
.login { max-width: 380px; margin: 12vh auto; padding: 28px; }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login button.primary { justify-content: center; padding: 9px; }
.err { color: var(--critical); font-size: 13px; min-height: 18px; }
body.anon .side .nav, body.anon .backbone { display: none; }

/* ---------- модальне вікно ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(8,14,20,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal-box { background: var(--surface); border-radius: 10px; padding: 22px; width: 100%; max-width: 640px; border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal:not(.hidden) .modal-box { animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.code { background: var(--sunk); border-radius: var(--r-s); padding: 10px 12px; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; position: relative; }
.qr { background: #fff; padding: 10px; border-radius: var(--r-s); display: inline-block; }
.qr svg, .qr img { display: block; width: 220px; height: 220px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
p.hint { margin: 10px 0 0; max-width: 80ch; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }

textarea.notes { width: 100%; font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; resize: vertical; min-height: 110px; padding: 10px 12px; }

table.fw td { padding: 6px; vertical-align: middle; }
table.fw input:not([type=checkbox]), table.fw select { width: 100%; min-width: 70px; padding: 5px 7px; }
table.fw input.w-num { width: 90px; }
table.fw select[multiple] { min-width: 120px; }

/* ---------- довідка ---------- */
.help { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 1px; padding: 10px; }
.help-toc a { color: var(--ink-2); padding: 5px 8px; border-radius: var(--r-s); font-size: 13px; }
.help-toc a:hover { background: var(--surface-2); text-decoration: none; }
.help-body .section:first-child { margin-top: 0; }
.help-body p, .help-body li { max-width: 80ch; }
.help-body h3 { margin-top: 16px; }
.help-body ul, .help-body ol { padding-left: 20px; }
.help-body li { margin: 4px 0; }
.code-wrap { position: relative; margin: 8px 0; }
.code-wrap pre.code { white-space: pre-wrap; word-break: break-word; margin: 0; padding-right: 96px; }
.code-wrap .copy { position: absolute; top: 4px; right: 4px; font-size: 12px; padding: 4px 8px; }
.dl-row { gap: 10px; margin: 8px 0; }
.dl-links { margin-top: 3px; color: var(--muted); }
section[id^="h-"] { scroll-margin-top: 20px; }

/* ---------- файли ---------- */
.f-search { min-width: 220px; }
.f-name { word-break: break-word; color: var(--ink); }
.f-desc { white-space: pre-wrap; word-break: break-word; margin-top: 2px; max-width: 520px; }
table.files td { vertical-align: top; }
.upbar { margin-top: 10px; }
.upbar .bar { height: 8px; }
.upbar .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- користувачі / вибір ---------- */
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 14px; }

/* ---------- телефон ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; overflow: visible; }
  .brand { padding: 2px 4px; }
  .brand span { display: none; }
  .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; white-space: nowrap; font-size: 13px; }
  .nav a svg { display: none; }
  .nav a.on { box-shadow: inset 0 -2px 0 var(--series-1); }
  .backbone { order: 2; display: flex; gap: 10px; padding: 4px 8px; background: transparent; }
  .backbone .bb-link, .backbone .bb-sum, .backbone .bb-node .m, .backbone .bb-node .n { display: none; }
  .bb-node { grid-template-columns: 10px auto; gap: 6px; }
  .bb-node .d { width: 10px; height: 10px; }
  .side-foot { order: 2; margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .where { display: none; }
  main { padding: 16px 16px 50px; }
  .tile { border-bottom: 1px solid var(--grid); }
}
@media (max-width: 720px) {
  .hide-m { display: none; }
  .card { padding: 14px; }
  h1 { font-size: 21px; }
  .card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .devtable { display: table !important; }
  table.fw { display: block; overflow-x: auto; }
  .help { grid-template-columns: 1fr; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .toolbar .search { max-width: none; }
  .seg { flex-wrap: wrap; }
  .seg button { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
.m0 { margin: 0 !important; }
.wide { width: 100%; }
