/* Micronix Cloud Monitor v2. Brand teal comes from the Micronix logo (#0093a4). Dark by default, light on request. */
:root {
  color-scheme: dark;
  --brand: #0093a4;
  --bg: #0a0f11;
  --surface: #11181b;
  --surface-2: #172125;
  --surface-3: #1e2a2f;
  --border: #1f2c31;
  --border-strong: #2b3b41;
  --text: #e9f1f2;
  --text-2: #a3b4b9;
  --muted: #6d8086;
  --accent: #2ab7c8;
  --accent-ink: #03252a;
  --series: #2ab7c8;
  --series-fill: rgba(42,183,200,.14);
  --grid: rgba(255,255,255,.055);
  --good: #34c06a;
  --warn: #f0b429;
  --crit: #f05252;
  --good-bg: rgba(52,192,106,.13);
  --warn-bg: rgba(240,180,41,.13);
  --crit-bg: rgba(240,82,82,.14);
  --idle-bg: rgba(109,128,134,.16);
  --cell-ok: #2a9d5c;
  --cell-part: #d99a1e;
  --cell-down: #d94848;
  --cell-none: #1a2428;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #f0f4f5;
  --surface-3: #e5ecee;
  --border: #dfe6e8;
  --border-strong: #c9d5d8;
  --text: #0b1a1e;
  --text-2: #435a60;
  --muted: #687c82;
  --accent: #007c8b;
  --accent-ink: #ffffff;
  --series: #0093a4;
  --series-fill: rgba(0,147,164,.12);
  --grid: rgba(0,0,0,.06);
  --good: #12863d;
  --warn: #b7791f;
  --crit: #c8302f;
  --good-bg: rgba(18,134,61,.10);
  --warn-bg: rgba(240,180,41,.18);
  --crit-bg: rgba(200,48,47,.09);
  --idle-bg: rgba(104,124,130,.12);
  --cell-ok: #3bb26b;
  --cell-part: #e5a52a;
  --cell-down: #dd4b4b;
  --cell-none: #e3e9eb;
  --shadow: 0 1px 2px rgba(10,40,48,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }
.link-accent { color: var(--accent); }
.link-accent:hover { text-decoration: underline; }
.t-ok { color: var(--good); } .t-warn { color: var(--warn); } .t-crit { color: var(--crit); }
.t-ok svg { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }
.arrow { color: var(--muted); font-size: .85em; margin-right: 2px; }

/* ---------- app bar */
.appbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.appbar-inner { max-width: 1680px; margin: 0 auto; display: flex; align-items: stretch; gap: 0 22px; padding: 0 clamp(16px, 3vw, 36px); min-height: 58px; }
.logo { display: flex; align-items: center; flex: none; }
.logo img { display: block; width: 159px; height: 35px; }
.app-name { align-self: center; font-weight: 600; font-size: 13px; color: var(--muted); padding-left: 16px; margin-left: -6px; border-left: 1px solid var(--border); white-space: nowrap; }
.nav { display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.appbar-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.appbar-tools form { margin: 0; display: flex; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.install-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--accent); background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.install-btn[hidden] { display: none; }
.install-btn:hover { background: var(--accent); color: var(--accent-ink, #fff); }
.install-btn svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 420px) { .install-btn span { display: none; } .install-btn { padding: 0 8px; } }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }
.user-chip { display: flex; gap: 8px; align-items: center; padding: 4px 10px 4px 4px; border-radius: 999px; color: var(--text); font-weight: 600; }
.user-chip:hover, .user-chip.active { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; }
.main { max-width: 1680px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 36px) 56px; min-width: 0; outline: none; }
@media (max-width: 900px) {
  .appbar-inner { flex-wrap: wrap; padding-top: 10px; }
  .app-name { display: none; }
  .nav { order: 3; width: 100%; margin-top: 6px; overflow-x: auto; }
  .nav a { padding: 10px 12px; }
  .user-name { display: none; }
  .user-chip { padding: 4px; }
}
@media (max-width: 420px) { .logo img { width: 127px; height: 28px; } .appbar-tools { gap: 2px; } }

/* ---------- page header */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin-bottom: 18px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; display: inline-flex; gap: 6px; }
.crumb:hover { color: var(--text); }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border); min-height: 52px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 650; }
.card-head .spacer { flex: 1; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid-2 > * { min-width: 0; }
.section { margin-top: 16px; }
.section-gap { margin-bottom: 16px; }
.scroll { max-height: 380px; overflow: auto; }

/* ---------- status bits */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.online { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.dot.degraded { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.offline { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-bg); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--idle-bg); color: var(--text-2); letter-spacing: 0; }
.pill svg { width: 12px; height: 12px; fill: currentColor; }
.pill.online, .pill.good { background: var(--good-bg); color: var(--good); }
.pill.degraded, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.offline, .pill.crit { background: var(--crit-bg); color: var(--crit); }

/* ---------- fleet health banner */
.health { display: grid; grid-template-columns: minmax(260px, auto) 1fr; gap: 0; margin-bottom: 16px; overflow: hidden; }
.health-main { display: flex; gap: 14px; align-items: center; padding: 18px 22px; border-right: 1px solid var(--border); }
.health-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.health-icon svg { width: 24px; height: 24px; fill: currentColor; }
.health-icon.ok { background: var(--good-bg); color: var(--good); }
.health-icon.warn { background: var(--warn-bg); color: var(--warn); }
.health-icon.crit { background: var(--crit-bg); color: var(--crit); }
.health-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.health-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.health.is-ok { border-left: 3px solid var(--good); }
.health.is-warn { border-left: 3px solid var(--warn); }
.health.is-crit { border-left: 3px solid var(--crit); }
.hstats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hstat { padding: 16px 18px; border-left: 1px solid var(--border); min-width: 0; }
.hstat:first-child { border-left: 0; }
.hstat[data-filter] { cursor: pointer; }
.hstat[data-filter]:hover { background: var(--surface-2); }
.hstat-label { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.hstat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hstat-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.hstat-foot { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issues { grid-column: 1 / -1; list-style: none; margin: 0; padding: 6px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.issues li { display: flex; align-items: center; gap: 10px; padding: 8px 22px; cursor: pointer; min-width: 0; }
.issues li:hover { background: var(--surface-2); }
.issues li b { font-weight: 650; white-space: nowrap; }
.issues li span:not(.sev):not(.go) { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issues .sev { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.issues .crit .sev { background: var(--crit); }
.issues .warn .sev { background: var(--warn); }
.issues .go { margin-left: auto; color: var(--muted); }
.issues .more { color: var(--accent); }
@media (max-width: 1250px) {
  .health { grid-template-columns: 1fr; }
  .health-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .hstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hstat:nth-child(4) { border-left: 0; }
  .hstat:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .hstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hstat:nth-child(4) { border-left: 1px solid var(--border); }
  .hstat:nth-child(odd) { border-left: 0; }
  .hstat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .health-main { padding: 16px; }
  .issues { grid-template-columns: 1fr; }
  .issues li { padding: 8px 16px; }
}

/* ---------- toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search {
  flex: 1 1 220px; max-width: 340px; padding: 8px 12px 8px 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%237d8494'%3E%3Cpath d='M10 4a6 6 0 1 0 3.9 10.6l4.8 4.8 1.4-1.4-4.8-4.8A6 6 0 0 0 10 4zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8z'/%3E%3C/svg%3E") no-repeat 10px center;
}
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface); gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; cursor: pointer; color: var(--text-2); font-weight: 550; border-radius: 6px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.refresh { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.refresh .live { width: 6px; height: 6px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- fleet table (grid rows, restacked on phones) */
.rtable { overflow: hidden; }
.rhead, .rrow {
  display: grid; align-items: center; column-gap: 18px; padding: 0 18px;
  grid-template-columns: minmax(170px, 1.3fr) minmax(200px, 1.6fr) minmax(120px, .9fr) minmax(140px, 1fr) 80px 92px 80px 76px;
}
.rhead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.rrow { min-height: 60px; padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.rrow:last-child { border-bottom: 0; }
.rrow:hover { background: var(--surface-2); }
.rrow.has-issue::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--warn); }
.rrow.offline.has-issue::before { background: var(--crit); }
.rrow > div { min-width: 0; }
.c-name { display: flex; align-items: center; gap: 12px; }
.c-name .nm { display: grid; min-width: 0; }
.c-name b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-name .meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-strip { display: flex; align-items: center; gap: 10px; }
.c-strip .avail { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; width: 46px; text-align: right; flex: none; }
.c-lat, .c-wan { display: flex; align-items: center; gap: 12px; }
.c-lat .val { min-width: 44px; } .c-wan .val { min-width: 74px; }
.val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: grid; line-height: 1.3; }
.val small { color: var(--muted); font-weight: 500; }
.val em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
.c-cli, .c-up { display: grid; }
.c-cli em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; }
.c-cpu { display: flex; align-items: center; gap: 8px; }
.c-cpu .bar { width: 44px; }
.icons { display: flex; gap: 4px; justify-content: flex-end; }
.ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; }
.ic svg { width: 14px; height: 14px; fill: currentColor; }
.ic.ok { color: var(--good); background: var(--good-bg); }
.ic.warn { color: var(--warn); background: var(--warn-bg); }
.ic.off { color: var(--muted); opacity: .55; }
.rrow.offline .c-name b { color: var(--text-2); }
@media (max-width: 1280px) {
  .rhead, .rrow { grid-template-columns: minmax(160px, 1.3fr) minmax(180px, 1.5fr) minmax(110px, .9fr) minmax(130px, 1fr) 64px 84px 76px; }
  .c-up { display: none; }
}
@media (max-width: 1020px) {
  .rhead, .rrow { grid-template-columns: minmax(150px, 1.2fr) minmax(170px, 1.5fr) minmax(90px, .7fr) minmax(100px, .8fr) 76px; }
  .c-cpu, .c-cli, .c-up, .spark { display: none !important; }
}
@media (max-width: 760px) {
  .rhead { display: none; }
  .rrow { grid-template-columns: 1fr auto; grid-template-areas: "name lat" "strip strip" "wan ic"; row-gap: 8px; padding: 12px 16px; }
  .c-name { grid-area: name; } .c-lat { grid-area: lat; } .c-strip { grid-area: strip; } .c-wan { grid-area: wan; } .c-ic { grid-area: ic; }
  .c-lat .val { text-align: right; }
  .c-wan .val { display: flex; gap: 10px; }
  .c-wan .val em { font-size: inherit; }
}

/* availability strip */
.strip { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1px; height: 22px; flex: 1; min-width: 0; }
.strip i { display: block; border-radius: 1.5px; background: var(--cell-none); }
.strip i.ok { background: var(--cell-ok); }
.strip i.part { background: var(--cell-part); }
.strip i.down { background: var(--cell-down); }
.strip i.gap, .legend i.gap { background: repeating-linear-gradient(135deg, var(--cell-none) 0 2px, var(--border-strong) 2px 3px); }
.strip i.wait { background: var(--cell-none); outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.strip i:hover { filter: brightness(1.3); }
.strip.big { height: 38px; gap: 1px; }
.strip-axis { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 8px; flex-wrap: wrap; }
.legend { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 8px; background: var(--cell-none); }
.legend i.ok { background: var(--cell-ok); } .legend i.part { background: var(--cell-part); } .legend i.down { background: var(--cell-down); }
.avail-big b { font-size: 15px; font-variant-numeric: tabular-nums; }

/* sparkline */
.spark { flex: 1 1 auto; width: auto; max-width: 110px; min-width: 40px; height: 24px; overflow: visible; }
.spark path { fill: none; stroke: var(--series); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark path.fill { fill: var(--series-fill); stroke: none; }

/* bars */
.bar { width: 80px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: inline-block; vertical-align: middle; }
.bar.wide { width: 100%; height: 6px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--series); }
.bar.warn > i { background: var(--warn); }
.bar.crit > i { background: var(--crit); }

/* dormant */
.dormant { margin-top: 14px; }
.dormant > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 18px; color: var(--text-2); font-weight: 600; }
.dormant > summary::-webkit-details-marker { display: none; }
.dormant > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.dormant[open] > summary::before { transform: rotate(45deg); }
.dormant > summary:hover { color: var(--text); }
.dormant[open] > summary { border-bottom: 1px solid var(--border); }
.dormant .rrow { opacity: .8; }

/* ---------- router detail */
.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.st { padding: 14px 16px; border-left: 1px solid var(--border); min-width: 0; }
.st:first-child { border-left: 0; }
.st-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.st-value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-value small { font-size: 13px; color: var(--muted); font-weight: 500; }
.st-foot { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 17px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .st:nth-child(5) { border-left: 0; } .st:nth-child(n+5) { border-top: 1px solid var(--border); } }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .st:nth-child(odd) { border-left: 0; } .st:nth-child(n+3) { border-top: 1px solid var(--border); } }
.charts { padding: 0 2px 8px; border-top: 1px solid var(--border); gap: 0; }
.chart-card { padding: 14px 18px 10px; min-width: 0; }
.chart-card + .chart-card { border-left: 1px solid var(--border); }
@media (max-width: 820px) { .chart-card + .chart-card { border-left: 0; border-top: 1px solid var(--border); } }
.chart-card h3 { margin: 0; font-size: 13px; font-weight: 650; }
.chart-card .chart-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.chart-box { position: relative; height: 210px; }
.notice { padding: 11px 14px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.notice.warn { background: var(--warn-bg); color: var(--text); }
.notice.crit { background: var(--crit-bg); color: var(--text); border-left: 3px solid var(--crit); }
.secret { display: inline-flex; gap: 4px; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.btn svg { width: 15px; height: 15px; fill: currentColor; }

/* ---------- system */
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-bottom: 18px; }
@media (max-width: 520px) { .meters { grid-template-columns: 1fr; gap: 14px; } }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.meter-top b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.meter-top b.t-warn { color: var(--warn); } .meter-top b.t-crit { color: var(--crit); }
.meter-foot { color: var(--muted); font-size: 12px; margin-top: 6px; }
.facts { border-top: 1px solid var(--border); padding-top: 14px; }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; cursor: pointer;
  padding: 7px 14px; border: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 600;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input, .field select { width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); }
.field input:focus, .field select:focus, .search:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field .hint { font-size: 12px; color: var(--muted); }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; }
.form-error { color: var(--crit); background: var(--crit-bg); padding: 8px 12px; border-radius: 8px; margin: 0; }
.form-ok { color: var(--good); background: var(--good-bg); padding: 8px 12px; border-radius: 8px; margin: 0; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.data td { padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
tr.server-gap td { color: var(--muted); }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

/* ---------- login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(900px 520px at 50% -12%, rgba(0,147,164,.26), transparent 65%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { padding: 26px 28px 0; display: flex; }
.login-brand img { display: block; }
.login-title { padding: 18px 28px 0; }
.login-title h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.login-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.login-card form { padding: 18px 28px 28px; }

/* ---------- toast & skeleton */
.toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 14px; border-radius: 8px; z-index: 10; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (forced-colors: active) { .dot, .strip i { forced-color-adjust: none; } }
@media (prefers-reduced-motion: reduce) { .refresh .live, .skeleton { animation: none; } }

/* ---------- live / lab switch */
.env-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--bg); }
.env-switch a { padding: 4px 12px; border-radius: 6px; color: var(--text-2); font-weight: 700; font-size: 12px; }
.env-switch a:hover { color: var(--text); }
.env-switch a[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.env-lab .env-switch a[aria-pressed="true"] { background: var(--warn); color: #3b2a00; }
.lab-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 5px; background: var(--warn); color: #3b2a00; font-size: 11px; font-weight: 800; letter-spacing: .06em; vertical-align: 1px; }
body.env-lab .appbar { box-shadow: inset 0 3px 0 var(--warn); }

/* ---------- tunnels */
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- backups */
pre.diff { margin: 0; max-height: 480px; overflow: auto; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); font: 12px/1.5 var(--mono); white-space: pre; }
pre.diff .add { color: var(--good); }
pre.diff .del { color: var(--crit); }
pre.diff .hunk { color: var(--muted); }
