/**
 * LCDP Admin — Design System v3.0
 * Le Chemin Du Prince Dashboard
 * Cosmos Warm/Cream Theme
 */

/* ============================================================
   1. DESIGN TOKENS — COSMOS WARM/CREAM
   ============================================================ */
:root {
  /* Backgrounds */
  --bg: #efe9df;
  --surface: #fffdfa;
  --surface-2: #f8f3eb;
  --surface-hover: #f3ece2;
  --surface-elevated: #f8f3eb;

  /* Text */
  --text: #1f2024;
  --text-muted: #666272;
  --text-subtle: #a79f94;

  /* Accent — LCDP sage green */
  --accent: #2f7c61;
  --accent-hover: #3a9474;
  --accent-dark: #246650;
  --accent-glow: rgba(47, 124, 97, 0.18);

  /* Secondary accents */
  --accent-amber: #b85733;
  --accent-red: #bf5e5a;
  --accent-blue: #241f1a;

  /* Borders */
  --border: #e4dbcf;
  --border-strong: #d9cfc1;

  /* Typography */
  --font: "Avenir Next", "Helvetica Neue", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-base: "Avenir Next", "Helvetica Neue", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
  --ff-display: "Avenir Next", "Helvetica Neue", -apple-system, sans-serif;

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Shadows — warm soft */
  --shadow-sm: 0 2px 8px rgba(60, 43, 29, 0.06);
  --shadow-md: 0 8px 22px rgba(60, 43, 29, 0.08);
  --shadow-lg: 0 28px 66px rgba(48, 35, 24, 0.14);

  /* Transitions */
  --t-fast: 150ms ease-out;
  --t-base: 250ms ease-out;

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

  /* Semantic */
  --success: #2f7c61;
  --success-bg: rgba(47, 124, 97, 0.1);
  --success-ring: rgba(47, 124, 97, 0.25);
  --warning: #b85733;
  --warning-bg: rgba(184, 87, 51, 0.1);
  --warning-ring: rgba(184, 87, 51, 0.25);
  --danger: #bf5e5a;
  --danger-bg: rgba(191, 94, 90, 0.1);
  --danger-ring: rgba(191, 94, 90, 0.25);
  --info: #241f1a;
  --info-bg: rgba(36, 31, 26, 0.07);
  --info-ring: rgba(36, 31, 26, 0.15);

  /* Sidebar */
  --sidebar-bg: linear-gradient(180deg, #fffdf9 0%, #f6f0e8 100%);
  --sidebar-border: #e4dbcf;
  --sidebar-text: #756a5f;
  --sidebar-text-hover: #1f2024;
  --sidebar-text-active: #1f2024;
  --sidebar-icon: #a79f94;
  --sidebar-icon-active: #2f7c61;
  --sidebar-hover-bg: rgba(36, 31, 26, 0.04);
  --sidebar-active-bg: rgba(47, 124, 97, 0.08);
  --sidebar-width: 240px;
  --sidebar-width-expanded: 240px;

  /* Topbar */
  --topbar-h: 60px;
  --body-bg: #efe9df;

  /* Font sizes */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 28px;
  --fs-4xl: 32px;

  /* Legacy radius */
  --radius-xs: 4px;
  --radius: 10px;
  --radius-xl: 16px;
  --radius-2xl: 24px;

  /* Legacy shadows */
  --shadow-xs: 0 1px 4px rgba(60, 43, 29, 0.05);
  --shadow: 0 8px 22px rgba(60, 43, 29, 0.08);
  --shadow-float: 0 8px 30px rgba(60, 43, 29, 0.12), 0 0 0 1px rgba(228, 219, 207, 0.5) inset;

  /* Legacy transitions */
  --t-slow: 300ms ease-out;
  --t-spring: 300ms ease-out;

  /* Font weights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Z-index */
  --z-modal: 1000;
  --z-toast: 9999;

  /* Legacy aliases */
  --olive: #2f7c61;
  --olive-light: #3a9474;
  --olive-dark: #246650;
  --olive-subtle: rgba(47, 124, 97, 0.06);
  --olive-muted: rgba(47, 124, 97, 0.12);
  --terra: #b85733;
  --terra-light: #d06b42;
  --terra-dark: #9a4628;
  --terra-subtle: rgba(184, 87, 51, 0.08);
  --gold: #756a5f;
  --gold-light: rgba(184, 87, 51, 0.12);
  --gold-dark: #9a4628;
  --text-1: #1f2024;
  --text-2: #1f2024;
  --text-3: #a79f94;
  --text-xmuted: #a79f94;
  --surface-1: #fffdfa;
  --surface-3: #f3ece2;
  --border-light: #ebe3d8;
  --border-color: #e4dbcf;
  --color-primary: #1f2024;
  --color-accent: #2f7c61;
  --sidebar-header-bg: #fffdf9;
  --sidebar-active-bar: #2f7c61;
  --clr-surface-3: #f3ece2;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text);
  background: radial-gradient(120% 86% at 8% -20%, rgba(184, 87, 51, 0.1) 0%, transparent 56%),
              radial-gradient(96% 72% at 94% -12%, rgba(36, 31, 26, 0.07) 0%, transparent 60%),
              linear-gradient(180deg, #f7f2ea 0%, #efe9df 44%, #e8dfd2 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============================================================
   3. ADMIN SHELL LAYOUT
   ============================================================ */

/* Full-screen flex container */
.admin-shell {
  display: flex;
  min-height: 100vh;
  background: var(--body-bg);
  color: var(--text);
}

/* ---------- Sidebar — Icones compactes organique ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, #fffdf9 0%, #f6f0e8 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--t-slow), transform var(--t-slow);
  overflow: hidden;
}

/* Always expanded — no collapse behavior */

/* Logo zone */
.sidebar-header {
  height: var(--topbar-h);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  white-space: nowrap;
}

.sidebar-logo-img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.sidebar-logo-sub {
  font-size: 9px;
  font-weight: 400;
  color: var(--sidebar-text);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }

.nav-section {
  margin-bottom: var(--space-2);
}

.nav-section-label {
  padding: var(--space-3) var(--space-5) var(--space-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--sidebar-icon);
  white-space: nowrap;
}

.nav-item {
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  padding: 10px 14px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 2px var(--space-3);
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

/* Labels always visible */
.sidebar .nav-section-label,
.sidebar .nav-link > span:not(.nav-icon),
.sidebar .sidebar-logo-text,
.sidebar .sidebar-user-info,
.sidebar .nav-badge {
  opacity: 1;
  pointer-events: auto;
}

.nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover-bg);
  transform: scale(1.04);
}

.nav-item.active .nav-link {
  color: var(--sidebar-text-active);
  background: var(--sidebar-active-bg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.active .nav-link::before {
  display: none;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--sidebar-icon);
  transition: color var(--t-base);
}

.nav-link:hover .nav-icon,
.nav-item.active .nav-link .nav-icon {
  color: var(--sidebar-icon-active);
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.6;
}

/* Sidebar footer — user card */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: var(--space-4) var(--space-5);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--fs-xs);
  color: var(--sidebar-text);
  text-transform: capitalize;
}

.sidebar-user-logout {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
  border-radius: var(--radius-sm);
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}

.sidebar-user-logout:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover-bg);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ---------- Admin body (right of sidebar) ---------- */
.admin-body {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-h);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--t-base);
}

