/* ═══════════════════════════════════════════════════════════════
   0DATA Design System — v1.0
   Inspiration: Linear (luminance stacking), Vercel (shadow-as-border),
                Stripe (typographic precision)
   Brand: "Aucun compromis. Architecture propriétaire. Zéro dépendance."
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── CSS Custom Properties (Design Tokens) ────────────────── */
:root {
  /* Canvas & Surfaces — Linear-style luminance stacking */
  --color-canvas:          #0a0c10;
  --color-panel:           #0f1115;
  --color-surface:         #16181c;
  --color-surface-hover:   #1a1d23;
  --color-surface-active:  #1e2128;

  /* Text */
  --color-text-primary:    #f0f2f5;
  --color-text-secondary:  #b0b8c4;
  --color-text-tertiary:   #6b7280;

  /* Accent — Cyan */
  --color-cyan-bright:     #00d4ff;
  --color-cyan:            #0ea5e9;
  --color-cyan-dim:        #0c7bb5;
  --color-cyan-glow:       rgba(0, 212, 255, 0.15);
  --color-cyan-glow-soft:  rgba(0, 212, 255, 0.08);

  /* Accent — Gold */
  --color-gold-bright:     #f0d68a;
  --color-gold:            #c9a84c;
  --color-gold-dim:        #a8872e;
  --color-gold-glow:       rgba(201, 168, 76, 0.15);

  /* Semantic */
  --color-success:         #22c55e;
  --color-error:           #ef4444;
  --color-warning:         #f59e0b;
  --color-info:            var(--color-cyan);

  /* Borders — Vercel shadow-as-border approach */
  --border-subtle:         0px 0px 0px 1px rgba(255, 255, 255, 0.04);
  --border-standard:       0px 0px 0px 1px rgba(255, 255, 255, 0.08);
  --border-hover:          0px 0px 0px 1px rgba(255, 255, 255, 0.12);
  --border-focus:          0px 0px 0px 1px rgba(0, 212, 255, 0.5);

  /* Shadows */
  --shadow-sm:             0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:             0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:             0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan:      0 0 20px rgba(0, 212, 255, 0.15);
  --shadow-glow-gold:      0 0 20px rgba(201, 168, 76, 0.12);

  /* Typography — Inter, Stripe precision */
  --font-family:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-weight-body:      400;
  --font-weight-ui:        500;
  --font-weight-heading:   600;

  --text-xs:               0.75rem;   /* 12px */
  --text-sm:               0.8125rem; /* 13px */
  --text-base:             0.9375rem; /* 15px */
  --text-md:               1.0625rem; /* 17px */
  --text-lg:               1.25rem;   /* 20px */
  --text-xl:               1.5rem;    /* 24px */
  --text-2xl:              1.75rem;   /* 28px */
  --text-3xl:              2.25rem;   /* 36px */

  --leading-tight:         1.15;
  --leading-normal:        1.5;
  --leading-relaxed:       1.65;

  --tracking-tight:        -0.025em;
  --tracking-tighter:      -0.035em;
  --tracking-wider:        0.015em;

  /* Radii */
  --radius-sm:             6px;
  --radius-md:             8px;
  --radius-lg:             12px;
  --radius-xl:             16px;
  --radius-full:           9999px;

  /* Spacing Scale (4px base) */
  --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;
  --space-16:              64px;

  /* Transitions */
  --transition-fast:       120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base:       200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow:       350ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-Index Scale */
  --z-base:                0;
  --z-dropdown:            100;
  --z-sticky:              200;
  --z-modal:               300;
  --z-tooltip:             400;
  --z-toast:               500;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-canvas);
  min-height: 100vh;
}

/* ─── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-heading);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: var(--tracking-tighter);
}

h2 {
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tighter);
}

h3 {
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-tight);
}

h4 {
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
}

h5 {
  font-size: var(--text-md);
  letter-spacing: 0;
}

h6 {
  font-size: var(--text-base);
  letter-spacing: 0;
}

p {
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: 1em;
}

a {
  color: var(--color-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-cyan-bright);
}

small, .text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-tertiary {
  color: var(--color-text-tertiary);
}

.text-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
}

code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8125rem;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family);
  font-weight: var(--font-weight-ui);
  font-size: var(--text-sm);
  line-height: 1;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.97);
}

/* Ghost Button — Linear-style */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: var(--border-standard);
}

