/* ═══════════════════════════════════════════════════════════════
   CONCOMBRE.EU LLD — DESIGN SYSTEM v2.0
   Palette resserrée : #BBDC83 · #E1FAA0 · blanc
   Vert primaire #82B533 réservé aux CTA et accents
   Typographie : Playfair Display + DM Sans
   Approche : mobile-first, accessible, SEO-friendly
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Palette concombre.eu — couleurs claires dominantes */
  --g-primary: #82B533;
  --g-primary-dark: #6a9820;
  --g-primary-darker: #547619;
  --g-light: #BBDC83;
  --g-lightest: #E1FAA0;
  --g-bg: #F2FBE0;
  --g-bg-soft: #EBF6D3;
  --white: #FFFFFF;

  /* Texte */
  --text-primary: #2A3D14;
  --text-secondary: #547619;
  --text-muted: #7A9351;
  --text-light: #A8C070;
  --text-on-primary: #FFFFFF;

  /* Surfaces */
  --bg: #FAFDF5;
  --bg-alt: #F3FADE;
  --surface: #FFFFFF;
  --surface-soft: #F8FCF0;

  /* Bordures */
  --border: #C8E49A;
  --border-soft: #DFF0BC;
  --border-light: #EBF6D3;

  /* États sémantiques (clairs) */
  --info: #5DA8E8;
  --info-bg: #EAF3FB;
  --info-border: #BDD5F7;
  --warning: #E89A3C;
  --warning-bg: #FFF7EC;
  --warning-border: #FFE0A0;
  --danger: #D26B6B;
  --danger-bg: #FCEFEF;
  --danger-border: #F5C8C8;

  /* Typographie */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Tailles texte */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;

  /* Espacement */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem; --sp-20: 5rem;

  /* Rayons */
  --r-sm: 6px; --r: 10px; --r-md: 14px; --r-lg: 20px;
  --r-xl: 28px; --r-full: 9999px;

  /* Ombres */
  --sh-xs: 0 1px 2px rgba(100,160,30,.06);
  --sh-sm: 0 2px 8px rgba(100,160,30,.08);
  --sh-md: 0 4px 16px rgba(100,160,30,.10);
  --sh-lg: 0 8px 28px rgba(100,160,30,.13);
  --sh-xl: 0 16px 48px rgba(100,160,30,.16);

  /* Transitions */
  --tr-fast: 0.15s ease;
  --tr: 0.25s ease;
  --tr-slow: 0.4s ease;

  /* Layout */
  --W-max: 1280px;
  --W-content: 880px;
  --W-form: 560px;
  --W-sidebar: 248px;
  --px-page: clamp(16px, 4vw, 64px);
  --nav-h: 64px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--g-primary-dark); text-decoration: none; transition: color var(--tr-fast); }
a:hover { color: var(--g-primary); }
img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; background: none; border: none; }

/* ── TYPOGRAPHIE ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.875rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.375rem); font-weight: 600; }
h4 { font-size: 1.0625rem; font-weight: 500; font-family: var(--font-body); }
p { color: var(--text-secondary); line-height: 1.7; }
.lead { font-size: var(--fs-md); color: var(--text-secondary); }

/* ── LAYOUT ── */
.wrap { max-width: var(--W-max); margin: 0 auto; padding: 0 var(--px-page); }
.wrap-narrow { max-width: var(--W-content); margin: 0 auto; padding: 0 var(--px-page); }
.wrap-form { max-width: var(--W-form); margin: 0 auto; padding: 0 var(--px-page); }
section { padding: clamp(48px, 8vw, 96px) 0; }

/* ── EYEBROW ── */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--g-primary-dark); margin-bottom: var(--sp-3);
}
.eyebrow::before {
  content: ''; width: 20px; height: 2px;
  background: var(--g-primary); border-radius: 2px;
}

/* ── BOUTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-full); font-size: var(--fs-sm);
  font-weight: 600; text-decoration: none;
  transition: all var(--tr); border: 1.5px solid transparent;
  white-space: nowrap; font-family: var(--font-body);
  cursor: pointer; line-height: 1;
}
.btn-primary {
  background: var(--g-primary); color: var(--text-on-primary);
  box-shadow: 0 3px 14px rgba(130,181,51,.28);
}
.btn-primary:hover {
  background: var(--g-primary-dark); transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(130,181,51,.35); color: var(--text-on-primary);
}
.btn-secondary {
  background: var(--white); color: var(--g-primary-dark);
  border-color: var(--g-light);
}
.btn-secondary:hover { background: var(--g-bg); border-color: var(--g-primary); color: var(--g-primary-darker); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--g-bg); border-color: var(--g-light); }
.btn-soft {
  background: var(--g-lightest); color: var(--g-primary-darker);
  border-color: var(--g-light);
}
.btn-soft:hover { background: var(--g-light); color: var(--g-primary-darker); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-base); }
.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── TAGS ── */
.tag {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.4;
}
.tag-primary { background: var(--g-light); color: var(--g-primary-darker); }
.tag-soft { background: var(--g-lightest); color: var(--g-primary-darker); border: 1px solid var(--g-light); }
.tag-white { background: var(--white); color: var(--g-primary-dark); border: 1px solid var(--g-light); }
.tag-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.tag-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.tag-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.tag-success { background: var(--g-bg); color: var(--g-primary-darker); border: 1px solid var(--g-light); }

/* ── CARTES ── */
.card {
  background: var(--white); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: var(--sp-6);
  transition: box-shadow var(--tr), border-color var(--tr), transform var(--tr);
}
.card:hover { box-shadow: var(--sh-md); border-color: var(--g-light); }
.card-interactive { cursor: pointer; }
.card-interactive:hover { transform: translateY(-2px); }
.card-soft { background: var(--g-lightest); border-color: var(--g-light); }
.card-bg { background: var(--g-bg); border-color: var(--border-soft); }
.card-featured { border-color: var(--g-primary); background: var(--surface-soft); }
.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--sp-4); gap: var(--sp-4);
}

/* ── FORMULAIRES ── */
.field { margin-bottom: var(--sp-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.label {
  display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-primary); margin-bottom: var(--sp-2);
}
.label-required::after { content: ' *'; color: var(--g-primary); }
.input, .select, .textarea {
  width: 100%; padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--border-soft); border-radius: var(--r);
  background: var(--white); color: var(--text-primary);
  font-family: var(--font-body); font-size: var(--fs-base);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
  outline: none; -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--g-primary);
  box-shadow: 0 0 0 3px rgba(130,181,51,.12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-light); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23547619' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: right var(--sp-4) center;
  background-repeat: no-repeat; padding-right: var(--sp-10);
}
.help-text { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-2); line-height: 1.5; }

/* ── ALERTES ── */
.alert {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r);
  border: 1px solid; margin-bottom: var(--sp-4);
  font-size: var(--fs-sm); line-height: 1.6;
}
.alert-icon { flex-shrink: 0; font-size: 1.25rem; line-height: 1; }
.alert-content { flex: 1; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: #1A5FBA; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: #925C00; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: #8B3030; }
.alert-success { background: var(--g-bg); border-color: var(--g-light); color: var(--g-primary-darker); }

/* ── NAV TOP ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100; height: var(--nav-h);
  background: rgba(255,255,255,.95);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 var(--px-page);
  max-width: var(--W-max); margin: 0 auto;
}
.nav-logo {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.25rem; color: var(--text-primary); letter-spacing: -0.02em;
}
.nav-logo em { color: var(--g-primary); font-style: normal; }
.nav-badge {
  font-family: var(--font-body); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-secondary); background: var(--g-lightest);
  border: 1px solid var(--g-light); border-radius: 4px; padding: 2px 6px;
}
.nav-user {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-sm); color: var(--text-secondary);
}
.nav-user-name { font-weight: 600; color: var(--text-primary); }
.nav-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--g-light); color: var(--g-primary-darker);
  font-weight: 700; font-size: var(--fs-sm);
  display: flex; align-items: center; justify-content: center;
}
.nav-mobile {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r); color: var(--text-primary);
}

/* ── DASHBOARD LAYOUT ── */
.app {
  display: grid; grid-template-columns: var(--W-sidebar) 1fr;
  min-height: 100vh; padding-top: var(--nav-h);
}
.sidebar {
  background: var(--white); border-right: 1px solid var(--border-soft);
  padding: var(--sp-6) var(--sp-3); overflow-y: auto;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
}
.sidebar-section {
  font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  margin-top: var(--sp-3);
}
.sidebar-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r);
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--tr-fast); margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--g-bg); color: var(--g-primary-darker); }
.sidebar-link.active {
  background: var(--g-lightest); color: var(--g-primary-darker); font-weight: 600;
}
.sidebar-link svg { flex-shrink: 0; width: 18px; height: 18px; }
.sidebar-link-badge {
  margin-left: auto; background: var(--g-primary); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-full);
}
.content { padding: var(--sp-8) clamp(16px, 4vw, 48px); background: var(--bg); min-width: 0; }

