/* ============================================================================
   NFF Internal — UI System
   Linear/Notion 系の業務密度ミニマル。絵文字なし。typography 主導。
   ============================================================================ */

/* ── Design tokens ─────────────────────────────────────────────────────────── */

:root {
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Hiragino Kaku Gothic ProN",
               "Yu Gothic Medium", "Meiryo", system-ui, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --lh-tight: 1.25;
  --lh-base: 1.5;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Color: grays (neutral) */
  --c-bg: #fafafa;
  --c-bg-card: #ffffff;
  --c-bg-hover: #f5f5f7;
  --c-bg-active: #ececef;
  --c-border: #e5e5e7;
  --c-border-strong: #d4d4d8;
  --c-text: #18181b;
  --c-text-muted: #71717a;
  --c-text-subtle: #a1a1aa;

  /* Color: brand & semantic */
  --c-accent: #2563eb;
  --c-accent-hover: #1d4ed8;
  --c-accent-bg: #eff6ff;
  --c-success: #15803d;
  --c-success-bg: #f0fdf4;
  --c-warning: #b45309;
  --c-warning-bg: #fffbeb;
  --c-danger: #b91c1c;
  --c-danger-bg: #fef2f2;
  --c-info: #1e40af;
  --c-info-bg: #eff6ff;

  /* Sidebar (dark) */
  --c-side-bg: #18181b;
  --c-side-bg-hover: #27272a;
  --c-side-bg-active: #3f3f46;
  --c-side-text: #d4d4d8;
  --c-side-text-muted: #71717a;
  --c-side-border: #27272a;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Radius */
  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;

  /* Layout */
  --sidebar-w: 220px;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
* { font-variant-numeric: tabular-nums; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--c-text);
  letter-spacing: -0.005em;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-muted); }

p { margin: 0; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--c-border); margin: var(--s-4) 0; }

::selection { background: var(--c-accent-bg); color: var(--c-accent); }

.icon {
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}

/* ── App shell ─────────────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* モバイル: sidebar を隠して main を全幅 */
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: var(--s-3); max-width: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--c-border);
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-3);
  }
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */

.sidebar {
  background: var(--c-side-bg);
  color: var(--c-side-text);
  display: flex;
  flex-direction: column;
  padding: var(--s-3) 0;
  font-size: var(--fs-sm);
  border-right: 1px solid var(--c-side-border);
}
.sidebar-brand {
  font-weight: 700;
  font-size: var(--fs-md);
  color: #fff;
  padding: 0 var(--s-4) var(--s-2);
  letter-spacing: -0.01em;
}
.sidebar-who {
  color: var(--c-side-text-muted);
  padding: 0 var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--c-side-border);
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 var(--s-2); }
.sidebar-group-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-side-text-muted);
  padding: var(--s-3) var(--s-2) var(--s-1);
}
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  color: var(--c-side-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 80ms;
}
.sidebar-nav a:hover { background: var(--c-side-bg-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--c-side-bg-active); color: #fff; }
.sidebar-nav a .icon { color: var(--c-side-text-muted); }
.sidebar-nav a:hover .icon, .sidebar-nav a.active .icon { color: #fff; }
.sidebar-foot {
  border-top: 1px solid var(--c-side-border);
  padding: var(--s-2);
  margin-top: var(--s-3);
}
.sidebar-foot form { margin: 0; }
.sidebar-foot button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--c-side-border);
  color: var(--c-side-text-muted);
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}
.sidebar-foot button:hover { background: var(--c-side-bg-hover); color: #fff; }

/* ── Main content ──────────────────────────────────────────────────────────── */

.main {
  padding: var(--s-5) var(--s-6) var(--s-8);
  width: 100%;
  /* デフォルトは reading-friendly な 960px — ページ全体の上限 */
  max-width: 960px;
}

/* 各セクションでさらに narrower にしたいときに使う */
.measure-sm { max-width: 480px; }
.measure    { max-width: 720px; }   /* フォーム 1 ブロックの上限 */
.measure-md { max-width: 960px; }   /* デフォルト同等 */
/* テーブルなど wide なものだけ outset で広げる */
.outset-lg { margin-left: calc(50% - 600px); margin-right: calc(50% - 600px); max-width: 1200px; }
.outset-xl { margin-left: calc(50% - 720px); margin-right: calc(50% - 720px); max-width: 1440px; }
@media (max-width: 1280px) {
  .outset-lg, .outset-xl { margin-left: 0; margin-right: 0; max-width: none; }
}

/* ── Page header ──────────────────────────────────────────────────────────── */

.page-header { margin-bottom: var(--s-5); }
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-bottom: var(--s-2);
}
.breadcrumbs a { color: var(--c-text-muted); }
.breadcrumbs a:hover { color: var(--c-text); }
.breadcrumbs .current { color: var(--c-text); }
.breadcrumb-sep { color: var(--c-text-subtle); display: inline-flex; }
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}
.page-title { font-size: var(--fs-2xl); margin: 0; }
.page-subtitle {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-top: var(--s-1);
}
.page-actions { display: flex; gap: var(--s-2); align-items: center; }