.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--border-hover);
}

.btn-ghost:active {
  background: var(--color-surface-active);
  box-shadow: var(--border-standard);
}

/* Primary Cyan */
.btn-primary-cyan {
  background: linear-gradient(135deg, var(--color-cyan-bright), var(--color-cyan));
  color: #000;
  font-weight: var(--font-weight-heading);
  box-shadow: var(--shadow-glow-cyan), var(--border-subtle);
}

.btn-primary-cyan:hover {
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.25), var(--border-hover);
  transform: translateY(-1px);
}

.btn-primary-cyan:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--shadow-glow-cyan), var(--border-subtle);
}

/* Primary Gold */
.btn-primary-gold {
  background: linear-gradient(135deg, var(--color-gold-bright), var(--color-gold));
  color: #0a0c10;
  font-weight: var(--font-weight-heading);
  box-shadow: var(--shadow-glow-gold), var(--border-subtle);
}

.btn-primary-gold:hover {
  box-shadow: 0 0 28px rgba(201, 168, 76, 0.25), var(--border-hover);
  transform: translateY(-1px);
}

.btn-primary-gold:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--shadow-glow-gold), var(--border-subtle);
}

/* Icon Button — Circular, minimal */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: var(--border-subtle);
  font-size: var(--text-md);
}

.btn-icon:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--border-standard);
}

.btn-icon:active {
  background: var(--color-surface-active);
  transform: scale(0.92);
}

/* Small button variant */
.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

/* Large button variant */
.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* Disabled state */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Inputs & Forms ───────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  font-family: var(--font-family);
  font-weight: var(--font-weight-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  padding: 9px 12px;
  color: var(--color-text-primary);
  background: var(--color-panel);
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--border-standard);
  transition:
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:hover {
  box-shadow: var(--border-hover);
  background: var(--color-surface);
}

.input:focus {
  box-shadow: var(--border-focus);
  background: var(--color-surface);
}

.input-error {
  box-shadow: 0px 0px 0px 1px var(--color-error);
}

.input-error:focus {
  box-shadow: 0px 0px 0px 1px var(--color-error), 0 0 0 3px rgba(239, 68, 68, 0.15);
}

label {
  display: block;
  font-weight: var(--font-weight-ui);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23b0b8c4' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

/* Form group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--border-subtle);
  padding: var(--space-6);
  transition:
    box-shadow var(--transition-base),
    background var(--transition-base);
}

.card-hoverable:hover {
  background: var(--color-surface);
  box-shadow: var(--shadow-md), var(--border-standard);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-md);
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-tight);
}

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

.card-body {
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ─── Devis Card (Quote/Estimate) ─────────────────────────── */
.devis-card {
  background: var(--color-panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md), var(--border-standard);
  overflow: hidden;
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base);
}

.devis-card:hover {
  box-shadow: var(--shadow-lg), var(--border-hover);
  transform: translateY(-2px);
}

.devis-card-header {
  padding: var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.devis-card-header .devis-ref {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.devis-card-header .devis-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

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

.devis-card-body .devis-client {
  font-weight: var(--font-weight-ui);
  font-size: var(--text-md);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.devis-card-body .devis-description {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.devis-card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.devis-card-footer .devis-amount {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}

.devis-card-footer .devis-amount .currency {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-body);
}

.devis-card-footer .devis-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
  font-weight: var(--font-weight-ui);
  font-size: 0.6875rem;
  line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: var(--border-subtle);
}

.badge-cyan {
  background: var(--color-cyan-glow-soft);
  color: var(--color-cyan-bright);
  box-shadow: 0px 0px 0px 1px rgba(0, 212, 255, 0.15);
}

.badge-gold {
  background: rgba(201, 168, 76, 0.1);
  color: var(--color-gold-bright);
  box-shadow: 0px 0px 0px 1px rgba(201, 168, 76, 0.15);
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
  box-shadow: 0px 0px 0px 1px rgba(34, 197, 94, 0.15);
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  box-shadow: 0px 0px 0px 1px rgba(239, 68, 68, 0.15);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  box-shadow: 0px 0px 0px 1px rgba(245, 158, 11, 0.15);
}

.badge-neutral {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-shadow: var(--border-standard);
}

/* Badge with dot indicator */
.badge-dot {
  position: relative;
  padding-left: 16px;
}

.badge-dot::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── Navigation ───────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--border-subtle);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-family);
  font-weight: var(--font-weight-ui);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  border: none;
  background: transparent;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--color-text-primary);
  background: var(--color-surface);
}

