/* DockPanel v2
   Layout: fixed sidebar (nav groups) + sticky topbar + fluid content column (max 1360px).
   Cards only for distinct objects; tables are the main surface. */
:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceef3;
  --line: #e3e6ec;
  --line-strong: #cdd2dc;
  --text: #141821;
  --text-2: #3f4655;
  --muted: #697184;
  --accent: #3156f5;
  --accent-hover: #2546d4;
  --accent-soft: #e9eeff;
  --accent-text: #2848d0;
  --on-accent: #ffffff;
  --ok: #157a3c; --ok-soft: #e5f5eb; --ok-dot: #22a55a;
  --warn: #a35a06; --warn-soft: #fdf2df; --warn-dot: #e59a1b;
  --bad: #c0262d; --bad-soft: #fdeced; --bad-dot: #e5484d;
  --info: #0b6a9e; --info-soft: #e4f2fa;
  --term-bg: #10141d; --term-text: #d5dae4; --term-muted: #7d8699;
  --overlay: rgba(15, 20, 30, .45);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 60px -16px rgba(16, 24, 40, .35), 0 2px 6px rgba(16, 24, 40, .06);
  --syn-keyword: #8b2fc9; --syn-string: #18794e; --syn-number: #b35900; --syn-comment: #8a91a0;
  --syn-def: #2848d0; --syn-variable: #1d2433; --syn-type: #0f6e8c; --syn-tag: #c0262d;
  --syn-attr: #9a5b00; --syn-meta: #6c4bd1; --syn-operator: #5b6375; --syn-builtin: #0f6e8c;
  --font: "Manrope", "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px; --r-sm: 7px; --r-lg: 14px;
  --side-w: 252px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1016; --surface: #151a23; --surface-2: #1a202b; --surface-3: #232a37;
    --line: #262e3c; --line-strong: #344052; --text: #e7eaf0; --text-2: #c2c8d4; --muted: #8b93a6;
    --accent: #5274ff; --accent-hover: #6a88ff; --accent-soft: #1b2448; --accent-text: #a3b5ff; --on-accent: #ffffff;
    --ok: #5ad48a; --ok-soft: rgba(46, 160, 90, .16); --ok-dot: #3ccf75;
    --warn: #f0b45a; --warn-soft: rgba(229, 154, 27, .15); --warn-dot: #f0a32e;
    --bad: #ff8a8e; --bad-soft: rgba(229, 72, 77, .15); --bad-dot: #f2555a;
    --info: #7cc6f0; --info-soft: rgba(56, 160, 220, .14);
    --term-bg: #0a0d13; --term-text: #d5dae4; --term-muted: #7d8699;
    --overlay: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
    --syn-keyword: #c792ea; --syn-string: #a5d6a7; --syn-number: #f9ae58; --syn-comment: #6b7487;
    --syn-def: #82aaff; --syn-variable: #e7eaf0; --syn-type: #7fdbca; --syn-tag: #ff8a8e;
    --syn-attr: #ffcb6b; --syn-meta: #b9a3ff; --syn-operator: #9aa3b5; --syn-builtin: #7fdbca;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1016; --surface: #151a23; --surface-2: #1a202b; --surface-3: #232a37;
  --line: #262e3c; --line-strong: #344052; --text: #e7eaf0; --text-2: #c2c8d4; --muted: #8b93a6;
  --accent: #5274ff; --accent-hover: #6a88ff; --accent-soft: #1b2448; --accent-text: #a3b5ff; --on-accent: #ffffff;
  --ok: #5ad48a; --ok-soft: rgba(46, 160, 90, .16); --ok-dot: #3ccf75;
  --warn: #f0b45a; --warn-soft: rgba(229, 154, 27, .15); --warn-dot: #f0a32e;
  --bad: #ff8a8e; --bad-soft: rgba(229, 72, 77, .15); --bad-dot: #f2555a;
  --info: #7cc6f0; --info-soft: rgba(56, 160, 220, .14);
  --term-bg: #0a0d13; --term-text: #d5dae4; --term-muted: #7d8699;
  --overlay: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
  --syn-keyword: #c792ea; --syn-string: #a5d6a7; --syn-number: #f9ae58; --syn-comment: #6b7487;
  --syn-def: #82aaff; --syn-variable: #e7eaf0; --syn-type: #7fdbca; --syn-tag: #ff8a8e;
  --syn-attr: #ffcb6b; --syn-meta: #b9a3ff; --syn-operator: #9aa3b5; --syn-builtin: #7fdbca;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14.5px; }
