/* ═══════════════════════════════════════════════════════════════════
   CRM Fiduciaire — Design System
   Police : Plus Jakarta Sans (Google Fonts)
   Thème défaut : Indigo Premium  |  Autres : navy, slate-teal, dark
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ─── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Tokens — Thème Indigo Premium (défaut) ─────────────────────── */
:root,
[data-theme="indigo"] {
  --sidebar-bg: #312E81;
  --sidebar-border: rgba(255,255,255,.06);
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active-bg: rgba(99,102,241,.28);
  --sidebar-active-text: #C7D2FE;
  --sidebar-text: rgba(255,255,255,.65);
  --sidebar-section: rgba(255,255,255,.35);
  --sidebar-logo: #FFFFFF;
  --sidebar-logo-sub: rgba(255,255,255,.45);
  --sidebar-w: 220px;

  --topbar-bg: #FFFFFF;
  --topbar-border: #E0E7FF;
  --topbar-h: 56px;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-fg: #FFFFFF;
  --accent-muted-bg: #EEF2FF;
  --accent-muted-text: #4338CA;

  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-hover: #F5F3FF;
  --border: #E5E7EB;
  --border-accent: #E0E7FF;
  --ring: #6366F1;

  --text: #1E1B4B;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --text-link: #6366F1;

  --success: #10B981;
  --success-bg: #D1FAE5;
  --success-text: #064E3B;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --warning-text: #78350F;
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --danger-text: #7F1D1D;
  --info: #3B82F6;
  --info-bg: #DBEAFE;
  --info-text: #1E3A8A;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ─── Thème Navy Finance ─────────────────────────────────────────── */
[data-theme="navy"] {
  --sidebar-bg: #1B2E4B;
  --sidebar-active-bg: rgba(37,99,235,.25);
  --sidebar-active-text: #93C5FD;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-muted-bg: #EFF6FF;
  --accent-muted-text: #1E40AF;
  --text: #0F172A;
  --text-link: #2563EB;
  --topbar-border: #E2E8F0;
  --border-accent: #DBEAFE;
  --surface-hover: #EFF6FF;
  --ring: #2563EB;
}

/* ─── Thème Slate + Teal ─────────────────────────────────────────── */
[data-theme="slate-teal"] {
  --sidebar-bg: #1E293B;
  --sidebar-active-bg: rgba(13,148,136,.22);
  --sidebar-active-text: #5EEAD4;
  --accent: #0D9488;
  --accent-hover: #0F766E;
  --accent-muted-bg: #F0FDFA;
  --accent-muted-text: #134E4A;
  --text: #1E293B;
  --text-link: #0D9488;
  --topbar-border: #E2E8F0;
  --border-accent: #CCFBF1;
  --surface-hover: #F0FDFA;
  --ring: #0D9488;
}

/* ─── Thème Swiss Gold ───────────────────────────────────────────── */
[data-theme="gold"] {
  --sidebar-bg: #0C1B33;
  --sidebar-active-bg: rgba(180,83,9,.18);
  --sidebar-active-text: #FCD34D;
  --accent: #B45309;
  --accent-hover: #92400E;
  --accent-muted-bg: #FFFBEB;
  --accent-muted-text: #78350F;
  --text: #111827;
  --text-link: #B45309;
  --topbar-border: #E5E7EB;
  --border-accent: #FDE68A;
  --surface-hover: #FFFBEB;
  --ring: #B45309;
}

/* ─── Base ───────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

body {
  font-family: var(--font);
  font-size: .875rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ─── Layout shell ───────────────────────────────────────────────── */
.crm-shell { display: flex; width: 100%; min-height: 100dvh; }

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  padding: 1.25rem 1.125rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo-name {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--sidebar-logo);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-logo-name svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: .9;
}
.sidebar-logo-sub {
  font-size: .6875rem;
  color: var(--sidebar-logo-sub);
  margin-top: .25rem;
  padding-left: 1.75rem;
  font-weight: 400;
}

.sidebar-nav { flex: 1; padding: .625rem 0; }

.sidebar-section {
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-section);
  padding: .875rem 1.125rem .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 1.125rem;
  color: var(--sidebar-text);
  font-size: .8125rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,.9);
  text-decoration: none;
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.nav-item svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity var(--transition);
}
.nav-item:hover svg,
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-size: .625rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-full);
  padding: .125rem .4rem;
  line-height: 1.4;
}

.sidebar-footer {
  padding: .875rem 1.125rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .625rem;
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: .6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: .75rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .625rem;
  color: rgba(255,255,255,.4);
}