/* ── Section ───────────────────────────────────────────────────────────────── */

.section { margin-bottom: var(--s-6); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
  gap: var(--s-4);
}
.section-title { font-size: var(--fs-md); font-weight: 600; }
.section-subtitle {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-top: 2px;
}
.section-actions { display: flex; gap: var(--s-2); }

/* ── Card / Panel ──────────────────────────────────────────────────────────── */

.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.card-tight { padding: var(--s-3); }

.panel {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-3);
}
.panel-header {
  padding: var(--s-2) var(--s-3);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
  font-size: var(--fs-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  color: var(--c-text);
}
.panel-body { padding: var(--s-3); }
.panel-footer {
  padding: var(--s-2) var(--s-3);
  background: var(--c-bg);
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

/* ── KPI ───────────────────────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); }
}
.kpi {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: block;
  color: var(--c-text);
  transition: border-color 80ms, box-shadow 80ms;
}
a.kpi:hover { border-color: var(--c-border-strong); text-decoration: none; box-shadow: var(--shadow-sm); }
.kpi-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  font-weight: 500;
}
.kpi-value {
  font-size: var(--fs-2xl);
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  margin-top: 2px;
}
.kpi-danger .kpi-value { color: var(--c-danger); }
.kpi-success .kpi-value { color: var(--c-success); }
.kpi-warning .kpi-value { color: var(--c-warning); }
.kpi-accent .kpi-value { color: var(--c-accent); }

/* ── Forms ─────────────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text);
  margin-bottom: 4px;
}
label.inline {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  margin-bottom: 0;
  font-weight: 400;
}
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  padding: 6px 10px;
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 80ms, box-shadow 80ms;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-bg);
}
input[type="checkbox"], input[type="radio"] {
  margin: 0 6px 0 0;
  cursor: pointer;
  vertical-align: -2px;
}

fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3) var(--s-3);
  margin: 0;
}
legend {
  padding: 0 var(--s-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  align-items: flex-end;
}
.form-row > label { flex: 1; min-width: 120px; }
.form-row > label.w-xs { flex: 0 0 80px; min-width: 80px; }
.form-row > label.w-sm { flex: 0 0 110px; min-width: 110px; }
.form-row > label.w-md { flex: 0 0 200px; min-width: 200px; }
.form-row > label.w-grow { flex: 1 1 auto; min-width: 200px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: 6px 12px;
  font-size: var(--fs-sm);
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  background: var(--c-accent);
  color: #fff;
  border: 1px solid var(--c-accent);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 80ms, border-color 80ms;
}
button:hover, .btn:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); text-decoration: none; }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; background: var(--c-accent); border-color: var(--c-accent); }

button.secondary, .btn.secondary {
  background: var(--c-bg-card);
  color: var(--c-text);
  border-color: var(--c-border-strong);
}
button.secondary:hover, .btn.secondary:hover { background: var(--c-bg-hover); border-color: var(--c-border-strong); }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--c-text);
  border-color: transparent;
}
button.ghost:hover, .btn.ghost:hover { background: var(--c-bg-hover); }

button.danger, .btn.danger {
  background: var(--c-danger);
  border-color: var(--c-danger);
}
button.danger:hover, .btn.danger:hover { background: #991b1b; border-color: #991b1b; }

button.sm, .btn.sm { padding: 3px 8px; font-size: var(--fs-xs); }
button.lg, .btn.lg { padding: 8px 16px; font-size: var(--fs-md); }
button.icon-only { padding: 4px; }

.btn-group { display: inline-flex; gap: 1px; }
.btn-group > * { border-radius: 0; }
.btn-group > *:first-child { border-top-left-radius: var(--r-sm); border-bottom-left-radius: var(--r-sm); }
.btn-group > *:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }

/* ── Badge / Tag ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--r-sm);
  background: var(--c-bg-active);
  color: var(--c-text-muted);
  border: 1px solid transparent;
}
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-danger  { background: var(--c-danger-bg);  color: var(--c-danger); }
.badge-info    { background: var(--c-info-bg);    color: var(--c-info); }
.badge-accent  { background: var(--c-accent-bg);  color: var(--c-accent); }
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
  margin-bottom: var(--s-3);
}
.alert-icon { flex-shrink: 0; padding-top: 1px; }
.alert-body { flex: 1; }
.alert-info    { background: var(--c-info-bg);    color: var(--c-info);    border-color: #bfdbfe; }
.alert-success { background: var(--c-success-bg); color: var(--c-success); border-color: #bbf7d0; }
.alert-warning { background: var(--c-warning-bg); color: var(--c-warning); border-color: #fde68a; }
.alert-error   { background: var(--c-danger-bg);  color: var(--c-danger);  border-color: #fecaca; }

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-bg-card);
}
.table-toolbar {
  padding: var(--s-2) var(--s-3);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}
.table-toolbar input[type="search"] { max-width: 280px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  padding: 6px 10px;
  white-space: nowrap;
}
tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--c-bg-hover); }
tbody tr.selected td { background: var(--c-accent-bg); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--c-text-muted); }
.subtle { color: var(--c-text-subtle); }
.tiny { font-size: var(--fs-xs); }
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }

table.dense thead th { padding: 4px 8px; }
table.dense tbody td { padding: 3px 8px; }

/* ── Details / Disclosure ──────────────────────────────────────────────────── */

details.disclosure {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg-card);
  margin-bottom: var(--s-3);
}
details.disclosure > summary {
  list-style: none;
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  user-select: none;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before {
  content: "";
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--c-text-muted);
  transition: transform 100ms;
}
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > summary:hover { background: var(--c-bg-hover); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--c-border); }
details.disclosure > *:not(summary) { padding: var(--s-3); }
details.disclosure .table-wrap { border: none; border-radius: 0; }