code, .mono { font-family: var(--mono); font-size: .9em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand-mark .ico { width: 19px; height: 19px; }
.brand-name { font-weight: 800; font-size: 15.5px; letter-spacing: -.02em; }
.brand-host { font-size: 11.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  font-weight: 600; font-size: 13.5px; text-decoration: none; margin: 1px 0;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; color: inherit; font: inherit; }
.me:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; background: var(--surface-3); color: var(--text-2); text-transform: uppercase; }
.me-name { font-weight: 700; font-size: 13px; }
.me-role { font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px;
  padding-block: 10px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; }
.crumb { color: var(--muted); font-size: 12.5px; }
.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); border-radius: 9px; padding: 7px 10px 7px 12px; min-width: 240px; cursor: pointer; font: inherit; font-size: 13px;
}
.search-btn:hover { border-color: var(--line-strong); }
.kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); background: var(--surface-2); }
.content { padding-block: 22px 48px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); width: 100%; max-width: 1360px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.menu-btn { display: none; }
.restart-bar { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); padding: 8px 24px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0; overflow: hidden; }
.hero-main { padding: 22px; }
.hero-side { padding: 22px; background: var(--surface-2); border-left: 1px solid var(--line); display: grid; gap: 14px; align-content: start; }
.hero-host { font-size: 26px; font-weight: 800; letter-spacing: -.025em; overflow-wrap: anywhere; line-height: 1.15; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.url-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-family: var(--mono); font-size: 13px; max-width: 100%;
}
.url-chip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big-num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* meters */
.meter-card { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--accent); transition: stroke-dashoffset .6s ease; }
.ring.warn .val { stroke: var(--warn-dot); }
.ring.bad .val { stroke: var(--bad-dot); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.meter-info { min-width: 0; flex: 1; }
.meter-info .sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 34px; display: block; margin-top: 6px; }
.spark .area { fill: var(--accent-soft); }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark .dot { fill: var(--accent); }
.bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar > i.warn { background: var(--warn-dot); }
.bar > i.bad { background: var(--bad-dot); }

