/* ═══════════════════════════════════════════════════════════════════════════
   XLUX Site Manager — Component Library
   Every visual element of the portal comes from THIS file (rule: no ad-hoc UI).
   Patterns are value-identical to the hub webapp (style.css) — one family.
   All colors route through tokens.css; components are theme-agnostic.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Base ──────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--app-bg);
  color: var(--text-primary);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }   /* author display rules must never beat the hidden attribute */
a { color: inherit; text-decoration: none; }
.lucide, svg.lucide { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Layout shell: header + content + bottom nav (all screen sizes) ────────── */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  flex-shrink: 0;
}
.app-header .brand-logo {
  width: 26px; height: 26px; display: inline-block; background: currentColor;
  -webkit-mask: url(../assets/logo.svg) no-repeat center / contain;
          mask: url(../assets/logo.svg) no-repeat center / contain;
}
.app-header .app-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.app-header .spacer { flex: 1; }
.app-content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 4px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
.bottom-nav {
  /* 1:1 hub webapp #bottom-nav: 5-column grid, 68px, 10px paddings */
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(68px + env(safe-area-inset-bottom));
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 11, .92);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, .05);
  z-index: 100;
}
[data-theme="light"] .bottom-nav { background: var(--surface-overlay); border-top: 1px solid var(--border-subtle); }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
  gap: 3px;
  border: none;
  background: none;
  color: rgba(156, 163, 175, 1);
  cursor: pointer;
  transition: color .15s;
}
.nav-item .lucide { width: 24px; height: 24px; }
.nav-item span { font-size: 10px; font-weight: 500; line-height: 1; }
.nav-item.active { color: #fff; }
[data-theme="light"] .nav-item { color: var(--text-secondary); }
[data-theme="light"] .nav-item.active { color: var(--clr-accent); }

/* Notification bell with unread dot */
.bell-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
}
.bell-btn:active { background: var(--surface-active); }
.bell-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--clr-error);
  border: 2px solid var(--app-bg);
}

/* ── Ambient background glow — quiet life on the dark canvas ───────────────── */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 340px at 85% -60px, color-mix(in srgb, var(--clr-cloud) 7%, transparent), transparent 70%),
    radial-gradient(680px 420px at -10% 30%, color-mix(in srgb, var(--clr-accent) 5%, transparent), transparent 70%);
}
[data-theme="light"] .bg-glow { opacity: .5; }

/* ── Page head (large title + quiet context line) ──────────────────────────── */
.page-head { padding: 18px 2px 16px; }
.page-head .context { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 0 0 2px; }
.page-head h1 { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 0; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--setting-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 1px 2px rgba(0,0,0,.18);  /* top sheen + seat */
}
[data-theme="light"] .card { box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.card + .card { margin-top: 12px; }
.card-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
/* Explanatory prose inside a card (consent text, what-we-share). NOT .field-sub —
 * that one is monospace for machine values (IDs, tokens, paths). */
.card-note { font-size: 13px; line-height: 1.55; color: var(--text-muted); margin: 0 0 10px; }
.card-note:last-of-type { margin-bottom: 14px; }
.card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  min-height: 44px;                                   /* touch target */
}
.card-row + .card-row { border-top: 1px solid var(--border-subtle); }
.card-row .lucide { color: var(--text-strong); }
.card-row .row-label { flex: 1; font-size: 14.5px; }
.card-row .row-value { color: var(--text-secondary); font-size: 13.5px; }
.card-row .chevron { color: var(--text-hint); width: 17px; height: 17px; }
.card-row.tappable { cursor: pointer; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.card-row.tappable:active { background: var(--surface-hover); }

/* ── Hub tile (the heart: click = open the hub's UI) ───────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
@media (min-width: 768px) { .tile-grid { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; } }
.hub-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: linear-gradient(180deg, var(--surface-elevated), var(--setting-panel) 55%);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 22px 16px 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 2px 6px rgba(0,0,0,.22);
  transition: border-color .18s ease, transform .18s cubic-bezier(.3,.7,.4,1), box-shadow .18s ease;
}
.hub-tile:active { transform: scale(.97); }
@media (hover: hover) {
  .hub-tile:hover {
    border-color: var(--border-medium);
    transform: translateY(-3px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 14px 30px rgba(0,0,0,.35);
  }
  .hub-tile:hover .hub-render { transform: scale(1.04); }
}
[data-theme="light"] .hub-tile { background: var(--panel-bg); box-shadow: 0 1px 3px rgba(16,24,40,.07); }
[data-theme="light"] .hub-tile:hover { box-shadow: 0 12px 28px rgba(16,24,40,.14); }
.hub-tile .hub-render {
  width: 92px; height: 92px;
  object-fit: contain;
  margin-bottom: 10px;
  transition: transform .18s ease;
}
.hub-tile .hub-shadow {                                /* realistic contact shadow under the device */
  width: 74px; height: 12px;
  margin: -14px 0 8px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent);
}
[data-theme="light"] .hub-tile .hub-shadow { background: radial-gradient(closest-side, rgba(16,24,40,.22), transparent); }
.hub-tile .hub-meta { width: 100%; display: flex; flex-direction: column; gap: 3px; }
.hub-tile .hub-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.hub-tile .hub-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-secondary);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-disabled); flex-shrink: 0; }
.status-dot.online, .status-dot.ok {
  background: var(--clr-ok);
  box-shadow: 0 0 6px color-mix(in srgb, var(--clr-ok) 70%, transparent);
}
.status-dot.warn  { background: var(--clr-warn);  box-shadow: 0 0 6px color-mix(in srgb, var(--clr-warn) 55%, transparent); }
.status-dot.error { background: var(--clr-error); box-shadow: 0 0 6px color-mix(in srgb, var(--clr-error) 55%, transparent); }
.status-dot.info  { background: var(--clr-info); }
.hub-tile .menu-btn {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: none; color: var(--text-muted); cursor: pointer;
  opacity: .0; transition: opacity .15s ease;
}
.hub-tile:hover .menu-btn, .hub-tile:focus-within .menu-btn { opacity: 1; }
@media (hover: none) { .hub-tile .menu-btn { opacity: 1; } }
.hub-tile .menu-btn:active { background: var(--surface-active); }

