/* ===================================================================
   SaaS layer: categorical colours, shell, palette, groups, map,
   onboarding, settings sections. Loaded after app.css.
   =================================================================== */
:root {
  /* Validated categorical palette (light): group identity */
  --cat-blue: #2a78d6; --cat-orange: #eb6834; --cat-aqua: #1baf7a; --cat-yellow: #eda100;
  --cat-magenta: #e87ba4; --cat-green: #008300; --cat-violet: #6250d6; --cat-red: #e34948;
  --axis-text: #73716b; /* 4.7:1 on the light surface (was 3.5:1) */
  --bulk-danger: #ffb3b3; /* on the dark bulk bar */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cat-blue: #3987e5; --cat-orange: #d95926; --cat-aqua: #199e70; --cat-yellow: #c98500;
    --cat-magenta: #d55181; --cat-green: #0ca30c; --cat-violet: #9085e9; --cat-red: #e66767;
    --axis-text: #898781;
    --bulk-danger: #b42f2f;
  }
}
:root[data-theme="dark"] {
  --cat-blue: #3987e5; --cat-orange: #d95926; --cat-aqua: #199e70; --cat-yellow: #c98500;
  --cat-magenta: #d55181; --cat-green: #0ca30c; --cat-violet: #9085e9; --cat-red: #e66767;
  --axis-text: #898781;
  --bulk-danger: #b42f2f; /* the bulk bar is light in dark mode */
}

/* Skip link */
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 200; padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: #fff; border: 0; font-weight: 600; cursor: pointer; transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

/* Brand + sidebar */
.brand-logo { width: 34px; height: 34px; border-radius: 9px; flex: none; display: block; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 13px; text-align: left;
}
.search-trigger:hover { color: var(--text); border-color: var(--axis); }
.search-trigger .icon { width: 16px; height: 16px; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface);
  font: 600 11px/1 var(--font); color: var(--text-2); white-space: nowrap;
}
.server-pill { text-decoration: none !important; color: var(--text-2); }
.server-pill:hover { background: var(--surface-3); }
.server-pill .muted { font-size: 11px; }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; border: 0;
  background: transparent; cursor: pointer; text-align: left; color: var(--text);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); }
.user-btn .icon { width: 16px; height: 16px; color: var(--muted); }
.user-name { display: block; font-weight: 600; font-size: 13px; }
.user-role { display: block; font-size: 11.5px; color: var(--muted); }
.avatar.sm { width: 30px; height: 30px; border-radius: 50%; font-size: 12px; background: var(--accent-soft); color: var(--accent-text); }
.avatar-btn { border-radius: 50%; }
.mobile-only { display: none !important; }

/* Page header */
.page-desc { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.page-desc[hidden] { display: none; }
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: -4px; overflow-x: auto; overflow-y: hidden; }
.page-tabs a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--text-2); font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; white-space: nowrap;
}
.page-tabs a .icon { width: 16px; height: 16px; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.page-tabs .count, .gfilter .count {
  font-size: 11.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
}

/* Menus */
.menu-header { padding: 7px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.menu button kbd { margin-left: 12px; }
.menu .menu-check { color: var(--accent-text) !important; }
.menu button:focus-visible { outline: none; background: var(--surface-2); }

/* Buttons: busy state */
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--text-2); border-color: var(--text-2) transparent var(--text-2) transparent; animation: spin 0.7s linear infinite;
}
.btn.primary[aria-busy="true"]::after, .btn.solid[aria-busy="true"]::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Password reveal */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; border: 0;
  background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; display: grid; place-items: center;
}
.pw-toggle:hover, .pw-toggle.on { color: var(--text); background: var(--surface-2); }
.pw-toggle .icon { width: 16px; height: 16px; }
.caps-hint { font-size: 12.5px; color: var(--warning-text); display: flex; gap: 6px; align-items: center; }
.caps-hint .icon { width: 14px; height: 14px; }

/* Command palette */
.modal-backdrop.top { align-items: start; padding-top: 12vh; }
.modal.palette { max-width: 620px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.modal.palette .modal-body { padding: 0; gap: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-search .icon { color: var(--muted); }
.palette-input { flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; color: var(--text); min-width: 0; }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.palette-item.active { background: var(--accent-soft); }
.palette-icon { position: relative; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--text-2); }
.palette-icon .icon { width: 16px; height: 16px; }
.palette-icon .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--surface); width: 10px; height: 10px; box-shadow: none; }
.palette-label { display: block; font-weight: 550; }
.palette-sub { display: block; font-size: 12px; color: var(--muted); }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); }
.table.shortcuts td { padding: 8px 12px; }
.table.shortcuts td:first-child { width: 120px; white-space: nowrap; }