/* list rows (dashboard) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); min-width: 0; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-title { font-weight: 650; }
.cell-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); }
table.compact th, table.compact td { padding: 7px 12px; }

/* ---------------------------------------------------------------- pills, dots */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill .ico { width: 13px; height: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; display: inline-block; }
.dot.ok { background: var(--ok-dot); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn-dot); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad-dot); box-shadow: 0 0 0 3px var(--bad-soft); }
.tag { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin: 2px 4px 2px 0; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; margin: 0 6px 6px 0; font-family: var(--mono); font-size: 12.5px; max-width: 100%; }
.chip span { overflow-wrap: anywhere; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 5px; padding: 2px; display: grid; }
.chip button:hover { color: var(--bad); background: var(--bad-soft); }
.lang { display: inline-grid; place-items: center; min-width: 30px; height: 20px; padding: 0 5px; border-radius: 5px; font: 700 10px/1 var(--mono); color: #fff; letter-spacing: .02em; flex: none; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
input, select, textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 11px; font: inherit; font-size: 13.5px; min-width: 0; width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.type-opt { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 10px 12px; text-align: left; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; gap: 3px; }
.type-opt b { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.type-opt small { color: var(--muted); font-size: 12px; }
.type-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); border-radius: 8px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; white-space: nowrap; line-height: 1.35;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad-dot); border-color: var(--bad-dot); color: #fff; }
.btn.ok { color: var(--ok); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { padding: 6px; }
.btn.icon.sm { padding: 4px; }
.btn .spin { animation: spin .8s linear infinite; }
.btns { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
td .btns { flex-wrap: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- notes, empty, skeleton */
.note { display: flex; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 13px; background: var(--info-soft); color: var(--text-2); border: 1px solid transparent; }
.note .ico { color: var(--info); margin-top: 1px; }
.note.warn { background: var(--warn-soft); }
.note.warn .ico { color: var(--warn); }
.note.bad { background: var(--bad-soft); }
.note.bad .ico { color: var(--bad); }
.note.ok { background: var(--ok-soft); }
.note.ok .ico { color: var(--ok); }
.note b { color: var(--text); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- terminal / code */
pre.term {
  background: var(--term-bg); color: var(--term-text); border-radius: 10px; padding: 14px 16px; margin: 0;
  font: 12.5px/1.6 var(--mono); max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
pre.term .p { color: var(--term-muted); }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; font: 12.5px/1.6 var(--mono); overflow: auto; max-height: 420px; white-space: pre; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 13px; font: inherit; font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters { display: inline-flex; gap: 4px; }
.filters button { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.filters button.on { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade .12s ease; }
.modal-box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .16s ease; border: 1px solid var(--line); }
.modal-box.sm { max-width: 440px; }
.modal-box.lg { max-width: 960px; }
.modal-box.xl { max-width: 1240px; height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { display: flex; gap: 9px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; overflow: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* toasts */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: calc(100% - 32px); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; min-width: 260px; max-width: 420px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .18s ease; overflow-wrap: anywhere; }
.toast .ico { color: var(--ok-dot); margin-top: 1px; }
.toast.bad .ico { color: var(--bad-dot); }

/* command palette */
.palette { align-items: start; padding-top: 12vh; }
.palette .modal-box { max-width: 600px; }
.palette input { border: 0; box-shadow: none; font-size: 15px; padding: 16px 18px 16px 46px; border-radius: 16px 16px 0 0; background: transparent; }
.palette .input-icon .ico { left: 18px; }
.pal-list { max-height: 50vh; overflow: auto; border-top: 1px solid var(--line); padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.pal-item .sub { margin-left: auto; color: var(--muted); font-size: 12px; }
.pal-item.on { background: var(--accent-soft); color: var(--accent-text); }
.pal-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 12px 4px; }

/* dropdown */
.menu { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; animation: pop .12s ease; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--bad); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 0; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-art { background: var(--term-bg); color: var(--term-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art pre { font: 13px/1.75 var(--mono); color: var(--term-muted); margin: 0; white-space: pre-wrap; }
.login-art pre b { color: #8fb0ff; font-weight: 500; }
.login-art pre i { color: #5ad48a; font-style: normal; }
.login-art h2 { font-size: 30px; color: #fff; letter-spacing: -.03em; line-height: 1.15; max-width: 16ch; }
.login-form { display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font-size: 24px; }
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; }

/* ---------------------------------------------------------------- files / editor */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; min-width: 0; }
.crumbs a { padding: 3px 6px; border-radius: 6px; color: var(--text-2); }
.crumbs a:hover { background: var(--surface-3); text-decoration: none; }
.crumbs .sep { color: var(--muted); }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-name a, .file-name span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.folder-ico { color: var(--warn-dot); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); transition: .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.progress { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; flex-basis: 100%; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-bar select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.editor-host { flex: 1; min-height: 0; position: relative; }
.editor-host > textarea { position: absolute; inset: 0; border: 0; border-radius: 0; resize: none; padding: 12px 14px; height: 100%; }
.editor-status { display: flex; gap: 16px; padding: 6px 14px; border-top: 1px solid var(--line); font: 11.5px var(--mono); color: var(--muted); background: var(--surface-2); flex-wrap: wrap; border-radius: 0 0 16px 16px; }
.editor-status .dirty { color: var(--warn); font-weight: 700; }
.modal-box.xl .modal-body { padding: 0; display: flex; flex-direction: column; }

/* CodeMirror theme from tokens */
.CodeMirror { height: 100%; font: 13px/1.6 var(--mono); background: var(--surface); color: var(--syn-variable); }
.cm-host-inline .CodeMirror { height: auto; min-height: 120px; max-height: 420px; border: 1px solid var(--line-strong); border-radius: 8px; }
.cm-host-inline .CodeMirror-scroll { min-height: 120px; max-height: 420px; }
.CodeMirror-gutters { background: var(--surface-2); border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: var(--muted); padding: 0 10px 0 6px; }
.CodeMirror-cursor { border-left: 2px solid var(--accent); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--accent-soft) !important; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: var(--accent-soft); }
.CodeMirror-activeline-background { background: var(--surface-2); }
.CodeMirror-matchingbracket { color: var(--text) !important; background: var(--accent-soft); outline: 1px solid var(--accent); }
.CodeMirror-dialog { background: var(--surface-2); color: var(--text); border-bottom: 1px solid var(--line); font-family: var(--font); padding: 6px 12px; }
.CodeMirror-dialog input { width: 18em; padding: 2px 6px; background: var(--surface); }
.cm-searching { background: var(--warn-soft); outline: 1px solid var(--warn-dot); }
.cm-s-dp .cm-keyword { color: var(--syn-keyword); }
.cm-s-dp .cm-string, .cm-s-dp .cm-string-2 { color: var(--syn-string); }
.cm-s-dp .cm-number, .cm-s-dp .cm-atom { color: var(--syn-number); }
.cm-s-dp .cm-comment { color: var(--syn-comment); font-style: italic; }
.cm-s-dp .cm-def, .cm-s-dp .cm-property { color: var(--syn-def); }
.cm-s-dp .cm-variable, .cm-s-dp .cm-variable-2 { color: var(--syn-variable); }
.cm-s-dp .cm-variable-3, .cm-s-dp .cm-type { color: var(--syn-type); }
.cm-s-dp .cm-builtin { color: var(--syn-builtin); }
.cm-s-dp .cm-tag, .cm-s-dp .cm-header { color: var(--syn-tag); }
.cm-s-dp .cm-attribute, .cm-s-dp .cm-qualifier { color: var(--syn-attr); }
.cm-s-dp .cm-meta { color: var(--syn-meta); }
.cm-s-dp .cm-operator, .cm-s-dp .cm-bracket { color: var(--syn-operator); }
.cm-s-dp .cm-link { color: var(--accent-text); text-decoration: underline; }
.cm-s-dp .cm-error { color: var(--bad); }

/* ---------------------------------------------------------------- domains */
.dom-row td:first-child { min-width: 240px; }
.dom-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dom-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.dom-ico.proxy { background: var(--accent-soft); color: var(--accent-text); }
.dom-ico.static { background: var(--ok-soft); color: var(--ok); }
.dom-ico.php { background: var(--info-soft); color: var(--info); }
.dom-ico.redirect { background: var(--warn-soft); color: var(--warn); }
.dom-row.off { opacity: .55; }
.arrow-target { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); min-width: 0; }
.arrow-target .ico { color: var(--muted); }
.preview-block { margin-top: 4px; }

/* role legend */
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.role-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.role-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-side { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn .kbd { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: min(280px, 85vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-top: max(14px, env(safe-area-inset-top, 0px)); padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .crumb { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .modal { padding: 10px; }
  .modal-box.xl { height: calc(100vh - 20px); }
  .g2 { grid-template-columns: 1fr; }
  .toolbar .input-icon { flex: 1 1 100%; max-width: none !important; width: auto !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