/* ---------- Topbar ---------- */
.admin-topbar {
  height: var(--topbar-h);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(250, 246, 241, 0.92) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 50;
  transition: left var(--t-base);
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.menu-toggle:hover { background: var(--surface-3); }

.menu-toggle svg { width: 18px; height: 18px; }

.topbar-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Notification button */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: background var(--t-fast);
}

.notif-btn:hover { background: var(--surface-3); }
.notif-btn svg { width: 18px; height: 18px; }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* Topbar user avatar */
.topbar-user {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: opacity var(--t-fast);
}

.topbar-user:hover { opacity: 0.85; }

/* ---------- Main content area ---------- */
.admin-main {
  flex: 1;
  padding: var(--space-8) var(--space-6);
}

/* ============================================================
   4. PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: 0em;
}

.page-subtitle {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ============================================================
   5. CARDS
   ============================================================ */
.card {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--t-base), transform var(--t-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card-header {
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--surface-2);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.kpi-card {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--t-base), transform var(--t-base);
  cursor: default;
}

.kpi-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 20px; height: 20px; }

.kpi-icon-gold   { background: var(--gold-light);    color: var(--gold-dark); }
.kpi-icon-green  { background: var(--success-bg);    color: var(--success); }
.kpi-icon-red    { background: var(--danger-bg);     color: var(--danger); }
.kpi-icon-blue   { background: var(--info-bg);       color: var(--info); }
.kpi-icon-olive  { background: var(--olive-subtle);  color: var(--olive-dark); }
.kpi-icon-terra  { background: var(--terra-subtle);  color: var(--terra-dark); }

