/* ============================================================
   Headscale Admin — Design System
   Clean & technical developer tool. IBM Plex. Violet accent.
   ============================================================ */

:root {
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Light theme */
  --bg: #f5f5f7;
  --bg-grid: rgba(20, 20, 30, 0.028);
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --surface-3: #e8e8ee;
  --border: #e5e5ea;
  --border-strong: #d4d4dc;
  --text: #16161a;
  --text-dim: #66666f;
  --text-faint: #9a9aa6;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.10);
  --accent-line: rgba(124, 58, 237, 0.28);
  --accent-fg: #ffffff;
  --online: #15a34a;
  --online-soft: rgba(21, 163, 74, 0.12);
  --offline: #a0a0ac;
  --warn: #b8730a;
  --warn-soft: rgba(184, 115, 10, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --info: #0e7490;
  --info-soft: rgba(14, 116, 144, 0.12);
  --shadow-sm: 0 1px 2px rgba(15, 15, 25, 0.05), 0 1px 1px rgba(15, 15, 25, 0.03);
  --shadow-md: 0 4px 16px -4px rgba(15, 15, 25, 0.12), 0 2px 6px -2px rgba(15, 15, 25, 0.07);
  --shadow-lg: 0 24px 60px -12px rgba(15, 15, 25, 0.26), 0 8px 20px -8px rgba(15, 15, 25, 0.14);
  --map-bg: #eeeef2;
  --map-link: rgba(124, 58, 237, 0.24);
}

[data-theme="dark"] {
  --bg: #09090b;
  --bg-grid: rgba(255, 255, 255, 0.022);
  --surface: #141418;
  --surface-2: #1b1b21;
  --surface-3: #25252d;
  --border: #26262e;
  --border-strong: #36363f;
  --text: #f3f3f5;
  --text-dim: #9c9caa;
  --text-faint: #646474;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --accent-line: rgba(139, 92, 246, 0.36);
  --accent-fg: #ffffff;
  --online: #2bd96f;
  --online-soft: rgba(43, 217, 111, 0.14);
  --offline: #55555f;
  --warn: #e0a93a;
  --warn-soft: rgba(224, 169, 58, 0.14);
  --danger: #f06363;
  --danger-soft: rgba(240, 99, 99, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 22px -6px rgba(0, 0, 0, 0.6), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 70px -16px rgba(0, 0, 0, 0.75), 0 10px 26px -10px rgba(0, 0, 0, 0.6);
  --map-bg: #0e0e13;
  --map-link: rgba(139, 92, 246, 0.32);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { height: 100%; }
::selection { background: var(--accent-soft); color: var(--text); }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

.mono { font-family: var(--font-mono); }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100%; overflow: hidden; }

.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; z-index: 30; }

.sb-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.sb-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), color-mix(in oklab, var(--accent), #ff63b8 55%));
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  box-shadow: 0 3px 10px -2px var(--accent-line);
}
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-text b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.sb-brand-text span { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

.sb-server {
  margin: 2px 12px 8px; padding: 9px 11px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  display: flex; align-items: center; gap: 9px; font-size: 12px; cursor: pointer;
  transition: border-color .15s var(--ease);
}
.sb-server:hover { border-color: var(--border-strong); }
.sb-server-meta { min-width: 0; line-height: 1.3; flex: 1; }
.sb-server-meta b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-server-meta span { color: var(--text-faint); font-family: var(--font-mono); font-size: 10.5px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 1px; }
.sb-section-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 600; padding: 13px 10px 5px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md);
  color: var(--text-dim); cursor: pointer; font-size: 13.5px; font-weight: 450; position: relative;
  transition: background .13s var(--ease), color .13s var(--ease); user-select: none;
}
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.sb-item.active svg { opacity: 1; }
.sb-item .count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  background: var(--surface-2); padding: 1px 6px; border-radius: 99px; min-width: 22px; text-align: center;
}
.sb-item:hover .count { background: var(--surface-3); }
.sb-item.active .count { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }

.sb-foot { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.sb-user { display: flex; align-items: center; gap: 9px; padding: 4px 4px; }
.sb-user .avatar { width: 28px; height: 28px; border-radius: 99px; flex-shrink: 0; }
.sb-user-meta { min-width: 0; line-height: 1.25; flex: 1; }
.sb-user-meta b { font-size: 12.5px; font-weight: 550; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-meta span { font-size: 11px; color: var(--text-faint); }

/* Main */
.main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg);
  background-image: radial-gradient(var(--bg-grid) 1px, transparent 1px); background-size: 22px 22px;
}
.topbar {
  height: 57px; flex-shrink: 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; background: color-mix(in oklab, var(--surface) 72%, transparent);
  backdrop-filter: blur(10px); position: relative; z-index: 20;
}
.tb-title { display: flex; flex-direction: column; line-height: 1.2; }
.tb-title h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.tb-title .crumb { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); }
.tb-spacer { flex: 1; }
.tb-search {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 11px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-faint); cursor: text; font-size: 13px; min-width: 220px; transition: border-color .15s;
}
.tb-search:hover { border-color: var(--border-strong); }
.tb-search svg { width: 15px; height: 15px; }
.tb-search .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; line-height: 1.5;
}

.content { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.page { max-width: 1320px; margin: 0 auto; padding: 26px 30px 80px; }
.page.wide { max-width: 1600px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: background .14s var(--ease), border-color .14s, transform .08s, box-shadow .14s;
  user-select: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-fg); box-shadow: 0 1px 2px var(--accent-line); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   Badges / chips / tags
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px;
  border-radius: 99px; font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex-shrink: 0; }
.badge.online { color: var(--online); background: var(--online-soft); }
.badge.offline { color: var(--text-dim); background: var(--surface-2); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.tag.muted { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.tag .x { cursor: pointer; opacity: .6; display: inline-flex; }
.tag .x:hover { opacity: 1; }

.dot-status { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; display: inline-block; position: relative; }
.dot-status.online { background: var(--online); }
.dot-status.online::after { content: ""; position: absolute; inset: -3px; border-radius: 99px; border: 1.5px solid var(--online); opacity: .4; }
.dot-status.offline { background: var(--offline); }
.dot-status.warn { background: var(--warn); }

/* ============================================================
   Cards / panels
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 7px; margin-bottom: 9px; font-weight: 500; }
.stat .label svg { width: 15px; height: 15px; opacity: .75; }
.stat .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-family: var(--font-mono); }
.stat .value .unit { font-size: 14px; color: var(--text-faint); font-weight: 500; margin-left: 3px; }
.stat .delta { font-size: 11.5px; margin-top: 8px; display: flex; align-items: center; gap: 5px; color: var(--text-faint); }
.stat .delta b { font-weight: 600; }
.stat .delta.up b { color: var(--online); }
.stat .delta.down b { color: var(--danger); }
.stat .spark { position: absolute; right: 14px; top: 14px; opacity: .9; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.section-head .sub { font-size: 12.5px; color: var(--text-faint); }
.section-head .spacer { flex: 1; }

/* ============================================================
   Tables
   ============================================================ */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl-toolbar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 550; color: var(--text-dim); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0; z-index: 2; cursor: default; user-select: none;
}
table.tbl th.sortable { cursor: pointer; }
table.tbl th.sortable:hover { color: var(--text); }
table.tbl th .arrow { opacity: .55; margin-left: 3px; font-size: 10px; }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; cursor: pointer; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr.sel { background: var(--accent-soft); }
.cell-main { font-weight: 550; display: flex; align-items: center; gap: 9px; }
.cell-sub { color: var(--text-faint); font-size: 12px; font-family: var(--font-mono); }
.ip { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.checkbox {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong);
  background: var(--surface); cursor: pointer; flex-shrink: 0; display: inline-grid; place-items: center; transition: .12s;
}
.checkbox.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.checkbox svg { width: 11px; height: 11px; opacity: 0; }
.checkbox.on svg { opacity: 1; }

.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }

/* selection bar */
.sel-bar {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-line); font-size: 13px;
}
.sel-bar b { color: var(--accent); }

/* ============================================================
   Inputs
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 550; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-faint); }
.input, .select, .textarea {
  height: 36px; padding: 0 11px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); color: var(--text); font-size: 13.5px; width: 100%; transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input.mono, .textarea.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* compact table density */
.tbl.compact th { padding: 6px 12px; font-size: 10.5px; }
.tbl.compact td { padding: 5px 12px; }
.tbl.compact .cell-main { font-size: 12.5px; gap: 6px; }
.tbl.compact .cell-sub { display: none; }
.tbl.compact .avatar-c { width: 18px !important; height: 18px !important; }