.nav-item.active,
.nav-item[aria-current="page"] {
  color: var(--color-text-primary);
  background: var(--color-surface-active);
  box-shadow: var(--border-standard);
}

/* Side navigation (vertical) */
.nav-vertical {
  flex-direction: column;
  align-items: stretch;
  background: transparent;
  box-shadow: none;
  padding: 0;
  gap: 2px;
}

.nav-vertical .nav-item {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

thead {
  background: var(--color-surface);
}

th {
  font-weight: var(--font-weight-ui);
  color: var(--color-text-secondary);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

/* Striped */
table.striped tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.01);
}

table.striped tbody tr:nth-child(even):hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Table cell utilities */
td .cell-secondary {
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
}

/* ─── Layout Utilities ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm {
  max-width: 720px;
}

.container-lg {
  max-width: 1400px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ─── Margin/Padding Utilities ────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

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

.mr-2 { margin-right: var(--space-2); }
.mr-4 { margin-right: var(--space-4); }

.ml-auto { margin-left: auto; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* ─── Divider ──────────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  margin: var(--space-4) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  min-height: 20px;
  background: rgba(255, 255, 255, 0.06);
}

/* ─── Skeleton / Loading ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface) 25%,
    var(--color-surface-hover) 50%,
    var(--color-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text {
  height: 12px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-block {
  height: 100px;
}

/* ─── Toast / Alert ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--border-standard);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-ui);
  color: var(--color-text-primary);
  animation: toast-in var(--transition-slow) ease forwards;
  max-width: 400px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-success {
  box-shadow: var(--shadow-lg), 0px 0px 0px 1px rgba(34, 197, 94, 0.2);
}

.toast-error {
  box-shadow: var(--shadow-lg), 0px 0px 0px 1px rgba(239, 68, 68, 0.2);
}

/* ─── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  font-family: var(--font-family);
  font-weight: var(--font-weight-ui);
  font-size: 0.6875rem;
  color: var(--color-text-primary);
  background: var(--color-surface-active);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md), var(--border-standard);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ─── Animations ───────────────────────────────────────────── */

/* Fade Up */
.animate-fade-up {
  opacity: 0;
  transform: translateY(12px);
  animation: fade-up var(--transition-slow) ease forwards;
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered fade-up for lists */
.animate-fade-up:nth-child(1) { animation-delay: 0.03s; }
.animate-fade-up:nth-child(2) { animation-delay: 0.06s; }
.animate-fade-up:nth-child(3) { animation-delay: 0.09s; }
.animate-fade-up:nth-child(4) { animation-delay: 0.12s; }
.animate-fade-up:nth-child(5) { animation-delay: 0.15s; }
.animate-fade-up:nth-child(6) { animation-delay: 0.18s; }
.animate-fade-up:nth-child(7) { animation-delay: 0.21s; }
.animate-fade-up:nth-child(8) { animation-delay: 0.24s; }

/* Fade In */
.animate-fade-in {
  opacity: 0;
  animation: fade-in var(--transition-base) ease forwards;
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* Scale In */
.animate-scale-in {
  opacity: 0;
  transform: scale(0.95);
  animation: scale-in var(--transition-slow) ease forwards;
}

@keyframes scale-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Glow pulse for cyan accent */
.animate-glow-cyan {
  animation: glow-cyan 2s ease-in-out infinite;
}

@keyframes glow-cyan {
  0%, 100% {
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.08), var(--border-subtle);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2), 0px 0px 0px 1px rgba(0, 212, 255, 0.15);
  }
}

/* Glow pulse for gold accent */
.animate-glow-gold {
  animation: glow-gold 2s ease-in-out infinite;
}

@keyframes glow-gold {
  0%, 100% {
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.08), var(--border-subtle);
  }
  50% {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.18), 0px 0px 0px 1px rgba(201, 168, 76, 0.12);
  }
}