.kpi-value {
  font-size: var(--fs-4xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-sm);
}

.kpi-trend-up   { color: var(--success); }
.kpi-trend-down { color: var(--danger); }
.kpi-trend-neutral { color: var(--text-muted); }

/* KPI card sans icône — hiérarchie label / valeur */
.kpi-card:not(:has(.kpi-icon)) .kpi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.kpi-card:not(:has(.kpi-icon)) .kpi-value {
  font-size: var(--fs-4xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* ============================================================
   6. GRID HELPERS
   ============================================================ */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  height: 38px;
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 500;
  border-radius: var(--radius-lg);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base), transform var(--t-spring), box-shadow var(--t-base);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn svg { width: 14px; height: 14px; }

.btn-sm { height: 30px; padding: 0 var(--space-3); font-size: var(--fs-sm); }
.btn-xs { height: 24px; padding: 0 var(--space-2); font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-lg { height: 42px; padding: 0 var(--space-6); font-size: var(--fs-md); }

.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Primary — dark warm gradient */
.btn-primary {
  background: linear-gradient(180deg, #221d19 0%, #171310 100%);
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(34, 26, 20, 0.28);
}
.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(34, 26, 20, 0.35);
  transform: translateY(-2px);
}

/* Olive — accent principal */
.btn-olive {
  background: var(--olive);
  color: #fff;
  border-color: var(--olive);
}
.btn-olive:hover {
  background: var(--olive-dark);
  border-color: var(--olive-dark);
  transform: translateY(-1px);
}

/* Terra cuite — accent chaud */
.btn-terra {
  background: var(--terra);
  color: #fff;
  border-color: var(--terra);
}
.btn-terra:hover {
  background: var(--terra-dark);
  border-color: var(--terra-dark);
  transform: translateY(-1px);
}

/* Gold — héritage */
.btn-gold {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: #fffcf8;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #f8f3eb;
  border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Danger */
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-ring);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Link style */
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gold);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--t-fast);
}
.btn-link:hover { color: var(--gold-dark); }

/* ============================================================
   8. FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: #241f1a;
  box-shadow: 0 0 0 3px rgba(36, 31, 26, 0.14);
}

.form-control::placeholder { color: var(--text-xmuted); }

textarea.form-control {
  height: auto;
  padding: var(--space-3);
  resize: vertical;
  min-height: 90px;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23756a5f' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: var(--space-8);
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--danger);
}

/* Filters bar */
.filters-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.filter-input, .filter-select {
  height: 34px;
  padding: 0 var(--space-3);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: var(--font);
  transition: border-color var(--t-fast);
}