.toggle { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer; position: relative; transition: background .16s var(--ease), border-color .16s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s var(--ease); }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(16px); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border: none; background: transparent; color: var(--text-dim); font-size: 12.5px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: .13s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============================================================
   Menus / dropdowns
   ============================================================ */
.menu {
  position: absolute; min-width: 188px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 5px; z-index: 200;
  animation: menuIn .14s var(--ease-out);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.menu-item svg { width: 15px; height: 15px; opacity: .75; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item .meta { margin-left: auto; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.menu-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 7px 9px 4px; font-weight: 600; }

/* ============================================================
   Modal
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 14, 0.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 500; padding: 24px; animation: fadeIn .16s var(--ease);
}
[data-theme="dark"] .overlay { background: rgba(0,0,0,.62); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  animation: modalIn .22s var(--ease-out); overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 960px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head .mh-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.modal-head .mh-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-head .mh-text { flex: 1; min-width: 0; }
.modal-head h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head p { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.modal-head .x { cursor: pointer; color: var(--text-faint); padding: 4px; border-radius: 6px; display: flex; }
.modal-head .x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.modal-foot { display: flex; align-items: center; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }

/* ============================================================
   Toast
   ============================================================ */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 700; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  min-width: 290px; max-width: 380px; animation: toastIn .26s var(--ease-out);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px) scale(.96); } to { opacity: 1; transform: none; } }
.toast .t-icon { width: 20px; height: 20px; flex-shrink: 0; display: grid; place-items: center; margin-top: 1px; }
.toast.success .t-icon { color: var(--online); }
.toast.error .t-icon { color: var(--danger); }
.toast.info .t-icon { color: var(--accent); }
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-body b { font-size: 13px; font-weight: 600; display: block; }
.toast .t-body span { font-size: 12px; color: var(--text-dim); }
.toast .t-x { color: var(--text-faint); cursor: pointer; display: flex; }
.toast .t-x:hover { color: var(--text); }

/* ============================================================
   Command palette
   ============================================================ */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(10,10,14,.4); backdrop-filter: blur(4px); z-index: 800; display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; animation: fadeIn .14s; }
[data-theme="dark"] .cmdk-overlay { background: rgba(0,0,0,.6); }
.cmdk { width: 100%; max-width: 580px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .2s var(--ease-out); }
.cmdk-input { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 18px; height: 18px; color: var(--text-faint); }
.cmdk-input input { border: none; background: none; outline: none; flex: 1; font-size: 15px; }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 7px; }
.cmdk-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 9px 9px 4px; font-weight: 600; }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-md); cursor: pointer; font-size: 13.5px; }
.cmdk-item svg { width: 16px; height: 16px; opacity: .7; }
.cmdk-item.active { background: var(--accent-soft); color: var(--accent); }
.cmdk-item.active svg { opacity: 1; }
.cmdk-item .meta { margin-left: auto; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

/* ============================================================
   Misc
   ============================================================ */
.empty { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty svg { width: 38px; height: 38px; opacity: .4; margin-bottom: 12px; }
.empty h3 { font-size: 15px; color: var(--text-dim); font-weight: 600; margin-bottom: 4px; }
.divider { height: 1px; background: var(--border); margin: 0; }
.code-inline { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }
.copy-btn { cursor: pointer; color: var(--text-faint); display: inline-flex; padding: 3px; border-radius: 5px; transition: .12s; }
.copy-btn:hover { color: var(--text); background: var(--surface-2); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-up { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .fade-up { animation: fadeUp .4s var(--ease-out); }
}
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: none; } }

.avatar-c { border-radius: 99px; display: grid; place-items: center; color: #fff; font-weight: 600; flex-shrink: 0; font-size: 12px; }

/* Responsive */
.sb-toggle { display: none; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; transform: translateX(-100%); transition: transform .24s var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; animation: fadeIn .16s; }
  .sb-toggle { display: inline-flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tb-search { min-width: 0; }
  .tb-search .label-txt, .tb-search .kbd { display: none; }
}
@media (max-width: 640px) {
  .page { padding: 18px 16px 60px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hide-sm { display: none !important; }
}
