/* ============================================================================
   Supervue design system
   Light-first, UniFi-inspired. Dark mode via prefers-color-scheme + an explicit
   data-theme override on <html> (set by the topbar toggle). All legacy CSS
   variable names are preserved so every template lifts from this one file.
   ============================================================================ */

:root {
  /* Surfaces */
  --bg:        #f5f6f8;   /* page */
  --bg-base:   #ffffff;   /* raised cards/surfaces */
  --bg-raised: #ffffff;
  --bg-sunken: #f1f3f6;   /* inputs, table headers */
  --bg-hover:  #eef1f5;   /* row/nav hover */

  /* Lines */
  --line:      #e4e8ee;
  --line-soft: #eef1f5;

  /* Text */
  --text:      #1b2430;
  --text-soft: #5c6875;
  --text-faint:#8b96a3;

  /* Brand accent (UniFi-style blue) */
  --accent:     #1f6fe5;
  --accent-hover:#1a61cc;
  --accent-dim: #e9f1fe;   /* soft tint for active/focus backgrounds */
  --on-accent:  #ffffff;

  /* Status */
  --ok:      #17915a;  --ok-soft:  #e6f5ec;
  --rec:     #e0433f;  --rec-soft: #fdeceb;
  --warn:    #c47d05;  --warn-soft:#fbf1de;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(20,28,40,.06), 0 1px 3px rgba(20,28,40,.05);
  --shadow-md: 0 4px 12px rgba(20,28,40,.08), 0 2px 4px rgba(20,28,40,.05);
  --shadow-lg: 0 16px 40px rgba(20,28,40,.16), 0 4px 12px rgba(20,28,40,.08);

  /* Shape + rhythm */
  --r-sm: 6px;  --r-md: 9px;  --r-lg: 13px;  --r-pill: 999px;
  --nav-w: 236px;
  --content-max: 1240px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter",
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg:        #0e1116;
    --bg-base:   #171b22;
    --bg-raised: #171b22;
    --bg-sunken: #12161c;
    --bg-hover:  #1f242d;
    --line:      #272d37;
    --line-soft: #1c222a;
    --text:      #e7ecf2;
    --text-soft: #9aa5b2;
    --text-faint:#69737f;
    --accent:     #4f97e8;
    --accent-hover:#63a5ee;
    --accent-dim: #16273c;
    --on-accent:  #06121f;
    --ok:      #3fbf82;  --ok-soft:  #12281e;
    --rec:     #eb5a54;  --rec-soft: #2c1514;
    --warn:    #e0a63e;  --warn-soft:#2c2210;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 16px rgba(0,0,0,.45);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
  }
}
/* Explicit dark toggle (wins over media query) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#0e1116; --bg-base:#171b22; --bg-raised:#171b22; --bg-sunken:#12161c; --bg-hover:#1f242d;
  --line:#272d37; --line-soft:#1c222a;
  --text:#e7ecf2; --text-soft:#9aa5b2; --text-faint:#69737f;
  --accent:#4f97e8; --accent-hover:#63a5ee; --accent-dim:#16273c; --on-accent:#06121f;
  --ok:#3fbf82; --ok-soft:#12281e; --rec:#eb5a54; --rec-soft:#2c1514; --warn:#e0a63e; --warn-soft:#2c2210;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow-md:0 6px 16px rgba(0,0,0,.45); --shadow-lg:0 20px 50px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-dim); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-faint) 45%, transparent); border-radius: var(--r-pill); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-faint) 70%, transparent); }

/* ---- App shell -------------------------------------------------------------
   minmax(0,1fr) is the fix for the horizontal-overflow bug: without it a wide
   child (table, full-width row) blows the grid column past the viewport. */
.app-shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--bg-base); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.sidebar .brand .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim); flex-shrink: 0;
}
.sidebar .brand span {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  text-transform: none; color: var(--text);
}
.nav-group { margin-bottom: 14px; }
.nav-label {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint);
  padding: 0 10px; margin: 6px 0 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); color: var(--text-soft); font-size: 13.5px;
  font-weight: 500; border-left: none; margin: 1px 0; transition: background .12s, color .12s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.main { display: flex; flex-direction: column; min-width: 0; overflow-x: hidden; }