.filter-input { min-width: 180px; }
.filter-select { appearance: none; min-width: 140px; }

.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--gold);
}

/* ============================================================
   9. DATA TABLE
   ============================================================ */
.table-wrapper {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.data-table thead {
  background: var(--surface-2);
}

.data-table th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: var(--space-5) var(--space-5);
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--t-fast);
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table .empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-10);
  font-size: var(--fs-md);
}

/* Cell helpers */
.cell-primary { font-weight: 500; color: var(--text); }
.cell-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.cell-truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-link { color: var(--text); text-decoration: none; }
.cell-link:hover { color: var(--accent); }
.cell-value { font-size: var(--fs-sm); color: var(--text); }
.cell-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: nowrap; }

/* Layout helpers */
.crm-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.inv-filters { margin-bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

/* ============================================================
   10. BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: #f3eee7;
  border: 1px solid #ded4c8;
  color: #3b342f;
}

.badge-success  { color: #194f3b; background: #d6ede4; border-color: #abd9c7; }
.badge-warning  { color: #74291a; background: #f5dfd8; border-color: #e8beb2; }
.badge-danger   { color: #702424; background: #f3dddd; border-color: #e7b7b7; }
.badge-info     { color: #29231e; background: #efe8dd; border-color: #ddd1c3; }
.badge-gold     { color: #74291a; background: #f5dfd8; border-color: #e8beb2; }
.badge-olive    { color: #194f3b; background: #d6ede4; border-color: #abd9c7; }
.badge-terra    { color: #74291a; background: #f5dfd8; border-color: #e8beb2; }
.badge-neutral  { background: #f3eee7; border-color: #ded4c8; color: var(--text-muted); }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   11. PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}

.page-btn:hover { background: var(--surface-2); }
.page-btn.active { background: var(--accent); color: #042513; font-weight: 700; }

/* ============================================================
   12. ALERTS & NOTICES
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  line-height: 1.5;
  border-left: 3px solid currentColor;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.alert-success  { background: var(--success-bg);  color: var(--success); }
.alert-warning  { background: var(--warning-bg);  color: var(--warning); }
.alert-danger   { background: var(--danger-bg);   color: var(--danger); }
.alert-info     { background: var(--info-bg);     color: var(--info); }

/* ============================================================
   13. EMPTY STATE
   ============================================================ */
.empty-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  gap: var(--space-3);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state-icon svg { width: 22px; height: 22px; }

.empty-state-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-2);
}

.empty-state-text {
  font-size: var(--fs-base);
  color: var(--text-muted);
  max-width: 300px;
}

/* ============================================================
   14. MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fffdfa;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  transition: transform var(--t-base);
}

.modal-backdrop.open .modal { transform: none; }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: var(--fs-lg); font-weight: 600; }

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--t-fast);
}

.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: var(--space-6); }

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ============================================================
   15. LOADING STATE
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-light) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: skeleton-load 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-load {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   16. UTILITY CLASSES
   ============================================================ */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-gold   { color: var(--gold); }
.text-sm     { font-size: var(--fs-sm); }
.text-xs     { font-size: var(--fs-xs); }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.price    { font-feature-settings: 'tnum'; font-weight: 500; }
.monospace { font-family: 'SF Mono', 'Fira Code', monospace; font-size: var(--fs-sm); }

/* ============================================================
   17. MODULE PAGE WRAPPER
   ============================================================ */
.module-page {
  /* base wrapper for all module pages */
}

/* ============================================================
   18. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .admin-body {
    margin-left: 0;
  }

  .admin-topbar {
    left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .admin-main { padding: var(--space-4); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filter-input, .filter-select { min-width: 0; width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   19. LOGIN PAGE
   ============================================================ */