/* Dashed "+ add" tile — webapp .ui-add-dashed pattern */
.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 172px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.add-tile:active { background: var(--surface-hover); }
.add-tile .lucide { width: 26px; height: 26px; }

/* ── Buttons (canonical webapp roles) ──────────────────────────────────────── */
.ui-save-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: var(--btn-primary-bg);
  border: none; border-radius: 14px;
  color: var(--btn-primary-fg);
  font-size: 14px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}
.ui-save-btn:disabled { opacity: .4; cursor: not-allowed; }
.ui-save-btn .lucide { width: 16px; height: 16px; }
.ui-save-btn-full { width: 100%; }
.ui-ghost-btn {                                        /* secondary: dark surface + border */
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 14px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.ui-ghost-btn:active { background: var(--surface-active); }
.ui-danger-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--clr-error);
  border-radius: 14px;
  color: var(--clr-error);
  font-size: 14px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: background .12s ease;
}
.ui-danger-btn:active { background: color-mix(in srgb, var(--clr-error) 12%, transparent); }
.ui-danger-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Segmented control with sliding pill (webapp .seg) ─────────────────────── */
.seg {
  position: relative;
  display: flex; gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
}
.seg-ind {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);              /* decorative depth */
  transition: transform .26s cubic-bezier(.4,0,.2,1), width .26s cubic-bezier(.4,0,.2,1);
  pointer-events: none; z-index: 0;
}
.seg-btn {
  position: relative; z-index: 1; flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px;
  border: none; border-radius: 10px;
  background: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.seg-btn.active { color: var(--text-primary); }

/* ── Chips ─────────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--chip-idle-bg, var(--surface-1));
  border: 1px solid var(--border-subtle);
  color: var(--text-soft);
  font-size: 12px; font-weight: 600;
}
.chip.selected { border-color: var(--chip-sel-bd, var(--border-strong)); color: var(--text-primary); }
.chip.ok    { color: var(--clr-ok);    border-color: color-mix(in srgb, var(--clr-ok) 35%, transparent); }
.chip.warn  { color: var(--clr-warn);  border-color: color-mix(in srgb, var(--clr-warn) 35%, transparent); }
.chip.error { color: var(--clr-error); border-color: color-mix(in srgb, var(--clr-error) 35%, transparent); }

/* ── Toggle (iOS switch, webapp .toggle-*) ─────────────────────────────────── */
.toggle-wrap { position: relative; width: 44px; height: 24px; flex-shrink: 0; display: inline-block; }
.toggle-wrap input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle-track { display: block; width: 100%; height: 100%; background: rgba(255,255,255,.16); border-radius: 99px; transition: background .2s; }
.toggle-wrap input:checked + .toggle-track { background: rgba(255,255,255,.3); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.8);
  transition: transform .2s, background .2s;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.toggle-wrap input:checked ~ .toggle-thumb { transform: translateX(20px); background: #fff; }
[data-theme="light"] .toggle-track { background: rgba(0,0,0,0.15); }
[data-theme="light"] .toggle-wrap input:checked + .toggle-track { background: var(--clr-accent); }
[data-theme="light"] .toggle-thumb,
[data-theme="light"] .toggle-wrap input:checked ~ .toggle-thumb { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

/* ── Form field (webapp pattern: big label ON TOP, borderless input on card) ── */
.field { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field-input {
  border: none; background: none; outline: none;
  font-size: 20px; font-weight: 700;
  color: var(--text-primary);
  padding: 2px 0;
  width: 100%;
}
.field-input::placeholder { color: var(--text-hint); font-weight: 600; }
.field-sub { font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-muted); word-break: break-all; }

/* ── Sheet (mobile bottom sheet → centered modal on desktop) ───────────────── */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55);
  -webkit-backdrop-filter: blur(5px);
          backdrop-filter: blur(5px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%;
  max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;   /* fixed head + scrolling body */
  overflow: hidden;
  position: relative;
  background: var(--surface-overlay);
  -webkit-backdrop-filter: blur(40px);
          backdrop-filter: blur(40px);
  border-top: 1px solid var(--border);
  border-radius: 28px 28px 0 0;
}
/* Drag handle — pull the sheet down to dismiss (wired in ui.js openSheet). */
.sheet .grabber {
  width: 40px; height: 5px; border-radius: 99px; flex-shrink: 0;
  background: var(--border-strong);
  margin: 8px auto 2px;
  position: relative; touch-action: none; cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
/* Enlarge the touch target well past the visible pill (stays clear of the header row below). */
.sheet .grabber::before { content: ''; position: absolute; top: -14px; bottom: -6px; left: -80px; right: -80px; }
.sheet .grabber:active { cursor: grabbing; }
/* Header row: FIXED (never scrolls) — title left, round close (×) right. */
.sheet-head {
  flex-shrink: 0; position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 16px;
}
.sheet-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; margin: 0; }
.sheet-close {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border-subtle); border-radius: 50%;
  background: var(--surface-raised); color: var(--text-muted);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s;
}
.sheet-close:hover, .sheet-close:focus-visible { background: var(--surface-hover); color: var(--text-primary); outline: none; }
.sheet-close .lucide { width: 18px; height: 18px; }
/* Soft edge under the fixed header — appears only once the body is scrolled. */
.sheet-head::after {
  content: ''; position: absolute; top: 100%; left: 0; right: 0;
  height: 22px; pointer-events: none; z-index: 3;
  background: linear-gradient(to bottom, var(--surface-overlay), transparent);
  opacity: 0; transition: opacity .2s ease;
}
.sheet.is-scrolled .sheet-head::after { opacity: 1; }
/* The scroll region — hidden scrollbar, its own padding. */
.sheet-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom));
  scrollbar-width: none;                                   /* Firefox */
}
.sheet-body::-webkit-scrollbar { width: 0; height: 0; display: none; }   /* WebKit */
/* Bottom fade — hints there's more below; clipped to the sheet's rounded corners. */
.sheet::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 40px; pointer-events: none; z-index: 3;
  background: linear-gradient(to top, var(--surface-overlay), transparent);
  opacity: 0; transition: opacity .2s ease;
}
.sheet.can-scroll-down::after { opacity: 1; }
@media (min-width: 768px) {
  .sheet-scrim { align-items: center; }
  /* Centred modal: the card floats free, so it carries a full border (not just the top edge). */
  .sheet { max-width: 560px; border: 1px solid var(--border); border-radius: var(--radius-sheet); }
  .sheet .grabber { display: none; }
  .sheet-head { padding-top: 20px; }   /* no grabber above → give the title room */
}