.topbar {
  height: 60px; flex-shrink: 0; border-bottom: 1px solid var(--line);
  background: var(--bg-base); display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 10;
}
.topbar-spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 12px;
  border-left: 1px solid var(--line); cursor: pointer; border-radius: var(--r-sm);
}
.user-chip:hover { background: var(--bg-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #7c4dff));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ---- Content + typography -------------------------------------------------- */
.content { padding: 26px 30px 44px; width: 100%; max-width: var(--content-max); margin: 0 auto; }
.eyebrow {
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 5px;
}
h1 { font-size: 22px; margin: 0; font-weight: 680; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 14.5px; font-weight: 650; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--text-faint); }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 600; font-size: 13px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; padding: 8px 14px; white-space: nowrap; font-family: var(--font-sans);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg-base); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.btn-danger { background: var(--rec); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---- Forms ----------------------------------------------------------------- */
label { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; font-weight: 500; }
.field { margin-bottom: 16px; }
input[type=text], input[type=password], input[type=number], input[type=time],
input[type=email], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--bg-base); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: var(--r-sm); font-size: 13.5px; font-family: var(--font-sans);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
input:disabled, select:disabled { background: var(--bg-sunken); color: var(--text-soft); cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .row2, .row3 { grid-template-columns: 1fr; } }