/* Fond beige doux avec texture subtile — fidèle au screenshot */
body.login-page {
  background-color: #ede9e0;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGQ9Ik0wIDBoMzAwdjMwMEgweiIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDQiLz48L3N2Zz4=');
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Card blanche centrée */
.login-container {
  background: #ffffff;
  border-radius: 16px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
}

/* Logo + brand name côte à côte */
.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.login-emblem {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.login-brand-name {
  font-family: var(--font-base);
  font-size: 18px;
  font-weight: 600;
  color: #000000;
  letter-spacing: 0em;
  white-space: nowrap;
}

.login-subtitle {
  font-size: 13px;
  color: #888;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

/* Champs */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 13px;
  font-weight: 400;
  color: #3a3a3a;
}

/* Input sombre avec icône — identique au screenshot */
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  flex-shrink: 0;
}

.login-input {
  width: 100%;
  height: 46px;
  background: #4a4d45;
  border: none;
  border-radius: 6px;
  padding: 0 40px 0 38px;
  color: rgba(255,255,255,0.85);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: background 0.2s ease;
}

.login-input::placeholder { color: rgba(255,255,255,0.25); }
.login-input:focus { background: #555a4d; }

/* Bouton œil (show/hide password) */
.login-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.login-eye:hover { color: rgba(255,255,255,0.65); }
.login-eye svg { width: 15px; height: 15px; }

/* Remember me + forgot */
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #6b7264;
  cursor: pointer;
}

.login-forgot {
  font-size: 13px;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.login-forgot:hover { color: #555; }

/* Bouton connexion — vert-gris militaire fidèle au screenshot */
.login-btn {
  width: 100%;
  height: 46px;
  background: #6b7264;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.03em;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s ease;
}

.login-btn:hover { background: #5c6256; }
.login-btn:active { background: #505748; }

/* Alerts */
.login-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.login-alert-danger  { background: #f5e0e0; color: #7a2020; }
.login-alert-success { background: #e6f4ea; color: #2d5a3a; }

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: #aaa;
}

/* ============================================================
   19b. ICON ACTION BUTTONS — Boutons icône dans les tableaux
   ============================================================ */
/* Override btn-primary dans les cellules d'action : fond neutre au lieu de noir */
.cell-actions .btn-primary,
.col-action .btn-primary,
.data-table .btn-primary,
.table-wrapper .btn-primary {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  font-weight: 500;
  box-shadow: none;
}

.cell-actions .btn-primary:hover,
.col-action .btn-primary:hover,
.data-table .btn-primary:hover,
.table-wrapper .btn-primary:hover {
  background: var(--surface-hover);
  color: var(--accent);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Bouton icône standalone — neutre */
.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--accent);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-icon svg { width: 14px; height: 14px; }

/* ============================================================
   20. BADGE ROLES — Identite visuelle par role utilisateur
   ============================================================ */
.badge-role {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-role-client,
.badge-role-customer   { background: var(--olive-subtle);  color: var(--olive-dark); }
.badge-role-artisan    { background: var(--terra-subtle);  color: var(--terra-dark); }
.badge-role-staff      { background: var(--info-bg);       color: var(--info); }
.badge-role-admin      { background: var(--gold-light);    color: var(--gold-dark); }
.badge-role-super_admin{ background: var(--surface-3);     color: var(--text); }

/* ============================================================
   21. NATIVE INPUT STYLES — pour formulaires sans .form-control
   ============================================================ */
input[type="text"]:not(.filter-input):not(.login-input):not([class]),
input[type="email"]:not(.login-input):not([class]),
input[type="password"]:not(.login-input):not([class]),
input[type="number"]:not([class]),
input[type="date"]:not(.filter-input):not([class]),
input[type="search"]:not([class]),
textarea:not([class]),
select:not(.filter-select):not([class]) {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

textarea:not([class]) {
  height: auto;
  padding: var(--space-3);
  resize: vertical;
  min-height: 90px;
}

input[type="text"]:not([class]):focus,
input[type="email"]:not([class]):focus,
input[type="password"]:not([class]):focus,
input[type="number"]:not([class]):focus,
input[type="date"]:not([class]):focus,
textarea:not([class]):focus,
select:not([class]):focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(77,93,52,0.10);
}

/* ============================================================
   22. DROPDOWN UTILISATEUR (topbar)
   ============================================================ */
.topbar-user-menu { position: relative; }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fffdfa;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.user-dropdown-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

.user-dropdown-role {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 2px;
}

.user-dropdown-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}

.user-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.user-dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.user-dropdown-logout {
  color: var(--danger);
}

.user-dropdown-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ============================================================
   FORM INPUTS — Apple-fluide styling
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: all var(--t-fast);
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px var(--olive-subtle);
  background: var(--surface);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  cursor: pointer;
  padding: 10px 14px;
  padding-right: 32px;
  appearance: none;
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%234d5d34' d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 10px;
}

select:hover {
  border-color: var(--olive-light);
}

/* Labels */
label {
  display: block;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--text);
  margin-bottom: 6px;
}

/* Form groups */
.form-group,
.field,
.field-group {
  margin-bottom: var(--space-5);
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Help text */
.help-text,
.field-hint,
.form-hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Error styling */
input.error,
textarea.error,
select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(139, 42, 42, 0.10);
}

.error-message {
  color: var(--danger);
  font-size: var(--fs-sm);
  margin-top: 4px;
}

/* ============================================================
   BUTTONS — Apple-fluide
   ============================================================ */

button,
input[type="submit"],
input[type="reset"],
input[type="button"],
.btn {
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-lg);
  padding: 10px 24px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  text-decoration: none;
}

.btn-primary,
button.btn-primary,
input[type="submit"] {
  background: #000000;
  color: white;
  border: 1px solid #000000;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"]:hover {
  background: #1a1a1a;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active,
button.btn-primary:active,
input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary,
button.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover,
button.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--olive);
  box-shadow: var(--shadow-sm);
}

.btn-ghost,
button.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover,
button.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--olive);
}