/* ── Toast (fixed top, dark + blur — webapp _showToast) ────────────────────── */
.toast {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  max-width: min(92vw, 420px);
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--surface-overlay);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);             /* decorative depth */
}
.toast.error { border-color: color-mix(in srgb, var(--clr-error) 45%, transparent); color: var(--clr-error); }

/* ── .cspin — the one waiting indicator (1:1 webapp comet) ─────────────────── */
.cspin {
  --cspin-size: 30px; --cspin-thick: 3px; --cspin-spin: .9s; --cspin-hue: 4s;
  width: var(--cspin-size); height: var(--cspin-size); border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg,
    transparent 0deg, transparent 92deg,
    rgba(167,139,250,.14) 200deg,
    rgba(167,139,250,.55) 300deg,
    var(--clr-accent) 350deg,
    #fff 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--cspin-thick)), #000 calc(100% - var(--cspin-thick) + 1px));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--cspin-thick)), #000 calc(100% - var(--cspin-thick) + 1px));
  animation: cspin-rot var(--cspin-spin) linear infinite, cspin-hue var(--cspin-hue) linear infinite;
}
@keyframes cspin-rot { to { transform: rotate(1turn); } }
@keyframes cspin-hue { to { filter: hue-rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .cspin { animation-duration: 2.4s, 12s; } }

/* ── Empty state (quiet background hint — memory: empty-states-bare) ───────── */
.ui-empty--bare {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 20px;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}
.ui-empty--bare .lucide { width: 34px; height: 34px; color: var(--text-disabled); }

/* ── Avatar (initials) ─────────────────────────────────────────────────────── */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-chip);
  color: var(--text-soft);
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  border: none;
}
button.avatar { cursor: pointer; }

/* ── Tinted icon square (webapp settings-overview .ov-kpi-ic: rounded square,
     13 % tinted ground, full-strength icon color) ───────────────────────────── */
.tint {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-1);
  color: var(--text-soft);
}
.tint .lucide { width: 19px; height: 19px; }
.tint.lg { width: 44px; height: 44px; border-radius: 13px; }
.tint.lg .lucide { width: 22px; height: 22px; }
.tint.sm { width: 28px; height: 28px; border-radius: 9px; }
.tint.sm .lucide { width: 15px; height: 15px; }
.tint.ok    { color: var(--clr-ok);    background: color-mix(in srgb, var(--clr-ok) 13%, transparent); }
.tint.warn  { color: var(--clr-warn);  background: color-mix(in srgb, var(--clr-warn) 12%, transparent); }
.tint.error { color: var(--clr-error); background: color-mix(in srgb, var(--clr-error) 13%, transparent); }
.tint.info  { color: var(--clr-info);  background: color-mix(in srgb, var(--clr-info) 13%, transparent); }

