/* ===== Tokens ===== */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e5e7ec;
  --line-2: #eef0f3;
  --ink: #111318;
  --ink-2: #3a3f4a;
  --muted: #6b7180;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --up: #0e9f6e;
  --up-soft: #e6f6ef;
  --down: #dc3b3b;
  --down-soft: #fdecec;
  --warn: #b7791f;
  --warn-soft: #fdf4e3;
  --chart-area: rgba(79, 70, 229, .14);
  --shadow: 0 1px 2px rgba(17, 19, 24, .04), 0 2px 8px rgba(17, 19, 24, .04);
  --radius: 14px;
  --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d10; --surface: #15171c; --surface-2: #1b1d23; --line: #262931; --line-2: #1f2228;
    --ink: #eceef2; --ink-2: #c4c8d0; --muted: #8e94a1; --accent: #8b85ff; --accent-ink: #0c0d10; --accent-soft: #1f1d3d;
    --up: #34d399; --up-soft: #0f2a21; --down: #f87171; --down-soft: #2f1717; --warn: #f5b84a; --warn-soft: #2d2412;
    --chart-area: rgba(139, 133, 255, .18); --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d10; --surface: #15171c; --surface-2: #1b1d23; --line: #262931; --line-2: #1f2228;
  --ink: #eceef2; --ink-2: #c4c8d0; --muted: #8e94a1; --accent: #8b85ff; --accent-ink: #0c0d10; --accent-soft: #1f1d3d;
  --up: #34d399; --up-soft: #0f2a21; --down: #f87171; --down-soft: #2f1717; --warn: #f5b84a; --warn-soft: #2d2412;
  --chart-area: rgba(139, 133, 255, .18); --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.num, .kpi-value, .net-metrics b, .totals-strip b { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ===== Shell ===== */
.shell { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 18px; letter-spacing: -.02em; }
.brand.big { font-size: 18px; padding: 0 0 22px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; font-weight: 700; font-size: 15px;
}
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 10px 6px; }
.nav {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; margin-bottom: 2px;
}
.nav:hover { background: var(--surface-2); color: var(--ink); }
.nav.on { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--line-2); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.who-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-txt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line-2);
}
.top-title { font-size: 15px; font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 26px 28px 60px; max-width: 1360px; margin: 0 auto; }
.scrim { display: none; }

/* ===== Buttons & inputs ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn.ghost { box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--down); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; height: 42px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; flex: none;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
input[type=text], input[type=password], input[type=date], input[type=search], select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; height: 38px; padding: 0 12px; width: 100%; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.acc-pick {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
}
.acc-pick select { border: 0; height: 32px; padding: 0 6px; background: transparent; width: auto; max-width: 220px; box-shadow: none; color: var(--ink); font-weight: 500; }

/* dropdown */
.dd { position: relative; }
.dd-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14);
}
.dd.open .dd-menu { display: block; }
.dd-item { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); }
.dd-item:hover { background: var(--surface-2); }
.dd-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.dd-custom { border-top: 1px solid var(--line-2); margin-top: 6px; padding: 10px 6px 4px; display: grid; gap: 8px; }
.dd-custom label { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }

/* ===== Sync progress ===== */
.sync-bar { position: sticky; top: 61px; z-index: 19; height: 30px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; padding: 0 28px; overflow: hidden; }
.sync-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--accent) 16%, transparent); transition: width .4s; }
.sync-bar span { position: relative; }

/* ===== Notes ===== */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.note .ic { margin-top: 2px; }
.note.ok { background: var(--up-soft); color: var(--up); }
.note.err { background: var(--down-soft); color: var(--down); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note a { text-decoration: underline; }

/* ===== Page head ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 28px; font-weight: 700; margin: 2px 0 4px; }
.page-head h2 .muted { font-weight: 500; font-size: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.sync-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.fresh { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.dot.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-note { font-size: 12.5px; margin-top: 10px; }
.link { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 500; font-size: 13px; }
.pad { padding: 20px 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 18px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.grid-2 > .card { margin-bottom: 18px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 16px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi:first-child { background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 650; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { background: var(--up-soft); color: var(--up); }
.delta.down { background: var(--down-soft); color: var(--down); }
.delta.flat { background: var(--surface-2); color: var(--muted); }

/* segmented */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 4px 10px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* chart */
.chart { position: relative; height: 270px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line-2); }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .area { fill: var(--chart-area); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cursor { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2.2; }
.chart .barr { fill: var(--accent); opacity: .85; }
.chart .barr.hl { opacity: 1; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.tip b { font-size: 13px; }

/* top sites bars */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 6px 0 4px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #8b5cf6); }
.bar-sub { font-size: 11.5px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--ink); }
.tbl th.sorted-asc::after { content: " ↑"; }
.tbl th.sorted-desc::after { content: " ↓"; }
.cell-title { font-weight: 600; display: block; }
a.cell-title:hover { color: var(--accent); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.only-m-inline { display: none; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2); vertical-align: middle; }
.pill.ok { background: var(--up-soft); color: var(--up); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.err { background: var(--down-soft); color: var(--down); border-color: transparent; }
.err-txt { color: var(--down); }
.share { display: inline-block; width: 46px; height: 5px; border-radius: 99px; background: var(--surface-2); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.share span { display: block; height: 100%; background: var(--accent); }

/* sparkline */
.spark { display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.spark-area { fill: var(--chart-area); }
.spark-flat { stroke: var(--line); stroke-width: 1.5; }

/* ===== Sites page ===== */
.totals-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.totals-strip > div { padding: 13px 16px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line-2); min-width: 0; }
.totals-strip > div:last-child { border-right: 0; }
.totals-strip span { font-size: 12px; color: var(--muted); }
.totals-strip b { font-size: 18px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; min-width: 240px; }
.search .ic { position: absolute; left: 11px; color: var(--muted); }
.search input { padding-left: 34px; height: 34px; }
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chips-label { font-size: 12px; margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.toggle { margin-left: auto; }
.chip.toggle.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.net-card { padding-top: 16px; }
.net-head { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.net-id { display: flex; align-items: center; gap: 12px; min-width: 200px; flex: 1; }
.net-id h3 { font-size: 16px; }
.net-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); flex: none; }
.net-metrics { display: flex; gap: 22px; }
.net-metrics > div { display: flex; flex-direction: column; line-height: 1.25; }
.net-metrics span { font-size: 11.5px; color: var(--muted); }
.net-metrics b { font-size: 15px; font-weight: 650; }
.site-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.site-name.sub { font-weight: 500; color: var(--ink-2); padding-left: 22px; }
.favicon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); flex: none; }
.caret { color: var(--muted); transition: transform .15s; display: inline-flex; }
.caret-sp { width: 14px; display: inline-block; }
.expandable { cursor: pointer; }
.expandable.open .caret { transform: rotate(90deg); color: var(--accent); }
.sub-row td { background: var(--surface-2); font-size: 13px; }
.tree { width: 12px; height: 12px; border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); border-bottom-left-radius: 4px; margin-top: -8px; }