/* Slide In Right (for panels / modals) */
.animate-slide-right {
  animation: slide-right var(--transition-slow) ease forwards;
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse (for loading dots / indicators) */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Spinner */
.animate-spin {
  animation: spin 0.8s linear infinite;
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--color-text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-cyan {
  border-color: rgba(0, 212, 255, 0.15);
  border-top-color: var(--color-cyan-bright);
}

/* ─── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ─── Selection ────────────────────────────────────────────── */
::selection {
  background: rgba(0, 212, 255, 0.2);
  color: var(--color-text-primary);
}

/* ─── Focus Ring ───────────────────────────────────────────── */
:focus-visible {
  outline: none;
  box-shadow: var(--border-focus);
  border-radius: var(--radius-sm);
}

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

.empty-state-title {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-lg);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  max-width: 360px;
  line-height: var(--leading-relaxed);
}

/* ─── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-header-title {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tighter);
}

.page-header-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ─── Stats / Metric Cards ─────────────────────────────────── */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tighter);
  color: var(--color-text-primary);
}

.stat-change {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-ui);
}

.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-error); }

/* ─── Tags / Chips ─────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: var(--font-weight-ui);
  color: var(--color-text-secondary);
  background: var(--color-surface);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  box-shadow: var(--border-subtle);
}

/* ─── Modal / Dialog ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in var(--transition-fast) ease forwards;
}

.modal {
  background: var(--color-panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--border-standard);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scale-in var(--transition-slow) ease forwards;
  padding: var(--space-6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.modal-title {
  font-weight: var(--font-weight-heading);
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  font-size: var(--text-lg);
}

.modal-close:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.modal-body {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ─── Dropdown ─────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: var(--z-dropdown);
  min-width: 180px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--border-standard);
  padding: var(--space-1);
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-family);
  font-weight: var(--font-weight-ui);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

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

.dropdown-item.danger {
  color: var(--color-error);
}

.dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
  margin: var(--space-1) 0;
}

/* ─── Progress Bar ─────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-cyan), var(--color-cyan-bright));
  transition: width var(--transition-base);
}

/* ─── Avatar / Initials ────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-heading);
  font-size: var(--text-sm);
  box-shadow: var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

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

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.625rem;
}

.avatar-lg {
  width: 40px;
  height: 40px;
  font-size: var(--text-md);
}

/* ─── KBD / Keyboard ───────────────────────────────────────── */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-family);
  font-size: 0.6875rem;
  font-weight: var(--font-weight-ui);
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.06);
  line-height: 1;
}

/* ─── Print Styles ─────────────────────────────────────────── */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  a,
  a:visited {
    color: #000 !important;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  h1, h2, h3, h4 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  p, li, blockquote {
    orphans: 3;
    widows: 3;
  }

  table {
    border-collapse: collapse !important;
  }

  th, td {
    border: 1px solid #ccc !important;
    padding: 8px !important;
  }

  th {
    background: #f5f5f5 !important;
    color: #000 !important;
    font-weight: 600 !important;
  }

  .btn, .nav, .modal-overlay,
  .toast, .dropdown, .spinner,
  .animate-fade-up, .animate-glow-cyan,
  .animate-glow-gold {
    display: none !important;
  }

  .card, .devis-card {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .devis-card-footer {
    border-top-color: #ddd !important;
  }

  .badge {
    border: 1px solid #ccc !important;
    color: #333 !important;
  }

  .badge-cyan,
  .badge-gold,
  .badge-success,
  .badge-error,
  .badge-warning {
    background: transparent !important;
    box-shadow: none !important;
  }

  .stat-value {
    font-size: 18pt;
  }

  .page-header {
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
  }

  @page {
    margin: 1.5cm 2cm;
  }
}

/* ─── Responsive Breakpoints ───────────────────────────────── */