/* ── TABLE ── */
.table-wrap {
  background: var(--white); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: var(--fs-sm); }
.table td, .table th { white-space: nowrap; }
.table thead th {
  background: var(--g-bg); color: var(--text-primary);
  font-weight: 600; text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em;
}
.table tbody td {
  padding: var(--sp-4); border-bottom: 1px solid var(--border-light);
  color: var(--text-primary); vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-soft); }

/* ── STATS GRID ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-8);
}
.stat-card {
  background: var(--white); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: var(--sp-5);
}
.stat-card.accent { background: var(--g-lightest); border-color: var(--g-light); }
.stat-label {
  font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600;
  color: var(--text-muted); margin-bottom: var(--sp-2);
}
.stat-value {
  font-family: var(--font-display); font-size: 2.25rem; font-weight: 700;
  color: var(--text-primary); line-height: 1; margin-bottom: var(--sp-2);
}
.stat-trend { font-size: var(--fs-xs); color: var(--text-muted); }
.stat-trend strong { color: var(--g-primary-dark); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: var(--sp-4);
  padding-bottom: var(--sp-6); margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-soft);
}
.page-header h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin-bottom: var(--sp-1); }
.page-header .breadcrumb { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-1); }
.page-header .breadcrumb a { color: var(--text-secondary); }

/* ── STEPPER ── */
.stepper {
  display: flex; align-items: center; justify-content: center;
  gap: var(--sp-2); margin-bottom: var(--sp-8); flex-wrap: wrap;
}
.step { display: flex; align-items: center; gap: var(--sp-2); }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border-soft); color: var(--text-muted);
  font-weight: 700; font-size: var(--fs-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--tr);
}
.step.active .step-circle {
  background: var(--g-primary); color: var(--text-on-primary);
  box-shadow: 0 3px 12px rgba(130,181,51,.3);
}
.step.done .step-circle { background: var(--g-light); color: var(--g-primary-darker); }
.step-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }
.step.active .step-label { color: var(--g-primary-dark); font-weight: 600; }
.step-bar { width: 24px; height: 2px; background: var(--border-soft); border-radius: 1px; }

/* ── UTILS ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--g-primary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-display { font-family: var(--font-display); }
.font-sm { font-size: var(--fs-sm); }
.font-xs { font-size: var(--fs-xs); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.full-width { width: 100%; }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--nav-h);
    width: 280px; height: calc(100vh - var(--nav-h));
    transform: translateX(-100%); transition: transform var(--tr);
    z-index: 50; box-shadow: var(--sh-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: var(--sp-6) var(--sp-4); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-mobile { display: flex; }
  .nav-user-name { display: none; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .step-label { display: none; }
}
@media (max-width: 480px) {
  :root { --px-page: 16px; }
  .card { padding: var(--sp-4); }
  section { padding: 48px 0; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── ACCESSIBILITÉ ── */
.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;
}
*:focus-visible { outline: 2px solid var(--g-primary); outline-offset: 2px; }

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

@media print {
  .nav, .sidebar, .btn, .nav-mobile { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid var(--border); }
  .content { padding: 0; }
  .app { grid-template-columns: 1fr; }
}