@media (min-width: 861px) {
  .tbl.sites { table-layout: fixed; }
  .tbl.sites th:first-child { width: 30%; }
  .tbl.sites td:first-child { overflow: hidden; text-overflow: ellipsis; }
  .tbl.sites th:last-child { width: 118px; }
}

/* ===== Empty ===== */
.empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-ic { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }

/* ===== Accounts ===== */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.acc-card { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.acc-top { display: flex; align-items: center; gap: 12px; }
.acc-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acc-id b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-top .pill { margin-left: 0; }
.acc-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.acc-stats dt { font-size: 11.5px; color: var(--muted); }
.acc-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.edit-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.form.two { grid-template-columns: 1fr 1fr; }
.span2 { grid-column: 1 / -1; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions.sep { border-top: 1px solid var(--line-2); margin-top: 16px; padding-top: 16px; }
.row-actions form { margin: 0; }
.danger-form { display: flex; gap: 6px; margin-left: auto !important; }
.danger-form input { height: 36px; width: 250px; }
.net-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; max-height: 360px; overflow: auto; padding: 2px; }
.check { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 10px !important; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400 !important; }
.check:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check span { display: flex; flex-direction: column; min-width: 0; }
.check small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 13px; display: grid; gap: 6px; }
.hint code { word-break: break-all; color: var(--ink); }

/* ===== Auth ===== */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-wrap.wide { max-width: 560px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 20px 50px rgba(17, 19, 24, .08); }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card h2 { font-size: 17px; margin: 22px 0 4px; }
.auth-card > p.muted { margin-bottom: 20px; }
.auth-card .form { margin-top: 18px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 12.5px; }
.checks { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
.checks li { display: flex; align-items: center; gap: 8px; }
.checks li.ok { color: var(--up); }
.checks li.bad { color: var(--down); }

/* ===== Responsive ===== */
.only-m { display: none; }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .totals-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .totals-strip > div:nth-child(4) { border-right: 0; }
  .totals-strip > div:nth-child(n+5) { border-top: 1px solid var(--line-2); }
}
@media (max-width: 980px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .net-metrics { gap: 16px; }
}
@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  .only-m { display: grid; }
  .top { padding: 10px 16px; }
  .content { padding: 18px 16px 50px; }
  .sync-bar { padding: 0 16px; top: 57px; }
  .hide-m { display: none; }
  .only-m-inline { display: block; }
  .form.two { grid-template-columns: 1fr; }
  .danger-form { margin-left: 0 !important; width: 100%; }
  .danger-form input { flex: 1; width: auto; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 20px; }
  .totals-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals-strip > div:nth-child(2n) { border-right: 0; }
  .totals-strip > div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .hide-s { display: none; }
  .top-title { display: none; }
  .top-actions { margin-left: auto; gap: 6px; }
  .acc-pick select { max-width: 110px; }
  .page-head h2 { font-size: 23px; }
  .net-metrics { width: 100%; justify-content: space-between; gap: 8px; }
  .net-head > .sync-state { display: none; }
  .search { min-width: 0; flex: 1; }
  .chip.toggle { margin-left: 0; }
  .site-name .pill { display: none; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .chart { height: 220px; }
  .dd-menu { right: -60px; }
}

/* ===== Users: access tree ===== */
.access-help { margin: 0 0 10px; }
.search.sm { min-width: 260px; }
.search.sm input { height: 32px; font-size: 13px; }
.inline-check { align-self: end; }
.access-tree { display: grid; gap: 10px; max-height: 520px; overflow: auto; padding: 2px; }
.acc-net { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--surface); }
.acc-site { margin-left: 26px; }
.acc-hosts { margin-left: 26px; border-left: 1.5px solid var(--line); padding-left: 8px; }
.tree-row { display: flex !important; align-items: center; gap: 10px !important; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 400 !important; }
.tree-row:hover { background: var(--surface-2); }
.tree-row input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.tree-row input:disabled + .tree-name { color: var(--muted); }
.tree-row:has(input:checked:not(:disabled)) { background: var(--accent-soft); }
.tree-row.net { background: var(--surface-2); }
.tree-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.tree-name small { color: var(--muted); font-size: 12px; }
.tree-empty { padding: 4px 12px 6px 36px; }
.wrap-cell { white-space: normal !important; max-width: 420px; color: var(--ink-2); }
@media (max-width: 640px) {
  .search.sm { min-width: 0; width: 100%; }
  .acc-site, .acc-hosts { margin-left: 14px; }
}