/* ── Health hero — 1:1 the webapp settings-overview hero (.ov-hero): progress
     ring with glow on the left, site name + status pill + causes on the right ── */
.health-hero {
  position: relative;
  border-radius: 26px;
  padding: 24px 26px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
  border: 1px solid var(--border-light);
  background:
    radial-gradient(135% 150% at -5% -20%, color-mix(in srgb, var(--accent, var(--clr-ok)) 20%, transparent) 0%, transparent 52%),
    radial-gradient(120% 170% at 105% -30%, rgba(129,140,248,.15) 0%, transparent 46%),
    linear-gradient(160deg, #1c1c20 0%, #161618 100%);
}
[data-theme="light"] .health-hero {
  background:
    radial-gradient(135% 150% at -5% -20%, color-mix(in srgb, var(--accent, var(--clr-ok)) 20%, transparent) 0%, transparent 55%),
    radial-gradient(120% 170% at 105% -30%, rgba(46,144,250,.12) 0%, transparent 48%),
    #ffffff;
}
.hero-ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.hero-ring svg { position: relative; z-index: 1; display: block; }
.ring-track { stroke: rgba(255,255,255,.07); }
[data-theme="light"] .ring-track { stroke: rgba(0,0,0,.08); }
.ring-fg { transition: stroke-dashoffset 1s cubic-bezier(.2,.7,.3,1); }
.ring-glow { position: absolute; inset: -22%; border-radius: 50%; filter: blur(13px); pointer-events: none; }
.ring-center { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 40px; font-weight: 800; line-height: .92; letter-spacing: -.03em; }
.ring-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; max-width: 96px; text-align: center; line-height: 1.25; }
.hero-main { flex: 1; min-width: 220px; }
.hero-name { font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.05; }
.hero-sub { font-size: 13px; color: var(--text-dim); margin-top: 10px; }
.hero-issues { margin-top: 10px; }
.hero-issues .card-row.tappable { margin: 0 -8px; padding: 9px 8px; min-height: 40px; border-radius: 10px; }
.hero-issues .row-label { font-weight: 600; }

/* Status pill — 1:1 webapp .ov-status-pill ("1 device offline" in the hero) */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 700;
}
.status-pill .lucide { width: 15px; height: 15px; }
.status-pill.ok   { color: var(--clr-ok);        background: color-mix(in srgb, var(--clr-ok) 10%, transparent);   border: 1px solid color-mix(in srgb, var(--clr-ok) 25%, transparent); }
.status-pill.warn { color: var(--clr-warn-text); background: color-mix(in srgb, var(--clr-warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--clr-warn) 25%, transparent); }

/* Section label — webapp overview divider ("PROTOKOLLE"): uppercase micro-label */
.sec-label {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 2px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.sec-label::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }

/* ── Two-line row body (user list, update rows, …) ─────────────────────────── */
.row-lines { flex: 1; min-width: 0; }
.row-lines .row-title { font-size: 14.5px; font-weight: 600; }
.row-lines .row-sub { font-size: 12.5px; color: var(--text-secondary); }

/* ── Push device registry ──────────────────────────────────────────────────── */
/* Group header of the "all devices" view: grouped by person. Deliberately text instead of
   an icon — in an already icon-dense list a quiet line is the better separator. */
.pdev-group {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 2px; padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-hint);
}
.pdev-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pdev-group .chip { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* The sign-out button. Restrained until needed: it deletes something, but it is not the
   row's primary action — hence warn color only on hover/focus. */
.icon-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
  color: var(--text-hint);
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface-hover); color: var(--clr-error); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn .lucide { width: 16px; height: 16px; }

/* Dashed "+ add" row — list-scale sibling of .add-tile */
.add-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 16px; margin-top: 12px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.add-row:active { background: var(--surface-hover); }
.add-row .lucide { width: 18px; height: 18px; }

/* ── Notification row (bell sheet) ─────────────────────────────────────────── */
.notif-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; }
.notif-row + .notif-row { border-top: 1px solid var(--border-subtle); }
.notif-body { flex: 1; min-width: 0; padding-top: 1px; }
.notif-text { font-size: 14px; font-weight: 600; }
.notif-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.notif-row .status-dot { margin-top: 7px; }