button:disabled,
input[type="submit"]:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  font-size: var(--fs-sm);
  padding: 6px 12px;
  height: 32px;
  border-radius: var(--radius);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: #6b2020;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   FORM SECTIONS — Card containers
   ============================================================ */

.form-section,
.form-card,
fieldset {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.form-section:last-child,
.form-card:last-child,
fieldset:last-child {
  margin-bottom: 0;
}

.form-section > h3,
.form-card > h3,
fieldset > legend {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: var(--space-4);
  margin-top: 0;
}

.form-section > p,
.form-card > p {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

.form-row-full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-light);
}

.form-actions .btn-secondary {
  margin-left: auto;
}

/* Form page layout — card container + section titles */
.form-layout {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

.form-section-title {
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  margin: var(--space-7) 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
  letter-spacing: normal;
  text-transform: none;
}

.form-section-title:first-child {
  margin-top: 0;
}

/* ============================================================
   CHECKBOXES & RADIOS
   ============================================================ */

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--t-fast);
  vertical-align: middle;
  margin-right: 6px;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
  cursor: pointer;
  font-size: var(--fs-base);
  color: var(--text);
  margin-left: 6px;
}

input[type="checkbox"]:focus + label,
input[type="radio"]:focus + label {
  color: var(--olive);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--olive);
  border-color: var(--olive);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='white' d='M2 7l3 3 6-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

input[type="radio"]:checked {
  background-image: radial-gradient(circle, white 40%, transparent 40%);
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  box-shadow: 0 0 0 3px var(--olive-subtle);
}

/* ============================================================
   FILE INPUTS
   ============================================================ */

input[type="file"] {
  display: block;
  width: 100%;
  padding: var(--space-3);
  border: 2px dashed var(--olive);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--t-fast);
}

input[type="file"]:hover {
  border-color: var(--olive-light);
  background: var(--olive-subtle);
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px var(--olive-subtle);
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: center;
}