/* ≤ 860px — Tablet / Small laptop */
@media (max-width: 860px) {
  :root {
    --space-6: 20px;
    --space-8: 28px;
    --space-12: 40px;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .page-header-title {
    font-size: var(--text-xl);
  }

  .card,
  .devis-card-body,
  .devis-card-header {
    padding: var(--space-4);
  }

  .devis-card-footer {
    padding: var(--space-3) var(--space-4);
  }

  .table-wrapper {
    border-radius: var(--radius-md);
  }

  th, td {
    padding: var(--space-2) var(--space-3);
  }

  .nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    max-width: 90vw;
    margin: var(--space-4);
    padding: var(--space-4);
  }

  .toast {
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    max-width: none;
  }

  .devis-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .devis-card-footer .devis-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ≤ 640px — Mobile landscape / Small tablet */
@media (max-width: 640px) {
  :root {
    --space-4: 12px;
    --space-6: 16px;
    --text-base: 0.875rem;
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  h3 { font-size: var(--text-lg); }

  .container {
    padding: 0 var(--space-3);
  }

  .card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }

  .devis-card {
    border-radius: var(--radius-lg);
  }

  .devis-card-header,
  .devis-card-body {
    padding: var(--space-4);
  }

  .devis-card-footer {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    gap: var(--space-3);
  }

  .devis-card-footer .devis-amount {
    font-size: var(--text-lg);
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  .empty-state {
    padding: var(--space-8) var(--space-4);
  }

  table {
    font-size: 0.8125rem;
  }

  th, td {
    padding: var(--space-2) var(--space-2);
  }

  .btn {
    font-size: 0.8125rem;
    padding: 7px 14px;
  }

  .btn-lg {
    padding: 10px 18px;
    font-size: var(--text-sm);
  }

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

  .modal-title {
    font-size: var(--text-md);
  }

  /* Stack cards in grid on mobile */
  .devis-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ≤ 480px — Mobile portrait */
@media (max-width: 480px) {
  :root {
    --space-3: 8px;
    --space-4: 10px;
    --space-6: 14px;
  }

  .container {
    padding: 0 var(--space-3);
  }

  h1 { font-size: var(--text-xl); }
  h2 { font-size: var(--text-lg); }

  .page-header-title {
    font-size: var(--text-lg);
  }

  .card,
  .devis-card-header,
  .devis-card-body {
    padding: var(--space-3);
  }

  .devis-card-footer {
    padding: var(--space-2) var(--space-3);
  }

  .btn {
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
  }

  th, td {
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
  }

  .nav-item {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
  }

  .badge {
    font-size: 0.625rem;
    padding: 2px 6px;
  }

  .stat-value {
    font-size: var(--text-lg);
  }

  .stat-label {
    font-size: 0.625rem;
  }

  .toast {
    font-size: 0.8125rem;
    padding: var(--space-2) var(--space-3);
  }

  /* Full-width buttons on very small screens */
  .btn-mobile-full {
    width: 100%;
    justify-content: center;
  }

  .modal {
    max-width: 100vw;
    margin: var(--space-2);
    border-radius: var(--radius-lg);
  }
}

/* ─── Utility: Reduced Motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Devis Grid (for dashboard listing) ───────────────────── */
.devis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}

/* ─── Status Indicator (colored dot) ───────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.en-cours {
  background: var(--color-cyan-bright);
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
}

.status-dot.valide {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-dot.refuse {
  background: var(--color-error);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.status-dot.brouillon {
  background: var(--color-text-tertiary);
}

.status-dot.envoye {
  background: var(--color-gold);
  box-shadow: 0 0 6px rgba(201, 168, 76, 0.4);
}

/* ─── Confirm Page ─────────────────────────────────────────── */
.confirm-card {
  max-width: 480px;
  margin: var(--space-12) auto;
  text-align: center;
}

.confirm-card .confirm-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  display: block;
}

.confirm-card .confirm-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-heading);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2);
}

.confirm-card .confirm-message {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.confirm-card .confirm-details {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  text-align: left;
}

.confirm-card .confirm-details dt {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.confirm-card .confirm-details dd {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

.confirm-card .confirm-details dd:last-child {
  margin-bottom: 0;
}

/* ─── Chat Styles ──────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-message {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  max-width: 85%;
  animation: fade-up var(--transition-base) ease forwards;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  box-shadow: var(--border-subtle);
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--color-cyan-dim), var(--color-cyan));
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-message.bot .chat-bubble {
  background: var(--color-panel);
  color: var(--color-text-primary);
  box-shadow: var(--border-standard);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-panel);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-input-bar .input {
  flex: 1;
}

/* ─── Dashboard Stats Grid ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stats-grid .card {
  padding: var(--space-5);
}

/* ─── Helpers ──────────────────────────────────────────────── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.w-full {
  width: 100%;
}

.relative {
  position: relative;
}

.overflow-hidden {
  overflow: hidden;
}

/* ─── Dark Mode Only (we are dark-first) ───────────────────── */
/* This ensures no light-mode flash; everything is already dark */