/* ─── Main content area ──────────────────────────────────────────── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  gap: 1rem;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-shrink: 0;
}

/* ─── Page content ───────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 1.5rem 1.75rem;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 0 0 0 var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: .9; text-decoration: none; }

.btn-sm {
  padding: .3rem .75rem;
  font-size: .75rem;
}
.btn-lg {
  padding: .625rem 1.375rem;
  font-size: .9375rem;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-icon {
  padding: .45rem;
  border-radius: var(--radius-sm);
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}
.card-title {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
}
.card-body { padding: 1.25rem; }

/* ─── KPI Cards ──────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.kpi-value {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-delta {
  font-size: .6875rem;
  font-weight: 600;
  margin-top: .25rem;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.neutral { color: var(--text-muted); }
.kpi-icon-success { background: var(--success-bg); color: var(--success); }
.kpi-icon-warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon-danger  { background: var(--danger-bg);  color: var(--danger); }
.kpi-icon-accent  { background: var(--accent-muted-bg); color: var(--accent); }

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: var(--radius-full);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-success  { background: var(--success-bg);  color: var(--success-text); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning-text); }
.badge-danger   { background: var(--danger-bg);   color: var(--danger-text); }
.badge-info     { background: var(--info-bg);     color: var(--info-text); }
.badge-accent   { background: var(--accent-muted-bg); color: var(--accent-muted-text); }
.badge-neutral  { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ─── Table ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8125rem;
}
thead th {
  padding: .625rem 1rem;
  text-align: left;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--text); }
thead th.sort-asc::after  { content: " ↑"; }
thead th.sort-desc::after { content: " ↓"; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
tbody td {
  padding: .75rem 1rem;
  color: var(--text);
  vertical-align: middle;
}
.td-muted { color: var(--text-muted); }
.td-mono { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}
.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control:disabled {
  opacity: .6;
  cursor: not-allowed;
  background: var(--bg);
}
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.form-helper { font-size: .6875rem; color: var(--text-muted); margin-top: .25rem; }
.form-error  { font-size: .6875rem; color: var(--danger); margin-top: .25rem; }

/* ─── Filter bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-wrap: wrap;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.filter-bar .form-control {
  max-width: 200px;
  padding: .375rem .625rem;
  font-size: .8125rem;
}
.filter-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

/* ─── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-state svg {
  width: 48px; height: 48px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: .5;
}
.empty-state-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .375rem;
}
.empty-state-desc {
  font-size: .8125rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 1.25rem;
}

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .8125rem;
  color: var(--text-muted);
  gap: 1rem;
  flex-wrap: wrap;
}
.pagination-pages { display: flex; align-items: center; gap: .25rem; }
.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: .8125rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: var(--font);
}
.page-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.page-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 700;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: modal-in .15s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem; line-height: 1;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .625rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Toast ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .8125rem; font-weight: 500;
  pointer-events: auto;
  animation: toast-in .2s cubic-bezier(.34,1.56,.64,1);
  min-width: 260px; max-width: 380px;
}
.toast.toast-success { border-color: var(--success); }
.toast.toast-error   { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-icon.success { color: var(--success); }
.toast-icon.error   { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-text { flex: 1; }
.toast-dismiss { cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Loading / Skeleton ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.loading-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Theme switcher panel ───────────────────────────────────────── */
.theme-panel {
  display: none;
  position: fixed;
  bottom: 5.5rem; left: 1rem;
  width: 198px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .875rem;
  z-index: 500;
  animation: modal-in .15s cubic-bezier(.34,1.56,.64,1);
}
.theme-panel.open { display: block; }
.theme-panel-title {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .625rem;
}
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.theme-option {
  display: flex; flex-direction: column; align-items: center; gap: .375rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all var(--transition);
  font-family: var(--font);
}
.theme-option:hover { background: var(--surface-hover); }
.theme-option.active { border-color: var(--accent); background: var(--accent-muted-bg); }
.theme-swatch {
  width: 36px; height: 24px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
}
.theme-swatch span { flex: 1; }
.theme-option-label {
  font-size: .625rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── Dropdown ───────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 300;
  overflow: hidden;
  animation: modal-in .12s cubic-bezier(.34,1.56,.64,1);
}
.dropdown-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .875rem;
  font-size: .8125rem; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none; background: transparent; width: 100%;
  font-family: var(--font);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { width: 15px; height: 15px; opacity: .7; flex-shrink: 0; }
.dropdown-sep { height: 1px; background: var(--border); margin: .25rem 0; }

/* ─── Utility classes ────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8125rem; }
.text-xs { font-size: .75rem; }
.font-mono { font-variant-numeric: tabular-nums; }
.fw-700 { font-weight: 700; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); --sidebar-w: 220px; }
  .main-area { margin-left: 0; }
  .page-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