/* ── Profile header (account sheet) ────────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 14px; }
.profile-head .avatar { width: 52px; height: 52px; font-size: 19px; }
.profile-name { font-size: 17px; font-weight: 700; }
.profile-mail { font-size: 13px; color: var(--text-secondary); }

/* ── Library card (Effects / Palettes / Widgets) ───────────────────────────── */
.lib-card { display: flex; align-items: center; gap: 14px; }
.lib-card .card-title { margin: 0; }
.swatches { display: flex; gap: 5px; margin-top: 6px; }                /* decorative palette preview */
.swatches span { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

/* ── Size variants of existing components (no new patterns) ────────────────── */
.seg.compact .seg-btn { padding: 6.5px 4px; font-size: 12.5px; }
.seg.compact .seg-btn .lucide { width: 15px; height: 15px; }
.ui-save-btn.small { padding: 7px 14px; font-size: 13px; border-radius: 11px; }
.ui-danger-btn.armed { background: color-mix(in srgb, var(--clr-error) 14%, transparent); }

/* ── Motion (view entry + sheet entry; honors reduced-motion) ──────────────── */
@media (prefers-reduced-motion: no-preference) {
  .view-enter { animation: rise .45s cubic-bezier(.3,.7,.4,1) both; }
  .sheet-scrim { animation: scrim-in .22s ease both; }
  .sheet { animation: sheet-in .34s cubic-bezier(.3,.7,.4,1) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes scrim-in { from { background: rgba(0,0,0,0); } }
@keyframes sheet-in { from { opacity: .4; transform: translateY(26px); } }

/* ── Search bar (device list & friends) ────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--setting-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.search-bar .lucide { width: 17px; height: 17px; color: var(--text-muted); }
.search-bar input { border: none; background: none; outline: none; flex: 1; font-size: 14.5px; color: var(--text-primary); }
.search-bar input::placeholder { color: var(--text-hint); }

/* ── List toolbar: search + filter button on one line, type segment below ───── */
.toolbar { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.toolbar .search-bar { flex: 1; margin-bottom: 0; }
.toolbar + .seg { margin-bottom: 10px; }

/* ── Protocol chip row (single dimension; active chip clears on re-tap) ────── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 10px; }
.chip-row .chip { cursor: pointer; }
.chip .lucide { width: 13px; height: 13px; }
.proto-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* Quiet count — sits at the right end of the chip row */
.list-meta { font-size: 12px; color: var(--text-muted); margin-left: auto; padding-left: 8px; }

/* Protocol icon — webapp _ccIcon: the protocol SVG masked in its CONNECT color.
   Mask + color are set INLINE by protoIcon() (url() in custom properties
   resolves against the stylesheet in WebKit and silently breaks). */
.proto-ic { display: inline-block; flex-shrink: 0; }

/* Product thumbnail — image when the photo pipeline has one, type icon until then */
.dev-thumb {
  position: relative;               /* photo overlays the icon (hub fixture-thumb pattern) */
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
/* transform-origin 0 0: thumb-fit.js layers its uniform content-fit scale/translate on top */
.dev-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; }
.dev-thumb .lucide { width: 19px; height: 19px; color: var(--text-strong); }
/* Fixture file icon (hub 'img:' SVGs, tinted via background-color like the hub's lt-file-icon).
   The mask itself is set inline — a url() inside a custom property resolves against the
   stylesheet in WebKit and would silently 404. */
.dev-fico { display: inline-block; flex-shrink: 0; width: 20px; height: 20px; background-color: var(--text-strong); }

/* ── Device page: internal scroll ─────────────────────────────────────────────
   The router adds .content-fixed to #view for the devices page, turning the content
   area into a fixed-height, non-scrolling column so ONLY the row list scrolls (the
   page title, search, filter and the table header all stay put). */
/* Pin the shell to the viewport so its child (the content area) has a definite
   height to bound against — otherwise min-height:100dvh lets it grow with content. */
body.view-fixed .app-shell { height: 100dvh; overflow: hidden; }
.app-content.content-fixed {
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.dev-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dev-view .page-head,
.dev-view .toolbar,
.dev-view .dev-metarow { flex-shrink: 0; }
.dev-view .page-head { padding: 14px 2px 12px; }
.dev-metarow { display: flex; justify-content: flex-end; margin-bottom: 8px; min-height: 16px; }
.dev-metarow .list-meta { margin-left: 0; }
/* The table card fills the remaining height; its header pins, its rows scroll. */
.dev-view .table-card {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;                       /* clip the scroll to the card's rounded corners */
}
.dev-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: none;                  /* Firefox */
}
.dev-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }   /* WebKit */
.dev-scroll > .dev-row:first-child { border-top: none; }

/* ── Device table (UniFi device list, adapted: taller rows, protocol column) ── */
.table-card { padding: 4px 0 6px; }
.dev-head { flex-shrink: 0; }
.dev-head, .dev-row {
  display: grid;
  grid-template-columns: 10px 38px minmax(130px, 1.4fr) 1.1fr 1fr .8fr .9fr 56px 84px 18px;
  gap: 12px;
  align-items: center;
  padding: 0 18px;
}
.dev-head {
  padding-top: 12px; padding-bottom: 9px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);   /* the fixed divider between header and the scrolling rows */
}
.dev-head [data-sort] { cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.dev-head [data-sort].sorted { color: var(--text-primary); }
.dev-head [data-sort] .lucide { width: 12px; height: 12px; }
.dev-row { min-height: 60px; border-top: 1px solid var(--border-subtle); cursor: pointer; padding-top: 8px; padding-bottom: 8px; }
@media (hover: hover) { .dev-row:hover { background: var(--surface-hover); } }
.dev-row:active { background: var(--surface-hover); }
.dev-row.dim { opacity: .55; }
.dev-row .lucide { width: 18px; height: 18px; color: var(--text-strong); }
.dev-row .chevron { color: var(--text-hint); width: 17px; height: 17px; }
.dev-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* RDM badge — marks an RDM-managed fixture. Inline variant rides next to the device name in the
   list; the plain variant sits in the sheet's identity-card header. A warn/error tint surfaces an
   active STATUS_MESSAGE right in the list (same colour vocabulary as .status-pill / .status-dot). */
.rdm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px;
  color: var(--clr-accent);
  background: color-mix(in srgb, var(--clr-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--clr-accent) 28%, transparent);
  white-space: nowrap; vertical-align: middle;
}
.rdm-badge .lucide { width: 12px; height: 12px; }
.rdm-badge.inline { margin-left: 7px; }
.rdm-badge.warn  { color: var(--clr-warn-text); background: color-mix(in srgb, var(--clr-warn) 12%, transparent); border-color: color-mix(in srgb, var(--clr-warn) 30%, transparent); }
.rdm-badge.error { color: var(--clr-error);     background: color-mix(in srgb, var(--clr-error) 12%, transparent); border-color: color-mix(in srgb, var(--clr-error) 30%, transparent); }

/* Card header that carries the overall health pill / RDM badge to the right of the title. */
.rdm-health-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.rdm-health-head .card-title { margin: 0; }
.dev-sub { display: none; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-cell { font-size: 13.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-proto { display: flex; align-items: center; gap: 7px; }
.dev-cell.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
@media (max-width: 1023px) {                      /* tablet: drop address + signal */
  .dev-head, .dev-row { grid-template-columns: 10px 38px minmax(130px, 1.4fr) 1.1fr 1fr .8fr 84px 18px; }
  .dev-col-addr, .dev-col-signal { display: none; }
}
@media (max-width: 767px) {                       /* phone: two-line rows, no columns */
  .dev-head { display: none; }
  .dev-row { grid-template-columns: 10px 38px 1fr auto 18px; min-height: 62px; }
  .dev-head + .dev-row { border-top: none; }      /* head is hidden -> no leading rule */
  .dev-row .dev-cell { display: none; }
  .dev-row .dev-cell.dev-status { display: block; }
  .dev-sub { display: block; }
}

/* ── Keyboard focus (minimal now, full a11y pass in E7) ────────────────────── */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
}

/* ── Login screen (custom sign-in — concept §2: logo-first, polished) ───────── */
body.login .bottom-nav, body.login .app-header .bell-btn, body.login .app-header .avatar { display: none; }
.login-wrap {
  min-height: calc(100dvh - var(--header-h) - 40px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0;
}
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-logo {
  width: 64px; height: 64px; display: inline-block;
  background: currentColor;
  -webkit-mask: url(../assets/logo.svg) no-repeat center / contain;
          mask: url(../assets/logo.svg) no-repeat center / contain;
  margin-bottom: 14px;
}
.login-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.login-tagline { font-size: 14px; color: var(--text-secondary); margin: 0 0 24px; }
.login-form { text-align: left; }
.login-form .field + .field { border-top: 1px solid var(--border-subtle); }

/* ── Wordmark — brand rule: bold X, LUX normal-to-light (global, 13.07.) ────── */
.brand-word { font-weight: 350; letter-spacing: .02em; }
.brand-word b { font-weight: 800; }

/* ── Center hub button — the ICONIC rainbow circle (1:1 hub webapp values:
     63px ring, 2.5px conic rainbow, dark core, floats 28px above the nav) ──── */
.nav-center { position: relative; display: flex; justify-content: center; align-items: flex-start; padding-top: 4px; }
.rainbow-border { background: conic-gradient(from 180deg, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00); }
.nav-hub-btn { border: none; background: none; padding: 0; cursor: pointer; transform: translateY(-28px); transition: transform .15s ease; }
@media (hover: hover) { .nav-hub-btn:hover { transform: translateY(-28px) scale(1.05); } }
.nav-hub-btn:active { transform: translateY(-28px) scale(.95); }
.nav-hub-ring {
  display: block; width: 63px; height: 63px; border-radius: 50%;
  padding: 2.5px;
  box-shadow: 0 0 30px rgba(0,0,0,.5);
}
.nav-hub-inner {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--app-bg);
  border: 1px solid var(--border-medium);
}
.nav-hub-inner .lucide { width: 28px; height: 28px; color: var(--text-primary); }
[data-theme="light"] .nav-hub-ring { box-shadow: 0 4px 18px rgba(16,24,40,.25); }

/* ── Cloud backups (§9) ─────────────────────────────────────────────────────
   Design matters here: generous cards, clear hierarchy, origin as a tinted pill, quiet empty/upsell
   states. All colours from tokens (color-mix for the tints). */
.bk-intro { font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin: 2px 2px 14px; }
.bk-loading { display: flex; justify-content: center; padding: 32px 0; }

.bk-list { display: flex; flex-direction: column; gap: 12px; }

.bk-card {
  position: relative;
  background: var(--surface-sunken);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 15px 17px 13px 19px;
  overflow: hidden;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease, background .16s ease;
}
/* Origin accent: a soft vertical bar on the leading edge, colour-keyed to how the backup was made.
   Gives each card an identity at a glance without a loud coloured icon box. */
.bk-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--border-medium); transition: background .16s ease;
}
.bk-card[data-origin="manual"]::before      { background: var(--clr-accent); }
.bk-card[data-origin="schedule"]::before    { background: var(--clr-cloud); }
.bk-card[data-origin="pre-restore"]::before { background: var(--clr-warn); }
.bk-card:hover {
  border-color: var(--border-strong); transform: translateY(-2px);
  background: var(--surface-elevated);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}

.bk-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bk-card-when { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bk-card-date { font-size: 16px; font-weight: 680; color: var(--text-bright); letter-spacing: -.01em; }
/* Meta as small pills with glyphs — reads as structured facts, not a grey run-on line. */
.bk-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-meta-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  background: var(--surface-chip); color: var(--text-secondary);
  font-size: 11.5px; font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.bk-meta-pill .lucide { width: 12px; height: 12px; color: var(--text-hint); }
.bk-card-counts { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border-subtle);
  font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.bk-badge {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  padding: 4px 9px 4px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.bk-badge .lucide { width: 13px; height: 13px; }
.bk-badge-ok   { color: var(--clr-ok);   background: color-mix(in srgb, var(--clr-ok) 14%, transparent); }
.bk-badge-info { color: var(--clr-info); background: color-mix(in srgb, var(--clr-info) 14%, transparent); }
.bk-badge-warn { color: var(--clr-warn); background: color-mix(in srgb, var(--clr-warn) 16%, transparent); }

.bk-card-acts { display: flex; align-items: center; gap: 8px; margin-top: 15px; }
.bk-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: 11px;
  background: var(--surface-chip); border: 1px solid var(--border-light);
  color: var(--text-regular); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .13s ease, border-color .13s ease, color .13s ease, box-shadow .13s ease;
}
.bk-act:hover { background: var(--surface-hover); border-color: var(--border-medium); color: var(--text-bright); }
.bk-act .lucide { width: 16px; height: 16px; }
/* Restore is the hero of a backup — accent-filled and takes the room; save sits beside it. */
.bk-act-restore { flex: 1; background: var(--clr-accent-bg); border-color: var(--clr-accent-bd); color: var(--clr-accent); }
.bk-act-restore:hover { background: var(--clr-accent); border-color: var(--clr-accent); color: var(--text-on-accent-soft);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--clr-accent) 40%, transparent); }
.bk-act[data-act="save"] { flex: 1; }
.bk-act-danger { flex: 0 0 auto; color: var(--text-muted); padding: 9px 11px; }
.bk-act-danger:hover { color: var(--clr-error); border-color: color-mix(in srgb, var(--clr-error) 45%, transparent); background: color-mix(in srgb, var(--clr-error) 10%, transparent); }
.bk-act.confirm { color: var(--clr-error); border-color: var(--clr-error); background: color-mix(in srgb, var(--clr-error) 12%, transparent); }