/* Groups */
.group-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.group-chip.sm { font-size: 12px; }
.gdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.client-name .note { display: flex; gap: 8px; align-items: center; min-width: 0; }
.client-name .title { color: var(--text); font-weight: 600; text-decoration: none; }
.client-name .title:hover { text-decoration: underline; }
.group-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.gfilter {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 550; cursor: pointer;
  text-decoration: none !important;
}
.gfilter:hover { color: var(--text); background: var(--surface-2); }
.gfilter.active { background: var(--accent-soft); color: var(--accent-text); }
.gfilter.ghost { background: transparent; }
.gfilter .icon { width: 14px; height: 14px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.group-card { display: flex; flex-direction: column; }
.group-card-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 10px; }
.group-card-head h2 a { color: var(--text); }
.group-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in oklab, var(--gc, var(--axis)) 16%, var(--surface)); color: var(--gc, var(--text-2));
}
.group-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 16px 14px; }
.group-stats > div { display: flex; flex-direction: column; }
.stat-num { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.group-card-foot { margin-top: auto; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; max-width: 860px; margin: 0 auto; text-align: left; }
.starter {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.starter:hover { background: var(--surface-2); }
.kind-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kind-option, .color-option { position: relative; }
.kind-option input, .color-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind-card {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; cursor: pointer; height: 100%;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.kind-card .icon { width: 18px; height: 18px; color: var(--text-2); }
.kind-option input:checked + .kind-card { background: var(--accent-soft); color: var(--accent-text); }
.kind-option input:checked + .kind-card .icon { color: var(--accent-text); }
.kind-option input:focus-visible + .kind-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-option span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.color-option input:checked + span::after { content: ""; width: 8px; height: 13px; margin-top: -3px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.color-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Bulk selection + pagination */
.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.table th.check-col, .table td.check-col { width: 36px; padding-right: 0; }
.table tbody tr.selected td { background: var(--accent-soft); }
.list-item.selected { background: var(--accent-soft); }
.bulk-bar {
  position: sticky; bottom: 16px; z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
}
.bulk-bar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 30%, transparent); box-shadow: none; }
.bulk-bar .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.bulk-bar .btn.danger { color: var(--bulk-danger); }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border); }