/* ---- Tables ---------------------------------------------------------------- */
.table-card { background: var(--bg-base); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-card > table, .table-scroll { display: block; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead, tbody, tr { width: 100%; }
th {
  text-align: left; background: var(--bg-sunken); color: var(--text-faint); font-weight: 600;
  font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; font-family: var(--font-sans);
  padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ---- Status pills + dots --------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans);
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--bg-sunken); color: var(--text-soft);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: var(--bg-sunken); color: var(--text-faint); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-remote { background: var(--accent-dim); color: var(--accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-off { background: var(--text-faint); }

/* ---- Cards / stat tiles ---------------------------------------------------- */
.card, .form-card, .settings-card {
  background: var(--bg-base); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 18px;
}
.stat-tile { background: var(--bg-base); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.stat-tile .k { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.stat-tile .v { font-size: 20px; font-weight: 680; letter-spacing: -0.01em; margin-top: 4px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* ---- Modals ---------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,28,40,.42); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 30;
}
.overlay.hidden { display: none; }
.modal { background: var(--bg-base); border: 1px solid var(--line); border-radius: var(--r-lg); width: 560px; max-width: 100%; box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .x { color: var(--text-faint); cursor: pointer; font-size: 18px; background: none; border: none; line-height: 1; padding: 4px; border-radius: var(--r-sm); }
.modal-head .x:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---- Banners / empty states ------------------------------------------------ */
.error-banner { background: var(--rec-soft); color: var(--rec); border: 1px solid color-mix(in srgb, var(--rec) 35%, transparent); border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px; margin-bottom: 16px; display: none; }
.error-banner.visible { display: block; }
.empty-state { padding: 44px 16px; text-align: center; color: var(--text-faint); font-size: 13.5px; }

/* ---- Video surfaces (stay dark in both themes, like UniFi Protect) --------- */
.vwall { display: grid; grid-template-columns: repeat(var(--wall-cols, 2), minmax(0, 1fr)); gap: 14px; align-content: start; }
/* A single camera shouldn't stretch edge-to-edge or float in a void —
   cap it to a comfortable width and centre it. */
.vwall.solo { max-width: 940px; margin: 0 auto; }
.vtile { position: relative; aspect-ratio: 16/9; border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; background: #0b0e12; box-shadow: var(--shadow-sm); }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0b0e12; }
.vtile .live-tag { position: absolute; top: 9px; left: 9px; display: flex; align-items: center; gap: 5px; z-index: 2; }
.vtile .live-tag .d { width: 6px; height: 6px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 6px 1px rgba(224,67,63,.7); }
.vtile .live-tag span { font-size: 11px; font-weight: 600; color: #f0f3f6; letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.vtile .cam-label { position: absolute; bottom: 9px; left: 10px; z-index: 2; font-size: 12px; font-weight: 500; color: #f0f3f6; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.vtile .cam-status { position: absolute; bottom: 9px; right: 10px; z-index: 2; }
.vtile.offline { display: flex; align-items: center; justify-content: center; }
.vtile.offline .off-msg { font-size: 12.5px; color: #8b96a3; text-align: center; }
.vtile a { position: absolute; inset: 0; z-index: 3; }

.stage { background: #0b0e12; border: 1px solid var(--line); border-radius: var(--r-lg); position: relative; overflow: hidden; aspect-ratio: 16/9; box-shadow: var(--shadow-md); }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage .live-tag { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 6px; z-index: 2; }
.stage .live-tag .d { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 8px 1px rgba(224,67,63,.7); }
.stage .live-tag span { font-size: 12px; font-weight: 600; color: #f0f3f6; letter-spacing: .03em; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.stage .off-msg { color: #8b96a3; font-size: 13px; }

/* ---- Small helpers --------------------------------------------------------- */
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.toggle input { margin: 0; }

/* ---- Sidebar nav icons (keyed by href; inherit nav item color via mask) ---- */
.nav-item::before {
  content: ''; width: 17px; height: 17px; flex-shrink: 0; background: currentColor;
  -webkit-mask: var(--i, none) center / contain no-repeat; mask: var(--i, none) center / contain no-repeat;
  opacity: .8;
}
.nav-item.active::before { opacity: 1; }
.nav-item[href="/live"]      { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m10 9 5 3-5 3z'/%3E%3C/svg%3E"); }
.nav-item[href="/dashboard"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9'/%3E%3Crect x='14' y='3' width='7' height='5'/%3E%3Crect x='14' y='12' width='7' height='9'/%3E%3Crect x='3' y='16' width='7' height='5'/%3E%3C/svg%3E"); }
.nav-item[href="/playback"]  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E"); }
.nav-item[href="/analytics"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Crect x='7' y='12' width='3' height='6'/%3E%3Crect x='12' y='8' width='3' height='10'/%3E%3Crect x='17' y='4' width='3' height='14'/%3E%3C/svg%3E"); }
.nav-item[href="/ai-search"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3Cpath d='M11 8v6M8 11h6' opacity='.6'/%3E%3C/svg%3E"); }
.nav-item[href="/cameras"]   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E"); }
.nav-item[href="/map"]       { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E"); }
.nav-item[href="/sites"]     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Cpath d='M9 22v-4h6v4M8 6h.01M12 6h.01M16 6h.01M8 10h.01M12 10h.01M16 10h.01M8 14h.01M12 14h.01M16 14h.01'/%3E%3C/svg%3E"); }
.nav-item[href="/agents"]    { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='20' height='8' rx='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2'/%3E%3Cpath d='M6 6h.01M6 18h.01'/%3E%3C/svg%3E"); }
.nav-item[href="/devices"]   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E"); }
.nav-item[href="/users"]     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.nav-item[href="/audit"]     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M8 13h8M8 17h8M8 9h2'/%3E%3C/svg%3E"); }
.nav-item[href="/settings"]  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }
.nav-item[href="/api-docs"]  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 18 6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E"); }

/* ---- Theme toggle icon (in the topbar via shell.js) ------------------------ */
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle { transition: color .15s, background .15s; }

/* ---- Segmented control (Live View density, etc.) --------------------------- */
.seg { display: inline-flex; background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { border: none; background: none; color: var(--text-soft); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: var(--r-sm); cursor: pointer; line-height: 1; transition: color .12s, background .12s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--bg-base); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .seg-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); padding: 5px 6px 5px 8px; align-self: center; pointer-events: none; }

/* ---- Rich empty state (icon + copy + CTA) --------------------------------- */
.empty-rich { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--bg-base); }
.empty-rich .ico { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-dim); color: var(--accent); }
.empty-rich .ico svg { width: 24px; height: 24px; }
.empty-rich h3 { margin: 2px 0 0; font-size: 15px; }
.empty-rich p { margin: 0; color: var(--text-soft); font-size: 13px; max-width: 360px; }
.empty-rich .btn { margin-top: 6px; }