/* ── Empty state ───────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  color: var(--c-text-muted);
}
.empty-state-icon { color: var(--c-text-subtle); margin-bottom: var(--s-2); }
.empty-state-title { font-size: var(--fs-md); font-weight: 600; color: var(--c-text); margin-bottom: var(--s-1); }
.empty-state-message { font-size: var(--fs-sm); margin-bottom: var(--s-3); }
.empty-state-action {
  display: inline-block;
  padding: 6px 12px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-sm);
  text-decoration: none;
}

/* ── HTMX states ───────────────────────────────────────────────────────────── */

.htmx-indicator { display: none !important; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-flex !important; align-items: center; gap: var(--s-1); }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  opacity: 0.6;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* HTMX request swap fade */
.htmx-swapping { opacity: 0.5; transition: opacity 200ms; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: var(--s-4);
  right: var(--s-4);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  background: var(--c-text);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  pointer-events: auto;
  min-width: 200px;
  max-width: 380px;
  animation: toast-in 180ms ease-out, toast-out 300ms ease-out 2700ms forwards;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }
.toast.info { background: var(--c-info); }
.toast.warning { background: var(--c-warning); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* ── Modal / Dialog ────────────────────────────────────────────────────────── */

dialog.modal {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0;
  background: var(--c-bg-card);
  box-shadow: var(--shadow-lg);
  width: min(480px, 90vw);
}
dialog.modal::backdrop { background: rgba(0,0,0,0.4); }
dialog.modal article { padding: 0; }
dialog.modal header {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
dialog.modal header h3 { margin: 0; font-size: var(--fs-md); }
dialog.modal .modal-close {
  background: transparent;
  border: none;
  color: var(--c-text-muted);
  padding: 4px;
  cursor: pointer;
}
dialog.modal .modal-close:hover { background: var(--c-bg-hover); color: var(--c-text); }
dialog.modal p { padding: var(--s-4); margin: 0; font-size: var(--fs-sm); }
dialog.modal footer {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}

/* ── Command palette ───────────────────────────────────────────────────────── */

.cmdk {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90vw);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  display: none;
  overflow: hidden;
}
.cmdk.open { display: block; }
.cmdk-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-md);
  outline: none;
  background: transparent;
}
.cmdk-input:focus { box-shadow: none; }
.cmdk-list {
  list-style: none;
  margin: 0;
  padding: var(--s-1) 0;
  max-height: 360px;
  overflow-y: auto;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3);
  font-size: var(--fs-sm);
  cursor: pointer;
  color: var(--c-text);
}
.cmdk-item:hover, .cmdk-item.active { background: var(--c-bg-hover); }
.cmdk-item .icon { color: var(--c-text-muted); }
.cmdk-empty {
  padding: var(--s-4);
  text-align: center;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9997;
  display: none;
}
.cmdk.open + .cmdk-backdrop,
.cmdk-backdrop.open { display: block; }
.cmdk-foot {
  border-top: 1px solid var(--c-border);
  padding: 6px var(--s-3);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  display: flex;
  gap: var(--s-3);
}
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 0 4px;
  border: 1px solid var(--c-border-strong);
  border-radius: 2px;
  background: var(--c-bg);
  color: var(--c-text-muted);
  line-height: 1.4;
}