/* Network map */
.map-toolbar .switch { gap: 6px; }
.map-legend .lg-line { width: 22px; height: 0; border-top: 2px solid var(--good); display: inline-block; }
.map-legend .lg-line.flow { border-top-style: dashed; border-color: var(--down); }
.map-legend .lg-line.off { border-top: 2px dashed var(--axis); }
.map-legend .lg-box { width: 14px; height: 10px; border-radius: 3px; background: var(--surface-3); display: inline-block; }
.map-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.pill strong { color: var(--text); }
.pill .icon { width: 15px; height: 15px; }
.map-card { overflow: hidden; }
.map-scroll { overflow-x: auto; }
.map-hint { padding: 8px 16px; border-top: 1px solid var(--border); }
.netmap { display: block; }
.netmap .map-node-bg { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.netmap .kind-srv .map-node-bg, .netmap .kind-net .map-node-bg { fill: var(--surface-2); }
.netmap .kind-ifc .map-node-bg { fill: var(--accent-soft); }
.netmap .kind-ifc.down .map-node-bg { fill: var(--critical-soft); }
.netmap .kind-cli.disabled { opacity: 0.55; }
.netmap .kind-site .map-node-bg { fill: var(--surface-2); }
.netmap .map-title { fill: var(--text); font: 600 13px var(--font); }
.netmap .map-title.mono { font: 600 12px var(--mono); }
.netmap .map-sub { fill: var(--muted); font: 11.5px var(--font); }
.netmap .map-empty { fill: var(--muted); font: italic 12.5px var(--font); }
.netmap .map-icon { fill: none; stroke: var(--text-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.netmap .map-dot { fill: var(--neutral-dot); }
.netmap .map-dot.online { fill: var(--good); }
.netmap .map-dot.critical { fill: var(--critical); }
.netmap .map-link { fill: none; stroke: var(--axis); }
.netmap .map-link.on { stroke: var(--good); }
.netmap .map-link.idle { stroke: color-mix(in srgb, var(--good) 45%, var(--axis)); }
.netmap .map-link.flow { stroke: var(--down); stroke-dasharray: 6 5; animation: flow 0.9s linear infinite; }
.netmap .map-link.off { stroke-dasharray: 4 4; }
.netmap .map-link.disabled { stroke-dasharray: 2 5; opacity: 0.6; }
.netmap .map-a { cursor: pointer; }
.netmap .map-a:hover .map-node-bg { fill: var(--surface-2); }
.netmap .map-a:focus { outline: none; }
.netmap .map-a:focus-visible .map-node-bg { stroke: var(--accent); stroke-width: 2.5; }
@keyframes flow { to { stroke-dashoffset: -22; } }

/* Onboarding checklist */
.onboard { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: start; }
.onboard h2 { font-size: 16px; }
.onboard-steps { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.onboard-step { display: flex; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.onboard-step.done { opacity: 0.75; }
.onboard-step .tick {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3);
}
.onboard-step.done .tick { background: var(--good); color: #fff; }
.onboard-step .tick .icon { width: 13px; height: 13px; stroke-width: 3; }
.onboard-step strong { display: block; font-size: 13.5px; }
.onboard-step .small { display: block; margin-top: 2px; }
.onboard-step .btn { margin-top: 8px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 140px; }
.progress > span { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--good-text); }
.live-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* Settings sections */
.settings-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.section-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.section-nav a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  font-weight: 550; text-decoration: none !important;
}
.section-nav a .icon { width: 16px; height: 16px; }
.section-nav a:hover { background: var(--surface-2); color: var(--text); }
.section-nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.save-bar .unsaved { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.save-bar .unsaved::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.danger-zone { border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .search-trigger { display: none; }
  .settings-shell { grid-template-columns: minmax(0, 1fr); }
  .section-nav { position: static; flex-direction: row; overflow-x: auto; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .section-nav a { white-space: nowrap; }
  .toasts { bottom: 84px; left: 16px; right: 16px; align-items: stretch; }
  .bulk-bar { bottom: 80px; }
  .page-desc { display: none; }
  .onboard { grid-template-columns: minmax(0, 1fr); }
  .nav a { min-width: 0; }
  .nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .netmap .map-link.flow, .live-badge::before { animation: none; }
}

@media (max-width: 1600px) { .client-table .col-live { display: none; } }
.group-stats .dot { display: inline-block; vertical-align: middle; margin-right: 2px; width: 7px; height: 7px; }

/* Network map: compact tree for phones */
.tree { padding: 14px; font-size: 13.5px; }
.tree ul { list-style: none; margin: 0; padding-left: 16px; border-left: 2px solid var(--border); margin-left: 8px; }
.tree li { position: relative; padding: 4px 0 4px 12px; }
.tree li::before { content: ""; position: absolute; left: -2px; top: 19px; width: 12px; border-top: 2px solid var(--border); }
.tree a { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.tree a:hover { background: var(--surface-2); }
.tree a .grow { display: flex; flex-direction: column; min-width: 0; }
.tree-root { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 4px 10px; }
.tree-root .icon { width: 16px; height: 16px; color: var(--text-2); }
.tree-iface > a { background: var(--accent-soft); flex-wrap: wrap; }
.tree-item.disabled { opacity: 0.6; }
.tree-site { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tree-site .icon { width: 14px; height: 14px; }
.tree-empty { padding: 6px 12px; }

/* Confirmation text keeps its line breaks (e.g. listing hooks in a backup) */
.modal-body p.text-2 { white-space: pre-line; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------
   No coloured borders on rounded components: selected / active states
   use a light fill + accent text; borders stay neutral everywhere.
   (Keyboard focus keeps its visible ring for accessibility.)
   ------------------------------------------------------------------ */
.chip.active { border-color: var(--border-strong); background: var(--accent-soft); color: var(--accent-text); }
.iface-tab.active { border-color: var(--border-strong); background: var(--accent-soft); color: var(--accent-text); }
.field.invalid .input, .field.invalid .textarea { border-color: var(--border-strong); background: var(--critical-soft); }
.dot.online { box-shadow: none; }
/* Yellow needs a dark check mark to stay visible */
.color-option input[value="yellow"]:checked + span::after { border-color: #0b0b0b; }

/* ------------------------------------------------------------------
   Updates
   ------------------------------------------------------------------ */
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: none; margin-left: auto;
}
.nav .badge:not([hidden]) + .nav-dot { margin-left: 6px; }
.section-nav a { position: relative; }
.update-versions { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.update-ver { font-size: 17px; font-weight: 600; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.update-arrow { color: var(--muted); padding-bottom: 2px; }
.update-arrow .icon { width: 18px; height: 18px; }
.job { display: flex; flex-direction: column; gap: 8px; }
.job-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--accent-text); border-color: var(--accent-text) transparent var(--accent-text) transparent;
  animation: spin 0.8s linear infinite;
}
.job-log {
  margin: 0; max-height: 260px; overflow: auto; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-family: var(--mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
@media (max-width: 860px) {
  .nav a { position: relative; }
  .nav .nav-dot { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; }
}
@media (prefers-reduced-motion: reduce) { .job-spinner { animation-duration: 2.4s; } }

/* ------------------------------------------------------------------
   Networks (WireGuard interfaces)
   ------------------------------------------------------------------ */
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.net-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.net-card:hover { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.net-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.net-head h2 { font-size: 17px; line-height: 1.2; }
/* The name link covers the whole card; buttons sit above it */
.net-link { color: var(--text); text-decoration: none; }
.net-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.net-link:focus-visible { outline: none; }
.net-card:has(.net-link:focus-visible) { box-shadow: 0 0 0 2px var(--accent); }
.net-foot, .net-foot * { position: relative; z-index: 1; }
.net-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.net-icon .icon { width: 19px; height: 19px; }
.net-icon.down { background: var(--critical-soft); color: var(--critical-text); }
.net-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.net-facts > div { min-width: 0; }
.net-facts dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.net-facts dd { margin: 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.net-facts dd strong { font-size: 15px; }
.net-card .r, .stat-sub .r { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.net-card .r .swatch, .stat-sub .r .swatch { width: 7px; height: 7px; border-radius: 50%; }
.net-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.net-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); margin-top: auto; }
.net-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 220px;
  border: 0; border-radius: var(--radius, 14px); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; text-align: center; padding: 18px;
}
.net-add:hover { background: var(--surface-3); }
.net-add strong { font-size: 15px; }
.pick-item { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--surface-2); }
.net-client-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.net-client-side .rates { flex-direction: row; gap: 8px; }
.net-settings { max-width: 880px; }
.switch .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* Danger zone: neutral border, the heading carries the meaning */
.danger-zone { border-color: var(--border); }
.danger-zone .card-head h2 { color: var(--critical-text); }
@media (max-width: 860px) {
  .net-grid { grid-template-columns: minmax(0, 1fr); }
  .net-add { min-height: 120px; }
}
@media (max-width: 420px) { .net-facts { grid-template-columns: minmax(0, 1fr); } }
.net-client-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
@media (max-width: 560px) { .net-client-side .rates { display: none; } }

/* ------------------------------------------------------------------
   Sign-in: two-factor codes and single sign-on
   ------------------------------------------------------------------ */
.otp-input { font-size: 20px; letter-spacing: 0.3em; text-align: center; height: 48px; }
.otp-secret { display: inline-block; margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; letter-spacing: 0.05em; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 14px; border-radius: 10px; background: var(--surface-2); font-size: 15px; }
.recovery-codes span { text-align: center; }
.sso-list { display: flex; flex-direction: column; gap: 8px; }
.sso-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.sso-divider::before, .sso-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* One-line setup command */
.cmd-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
pre.config.cmd-text { width: 100%; max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
details.small summary { cursor: pointer; color: var(--text-2); }
details.small[open] summary { margin-bottom: 8px; }
.section-nav, .page-tabs { scrollbar-width: none; }
.section-nav::-webkit-scrollbar, .page-tabs::-webkit-scrollbar { display: none; }

/* Language choice on the sign-in page: current language in bold, others as links */
.lang-current { font-weight: 600; color: var(--text); padding: 2px 6px; }
.lang-link { border: 0; background: none; font: inherit; color: var(--accent-text); padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.lang-link:hover { text-decoration: underline; }

/* Connect dialog: one tab per kind of device */
.connect-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 18px; overflow-x: auto; scrollbar-width: none; }
.connect-tabs::-webkit-scrollbar { display: none; }
.connect-tabs button {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 550;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer;
}
.connect-tabs button .icon { width: 16px; height: 16px; }
.connect-tabs button:hover { color: var(--text); }
.connect-tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.connect-panel { min-height: 260px; }
.cmd-box .btn.primary { align-self: stretch; justify-content: center; height: 40px; }
@media (max-width: 560px) {
  .connect-tabs { gap: 0; }
  .connect-tabs button { flex: 1; justify-content: center; padding: 10px 4px; font-size: 13px; }
  .connect-tabs button .icon { display: none; }
}

/* Share page */
.share-qr { align-self: center; width: 100%; max-width: 300px; }
.share-actions { display: flex; flex-direction: column; gap: 8px; }
.share-actions .btn.primary { height: 42px; }
.share-actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-actions-row .btn { min-width: 0; height: auto; min-height: 42px; padding: 8px 10px; white-space: normal; line-height: 1.25; text-align: center; }
.share-actions-row .btn .icon { flex: none; }
.share-note { text-align: center; margin: 0; }
.share-note .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
@media (max-width: 420px) { #share { padding: 22px 16px; } .share-actions-row { grid-template-columns: minmax(0, 1fr); } }
#share { max-width: 440px; }
#share.share-wide { max-width: 600px; }
#share .connect-tabs { margin: 0 0 4px; }

/* ------------------------------------------------------------------
   Setup guide (onboarding)
   ------------------------------------------------------------------ */
.modal.onboarding { max-width: 760px; }
.onboarding .modal-body { min-height: 380px; }
.ob-stepper { list-style: none; margin: 0 0 22px; padding: 0; display: flex; gap: 6px; counter-reset: none; }
.ob-stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-width: 0; }
.ob-stepper li:not(:first-child)::before {
  content: ""; position: absolute; top: 13px; right: calc(50% + 18px); left: calc(-50% + 18px); height: 2px; background: var(--border);
}
.ob-stepper li.done:not(:first-child)::before, .ob-stepper li.current:not(:first-child)::before { background: var(--accent); }
.ob-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650;
  background: var(--surface-3); color: var(--text-2); position: relative; z-index: 1;
}
.ob-dot .icon { width: 15px; height: 15px; }
.ob-stepper li.done .ob-dot { background: var(--accent); color: #fff; }
.ob-stepper li.current .ob-dot { background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 2px var(--accent) inset; }
.ob-label { font-size: 12px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ob-stepper li.current .ob-label { color: var(--text); font-weight: 600; }
.ob-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 8px 0; }
.ob-hero h2 { font-size: 21px; }
.ob-hero p { max-width: 520px; margin: 0; }
.ob-logo { border-radius: 14px; }
.ob-overview { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ob-overview li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.ob-overview .icon { width: 14px; height: 14px; color: var(--good-text); }
.ob-form { gap: 14px; max-width: 560px; }
.ob-form h3, .ob-step h3 { font-size: 17px; margin: 0; }
.ob-form p { margin: 0; }
.ob-devices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ob-devices .kind-card { flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 14px 8px; }
.ob-devices .kind-card .icon { width: 24px; height: 24px; }
.ob-wait { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13.5px; }
.ob-wait.ok { background: var(--good-soft); color: var(--good-text); }
.ob-wait.ok .icon { width: 18px; height: 18px; }
.ob-done { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--good-soft); color: var(--good-text); }
.ob-done .icon { width: 32px; height: 32px; }
.ob-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 6px; }
.ob-next-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.ob-next-card:hover { background: var(--surface-2); }
.ob-next-card .icon { width: 20px; height: 20px; color: var(--accent-text); margin-bottom: 4px; }
.ob-next-card span { font-size: 12.5px; color: var(--muted); }
.onboarding .modal-foot { gap: 8px; }
@media (max-width: 560px) {
  .ob-label { display: none; }
  .ob-stepper li.current .ob-label { display: block; position: absolute; top: 34px; left: 50%; transform: translateX(-50%); max-width: none; overflow: visible; white-space: nowrap; }
  .ob-stepper { margin-bottom: 34px; }
  .ob-devices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-next { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .ob-wait .job-spinner { animation-duration: 2.4s; } }