/* Upsell — ruhig, nicht marktschreierisch */
.bk-upsell { text-align: center; padding: 30px 22px; }
.bk-upsell-ico {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--clr-cloud) 16%, transparent); color: var(--clr-cloud);
}
.bk-upsell-ico .lucide { width: 28px; height: 28px; }
.bk-upsell-title { font-size: 16px; font-weight: 650; color: var(--text-bright); margin-bottom: 6px; }
.bk-upsell-sub { font-size: 13px; line-height: 1.55; color: var(--text-secondary); max-width: 34ch; margin: 0 auto; }

/* Empty — leise (Regel: Empty-States bare Hintergrund) */
.bk-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.bk-empty .lucide { width: 34px; height: 34px; opacity: .5; margin-bottom: 12px; }
.bk-empty-title { font-size: 14.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.bk-empty-sub { font-size: 12.5px; line-height: 1.5; }

.bk-restore-info { padding: 14px 16px; }
.bk-restore-when { font-size: 15px; font-weight: 600; color: var(--text-bright); margin-bottom: 6px; }
.bk-restore-zb .row-label b { font-size: 14px; }

/* Libraries → Cloud backups entry + hub picker */
.lib-card-action { cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.lib-card-action:hover { border-color: var(--border-medium); transform: translateY(-1px); }
.lib-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.lib-chev { margin-left: auto; color: var(--text-hint); width: 18px; height: 18px; }
.bk-hublist { display: flex; flex-direction: column; gap: 8px; }
.bk-hubrow {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 14px; text-align: left;
  transition: background .13s ease, border-color .13s ease;
}
.bk-hubrow:hover { background: var(--surface-hover); border-color: var(--border-medium); }
.bk-hubrow-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: color-mix(in srgb, var(--clr-cloud) 15%, transparent); color: var(--clr-cloud); }
.bk-hubrow-ico .lucide { width: 17px; height: 17px; }
.bk-hubrow-name { flex: 1; font-weight: 550; }
.bk-hubrow-chev { color: var(--text-hint); width: 17px; height: 17px; }

/* ── Cloud-backups overview overlay (§9) — full surface: filter, sort, group ── */
.bkov-ov { position: fixed; inset: 0; z-index: 1000; display: flex; justify-content: center;
  background: var(--surface-overlay, rgba(10,12,16,.55)); backdrop-filter: blur(6px);
  animation: bkov-fade .18s ease; overflow: auto; }
@keyframes bkov-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes bkov-rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
.bkov-panel { width: min(760px, 100%); min-height: 100%; background: var(--surface-elevated);
  display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.5); }