/* ── Settings / admin sub-nav layout ──────────────────────────────────────── */

.settings-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--s-5);
  margin-top: var(--s-3);
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: var(--fs-sm);
}
.settings-nav a {
  display: block;
  padding: 5px 10px;
  color: var(--c-text);
  border-radius: var(--r-sm);
  text-decoration: none;
}
.settings-nav a:hover { background: var(--c-bg-hover); text-decoration: none; }
.settings-nav a.active { background: var(--c-bg-active); font-weight: 600; }
.settings-nav a.disabled { color: var(--c-text-subtle); cursor: not-allowed; }
.settings-nav a.disabled:hover { background: transparent; }
.settings-body { min-width: 0; }

/* ── Login ─────────────────────────────────────────────────────────────────── */

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--c-bg);
}
.login-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-6);
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-md);
}
.login-title {
  text-align: center;
  margin-bottom: var(--s-5);
  font-size: var(--fs-xl);
}
.login-card .form-row { display: block; margin-bottom: var(--s-3); }

/* ── Utility ───────────────────────────────────────────────────────────────── */

.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.row > * { margin: 0; }
.spacer { flex: 1; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mb-1 { margin-bottom: var(--s-1); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.hide { display: none; }

/* Status dots */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: 0;
}
.dot-success { background: var(--c-success); }
.dot-warning { background: var(--c-warning); }
.dot-danger  { background: var(--c-danger); }
.dot-neutral { background: var(--c-text-subtle); }