.file-input-label:hover {
  border-color: var(--olive);
  background: var(--olive-subtle);
}

/* Optgroup styling */
optgroup {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

option {
  color: var(--text);
  background: var(--surface);
}

/* ============================================================
   FORM WRAPPER
   ============================================================ */

.form-wrapper,
form.module-form {
  max-width: 900px;
  margin: 0 auto;
}

.form-container {
  padding: var(--space-6);
}

.form-header {
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-5);
}

.form-header h1,
.form-header h2 {
  font-family: var(--ff-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin: 0 0 8px 0;
}

.form-header p {
  color: var(--text-muted);
  margin: 0;
}

.form-success,
.form-error,
.form-info {
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
  font-size: var(--fs-base);
}

.form-success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

.form-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.form-info {
  background: var(--info-bg);
  border: 1px solid var(--info);
  color: var(--info);
}

/* ============================================================
   FORM SECTIONS — Card containers
   ============================================================ */

.form-section,
fieldset {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.form-section:last-child,
fieldset:last-child {
  margin-bottom: 0;
}

.form-section > h3,
.form-section > h2,
fieldset > legend {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin: 0 0 var(--space-4) 0;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

.form-section > p {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* Grid layout for inputs in sections */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

.form-row-full {
  grid-column: 1 / -1;
}

/* Form grid layouts */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.form-main {
  grid-column: 1;
}

.form-sidebar {
  grid-column: 2;
}

.form-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* Form actions */
.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-light);
}

.form-actions .btn-secondary {
  margin-left: auto;
}

/* ============================================================
   EMPTY STATES — Styled properly
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: var(--space-8);
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  font-size: 48px;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-title {
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.empty-state-text {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 0 var(--space-6) 0;
  line-height: 1.6;
}

.empty-state-action {
  margin-top: var(--space-4);
}

/* ============================================================
   SIDEBAR & RESPONSIVE LAYOUT
   ============================================================ */

.sidebar {
  transition: width var(--t-base), margin var(--t-base);
}

.main-content {
  flex: 1;
  transition: margin var(--t-base), width var(--t-base);
}

body.sidebar-collapsed .main-content {
  width: 100%;
}

/* ============================================================
   PROFILE ICONS — User dropdown & actions
   ============================================================ */

.profile-icon,
.user-icon,
.logout-icon,
.settings-icon,
.notification-icon {
  cursor: pointer;
  transition: all var(--t-fast);
  padding: var(--space-2);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 20px;
  color: var(--text-muted);
}

.profile-icon:hover,
.user-icon:hover,
.logout-icon:hover,
.settings-icon:hover,
.notification-icon:hover {
  background: var(--surface-2);
  color: var(--olive);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--olive-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--olive);
  font-size: var(--fs-sm);
  border: 1px solid var(--olive);
}

.user-avatar:hover {
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   TOPBAR IMPROVEMENTS
   ============================================================ */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
}

.topbar-icons {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

/* ============================================================
   DASHBOARD/OVERVIEW IMPROVEMENTS
   ============================================================ */

.dashboard-title,
.overview-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dashboard-icon,
.overview-icon {
  font-size: 28px;
  color: var(--olive);
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* NOTE: duplicate .kpi-value overridden below — use var(--text) not olive */
.kpi-value {
  font-size: var(--fs-4xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: var(--space-3) 0;
}

/* ============================================================
   DASHBOARD OVERVIEW — Premium layout v3
   ============================================================ */

.dash-welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.dash-greeting {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.dash-date {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.dash-quick-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* KPI Grid — 4 tiles */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.dash-kpi {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.dash-kpi:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.dash-kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.dash-kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.dash-kpi-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0;
}

.dash-kpi-trend--up    { background: rgba(47,124,97,0.1); color: var(--accent); }
.dash-kpi-trend--down  { background: rgba(191,94,90,0.1); color: var(--accent-red); }
.dash-kpi-trend--neutral { background: var(--surface-2); color: var(--text-muted); }

.dash-kpi-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
}

.dash-kpi-badge--accent {
  background: rgba(48,65,35,0.08);
  color: var(--accent);
}

.dash-kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.dash-kpi-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.dash-kpi-spark {
  height: 28px;
  margin-top: var(--space-2);
  color: var(--accent);
  opacity: 0.6;
}

.dash-kpi-spark svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Secondary metrics strip */
.dash-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.dash-metric {
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  text-decoration: none;
  transition: all var(--t-base);
}

.dash-metric:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.dash-metric-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.dash-metric-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}

/* Main grid: orders (2fr) + side column (1fr) */
.dash-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.dash-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dash-card { margin: 0; }

/* Appointments list */
.dash-appts {
  padding: var(--space-3) var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dash-appt {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--t-base);
}

.dash-appt:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.dash-appt-time {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
}

.dash-appt-info { flex: 1; min-width: 0; }

.dash-appt-client {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.dash-appt-notes {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* Activity list */
.dash-activity {
  list-style: none;
  padding: var(--space-3) var(--space-5) var(--space-4);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dash-activity-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.dash-activity-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.dash-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.dash-activity-dot--message { background: var(--accent-blue); }
.dash-activity-dot--devis   { background: var(--accent); }

.dash-activity-body { flex: 1; min-width: 0; }

.dash-activity-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.dash-activity-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.dash-activity-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dash-activity-detail {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .dash-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .dash-welcome { flex-direction: column; align-items: flex-start; }
  .dash-greeting { font-size: 22px; }
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-metrics-strip { grid-template-columns: 1fr; }
}

.kpi-label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   MESSAGE BUBBLES & CHAT STYLING
   ============================================================ */

.message-bubble,
.chat-message {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  max-width: 70%;
  word-wrap: break-word;
}

.message-bubble.sent,
.chat-message.sent {
  background: var(--olive);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message-bubble.received,
.chat-message.received {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.conversation-item {
  padding: var(--space-4);
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--t-fast);
}

.conversation-item:hover {
  background: var(--surface-2);
}

.conversation-item.active {
  background: var(--olive-subtle);
  border-left: 3px solid var(--olive);
  padding-left: calc(var(--space-4) - 3px);
  font-weight: 500;
  color: var(--olive);
}

.message-input-area {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.message-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font);
  font-size: var(--fs-base);
}

.message-input:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px var(--olive-subtle);
}

/* ============================================================
   GLOBAL SEARCH BAR
   ============================================================ */
.topbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap svg.search-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-subtle);
  pointer-events: none;
  flex-shrink: 0;
}

/* .search-input-wrap prefix : nécessaire pour battre la règle générique input[type="text"] */
.search-input-wrap .search-input {
  width: 100%;
  height: 34px;
  padding: 0 var(--space-8) 0 34px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-family: var(--font);
  color: var(--text);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.search-input-wrap .search-input::placeholder { color: var(--text-subtle); }

.search-input-wrap .search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-kbd {
  position: absolute;
  right: 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-subtle);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
}

.topbar-search:focus-within .search-kbd { opacity: 0; }

/* Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 440px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}

.search-dropdown.open { display: block; }

.search-group-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px 4px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background var(--t-fast);
  border-radius: 0;
}

.search-result:hover,
.search-result.active {
  background: var(--surface-hover);
}

.search-result-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.search-result-icon svg { width: 14px; height: 14px; }

.search-result-body { flex: 1; min-width: 0; }

.search-result-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-arrow {
  color: var(--text-subtle);
  flex-shrink: 0;
}
.search-result-arrow svg { width: 12px; height: 12px; }

.search-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.search-loading {
  padding: var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Divider between groups */
.search-group + .search-group { border-top: 1px solid var(--border); }

@media (max-width: 768px) {
  .topbar-search { display: none; }
}