@media (min-width: 780px) { .bkov-panel { min-height: auto; margin: 32px 0; border-radius: var(--radius-sheet);
  max-height: calc(100vh - 64px); border: 1px solid var(--border-light);
  animation: bkov-rise .24s cubic-bezier(.2,.8,.3,1); }
  /* The sticky header paints its own background — round it with the panel, or it fills the corner
   * pixels the panel's radius clips and the corners read as square against the backdrop. */
  .bkov-head { border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; } }
@media (prefers-reduced-motion: reduce) { .bkov-ov, .bkov-panel { animation: none; } }
/* Header: a whisper of accent as a top wash, so the sheet has a "surface" rather than a flat edge. */
.bkov-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 15px;
  border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 2;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--clr-cloud) 8%, transparent), transparent 60%),
    var(--surface-elevated); }
.bkov-back { width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; cursor: pointer;
  display: grid; place-items: center; border: 1px solid var(--border-light);
  background: var(--surface-sunken); color: var(--text-soft);
  transition: background .13s ease, color .13s ease, border-color .13s ease; }
.bkov-back:hover { background: var(--surface-hover); color: var(--text-bright); border-color: var(--border-medium); }
.bkov-title { flex: 1 1 auto; min-width: 0; }
.bkov-title h2 { margin: 0; font-size: 20px; font-weight: 680; color: var(--text-bright); display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.bkov-titleico { width: 22px; height: 22px; color: var(--clr-cloud); flex: 0 0 auto; }
/* Close (x): desktop-only dismiss, mirrors the sheet-close round button. Mobile hides it — the
   full-screen sheet is dismissed with the leading back arrow instead. */
.bkov-close { display: none; flex-shrink: 0; margin-left: 6px;
  width: 38px; height: 38px; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--border-light); border-radius: 50%;
  background: var(--surface-sunken); color: var(--text-soft);
  transition: background .13s ease, color .13s ease, border-color .13s ease; }
.bkov-close:hover { background: var(--surface-hover); color: var(--text-bright); border-color: var(--border-medium); }
.bkov-close:focus-visible { outline: 2px solid color-mix(in srgb, var(--clr-accent) 60%, transparent); outline-offset: 2px; }
.bkov-close .lucide { width: 19px; height: 19px; }
/* Desktop is a centred dialog → dismiss with the close (x) on the right; mobile keeps the leading
   back arrow. This block sits AFTER the base .bkov-back/.bkov-close rules so it wins the cascade
   (a media query adds no specificity — only source order). */
@media (min-width: 780px) {
  .bkov-back { display: none; }
  .bkov-close { display: inline-flex; }
}
.bkov-summary { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.bkov-toolbar { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle); position: sticky; top: 71px; background: var(--surface-1); z-index: 1; }
.bkov-filtrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bkov-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.bkov-chip { border: 1px solid var(--border-subtle); background: var(--surface-sunken);
  color: var(--text-soft); padding: 6px 13px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 550; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.bkov-chip:hover { background: var(--surface-hover); border-color: var(--border-strong, var(--border-subtle));
  color: var(--text-primary); }
.bkov-chip.is-on { background: color-mix(in srgb, var(--clr-accent) 16%, transparent);
  color: var(--clr-accent); border-color: color-mix(in srgb, var(--clr-accent) 40%, transparent); }
.bkov-chip:focus-visible, .bkov-sort select:focus-visible, .bkov-back:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--clr-accent) 60%, transparent); outline-offset: 2px; }
.bkov-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
/* Fully styled select: no system chrome, own chevron (mask so it follows the text color). */
.bkov-sort select { appearance: none; -webkit-appearance: none;
  background: var(--surface-sunken); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: 999px; padding: 7px 30px 7px 13px;
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background .12s ease, border-color .12s ease; }
.bkov-sort select:hover { background: var(--surface-hover); border-color: var(--border-strong, var(--border-subtle)); }
.bkov-sort { position: relative; }
.bkov-sort::after { content: ''; position: absolute; right: 11px; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%); pointer-events: none; background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.bkov-body { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 26px; overflow: auto; }
.bkov-group { display: flex; flex-direction: column; gap: 11px; }
.bk-list { display: flex; flex-direction: column; gap: 10px; }
/* Section header: hub name in a tinted router chip + a count·size pill, on a hairline that spans the
   width so each hub reads as its own block. Sticks just under the toolbar while its cards scroll. */
.bkov-grouphead { display: flex; align-items: center; gap: 10px; padding: 3px 2px 9px;
  border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 1;
  background: linear-gradient(180deg, var(--surface-elevated) 70%, transparent); }
.bkov-groupname { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 680; color: var(--text-bright); letter-spacing: -.01em; }
.bkov-groupname .lucide { width: 15px; height: 15px; color: var(--clr-cloud);
  padding: 5px; box-sizing: content-box; border-radius: 8px;
  background: color-mix(in srgb, var(--clr-cloud) 14%, transparent); }
.bkov-groupcount { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-chip); border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.bk-card-hub { display: inline-flex; align-items: center; gap: 4px; }
.bk-card-hub .lucide { width: 12px; height: 12px; }
