* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-gradient: radial-gradient(circle at 5% -10%, #1d3b74 0%, #0a162b 45%, #030712 100%);
  --surface-primary: rgba(15, 23, 42, 0.88);
  --surface-elevated: rgba(17, 30, 58, 0.94);
  --surface-muted: rgba(21, 32, 60, 0.68);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-soft: rgba(17, 27, 48, 0.75);
  --glass-border: rgba(94, 114, 158, 0.22);
  --border-subtle: rgba(94, 114, 158, 0.28);
  --primary: #34d399;
  --primary-dark: #059669;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --text: #f8fafc;
  --text-muted: rgba(226, 232, 240, 0.78);
  --text-soft: rgba(148, 163, 184, 0.72);
  --chip-bg: rgba(52, 211, 153, 0.12);
  --shadow-lg: 0 40px 80px -48px rgba(15, 23, 42, 0.95), 0 30px 60px -34px rgba(56, 189, 248, 0.24);
  --shadow-hover: 0 35px 70px -40px rgba(52, 211, 153, 0.35), 0 24px 48px -28px rgba(15, 23, 42, 0.85);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.24s ease;
  /* Scrollbar theme */
  --scrollbar-size: 10px;
  --scrollbar-thumb: rgba(148, 163, 184, 0.38);
  --scrollbar-thumb-hover: rgba(52, 211, 153, 0.7);
  --scrollbar-track: rgba(12, 21, 38, 0.4);
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0.01em;
  scrollbar-gutter: stable both-edges;
  overflow-x: hidden;
  overflow-y: auto;
  /* Ensure scroll positions account for sticky header height */
  scroll-padding-top: clamp(72px, 12vh, 120px);
}

/* Global scrollbar styling (WebKit) */
*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Global scrollbar styling (Firefox) */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* Ensure key scroll containers use thin bars */
.multi-select-menu,
.compact-library-list,
.library-body,
.dynamic-sections,
.preview-modal-body,
.section-nav,
.sequence-list {
  scrollbar-width: thin;
}

/* Extra metadata input for sequence items (mesh for sieve steps) */
.sequence .step-extra {
  margin-top: 8px;
}
.sequence .step-extra input[type="text"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(10, 18, 34, 0.6);
  outline: none;
  transition: var(--transition);
}
.sequence .step-extra .mesh-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sequence .step-extra input[type="text"]::placeholder { color: var(--text-soft); }
.sequence .step-extra input[type="text"]:focus {
  border-color: rgba(56, 240, 184, 0.45);
  box-shadow: 0 0 0 3px rgba(56, 240, 184, 0.15);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 15% 20%, rgba(56, 240, 184, 0.18), transparent 55%),
              radial-gradient(circle at 85% 10%, rgba(139, 92, 246, 0.18), transparent 45%),
              radial-gradient(circle at 50% 90%, rgba(14, 165, 233, 0.18), transparent 55%);
  pointer-events: none;
  z-index: -2;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(18px, 2.8vw, 32px);
  position: relative;
  isolation: isolate;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 24px) clamp(20px, 3.5vw, 32px);
  background: rgba(8, 14, 27, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 10;
}

.top-nav-status {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 12px;
  padding: 4px;
  margin: -4px;
}

.brand:hover {
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}

.brand:hover .brand-mark {
  background: linear-gradient(135deg, rgba(56, 240, 184, 0.35), rgba(139, 92, 246, 0.4));
  border-color: rgba(56, 240, 184, 0.5);
  box-shadow: 0 18px 40px -18px rgba(56, 240, 184, 0.6);
}

.brand:active {
  transform: translateY(0);
  background: rgba(56, 189, 248, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(56, 240, 184, 0.25), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(56, 240, 184, 0.35);
  border-radius: 16px;
  font-size: 24px;
  box-shadow: 0 15px 35px -18px rgba(56, 240, 184, 0.45);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-text strong {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.brand-text span {
  font-size: 0.85rem;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(18px);
}

/* Orange dot indicator for Library when review incomplete */
.pill-btn.has-indicator {
  position: relative;
}
.pill-btn.has-indicator::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: #f59e0b; /* orange-500 */
  border: 2px solid rgba(8, 14, 27, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

/* Draft badge pill style */
#draftBadge {
  background: rgba(234, 179, 8, 0.16);
  border-color: rgba(234, 179, 8, 0.35);
}
#draftBadge:hover { color: var(--text); }

/* Tips popover (hover on Astuce) */
.tips-popover {
  position: fixed;
  z-index: 1600;
  min-width: 300px;
  max-width: 380px;
  background: rgba(10, 18, 34, 0.96);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  color: var(--text);
}
.tips-popover h4 {
  font-size: 0.98rem;
  margin-bottom: 8px;
}
.tips-popover .tips-section {
  margin-top: 10px;
}
.tips-popover .tip-steps {
  list-style: decimal inside;
  display: grid;
  gap: 6px;
  color: var(--text-muted);
}
.tips-popover .kbd-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}
.tips-popover kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 -2px 0 rgba(148, 163, 184, 0.18);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Tips full dialog (editor) */
.tips-overlay {
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(0, 0, 0, 0.42);
}
.tips-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 720px);
  max-height: 82vh;
  overflow: auto;
  background: rgba(10, 18, 34, 0.98);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.tips-dialog .tips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
}
.tips-dialog .tips-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.tips-dialog .tips-header .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(148,163,184,0.12);
  cursor: pointer;
}
.tips-dialog .tips-body {
  padding: 14px 18px 18px;
}
.tips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 700px) {
  .tips-grid { grid-template-columns: 1fr 1fr; }
}
.tips-block {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.tips-block h4 { margin: 0 0 8px 0; font-size: 0.98rem; }
.tips-block ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
.tips-kbd-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-muted); }
.tips-kbd-line kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 -2px 0 rgba(148, 163, 184, 0.18);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Unified modal system (responsive & scalable) ---------- */
.modal,
.export-config-modal,
#accountModal {
  position: fixed;
  inset: 0;
  display: none; /* toggled via inline style or .active */
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.modal.active,
.export-config-modal.active,
#accountModal.active {
  display: flex;
}

.modal-overlay,
.export-config-modal .modal-overlay,
.account-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.6);
  backdrop-filter: blur(8px);
}

.modal-content,
.export-config-container,
.account-dialog,
.account-modal-content {
  position: relative;
  max-width: min(96vw, 980px);
  width: min(96vw, 980px);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(8,14,27,0.98), rgba(10,18,34,0.98));
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header,
.export-config-header,
.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2,
.modal-header h3,
.export-config-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body,
.modal-content .modal-body,
.account-body {
  padding: 6px 2px 2px;
  color: var(--text);
}

.modal-actions,
.modal-actions .btn,
.account-modal-content .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.modal-close:hover { transform: translateY(-1px); background: rgba(148,163,184,0.06); }

.btn-danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.btn-danger:active { transform: translateY(1px); }

/* Responsive: full-screen modals on small devices */
@media (max-width: 640px) {
  .modal-content,
  .account-dialog,
  .export-config-container {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    padding: 14px;
  }
  .modal-body { padding: 8px 0 0; }
  .modal-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.35)); padding-top: 12px; }
}

/* Accessibility: focus outlines for keyboard navigation */
.modal [tabindex],
.modal button,
.modal input,
.modal select {
  outline: none;
}
.modal button:focus,
.modal [tabindex]:focus,
.modal input:focus {
  box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
  border-color: var(--primary);
}

/* Small helper: centered small modals */
.modal.small .modal-content { max-width: 560px; width: 92vw; }


/* Boolean Oui/Non control */
.boolean-group {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 6px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
}
.boolean-group .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.boolean-group .radio:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}
.boolean-group .radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: inset 0 -1px 0 rgba(148,163,184,0.18);
  position: relative;
}
.boolean-group .radio input[type="radio"]:checked {
  border-color: var(--primary);
  background: radial-gradient(circle at 50% 50%, var(--primary) 35%, rgba(52,211,153,0.25) 36%, transparent 38%)
              , rgba(15, 23, 42, 0.7);
}
.boolean-group .radio:has(input[type="radio"]:checked) {
  color: var(--text);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.12);
}
.boolean-group .radio input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pill-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(56, 240, 184, 0.45);
  color: var(--primary);
  box-shadow: 0 16px 40px -22px rgba(56, 240, 184, 0.55);
}

.workspace {
  width: min(1640px, 94vw);
  margin: 0 auto;
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  grid-template-columns: 1fr;
  grid-template-areas: "assistant";
  align-items: start;
  justify-items: center;
}

/* When form and preview are visible */
.workspace.has-content {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  grid-template-areas:
    "assistant assistant"
    "form preview";
  justify-items: stretch;
}

/* Mode compact: cacher la colonne Aperçu et donner toute la largeur au formulaire */
.workspace.has-content.no-preview {
  grid-template-columns: 1fr;
  grid-template-areas:
    "assistant"
    "form";
}
.workspace.has-content.no-preview .panel-preview { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 3.2vw, 36px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.8vw, 30px);
  height: 100%;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-sidebar {
  gap: clamp(18px, 2.6vw, 28px);
  position: relative;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2.4vw, 24px);
  box-shadow: 0 24px 48px -36px rgba(15, 23, 42, 0.7);
}

.sidebar-section .section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-panel .section-helper {
  margin-bottom: 8px;
}

.shortcut-list {
  list-style: none;
  display: grid;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.shortcut-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 -2px 0 rgba(148, 163, 184, 0.18);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.panel-header h1,
.panel-header h2 {
  font-size: clamp(1.85rem, 3vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-subtitle {
  color: var(--text-muted);
  max-width: 38ch;
}

.panel-sidebar .panel-subtitle {
  max-width: 34ch;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress.compact {
  min-width: clamp(180px, 22vw, 280px);
}

.top-nav .progress.compact .progress-legend {
  justify-content: space-between;
}

.progress-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.progress-bar {
  height: 6px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.9) 0%, rgba(56, 189, 248, 0.9) 100%);
  transition: width 0.3s ease;
  border-radius: inherit;
}

.panel-section {
  padding: clamp(22px, 3vw, 28px);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: 0 18px 32px -28px rgba(56, 240, 184, 0.32);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-preview {
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel-section h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
}

/* Banner showing the currently selected product in step 2 */
.selected-product-banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-helper {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  justify-items: stretch;
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px;
  background: rgba(12, 21, 38, 0.75);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 20px 35px -30px rgba(15, 23, 42, 0.8);
  min-height: 108px;
  pointer-events: auto;
}

.type-card::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.18), transparent 60%);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.type-card:hover,
.type-card:focus-visible {
  border-color: rgba(52, 211, 153, 0.55);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.type-card.selected {
  border-color: rgba(52, 211, 153, 0.75);
  box-shadow: var(--shadow-hover);
}

.type-card.selected::after {
  opacity: 1;
}

.type-icon {
  font-size: 1.8rem;
}

.type-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.type-caption {
  font-size: 0.9rem;
  color: var(--text-soft);
}

form {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3vw, 32px);
}

.review-form {
  gap: clamp(20px, 2.8vw, 28px);
}

.form-content {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 24px);
}

.form-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: clamp(14px, 2vw, 18px);
  background: rgba(12, 21, 38, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 32px -28px rgba(15, 23, 42, 0.65);
}

.form-shell {
  display: grid;
  grid-template-columns: minmax(240px, 0.36fr) minmax(0, 1fr);
  gap: clamp(20px, 3.5vw, 36px);
  align-items: start;
}

.form-preamble {
  position: sticky;
  top: clamp(130px, 16vh, 160px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.5vw, 24px);
  max-height: calc(100vh - clamp(200px, 24vh, 260px));
  overflow-y: auto;
  padding-right: 4px;
}

.form-preamble .section-nav {
  position: static;
}

.form-preamble::-webkit-scrollbar {
  width: 6px;
}

.form-preamble::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
}

/* Account modal - redesigned */
.account-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,10,20,0.55);
  backdrop-filter: blur(6px) saturate(110%);
  display: none;
  z-index: 2400;
  pointer-events: auto !important;
}

.account-overlay.show { display: block; }

#accountModal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, 94vw);
  max-height: 88vh;
  display: none;
  z-index: 2500;
  pointer-events: auto !important;
}

#accountModal.show { display: block; }

.account-dialog {
  width: 100%;
  background: linear-gradient(180deg, rgba(12,18,28,0.98), rgba(8,12,20,0.98));
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 18px 40px rgba(2,6,23,0.6);
  overflow: hidden;
  /* Ensure the dialog is above the overlay so clicks reach buttons inside the dialog */
  position: relative;
  z-index: 2501;
  pointer-events: auto !important;
}

.account-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.account-body { padding:18px; display:grid; grid-template-columns: 360px 1fr; gap: 18px; }

.account-left {
  background: linear-gradient(180deg, rgba(14,20,32,0.6), rgba(10,16,26,0.5));
  border-radius: 10px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.02);
}

.account-profile { display:flex; gap:12px; align-items:center; }
.account-avatar { width:64px; height:64px; border-radius:12px; display:grid; place-items:center; font-size:26px; background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(99,102,241,0.06)); border:1px solid rgba(255,255,255,0.02); }
.account-meta .email { font-weight:700; color:var(--text); }
.account-meta .sub { color:var(--text-soft); font-size:0.92rem; }

.stats-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; margin-top:12px; }
.stat-card { background: rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.02); padding:12px; border-radius:10px; text-align:center; }
.stat-card .num { font-weight:800; font-size:1.15rem; }
.stat-card .label { font-size:0.82rem; color:var(--text-soft); }

.account-stats-by-type { margin-top:12px; display:flex; flex-wrap:wrap; gap:8px; }
.type-pill { background: rgba(255,255,255,0.02); padding:6px 10px; border-radius:999px; font-weight:600; font-size:0.86rem; color:var(--text); }

.account-right { padding: 12px; display:flex; flex-direction:column; gap:14px; }
.panel { background: linear-gradient(180deg, rgba(10,14,20,0.45), rgba(6,10,16,0.25)); padding:14px; border-radius:10px; border:1px solid rgba(255,255,255,0.02); }
.panel .section-title { font-size:1rem; margin-bottom:8px; }

/* Settings panel inside the dialog */
.account-settings-panel { background: transparent; padding:6px 0; }

@media (max-width:880px) {
  .account-body { grid-template-columns: 1fr; }
  .account-left { order:2; }
  .account-right { order:1; }
}
.pill-action {
  padding:10px 14px;
  border-radius:999px;
  background: linear-gradient(180deg, rgba(52,211,153,0.12), rgba(56,189,248,0.06));
  color: var(--text);
  border: 1px solid rgba(52,211,153,0.12);
  cursor:pointer;
  font-weight:700;
}
.danger {
  background: linear-gradient(180deg, rgba(240,80,90,0.06), rgba(240,80,90,0.02));
  border: 1px solid rgba(240,80,90,0.12);
  color: #ffdede;
}

.account-preferences {
  margin-top:8px;
  padding:12px;
  border-radius:12px;
  background: rgba(10,18,34,0.6);
  border: 1px solid var(--glass-border);
}
.pref-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.pref-row label { color: var(--text-soft); font-weight:600; }
.theme-select {
  padding:8px 10px;
  border-radius:8px;
  border:1px solid var(--glass-border);
  background: rgba(12,21,38,0.6);
  color: var(--text);
}

/* Predefined theme palettes (gradients + variable overrides) */
:root.theme-violet {
  --bg-gradient: radial-gradient(circle at 10% 0%, #2c0f4b 0%, #1b0b2a 45%, #07050a 100%);
  --surface-primary: rgba(18, 8, 32, 0.92);
  --surface-elevated: rgba(22, 10, 40, 0.94);
  --primary: #9b6cff; /* accent */
  --accent: #7c3aed;
  --text: #f7f3ff;
  --text-muted: rgba(247,243,255,0.78);
  --chip-bg: rgba(155,108,255,0.10);
}

:root.theme-rose {
  --bg-gradient: radial-gradient(circle at 10% 0%, #ffdbe8 0%, #f7d9ee 45%, #efe3f6 100%);
  --surface-primary: rgba(28, 10, 20, 0.94);
  --surface-elevated: rgba(34, 12, 26, 0.96);
  --primary: #ff8fb1;
  --accent: #ff6fa3;
  --text: #111017;
  --text-muted: rgba(17,16,23,0.6);
  --chip-bg: rgba(255,143,177,0.08);
}

:root.theme-bluish {
  --bg-gradient: radial-gradient(circle at 10% 0%, #0f1724 0%, #1b2633 45%, #111219 100%);
  --surface-primary: rgba(10, 14, 20, 0.96);
  --surface-elevated: rgba(12, 18, 26, 0.96);
  --primary: #5b7fa6;
  --accent: #6b8aa3;
  --text: #eaf0f6;
  --text-muted: rgba(234,240,246,0.75);
  --chip-bg: rgba(91,127,166,0.08);
}

/* Helper classes to apply theme quickly */
.theme-violet, .theme-rose, .theme-bluish { transition: background 320ms ease, color 220ms ease; }

/* Theme option buttons (icon-style) */
.theme-options { display:flex; gap:10px; align-items:center; }
.theme-option {
  all: unset;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:48px;
  border-radius:12px;
  cursor:pointer;
  border: 2px solid transparent;
  box-shadow: 0 6px 18px rgba(2,6,23,0.45);
}
.theme-option[aria-checked="true"] { border-color: rgba(255,255,255,0.12); box-shadow: 0 8px 22px rgba(0,0,0,0.5); }
.theme-swatch { width:34px; height:34px; border-radius:8px; display:block; }
.swatch-violet { background: linear-gradient(135deg,#6e3cff,#2b0f4b); }
.swatch-rose { background: linear-gradient(135deg,#ffd0e8,#f5c3e6); }
.swatch-bluish { background: linear-gradient(135deg,#24455a,#0f1724); }

.sr-only { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* Close button */
.account-close {
  position:absolute;
  right:12px;
  top:12px;
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border-radius:999px;
  border:1px solid var(--glass-border);
  background: rgba(148,163,184,0.06);
  cursor:pointer;
}

@media (max-width: 820px) {
  .account-modal-inner { grid-template-columns: 1fr; }
  .account-left { order: 2; }
  .account-right { order: 1; }
  #accountModal { width: min(96vw, 520px); }
}

/* Small focus and motion polish */
#accountModal :focus { outline: 2px solid rgba(56,189,248,0.12); outline-offset: 2px; }
.type-pill { transition: transform 140ms ease, background 140ms ease; }
.type-pill:hover { transform: translateY(-4px); background: rgba(56,189,248,0.08); }

/* Prevent the page from scrolling when a modal is open */
body.modal-open {
  overflow: hidden;
  height: 100vh;
}

/* Ensure the account modal overlay only dims the background and does not blur the modal */
#accountModalOverlay,
.account-modal-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}


.type-panel {
  background: rgba(14, 24, 42, 0.85);
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 24px 42px -36px rgba(52, 211, 153, 0.32);
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.label-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(56, 240, 184, 0.18);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(56, 240, 184, 0.42);
}


.section-nav {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 10px;
  background: rgba(12, 21, 38, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
}

.section-nav::-webkit-scrollbar {
  height: 6px;
}

.section-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

.section-nav button {
  all: unset;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-soft);
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.55);
  scroll-snap-align: start;
}

.section-nav button .nav-index {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-nav button .nav-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.75);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-top: 6px;
}


.section-nav button:hover,
.section-nav button:focus-visible {
  border-color: rgba(52, 211, 153, 0.6);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 18px 32px -24px rgba(52, 211, 153, 0.45);
}

.section-nav button.active {
  border-color: rgba(52, 211, 153, 0.8);
  background: rgba(52, 211, 153, 0.16);
  color: var(--primary);
  box-shadow: var(--shadow-hover);
}

.section-nav button.active .nav-tag {
  color: var(--primary);
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.16);
}

.section-nav button.completed::after {
  content: '✓';
  align-self: flex-end;
  font-size: 0.75rem;
  color: var(--primary);
}

.section-stage {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 28px);
}

.section-legend {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: rgba(12, 21, 38, 0.72);
  box-shadow: 0 24px 38px -30px rgba(56, 189, 248, 0.28);
}

.section-legend p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.legend-bullet {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.9), rgba(56, 189, 248, 0.9));
  color: #041b14;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.18);
}

.dynamic-sections {
  position: relative;
  min-height: 320px;
}

.section {
  background: rgba(14, 23, 40, 0.92);
  border: 1px solid var(--glass-border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2vw, 22px);
  display: none;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 38px -34px rgba(15, 23, 42, 0.74);
  position: relative;
}

.section.is-active {
  display: flex;
  animation: fadeInUp 0.4s ease;
  border-color: var(--glass-border);
  border-left-color: var(--primary);
  box-shadow: 0 36px 64px -42px rgba(52, 211, 153, 0.38);
}

.section h2 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section h2::before {
  content: '';
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.18);
}



.field-group label {
  margin-bottom: 0;
  color: var(--text-soft);
}

label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-soft);
}

input[type="text"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(10, 18, 34, 0.85);
  color: var(--text);
  font: inherit;
  transition: var(--transition);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 12px 24px -24px rgba(52, 211, 153, 0.3);
}
/* Sizing for better readability across all types */
input[type="text"], input[type="number"], select { min-height: 44px; }
input[type="number"] { min-width: 120px; }

input::placeholder,
textarea::placeholder {
  color: rgba(226, 232, 240, 0.38);
}
/* Bigger default textarea */
textarea { min-height: 120px; }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.7);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
  background: rgba(15, 23, 42, 0.92);
}

/* Multiple choice checkboxes */
.multiple-choice-container {
  display: grid;
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(10, 18, 34, 0.85);
  transition: var(--transition);
}

.checkbox-item:hover {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(15, 23, 42, 0.92);
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  background: rgba(10, 18, 34, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-sm);
  appearance: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.checkbox-item input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  border-color: rgba(52, 211, 153, 0.8);
}

.checkbox-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #042316;
  font-size: 12px;
  font-weight: 700;
}

.checkbox-item input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.checkbox-label {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

/* New multi-select dropdown */
.multi-select { position: relative; }
.multi-select-display {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(10, 18, 34, 0.85);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 44px;
}
.multi-select-display:hover { border-color: rgba(52,211,153,.5); background: rgba(15,23,42,.92); }
.multi-select-display:focus { outline: none; box-shadow: 0 0 0 3px rgba(52,211,153,.2); border-color: rgba(52,211,153,.7); }
.multi-select-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-width: min(520px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(10, 18, 34, 0.98);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.multi-select-option { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.multi-select-option:hover { background: rgba(52, 211, 153, 0.08); }
.multi-select-option input { accent-color: #10b981; }
.multi-select-option span { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent); border: 1px solid rgba(56,189,248,.3);
  font-size: .78rem;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Sequence builder (ordered pipeline) */
.sequence {
  display: grid;
  position: relative; /* for dropdown menu positioning */
  gap: 10px;
}
.sequence-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.sequence-select {
  width: 100%;
}
.sequence-list {
  list-style: decimal inside;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  background: rgba(12, 21, 38, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.sequence-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-sm);
}
.step-label {
  color: var(--text);
}
.step-actions {
  display: inline-flex;
  gap: 6px;
}
.step-actions .step-move,
.step-actions .step-del {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  cursor: pointer;
}
.step-actions .step-del:hover,
.step-actions .step-move:hover {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--primary);
}

/* Cultivar list styles */
.cultivar-list {
  display: grid;
  gap: 16px;
}

.add-cultivar-btn {
  justify-self: flex-start;
}

.cultivar-items {
  display: grid;
  gap: 14px;
}

.cultivar-item {
  padding: 16px;
  background: rgba(12, 21, 38, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 12px;
}

.cultivar-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.cultivar-item-number {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.05rem;
}

.cultivar-fields {
  display: grid;
  gap: 12px;
}

.field-inline {
  display: grid;
  gap: 6px;
}

.field-inline label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-inline input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  transition: var(--transition);
}

.field-inline input[type="text"]:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(15, 23, 42, 0.8);
}

.matiere-group .checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(10, 18, 34, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.checkbox-label:hover {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(10, 18, 34, 0.6);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
}

.btn-icon {
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Pipeline with cultivars styles */
.pipeline-with-cultivars {
  display: grid;
  position: relative;
  gap: 10px;
}

.pipeline-list {
  list-style: decimal inside;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  background: rgba(12, 21, 38, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.pipeline-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-sm);
}

.pipeline-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-cultivars {
  padding: 10px;
  background: rgba(52, 211, 153, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.15);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
}

.step-cultivars-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.step-cultivars-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-cultivars-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="file"] {
  padding: 12px 16px;
  cursor: pointer;
}



.total-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--chip-bg);
  border: 1px solid rgba(52, 211, 153, 0.5);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.section-header .total-badge {
  align-self: center;
  margin-left: auto;
}

.btn,
button {
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn.btn-sm {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn span[aria-hidden="true"],
.btn span:not([aria-hidden]) {
  display: inline-flex;
}

.btn-primary {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  color: #042316;
  box-shadow: 0 22px 45px -20px rgba(52, 211, 153, 0.6);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 60px -18px rgba(52, 211, 153, 0.7);
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(129, 140, 248, 0.95));
  color: var(--text);
  box-shadow: 0 22px 40px -24px rgba(56, 189, 248, 0.55);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 54px -22px rgba(56, 189, 248, 0.6);
}

.btn-outline {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.24);
}

.btn-outline:hover {
  border-color: rgba(52, 211, 153, 0.55);
  color: var(--primary);
  background: rgba(52, 211, 153, 0.14);
}

/* Additional button variants for consistency */
.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(148,163,184,.2); }
.btn-ghost:hover { background: rgba(148,163,184,.08); border-color: rgba(52,211,153,.45); color: var(--primary); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #ef4444); color: #fff; box-shadow: 0 22px 45px -20px rgba(239,68,68,.4); }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 28px 60px -18px rgba(239,68,68,.5); }

/* Themed file input */
.file-input { display: inline-flex; align-items: center; gap: 12px; }
.file-input { display: inline-flex; align-items: center; gap: 12px; width: 100%; }
.file-name { color: var(--text-soft); font-size: .9rem; }
.file-name { color: var(--text-soft); font-size: .9rem; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-input-hidden { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.file-name { color: var(--text-soft); font-size: .9rem; }
.file-select-btn { white-space: nowrap; }

.form-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.section-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-controls .btn {
  flex: 1 1 220px;
}

.form-actions .btn {
  flex: 1 1 220px;
}

.preview-header .panel-subtitle {
  max-width: 32ch;
}

.preview-body {
  background: rgba(12, 21, 38, 0.78);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  padding: clamp(24px, 3.2vw, 32px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.preview-placeholder {
  text-align: center;
  display: grid;
  gap: 16px;
  place-items: center;
  color: var(--text-muted);
  padding: 28px 16px;
}

.placeholder-icon {
  font-size: 2.4rem;
  filter: drop-shadow(0 12px 22px rgba(139, 92, 246, 0.45));
}

.placeholder-list {
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.review-output {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.5vw, 24px);
}

.preview-controls {
  display: flex;
  justify-content: flex-end;
  padding: 0 4px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}
.review-content {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: clamp(28px, 3.2vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 0 40px 70px -40px rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

/* Nouveau layout optimisé pour l'image finale */
.review-header {
  text-align: center;
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

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

.product-title {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0;
}

.farm-info {
  font-size: 0.9rem;
  color: var(--text-soft);
  background: rgba(52, 211, 153, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
}

/* Cultivars info display in generated review */
.cultivars-info {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.cultivar-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
}

.cultivar-number {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cultivar-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cultivar-details strong {
  color: var(--primary);
  font-size: 1.05rem;
}

.cultivar-meta {
  font-size: 0.85rem;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-image-container {
  margin: 16px 0;
  text-align: center;
}

.product-image {
  max-width: 300px;
  max-height: 200px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Score global compact */
.global-score-compact {
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.08), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.score-header h3 {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
}

.score-main {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.score-main .score-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.score-main .score-max {
  font-size: 1.2rem;
  color: var(--text-soft);
}

.score-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-breakdown {
  font-size: 0.85rem;
  color: var(--text-soft);
  white-space: nowrap;
}

/* Grille de contenu optimisée */
.review-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.review-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.section-header {
  background: rgba(52, 211, 153, 0.1);
  border-bottom: 1px solid var(--glass-border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.section-score-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-score-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.section-score-bar-mini {
  width: 40px;
  height: 4px;
  background: rgba(52, 211, 153, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.section-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

.section-content {
  padding: 16px;
}

/* Grille numérique compacte */
.numeric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.field-numeric {
  background: rgba(52, 211, 153, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.15);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.field-numeric .field-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.field-numeric .field-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.score-indicator {
  margin-top: 4px;
}

.score-bar-inline {
  width: 100%;
  height: 3px;
  background: rgba(52, 211, 153, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill-inline {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

/* Champs texte optimisés */
.field-item {
  margin-bottom: 12px;
}

.field-item:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.field-value {
  color: var(--text-muted);
  line-height: 1.4;
}

.field-text-long .field-value {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Séquences optimisées */
.field-sequence .field-value {
  margin-top: 8px;
}

.sequence-list {
  margin: 0;
  padding-left: 16px;
}

.sequence-item {
  margin-bottom: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Choix multiples */
.choice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.choice-tag {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.no-content {
  color: var(--text-soft);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* Responsive pour export haute résolution */
@media print, (min-width: 1200px) {
  .review-content-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
  }
  
  .section-content {
    padding: 12px;
  }
  
  .numeric-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
  }
}

.product-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  justify-self: center;
}

/* hide default page scrollbar when modal is open (visual improvement) */
body.modal-open { overflow: hidden; }

/* Ensure modals and overlays are interactive and on top when modal-open is set */
.modal, .modal-overlay, #accountModal, .account-overlay, #publicProfileModal {
  pointer-events: auto !important;
}

/* When a modal is open, ensure any bottom navigation or body decoration doesn't intercept clicks */
body.modal-open::after,
.mobile-bottom-nav {
  pointer-events: none !important;
}

.review-header h2 {
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.review-meta {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.global-score {
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.08), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.global-score h3 {
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 600;
}

.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.score-circle {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.2));
  border: 2px solid rgba(52, 211, 153, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.score-max {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.score-breakdown {
  flex: 1;
  min-width: 200px;
}

.score-bar {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.8s ease;
}

.score-text {
  font-size: 0.85rem;
  color: var(--text-soft);
}

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

.review-image img {
  max-width: min(520px, 90%);
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 24px 40px -28px rgba(15, 23, 42, 0.85);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.review-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 240, 184, 0.12);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
}

.review-card h3::before {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.85), rgba(56, 189, 248, 0.85));
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.12);
}

.review-item {
  border-left: 2px solid rgba(52, 211, 153, 0.45);
  padding-left: 12px;
  display: grid;
  gap: 4px;
}

.review-item strong {
  color: var(--text);
}

.review-item span {
  color: var(--text-soft);
}

.sequence-step {
  display: block;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 2px 0;
  font-size: 0.85rem;
}

.choice-tag {
  display: inline-block;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 12px;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  font-size: 0.8rem;
  color: var(--primary);
}

.mini-score-bar {
  width: 60px;
  height: 4px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.mini-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #eab308, #22c55e, #10b981);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.section-total {
  border-color: var(--primary) !important;
  background: rgba(52, 211, 153, 0.05);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
}

.section-score {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600 !important;
  color: var(--primary) !important;
}

.section-score-bar {
  flex: 1;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.section-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.no-data {
  font-style: italic;
  opacity: 0.6;
}

/* Aperçu live compact */
.live-preview {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.9);
}

.live-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.live-product-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  align-self: center;
}

.live-icon {
  font-size: 1.1rem;
}

.live-title {
  font-size: 1.4rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.live-score {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 12px;
  padding: 16px;
}

.live-score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.2));
  border: 2px solid rgba(52, 211, 153, 0.4);
  flex-shrink: 0;
}

.live-score-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.live-score-unit {
  font-size: 0.7rem;
  color: var(--text-soft);
  line-height: 1;
}

.live-score-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-score-bar {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.live-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.8s ease;
}

.live-score-text {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.live-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  transition: all 0.2s ease;
}

.live-section.has-data {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.05);
}

.live-section.empty {
  opacity: 0.6;
}

.live-section-icon {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
}

.live-section-title {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.live-section-score {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

/* ========================================
   PREVIEW MODE SELECTOR
   ======================================== */
.preview-mode-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.preview-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.preview-mode-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--primary);
  transform: translateY(-2px);
}

.preview-mode-btn.active {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(56, 189, 248, 0.25));
  border-color: rgba(52, 211, 153, 0.6);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

/* ========================================
   MODE 1: COMPACT PREVIEW
   ======================================== */
.preview-compact {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 24px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.9);
}

.compact-header {
  text-align: center;
  margin-bottom: 24px;
}

.compact-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 12px;
}

.compact-icon {
  font-size: 1.1rem;
}

.compact-title {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0;
}

.compact-score {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.compact-score-circle {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s ease;
}

.score-ring-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-ring-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.score-ring-unit {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* Gradient for SVG */
svg defs {
  display: none;
}

.compact-score-details {
  flex: 1;
  display: grid;
  gap: 12px;
}

.compact-score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.compact-score-item .score-label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.compact-score-item .score-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.compact-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compact-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
}

.compact-section:hover {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.05);
  transform: translateX(4px);
}

.compact-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.compact-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.compact-section-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.compact-section-bar {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.compact-section-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.8s ease;
}

/* ========================================
   MODE 2: DETAILED PREVIEW
   ======================================== */
.preview-detailed {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 28px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.9);
}

.detailed-header {
  text-align: center;
  margin-bottom: 24px;
}

.detailed-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.2));
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 22px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
}

.detailed-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.detailed-cultivars {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.detailed-cultivar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
}

.cultivar-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 50%;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.cultivar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cultivar-info strong {
  color: var(--primary);
  font-size: 1.05rem;
}

.cultivar-info .cultivar-meta {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.detailed-global-score {
  margin-bottom: 28px;
}

.global-score-main {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.12), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-lg);
}

.global-score-circle {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.global-score-info {
  flex: 1;
}

.global-score-info h3 {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  color: var(--text);
}

.global-score-info .score-breakdown {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 600;
  margin: 4px 0;
}

.global-score-info .score-sections {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 4px 0;
}

.detailed-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detailed-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s ease;
}

.detailed-section:hover {
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.1);
}

.detailed-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.detailed-section-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
}

.section-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-score-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.section-score-bar {
  width: 80px;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.section-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.8s ease;
}

.detailed-section-content {
  display: grid;
  gap: 14px;
}

.detailed-field {
  display: grid;
  gap: 6px;
}

.detailed-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detailed-field .field-value {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.detailed-field.field-number-type .field-value {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
}

.field-bar {
  flex: 1;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.field-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.8s ease;
}

.field-sequence {
  list-style: decimal inside;
  padding: 12px;
  background: rgba(10, 18, 34, 0.6);
  border-radius: var(--radius-sm);
  margin: 0;
}

.field-sequence li {
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.05);
  transition: all 0.2s ease;
}

.field-sequence li:hover {
  background: rgba(52, 211, 153, 0.08);
}

.field-sequence small {
  color: var(--text-soft);
  font-size: 0.85em;
}

.field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 16px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}

.field-tag.cultivar-tag {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--accent);
}

/* ========================================
   MODE 3: CARD PREVIEW
   ======================================== */
.preview-card {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 24px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.9);
}

.card-container {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.1), rgba(56, 189, 248, 0.1));
}

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

.card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.15), rgba(56, 189, 248, 0.15));
}

.card-placeholder-icon {
  font-size: 4rem;
  opacity: 0.5;
}

.card-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-badge {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.card-content {
  padding: 24px;
}

.card-title {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 16px 0;
}

.card-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 10px 18px;
  border-radius: 24px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.2));
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.card-score.excellent {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(52, 211, 153, 0.25));
  border-color: rgba(16, 185, 129, 0.5);
}

.card-score.good {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(59, 130, 246, 0.25));
  border-color: rgba(56, 189, 248, 0.5);
}

.card-score.average {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.25));
  border-color: rgba(251, 191, 36, 0.5);
}

.card-score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.card-score-unit {
  font-size: 1.2rem;
  color: var(--text-soft);
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.card-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.card-stat:hover {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.05);
}

.card-stat .stat-icon {
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 211, 153, 0.15);
  border-radius: 8px;
  flex-shrink: 0;
}

.card-stat .stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-stat .stat-label {
  font-size: 0.75rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-stat .stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.card-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-section-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(10, 18, 34, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.card-section-item:hover {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.05);
}

.card-section-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.card-section-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.card-section-bar {
  width: 60px;
  height: 4px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.card-section-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.8s ease;
}

/* ========================================
   MODE 4: MINIMAL PREVIEW
   ======================================== */
.preview-minimal {
  background: linear-gradient(145deg, rgba(14, 20, 36, 0.96), rgba(16, 24, 42, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 24px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.9);
}

.minimal-content {
  text-align: center;
  padding: 20px;
}

.minimal-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.minimal-title {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(56, 240, 184, 1), rgba(139, 92, 246, 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 8px 0;
}

.minimal-type {
  font-size: 1rem;
  color: var(--text-soft);
  margin-bottom: 28px;
}

.minimal-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 32px;
  border-radius: 20px;
  margin-bottom: 24px;
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.15), rgba(56, 189, 248, 0.15));
  border: 2px solid rgba(52, 211, 153, 0.4);
}

.minimal-score.excellent {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.2));
  border-color: rgba(16, 185, 129, 0.6);
}

.minimal-score.good {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.2), rgba(59, 130, 246, 0.2));
  border-color: rgba(56, 189, 248, 0.6);
}

.minimal-score.average {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border-color: rgba(251, 191, 36, 0.6);
}

.minimal-score-value {
  font-size: 4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.minimal-score-label {
  font-size: 1.5rem;
  color: var(--text-soft);
  margin-top: 4px;
}

.minimal-progress {
  max-width: 320px;
  margin: 0 auto 16px;
}

.minimal-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.minimal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 6px;
  transition: width 0.8s ease;
}

.minimal-progress-text {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.minimal-info {
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 12px;
  background: rgba(52, 211, 153, 0.08);
  border-radius: var(--radius-md);
  border: 1px solid rgba(52, 211, 153, 0.2);
  display: inline-block;
}

/* Bibliothèque compacte */
.compact-library-section {
  margin-top: 24px;
}

.sidebar-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.compact-library {
  background: rgba(12, 21, 38, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.compact-library-empty {
  text-align: center;
  padding: 16px 8px;
  color: var(--text-soft);
}

.compact-empty-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 8px;
}

.compact-library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
}

.compact-library-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 80px;
  position: relative;
  overflow: hidden;
}

.compact-library-item:hover {
  border-color: var(--primary);
  background: rgba(52, 211, 153, 0.15);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(52, 211, 153, 0.25);
}

.compact-library-item.is-draft {
  border: 2px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
}

.compact-library-item.is-draft::after {
  content: "📋 Brouillon";
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  color: rgba(245, 158, 11, 1);
  background: rgba(15, 23, 42, 0.95);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 10;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.compact-item-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.compact-item-info {
  flex: 1;
  min-width: 0;
}

.compact-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.compact-item-meta {
  font-size: 0.7rem;
  color: var(--text-soft);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image d'aperçu pour les cartes */
.compact-item-image {
  width: 100%;
  height: 50px;
  object-fit: cover;
  background: rgba(148, 163, 184, 0.1);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.compact-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
}

/* Badge de brouillon spécial pour galerie */
.compact-library-item .draft-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.compact-item-badge {
  font-size: 0.6rem;
  background: #f59e0b;
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.compact-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-item-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.compact-library-item:hover .compact-item-actions {
  opacity: 1;
}

.compact-item-actions .btn {
  padding: 2px 4px;
  font-size: 0.7rem;
  min-width: auto;
  white-space: nowrap;
  border-radius: 4px;
  min-height: 20px;
  line-height: 1;
}

.btn-xs {
  padding: 2px 4px;
  font-size: 0.7rem;
  min-height: 20px;
  line-height: 1;
  border-radius: 4px;
}

/* Amélioration pour les icônes emoji dans les boutons */
.compact-item-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive pour la galerie compacte */
@media (max-width: 768px) {
  .compact-library-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  
  .compact-library-item {
    min-height: 70px;
  }
  
  .compact-item-image {
    height: 40px;
  }
  
  .compact-item-title {
    font-size: 0.75rem;
  }
  
  .compact-item-meta {
    font-size: 0.65rem;
  }
  
  .compact-item-content {
    padding: 8px;
  }
  
  .library-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  background: rgba(245, 158, 11, 0.15);
  color: rgba(245, 158, 11, 1);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(245, 158, 11, 0.4);
  backdrop-filter: blur(8px);
}

.draft-badge::before {
  content: "📋";
  font-size: 0.85rem;
}

.library-item.is-draft {
  border: 2px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.05);
}

.library-item.is-draft .library-item-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 0%, rgba(245, 158, 11, 0.1) 100%);
  pointer-events: none;
}

/* Neutralize draft visuals (draft system deprecated) */
.is-draft, .library-item.is-draft, .compact-library-item.is-draft { 
  border: none !important; 
  background: transparent !important; 
}
.draft-badge, .compact-library-item .draft-badge, #draftBadge { display: none !important; }
.compact-library-item.is-draft::after, .compact-library-item.is-draft::before { content: none !important; }

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.review-actions .btn {
  flex: 1 1 200px;
}

#reviewOutput[hidden] {
  display: none !important;
}

.loading {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.site-footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;

/* Strong override: hide any remaining draft visuals and pseudo elements.
   This is appended at the end to win over earlier rules and browser caching. */
*[class*="draft"],
*[id*="draft"],
.draft-badge,
.compact-library-item .draft-badge,
.library-item .draft-badge,
.compact-library-item.is-draft,
.library-item.is-draft,
.is-draft,
.compact-library-item.is-draft::before,
.compact-library-item.is-draft::after,
.library-item.is-draft::before,
.library-item.is-draft::after {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Defensive: remove any 'Brouillon' / 'Draft' pseudo-content */
.compact-library-item.is-draft::after,
.compact-library-item.is-draft::before,
.library-item.is-draft::after,
.library-item.is-draft::before {
  content: none !important;
}

/* Prevent accidental focus on hidden draft controls */
[id^="draft"],
[data-draft],
[aria-draft] {
  pointer-events: none !important;
}
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding-top: 24px;
}

.footer-links {
  display: inline-flex;
  gap: 18px;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

.hidden {
  display: none !important;
}

/* Honor the HTML hidden attribute even when layout sets display on panels */
[hidden] {
  display: none !important;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(18px, 2.8vw, 32px);
}

/* Sidebar now behaves like a top row assistant panel */
.panel-sidebar {
  grid-area: assistant;
  /* Non-sticky for a simpler scroll experience */
  position: static;
  top: auto;
  height: auto;
  overflow: visible;
  z-index: 20;
  max-width: 1040px;
  width: 100%;
  justify-self: center;
  margin-left: auto;
  margin-right: auto;
}

/* Step 1: center the assistant and remove sticky to avoid awkward offset */
.workspace:not(.has-content) .panel-sidebar {
  position: static;
  top: auto;
  margin: 0 auto;
  max-width: none;
  width: min(1640px, 94vw);
  justify-self: center;
}

/* Compact assistant bar (visible only in step 2) */
.assistant-compact {
  background: rgba(12, 21, 38, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
}
.assistant-compact .compact-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.assistant-compact .compact-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: var(--primary);
  font-weight: 600;
}
.assistant-compact .compact-progress {
  color: var(--text-soft);
}

/* Toggle assistant sections depending on step */
.workspace.has-content #assistantStep1 { display: none; }
.workspace.has-content #assistantCompact { display: block; }

/* Step 1 horizontal layout: label/help on left, cards on right */
.workspace:not(.has-content) .type-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1fr);
  gap: 18px 24px;
  align-items: start;
}

.workspace:not(.has-content) .type-panel .type-selector {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.workspace:not(.has-content) .type-panel .section-label {
  align-items: flex-start;
}

.workspace:not(.has-content) .type-panel .section-helper {
  margin-top: 4px;
}

.panel-preview {
  grid-area: preview;
  position: static;
  top: auto;
  height: auto;
  margin-top: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: visible;
}

.panel-sidebar::-webkit-scrollbar {
  width: 6px;
}

.panel-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
}

.panel-form {
  grid-area: form;
  display: flex;
  margin-top: 8px;
}

/* When content is visible, adjust the hidden assistant layout */
.assistant-hidden .workspace.has-content {
  grid-template-areas: "form preview";
}

.review-form {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.6vw, 28px);
  height: 100%;
}

.form-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 24px);
  min-height: 0;
}

.dynamic-sections {
  /* Let content flow without an inner scrollbar */
  flex: 1 1 auto;
  min-height: auto;
  overflow: visible;
  padding-right: 0;
}

.dynamic-sections::-webkit-scrollbar {
  width: 8px;
}

.dynamic-sections::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.32);
  border-radius: 999px;
}

/* Section nav becomes horizontal pill row in the top assistant */
.section-nav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 10px;
  padding: 8px 2px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: rgba(12, 21, 38, 0.7);
}

.section-nav button {
  min-width: 0;
  white-space: nowrap;
}

.section-controls {
  position: static;
  padding: clamp(12px, 1.5vw, 18px);
  border: 1px solid rgba(94, 114, 158, 0.22);
  border-radius: var(--radius-lg);
  background: rgba(10, 18, 34, 0.9);
  backdrop-filter: blur(18px);
  gap: clamp(14px, 1.8vw, 20px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.preview-body {
  /* Avoid nested scrollbars in the preview column */
  min-height: auto;
  overflow: visible;
  padding-right: 0;
  align-items: stretch;
  background: rgba(12, 21, 38, 0.78);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  padding: clamp(24px, 3.2vw, 32px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.review-output {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.review-actions {
  margin-top: auto;
}

/* Collapsed assistant (sidebar hidden) for wider form/preview */
.assistant-hidden .panel-sidebar {
  display: none !important;
}
.assistant-hidden .workspace {
  grid-template-columns: minmax(0, 1.1fr) minmax(520px, 0.9fr);
  grid-template-areas:
    "form preview";
}

/* Library Drawer */
.library-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1200;
}

.library-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(540px, 94vw);
  height: 100vh;
  background: rgba(10, 18, 34, 0.98);
  border-left: 1px solid var(--glass-border);
  box-shadow: -24px 0 60px -24px rgba(0,0,0,0.55);
  z-index: 1250;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* Preview-only modal */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1400;
}
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1450;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(1000px, 94vw);
  height: min(88vh, 920px);
  margin: auto;
  background: rgba(10, 18, 34, 0.98);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.preview-modal-header .actions { display: inline-flex; gap: 10px; align-items: center; }
.preview-modal-body {
  overflow: auto;
  padding: 14px 16px;
}
.preview-modal .review-content {
  margin: 0 auto;
  max-width: 820px;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--glass-border);
}
.library-header h3 {
  font-size: 1.1rem;
}
.library-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.library-actions input[type="search"] {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(10, 18, 34, 0.85);
  color: var(--text);
}

.library-body {
  overflow-y: auto;
  padding: 20px 18px;
  background: rgba(0, 0, 0, 0.1);
}

.library-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.library-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(12, 21, 38, 0.85);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.library-item:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(52, 211, 153, 0.2);
}

.library-item .meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  flex: 1;
}
.library-item .meta .title {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--text);
}
.library-item .meta .sub {
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.4;
}
.library-item .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}
.library-empty {
  color: var(--text-soft);
  text-align: center;
  padding: 18px 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(16px, 2vw, 22px);
  grid-auto-flow: dense;
}

.fields-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 1.8vw, 20px);
}

.field-group {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
}

.field-group label {
  margin-bottom: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.field-group input,
.field-group textarea,
.field-group select {
  margin: 0;
}
.field-group > label { align-self: start; padding-top: 6px; }
.field-group > *:not(label) { align-self: center; }

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

@media (min-width: 1200px) {
  /* Large screens: keep one-row-per-field; ensure complex widgets span full width */
  .fields-stack { grid-template-columns: 1fr; }
  .field-group:has(textarea),
  .field-group:has(.sequence),
  .field-group:has(.multi-select) { grid-column: 1 / -1; }
}

.toast-container {
  position: fixed;
  left: clamp(24px, 4vw, 40px);
  bottom: clamp(24px, 4vw, 40px);
  display: grid;
  gap: 12px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 320px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: 0 22px 40px -24px rgba(15, 23, 42, 0.8);
  opacity: 0;
  transform: translateY(12px);
  transition: var(--transition), opacity 0.3s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(56, 240, 184, 0.4);
  background: rgba(13, 35, 28, 0.92);
  color: var(--text);
}

.toast-info {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
}

.toast-warning {
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(55, 48, 15, 0.92);
  color: #facc15;
}

.toast-error {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(69, 16, 25, 0.94);
  color: #fecaca;
}

/* Floating Auth Button */
.floating-auth-btn {
  position: fixed;
  bottom: clamp(24px, 4vw, 40px);
  right: clamp(24px, 4vw, 40px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px -4px rgba(52, 211, 153, 0.4), 0 4px 12px -2px rgba(15, 23, 42, 0.6);
  transition: all 0.3s ease;
  z-index: 1500;
}

.floating-auth-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px -4px rgba(52, 211, 153, 0.5), 0 6px 16px -2px rgba(15, 23, 42, 0.7);
}

.floating-auth-btn.connected {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}

/* Auth Modal Content */
.auth-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.auth-status {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 5000;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: slideInLeft 0.4s ease-out;
}

/* Feedback widget removed */

.auth-status:hover {
  transform: translateX(-5px);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Ensure small auth-status notifications don't intercept clicks when a modal is open */
body.modal-open .auth-status { pointer-events: none; opacity: 0.95; }

.auth-status-success {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(52, 211, 153, 0.1) 100%);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  backdrop-filter: blur(10px);
}

.auth-status-error {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2) 0%, rgba(248, 113, 113, 0.1) 100%);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
  backdrop-filter: blur(10px);
}

.auth-status-info {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.2) 0%, rgba(148, 163, 184, 0.1) 100%);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.4);
  backdrop-filter: blur(10px);
}

.auth-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.auth-help {
  font-size: 0.875rem;
  color: var(--text-soft);
  text-align: center;
  margin-top: 8px;
}

.auth-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-info {
  padding: 12px 16px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-info strong {
  color: var(--accent);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.form-group .input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group .input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-elevated);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  padding: 0;
  transition: var(--transition);
}

.link-btn:hover {
  color: var(--primary);
}

@media (min-width: 1280px) {
  .workspace {
    width: min(1640px, 94vw);
  }

  body:not(.layout-landscape) .workspace {
    grid-template-columns: 320px minmax(0, 1.1fr) minmax(360px, 1fr);
  }

  body:not(.layout-landscape) .panel-preview {
    align-self: stretch;
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: clamp(24px, 5vw, 36px);
  }

  .panel-sidebar,
  .panel-preview {
    position: static;
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .section-nav {
    position: sticky;
    top: clamp(88px, 14vh, 120px);
  }

  .shortcut-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .preview-body {
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .top-nav {
    flex-direction: column;
    gap: 18px;
    text-align: center;
  }

  .brand {
    flex-direction: column;
  }

  .app-shell {
    padding: clamp(18px, 5vw, 28px);
    gap: clamp(20px, 6vw, 32px);
  }

  .workspace {
    gap: clamp(20px, 5vw, 32px);
  }

  .panel {
    padding: clamp(22px, 6vw, 32px);
    gap: clamp(20px, 5vw, 28px);
  }

  .section-nav {
    margin: 0 calc(-1 * clamp(18px, 5vw, 28px));
    padding: 12px clamp(18px, 5vw, 28px);
    border-radius: 0;
    backdrop-filter: blur(18px);
    scroll-snap-type: x mandatory;
  }

  .section-nav button {
    min-width: 180px;
  }

  .form-actions,
  .review-actions {
    flex-direction: column;
  }

  .section-controls {
    flex-direction: column;
  }

  .type-selector {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .site-footer {
    flex-direction: column;
    text-align: center;
  }

  .section-legend {
    flex-direction: column;
  }
}

/* ============================
   STYLES SPÉCIFIQUES NOUVELLES PAGES
   ============================ */

/* PAGE D'ACCUEIL */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-page .top-nav {
  backdrop-filter: blur(16px);
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.home-page .workspace {
  /* Wider canvas so the gallery can breathe */
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.home-workspace {
  background: none;
  gap: 0;
}

.hero-section {
  text-align: center;
  padding: 2rem 0 1rem 0;
  margin: 0 auto 2rem auto;
  width: 100%;
}

.hero-content {
  max-width: 1100px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.home-page .type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 0 auto 1.5rem auto;
  max-width: 920px;
}

.home-page .type-card {
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  text-align: left;
  background: var(--surface-elevated);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.home-page .type-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(52, 211, 153, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

.home-page .type-card:hover::before {
  left: 100%;
}

.home-page .type-card:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 20px 40px -12px rgba(15, 23, 42, 0.8),
    0 0 40px -20px rgba(52, 211, 153, 0.4);
  border-color: var(--primary);
  background: var(--panel-strong);
}

.home-page .type-card:active {
  transform: translateY(-2px);
}

.home-page .type-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.type-content {
  flex: 1;
}

.home-page .type-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.home-page .type-caption {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.quick-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.library-section {
  margin: 2rem auto 0 auto;
  padding-top: 1.25rem;
  /* Intégration douce: pas de séparation en "boîte" */
  border-top: none;
  max-width: 1300px;
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.compact-library {
  /* Supprime l'apparence de boîte et tout scroll interne */
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  max-height: none;
  overflow: visible;
  width: 100%;
}

.compact-library-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.6;
}

.empty-hint {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-top: 0.5rem;
  display: block;
}

.home-page .compact-library-list {
  display: grid;
  /* 4 colonnes plein écran pour un layout 4x2 */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  max-height: none;
  overflow: visible;
  width: 100%;
}

.compact-library-item {
  /* Style harmonisé avec les boutons de type */
  background: var(--surface-elevated);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  box-shadow: 0 20px 35px -30px rgba(15, 23, 42, 0.8);
  overflow: hidden;
}

.compact-library-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.1), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

.compact-library-item.is-draft::before {
  /* Désactivé sur la home pour un rendu plus propre (voir override plus bas) */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.compact-library-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.compact-library-item:hover::before { left: 100%; }

.compact-item-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.85rem;
}
.library-actions-below {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.compact-item-content {
  margin-bottom: 0.75rem;
}

.compact-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.compact-item-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.compact-item-actions {
  display: flex;
  gap: 0.5rem;
}

.draft-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Home: style de brouillon plus discret et élégant */
.home-page .compact-library-item.is-draft::before { display: none; }
.home-page .compact-library-item.is-draft::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  opacity: 0.9;
}
.home-page .compact-library-item .draft-badge {
  right: auto;
  left: 12px;
  top: 10px;
  background: rgba(10, 18, 34, 0.7);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(6px);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

.library-item {
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
}

.library-item.is-draft::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.library-item:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 16px 32px -8px rgba(15, 23, 42, 0.6),
    0 0 40px -16px rgba(52, 211, 153, 0.3);
  border-color: var(--primary);
}

.library-item-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: rgba(148, 163, 184, 0.1);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.library-item-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-item-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-item-type {
  display: inline-block;
  color: var(--primary);
  background: rgba(52, 211, 153, 0.12);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  width: fit-content;
}

.library-item-farm {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-item-farm::before {
  content: "🏪";
  font-size: 0.9rem;
}

.library-item-date {
  color: var(--text-soft);
  font-size: 0.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-item-date::before {
  content: "📅";
  font-size: 0.85rem;
}

.library-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.search-bar {
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--surface-primary);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
  background: var(--surface-elevated);
}

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

/* Modales améliorées */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Ensure save modal is above any other overlays (preview: 1450, toasts: 2000) */
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 
    0 40px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 60px -20px rgba(52, 211, 153, 0.2);
}

/* Public profile modal: hidden by default and shown when .show is added */
#publicProfileModal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 94vw);
  max-height: 88vh;
  display: none;
  z-index: 2450;
}

#publicProfileModal .account-dialog { max-width: 100%; }
#publicProfileModal.show { display: block; }

/* Strong override: prevent the public profile from being rendered as a bottom-docked bar.
   It must remain hidden until explicitly opened with the .show class. Use !important
   to override any inline styles or other rules that placed it at the bottom. */
#publicProfileModal {
  bottom: auto !important;
  right: auto !important;
  width: min(900px, 94vw) !important;
  max-width: 100% !important;
  display: none !important;
  visibility: hidden !important;
}

#publicProfileModal.show {
  display: block !important;
  visibility: visible !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
}

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

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(90vh - 200px);
}

/* Save modal specific */
.save-form { display: grid; gap: 1.25rem; }
.save-form .form-row { display: grid; gap: 0.5rem; }
.save-form .field-label { font-weight: 600; }
.save-form input[type="text"] {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--surface-elevated);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text);
}
.save-form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}
.save-form .field-hint { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.save-form .field-error { color: #fca5a5; font-size: 0.9rem; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: .5rem; }

/* Styles pour les astuces */
.tips-content {
  display: grid;
  gap: 2rem;
}

.tip-group h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tip-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tip-group li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tip-group li:last-child {
  border-bottom: none;
}

kbd {
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-family: monospace;
  font-weight: 600;
}

/* PAGE ÉDITEUR */
.editor-page .workspace {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  /* Let content define height to avoid nested scrollbars */
  height: auto;
}

.editor-page .panel {
  background: var(--surface-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-form {
  /* Avoid inner scroll; allow the page to scroll */
  overflow: visible;
}

.panel-preview {
  /* Ensure preview is not sticky in the editor page final rules */
  position: static;
  top: auto;
  height: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.preview-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.preview-controls {
  display: flex;
  gap: 0.75rem;
}

.preview-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.review-container {
  flex: 1;
  margin-bottom: 1.5rem;
}

.export-controls {
  display: flex;
  gap: 0.75rem;
}

.selected-type-chip {
  background: var(--chip-bg);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

/* RESPONSIVE POUR NOUVELLES PAGES */
@media (max-width: 1200px) {
  .home-page .type-selector {
    grid-template-columns: 1fr;
    max-width: 600px;
  }
  .home-page .compact-library-list { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .editor-page .workspace {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .hero-title {
    font-size: 2.75rem;
  }
  
  .home-page .workspace {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .home-page .workspace {
    padding: 1rem;
    gap: 2rem;
  }
  
  .hero-section {
    padding: 1.5rem 0;
    margin-bottom: 2rem;
  }
  
  .hero-title {
    font-size: 2.25rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }
  
  .home-page .type-card {
    padding: 1.5rem;
    gap: 1rem;
    min-height: 100px;
  }
  
  .home-page .type-icon {
    font-size: 2rem;
  }
  
  .home-page .type-title {
    font-size: 1.1rem;
  }
  
  .home-page .type-caption {
    font-size: 0.85rem;
  }
  
  .library-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 1rem !important; }
  .home-page .compact-library-list { grid-template-columns: repeat(2, 1fr); }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .quick-actions {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.875rem;
  }
  
  .home-page .type-card {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }
  
  .modal-content {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
  
  .modal-header,
  .modal-body {
    padding: 1.5rem;
  }
  .home-page .compact-library-list { grid-template-columns: 1fr; }
}

  /* Ensure author buttons in compact items are visible and clickable */
  .compact-library-item .author-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    z-index: 50;
    position: relative;
  }

/* ========================================
   📱 MOBILE RESPONSIVE DESIGN
   ======================================== */

/* 
 * Breakpoints:
 * - Tablet:  < 1024px
 * - Mobile:  < 768px  
 * - Small:   < 480px
 */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TABLET (< 1024px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 1024px) {
  /* Editor layout : Réduire largeur sidebar */
  .editor-layout {
    grid-template-columns: minmax(200px, 0.3fr) minmax(0, 1fr) !important;
  }
  
  /* Galerie produits */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }
  
  /* Cards de reviews */
  .review-cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MOBILE LANDSCAPE & PORTRAIT (< 768px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
  
  /* ────────────────────────────────────────
     BASE & TYPOGRAPHY - Plus élégant
     ──────────────────────────────────────── */
  :root {
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
  }
  
  /* Forcer l'affichage du bouton Ma bibliothèque si connecté */
  #openLibrary[style*="display: inline-flex"],
  #openLibrary[style*="display:inline-flex"] {
    display: inline-flex !important;
  }
  
  /* Interface mobile compacte et fluide */
  body {
    font-size: 15px;
    line-height: 1.5;
    padding-top: 0 !important;
    padding-bottom: 80px; /* Espace pour navigation bottom */
  }
  
  /* Workspace ultra-compact */
  .workspace,
  .container,
  .wrap,
  .main-content {
    padding: 0.3rem !important; /* Padding minimal */
    max-width: 100%;
  }
  
  /* Panels sans espacement inutile */
  .panel {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
  }
  
  .panel-header {
    padding: 0.8rem 0.5rem 0.3rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.1) !important;
    border-radius: 0 !important;
    margin-bottom: 0.5rem !important;
  }
  
  .panel-eyebrow {
    font-size: 0.7rem !important;
    margin-bottom: 0.2rem !important;
    color: var(--primary) !important;
    opacity: 0.8;
  }
  
  .panel-header h2 {
    font-size: 1rem !important;
    margin-bottom: 0 !important;
    font-weight: 600 !important;
  }
  
  /* ────────────────────────────────────────
     NAVIGATION TOP - Compact et élégant
     ──────────────────────────────────────── */
  .top-nav {
    position: static !important; /* Pas sticky sur mobile */
    top: auto !important;
    margin: 0 !important;
    padding: 1rem 1.25rem !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: none !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.1) !important;
    border-radius: 0 !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: none !important;
    z-index: 1 !important; /* Réduire le z-index */
  }
  
  .top-nav .brand .brand-text strong {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
  }
  
  /* Actions en bas pour mobile */
  .top-nav .nav-actions {
    display: none !important; /* On les met en bottom navigation */
  }
  
  .top-nav-status {
    display: none !important;
  }
  
  /* Ajout padding-top au body pour compenser */
  body {
    padding-top: 0 !important;
  }
  
  /* App shell sans padding sur mobile */
  .app-shell {
    padding: 0 !important;
    gap: 0 !important;
  }
  
  /* S'assurer que le contenu principal n'est pas affecté */
  .workspace,
  .main-content {
    padding: 1.25rem !important;
    padding-top: 1rem !important;
  }
  
  /* ────────────────────────────────────────
     BOTTOM NAVIGATION - Actions principales
     ──────────────────────────────────────── */
  
  /* Container de navigation bottom */
  body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.98), transparent);
    pointer-events: none;
    z-index: 99;
  }
  
  /* Créer une navigation bottom avec les actions originales */
  .mobile-bottom-nav {
    position: fixed !important;
    bottom: 12px !important;
    left: 50% !important;
    transform: translateX(-50%);
    display: flex !important;
    gap: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    border: 1px solid rgba(52, 211, 153, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(52, 211, 153, 0.1) inset;
    z-index: 100;
    max-width: calc(100vw - 32px);
  }
  
  .mobile-bottom-nav .pill-btn {
    min-height: 44px !important;
    padding: 0 1rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    border-radius: 20px !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  
  .mobile-bottom-nav .pill-btn:active {
    transform: scale(0.95) !important;
  }
  
  /* ────────────────────────────────────────
     LAYOUTS - Design moderne
     ──────────────────────────────────────── */
  
  .editor-layout {
    grid-template-columns: 1fr !important;
    gap: 0;
    padding: 0;
  }
  
  .sidebar {
    display: none;
  }
  
  /* Workspace amélioré pour mobile */
  .workspace,
  .container,
  .wrap,
  .main-content {
    padding: 0.5rem !important; /* Padding minimal pour plus d'espace */
    padding-top: 0.5rem !important;
    max-width: 100%;
  }
  
  /* Panels plus compacts sur mobile */
  .panel {
    margin: 0.5rem 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(52, 211, 153, 0.1) !important;
  }
  
  .panel-header {
    padding: 1rem 0.8rem 0.5rem !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.08) !important;
    border-radius: 12px 12px 0 0 !important;
  }
  
  .panel-eyebrow {
    font-size: 0.75rem !important;
    margin-bottom: 0.3rem !important;
    color: var(--primary) !important;
  }
  
  .panel-header h2 {
    font-size: 1.1rem !important;
    margin-bottom: 0.2rem !important;
  }
  
  /* Page d'accueil - Hero moderne */
  .home-hero {
    grid-template-columns: 1fr !important;
    padding: 3rem 1.25rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, 
      rgba(52, 211, 153, 0.08) 0%, 
      rgba(56, 189, 248, 0.05) 100%
    );
    border-radius: var(--radius-xl);
    margin: 1.25rem;
  }
  
  .home-hero h1 {
    font-size: 2.25rem !important;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .home-hero p {
    font-size: 1.05rem;
    opacity: 0.85;
  }
  
  .home-stats,
  .home-tips,
  .home-library {
    padding: 1.5rem 1.25rem;
    margin: 0 1.25rem;
  }
  
  .stats-grid,
  .tips-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }
  
  /* Stats cards avec design moderne */
  .stat-card {
    background: linear-gradient(135deg, 
      rgba(52, 211, 153, 0.06) 0%, 
      rgba(56, 189, 248, 0.03) 100%
    );
    border: 1px solid rgba(52, 211, 153, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
  }
  
  .stat-card:active {
    transform: scale(0.98);
    border-color: rgba(52, 211, 153, 0.3);
  }
  
  /* ────────────────────────────────────────
     FORMULAIRES & INPUTS - Design épuré
     ──────────────────────────────────────── */
  
  .form-section {
    padding: 1.5rem 1.25rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-lg);
    margin: 0.75rem;
    border: 1px solid rgba(52, 211, 153, 0.08);
  }
  
  .form-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .form-group {
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  
  label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: block;
  }
  
  /* Champs compacts mais utilisables */
  input,
  textarea,
  select,
  .input {
    font-size: 16px !important;
    padding: 0.7rem 0.6rem !important;
    min-height: 44px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(52, 211, 153, 0.25) !important;
    border-radius: 6px !important;
    color: var(--text) !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
  }
  
  input:focus,
  textarea:focus,
  select:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15) !important;
    outline: none !important;
  }
  
  /* Focus simple et net */
  input:focus,
  textarea:focus,
  select:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15) !important; /* Glow minimal */
    outline: none !important;
    transform: none !important; /* Pas de mouvement */
  }
  
  /* Hover simple */
  input:hover:not(:focus),
  textarea:hover:not(:focus),
  select:hover:not(:focus) {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
  }
  
  /* Sélecteurs minimalistes */
  select {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), 
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) !important;
    background-position: calc(100% - 16px) calc(1em + 2px), 
                         calc(100% - 12px) calc(1em + 2px) !important;
    background-size: 4px 4px, 4px 4px !important; /* Flèche plus petite */
    background-repeat: no-repeat !important;
    padding-right: 2rem !important;
    cursor: pointer !important;
  }
  
  /* Placeholders discrets */
  input::placeholder,
  textarea::placeholder {
    color: rgba(148, 163, 184, 0.6) !important;
    font-weight: 400 !important;
  }
  
  /* Select simple */
  select {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), 
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) !important;
    background-position: calc(100% - 16px) calc(1em + 2px), 
                         calc(100% - 12px) calc(1em + 2px) !important;
    background-size: 4px 4px, 4px 4px !important;
    background-repeat: no-repeat !important;
    padding-right: 2rem !important;
    cursor: pointer !important;
  }
  
  /* Boutons de fichier simples */
  input[type="file"] {
    padding: 0.7rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px dashed rgba(52, 211, 153, 0.3) !important;
    border-radius: 6px !important;
    color: var(--text) !important;
    cursor: pointer !important;
  }
  
  /* Groupes boolean compacts */
  .boolean-group {
    gap: 0.5rem !important;
    margin: 0.8rem 0 !important;
  }
  
  .boolean-group .radio {
    border-radius: 6px !important;
    min-height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.6rem !important;
  }
  
  /* Textarea bien visibles */
  textarea {
    min-height: 100px !important; /* Hauteur correcte */
    resize: vertical !important;
    line-height: 1.5 !important;
    font-family: 'Inter', sans-serif !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(52, 211, 153, 0.4) transparent !important;
  }
  
  /* Scrollbar personnalisée pour textarea */
  textarea::-webkit-scrollbar {
    width: 8px !important;
  }
  
  textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px !important;
  }
  
  textarea::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.4) !important;
    border-radius: 4px !important;
  }
  
  textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 211, 153, 0.6) !important;
  }
  
  /* Labels bien visibles */
  label {
    font-size: 0.95rem !important; /* Taille lisible */
    font-weight: 700 !important; /* Gras pour visibilité */
    color: var(--text) !important; /* Couleur principale */
    margin-bottom: 0.5rem !important;
    display: block !important;
    transition: color 0.2s ease !important;
  }
  
  /* Animation label quand le champ est focus */
  .field-group:focus-within label {
    color: var(--primary) !important;
    transform: translateX(2px) !important;
  }
  
  /* Groupes ultra-compacts */
  .field-group,
  .field-row {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
    margin-bottom: 0.8rem !important;
  }
  
  .field-inline {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.4rem !important;
  }
  
  /* ────────────────────────────────────────
     AMÉLIORATIONS SUPPLÉMENTAIRES MOBILE
     ──────────────────────────────────────── */
  
  /* Sections ultra-simplifiées */
  .dynamic-sections {
    padding: 0.3rem !important;
    gap: 0.5rem !important;
  }
  
  .form-section {
    margin-bottom: 0.8rem !important;
    padding: 0.6rem !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 6px !important;
    border: 1px solid rgba(52, 211, 153, 0.08) !important;
  }
  
  .form-section-title {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.6rem !important;
    color: var(--text) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.06) !important;
  }
  
  /* Boutons d'action compacts */
  .btn, .pill-btn {
    min-height: 42px !important;
    padding: 0.6rem 1.2rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    font-size: 0.9rem !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
  }
  
  .btn:hover, .pill-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.15) !important;
  }
  
  .btn:hover, .pill-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(52, 211, 153, 0.25) !important;
  }
  
  .btn:active, .pill-btn:active {
    transform: translateY(0) scale(0.98) !important;
    transition: all 0.1s ease !important;
  }
  
  /* Groupes boolean minimalistes */
  .boolean-group {
    gap: 0.5rem !important; /* Gap minimal */
  }
  
  .boolean-group .radio {
    border-radius: 8px !important;
    min-height: 40px !important; /* Hauteur minimale */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem !important;
  }
  
  /* États checked simples */
  .radio:has(input:checked),
  .checkbox-item:has(input:checked) {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: var(--primary) !important;
  }
  
  /* Navigation ultra-compacte */
  .section-nav {
    padding: 0.8rem 0.5rem !important;
    gap: 0.6rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 0 !important;
    border-top: 1px solid rgba(52, 211, 153, 0.06) !important;
  }
  
  .section-controls {
    padding: 1rem 0.5rem !important;
    gap: 0.8rem !important;
    background: rgba(255, 255, 255, 0.01) !important;
    border-radius: 6px !important;
    margin-top: 1rem !important;
    border: 1px solid rgba(52, 211, 153, 0.06) !important;
  }
  
  .nav-btn {
    min-height: 42px !important;
    padding: 0.8rem 1.5rem !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    flex: 1 !important;
  }
  
  /* ────────────────────────────────────────
     SÉLECTEURS ET CARTES - Plus lisibles et tactiles
     ──────────────────────────────────────── */
  
  /* Type cards ultra-compactes */
  .type-card {
    padding: 0.8rem !important; /* Padding minimal */
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    min-height: 50px !important; /* Hauteur minimale */
    cursor: pointer !important;
  }
  
  .type-card:hover,
  .type-card:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 12px 32px rgba(52, 211, 153, 0.2) !important;
  }
  
  .type-card:active {
    transform: translateY(-1px) scale(1.01) !important;
    transition: all 0.1s ease !important;
  }
  
  .type-card .type-title {
    font-size: 1rem !important; /* Taille réduite */
    font-weight: 600 !important;
    color: var(--text) !important;
    margin-bottom: 0.2rem !important;
  }
  
  .type-card .type-description {
    font-size: 0.8rem !important; /* Plus petit */
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
  }
  
  /* Sélecteurs simples et compacts */
  .radio,
  .checkbox-item {
    padding: 0.6rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
    border-radius: 6px !important;
    min-height: 40px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin-bottom: 0.3rem !important;
  }
  
  .radio:hover,
  .checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
  }
  
  .radio label,
  .checkbox-item label {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: var(--text) !important;
    margin: 0 !important;
    line-height: 1.3 !important;
  }
  
  /* Effet de ripple au clic */
  .radio::before,
  .checkbox-item::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 0 !important;
    height: 0 !important;
    background: rgba(52, 211, 153, 0.3) !important;
    border-radius: 50% !important;
    transform: translate(-50%, -50%) !important;
    transition: width 0.3s ease, height 0.3s ease !important;
    pointer-events: none !important;
  }
  
  .radio:active::before,
  .checkbox-item:active::before {
    width: 100px !important;
    height: 100px !important;
  }
  
  .radio:hover,
  .checkbox-item:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.15) !important;
  }
  
  /* Labels dans les sélecteurs bien lisibles */
  .radio label,
  .checkbox-item label {
    font-size: 1rem !important; /* Taille lisible */
    font-weight: 600 !important;
    color: var(--text) !important;
    cursor: pointer !important;
    margin: 0 !important;
    line-height: 1.4 !important;
  }
  
  /* Multi-select simple */
  .multi-select-button {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
    color: var(--text) !important;
    font-weight: 500 !important;
    padding: 0.7rem !important;
    min-height: 42px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }
  
  .multi-select-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
  }
  
  .multi-select-button:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15) !important;
    outline: none !important;
  }
  
  .multi-select-button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.15) !important;
  }
  
  .multi-select-button:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.25) !important;
    outline: none !important;
  }
  
  /* ────────────────────────────────────────
     CHIPS, TAGS & BADGES - Plus élégants
     ──────────────────────────────────────── */
  
  .chip,
  .tag {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, 
      rgba(52, 211, 153, 0.15) 0%, 
      rgba(56, 189, 248, 0.1) 100%
    );
    border: 1px solid rgba(52, 211, 153, 0.2);
    font-weight: 500;
  }
  
  .chips-container {
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  
  /* ────────────────────────────────────────
     BUTTONS & ACTIONS - Design moderne
     ──────────────────────────────────────── */
  
  .pill-btn,
  .btn {
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    font-weight: 600;
    line-height: 1.2 !important;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }
  
  /* Boutons du header spécifiquement */
  .top-nav .pill-btn {
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
  }
  
  .pill-btn:active,
  .btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  
  .btn-group {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
  }
  
  /* ────────────────────────────────────────
     MODALES & OVERLAYS - Full screen élégant
     ──────────────────────────────────────── */
  
  .modal-backdrop {
    padding: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
  }
  
  .modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: modalSlideUp 0.3s ease-out;
  }
  
  @keyframes modalSlideUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .modal-header {
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, 
      rgba(15, 23, 42, 0.98) 0%, 
      rgba(17, 30, 58, 0.98) 100%
    );
    backdrop-filter: blur(20px);
    z-index: 10;
    border-bottom: 1px solid rgba(52, 211, 153, 0.15);
  }
  
  .modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
  }
  
  .modal-body {
    padding: 1.5rem 1.25rem;
    min-height: calc(100vh - 140px);
  }
  
  .modal-footer {
    padding: 1.25rem 1.5rem;
    position: sticky;
    bottom: 0;
    background: linear-gradient(135deg, 
      rgba(15, 23, 42, 0.98) 0%, 
      rgba(17, 30, 58, 0.98) 100%
    );
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(52, 211, 153, 0.15);
  }
  
  /* Preview Modal spécifique */
  #previewModal {
    padding: 0;
    background: var(--bg-gradient);
  }
  
  #previewModalContent {
    padding: 1.25rem;
  }
  
  .close-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(52, 211, 153, 0.2);
    transition: all 0.2s ease;
  }
  
  .close-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
  }
  
  /* ────────────────────────────────────────
     PREVIEW MODES - Interface améliorée
     ──────────────────────────────────────── */
  
  .preview-mode-selector {
    gap: 8px;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    justify-content: center;
  }
  
  .preview-mode-btn {
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(52, 211, 153, 0.2);
    transition: all 0.25s ease;
  }
  
  .preview-mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
  }
  
  .preview-mode-btn:active {
    transform: scale(0.9);
  }
  
  /* Compact preview */
  .preview-compact {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(52, 211, 153, 0.15);
  }
  
  .score-ring {
    width: 90px !important;
    height: 90px !important;
  }
  
  /* Detailed preview */
  .preview-detailed {
    padding: 1.5rem;
  }
  
  .preview-section {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 1px solid rgba(52, 211, 153, 0.1);
  }
  
  .preview-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
  }
  
  /* Card preview */
  .preview-card {
    padding: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
  }
  
  .preview-card-image {
    height: 220px;
    object-fit: cover;
  }
  
  .preview-card-content {
    padding: 1.5rem;
  }
  
  /* ────────────────────────────────────────
     CULTIVARS & PIPELINE - Design moderne
     ──────────────────────────────────────── */
  
  .cultivar-item,
  .pipeline-item {
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(52, 211, 153, 0.15);
    margin-bottom: 1rem;
  }
  
  .cultivar-item-header,
  .pipeline-item-header {
    margin-bottom: 1rem;
  }
  
  .cultivar-fields {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .step-cultivars-checkboxes {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .checkbox-label {
    min-height: 50px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(52, 211, 153, 0.15);
    transition: all 0.2s ease;
  }
  
  .checkbox-label:active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
  }
  
  /* ────────────────────────────────────────
     GALERIE & CARDS - Design professionnel
     ──────────────────────────────────────── */
  
  .gallery-grid,
  .cards,
  .products-grid,
  .review-cards,
  .compact-library-list,
  #compactLibraryList,
  .home-page .compact-library-list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
    padding: 0 1rem;
  }
  
  .card {
    margin: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(135deg, 
      rgba(255, 255, 255, 0.04) 0%, 
      rgba(255, 255, 255, 0.02) 100%
    );
    border: 1px solid rgba(52, 211, 153, 0.15);
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }
  
  .card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .card-image-wrapper {
    height: 180px;
    position: relative;
    overflow: hidden;
  }
  
  .card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
  }
  
  .card:active img {
    transform: scale(1.05);
  }
  
  .card-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(52, 211, 153, 0.95);
    backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f1628;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .card-score-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 22, 40, 0.95);
    backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    border: 1.5px solid rgba(52, 211, 153, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .card .body {
    padding: 0.85rem;
  }
  
  .card .title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
  }
  
  .card .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  /* ────────────────────────────────────────
     SEQUENCE & MULTI-SELECT
     ──────────────────────────────────────── */
  
  .sequence-list,
  .pipeline-list {
    gap: 0.75rem;
  }
  
  .multi-select-menu {
    max-height: 60vh;
  }
  
  .step-extra {
    grid-template-columns: 1fr !important;
  }
  
  .mesh-pair {
    flex-direction: column;
  }
  
  /* ────────────────────────────────────────
     TABLES & LISTS
     ──────────────────────────────────────── */
  
  table {
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 0.75rem 0.5rem;
  }
  
  /* Scroll horizontal pour tables larges */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* ────────────────────────────────────────
     SCORES & PROGRESS
     ──────────────────────────────────────── */
  
  .score-breakdown {
    grid-template-columns: 1fr !important;
  }
  
  .progress-bar {
    height: 8px;
  }
  
  .total-badge {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  /* ────────────────────────────────────────
     TOOLTIPS & POPOVERS
     ──────────────────────────────────────── */
  
  .tooltip,
  .popover {
    font-size: 0.85rem;
    max-width: calc(100vw - 2rem);
  }
  
  /* ────────────────────────────────────────
     SPACING & CONTAINERS
     ──────────────────────────────────────── */
  
  .container,
  .wrap {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .section {
    padding: 1.5rem 1rem;
  }
  
  /* ────────────────────────────────────────
     IMAGES & MEDIA
     ──────────────────────────────────────── */
  
  .image-preview,
  .product-image {
    max-height: 250px;
  }
  
  .image-upload-zone {
    min-height: 150px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SMALL MOBILE (< 480px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 480px) {
  
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.1rem !important; }
  
  .nav {
    padding: 0.5rem 0.75rem;
  }
  
  .nav-logo {
    font-size: 1.1rem;
  }
  
  .pill-btn,
  .btn {
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
  }
  
  /* Preview mode buttons plus petits */
  .preview-mode-btn {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.1rem;
  }
  
  /* Modales padding réduit */
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 0.75rem;
  }
  
  /* Forms ultra compact */
  input,
  textarea,
  select {
    padding: 0.65rem;
  }
  
  .form-section {
    padding: 0.75rem;
  }
  
  /* Score ring encore plus petit */
  .score-ring {
    width: 70px !important;
    height: 70px !important;
  }
  
  .score-number {
    font-size: 1.5rem !important;
  }
  
  /* Cards très compactes */
  .card {
    border-radius: var(--radius-md);
  }
  
  .card-body,
  .card .body {
    padding: 0.75rem;
  }
  
  /* Cultivar items compacts */
  .cultivar-item,
  .pipeline-item {
    padding: 0.65rem;
  }
  
  /* Chips plus petits */
  .chip,
  .tag {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LANDSCAPE MODE (hauteur < 500px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-height: 500px) and (orientation: landscape) {
  
  /* Réduire header pour gagner de la place */
  .nav {
    padding: 0.5rem 1rem;
  }
  
  /* Modales prennent toute la hauteur */
  .modal {
    height: 100vh !important;
  }
  
  .modal-header {
    padding: 0.5rem 1rem;
  }
  
  .modal-body {
    padding: 0.75rem 1rem;
  }
  
  /* Sections plus compactes */
  .form-section {
    padding: 0.75rem;
  }
  
  /* Images plus petites */
  .image-preview,
  .card-image-wrapper {
    height: 120px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TOUCH IMPROVEMENTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (hover: none) and (pointer: coarse) {
  
  /* Agrandir zones tactiles */
  button,
  a.btn,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Les hover effects sont automatiquement désactivés sur tactile */
  
  /* Améliorer feedback tactile */
  button:active,
  .btn:active,
  .clickable:active {
    transform: scale(0.98);
    opacity: 0.8;
  }
  
  /* Scrollbar invisible sur mobile */
  * {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  *::-webkit-scrollbar {
    display: none;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   DARK MODE ADJUSTMENTS (optionnel)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (prefers-color-scheme: dark) {
  /* Le design est déjà dark by default */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   HIGH CONTRAST MODE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(94, 114, 158, 0.5);
    --border-subtle: rgba(94, 114, 158, 0.6);
  }
  
  button,
  .btn,
  input,
  select,
  textarea {
    border-width: 2px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   OPTIMISATIONS ERGONOMIQUES FINALES MOBILE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
  
  /* Conteneurs de listes multi-select ultra-compacts */
  .multi-select-container,
  .checkbox-list,
  .radio-list {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(52, 211, 153, 0.1) !important;
    border-radius: 3px !important;
    padding: 0.2rem !important;
    margin: 0.2rem 0 !important;
    max-height: 50px !important;
    overflow-y: auto !important;
  }
  
  /* Interface ultra-compacte et ergonomique */
  .panel {
    padding: 0.8rem !important;
    margin-bottom: 0.8rem !important;
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid rgba(52, 211, 153, 0.04) !important;
    border-radius: 6px !important;
  }
  
  .form-section {
    margin-bottom: 0.8rem !important;
    padding: 0.6rem 0.4rem !important;
    background: transparent !important;
  }
  
  /* Titres et textes compacts */
  h1, h2, h3 {
    font-size: 1.1rem !important;
    margin: 0.6rem 0 !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }
  
  label {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    margin-bottom: 0.3rem !important;
  }
  
  /* Éléments interactifs ultra-compacts */
  .radio,
  .checkbox-item {
    padding: 0.1rem !important;
    min-height: 10px !important;
    margin-bottom: 0.05rem !important;
    border-radius: 1px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(52, 211, 153, 0.15) !important;
  }
  
  .radio label,
  .checkbox-item label {
    font-size: 0.25rem !important;
    font-weight: 250 !important;
    line-height: 0.9 !important;
    margin: 0 !important;
  }
  
  .radio:has(input:checked),
  .checkbox-item:has(input:checked) {
    background: rgba(52, 211, 153, 0.1) !important;
    border-color: var(--primary) !important;
  }
  
  /* Boutons optimisés */
  .btn, .pill-btn {
    min-height: 40px !important;
    padding: 0.6rem 1rem !important;
    font-size: 0.85rem !important;
    border-radius: 4px !important;
  }
  
  /* Navigation ergonomique */
  .section-nav {
    padding: 0.6rem 0.4rem !important;
    gap: 0.5rem !important;
  }
  
  .nav-btn {
    min-height: 40px !important;
    padding: 0.6rem 1rem !important;
    font-size: 0.85rem !important;
  }
  
  /* Multi-select ultra-compact */
  .multi-select-button {
    min-height: 10px !important;
    padding: 0.15rem !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(52, 211, 153, 0.15) !important;
    border-radius: 1px !important;
    font-size: 0.45rem !important;
    line-height: 0.9 !important;
  }
  
  /* Options des menus déroulants ultra-compacts */
  select {
    font-size: 0.55rem !important;
    line-height: 1.0 !important;
    min-height: 10px !important;
    padding: 0.25rem !important;
  }
  
  select option {
    font-size: 0.55rem !important;
    padding: 0.15rem !important;
  }
  
  /* Espaces ultra-optimisés */
  .form-row {
    gap: 0.5rem !important;
    margin-bottom: 0.6rem !important;
  }
  
  .field-group {
    margin-bottom: 0.6rem !important;
  }
  
  .input-group {
    gap: 0.3rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Messages discrets */
  .error-message,
  .success-message {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.75rem !important;
    border-radius: 3px !important;
    margin: 0.2rem 0 !important;
  }
  
  /* Options multi-select ultra-compactes */
  .multi-select-menu {
    font-size: 0.45rem !important;
  }
  
  .multi-select-menu .option {
    padding: 0.08rem 0.15rem !important;
    font-size: 0.45rem !important;
    line-height: 0.9 !important;
    min-height: 16px !important;
  }
  
  .multi-select-menu .option label {
    font-size: 0.42rem !important;
    font-weight: 500 !important;
  }
  
  /* Polices compactes */
  body {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
  }
  
  /* Tous les inputs et selects ultra-compacts */
  input, select, textarea {
    font-size: 0.6rem !important;
    line-height: 1.0 !important;
  }
  
  input::placeholder,
  textarea::placeholder {
    font-size: 0.6rem !important;
    opacity: 0.7 !important;
  }
  
  /* Scrollbars optimisées pour les listes compactes */
  .multi-select-container::-webkit-scrollbar,
  .checkbox-list::-webkit-scrollbar,
  .radio-list::-webkit-scrollbar {
    width: 3px !important;
  }
  
  .multi-select-container::-webkit-scrollbar-track,
  .checkbox-list::-webkit-scrollbar-track,
  .radio-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 2px !important;
  }
  
  .multi-select-container::-webkit-scrollbar-thumb,
  .checkbox-list::-webkit-scrollbar-thumb,
  .radio-list::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.3) !important;
    border-radius: 2px !important;
  }
  /* Groupes boolean ultra-compacts */
  .boolean-group {
    gap: 0.05rem !important;
    margin: 0.2rem 0 !important;
  }
  
  .boolean-group .radio {
    min-height: 18px !important;
    padding: 0.08rem !important;
    border-radius: 1px !important;
  }
  
  .boolean-group .radio label {
    font-size: 0.42rem !important;
    font-weight: 500 !important;
  }
  
  p {
    font-size: 0.8rem !important;
    margin: 0.3rem 0 !important;
  }
  
  .description,
  .help-text {
    font-size: 0.75rem !important;
    margin: 0.2rem 0 !important;
  }
  
  /* Sections dynamiques */
  .dynamic-sections .section {
    margin-bottom: 0.8rem !important;
    padding: 0.6rem 0.4rem !important;
    border: 1px solid rgba(52, 211, 153, 0.03) !important;
    border-radius: 4px !important;
  }
  
  /* Optimisations pour les listes verticales d'éléments */
  .checkbox-list .checkbox-item,
  .radio-list .radio {
    display: flex !important;
    align-items: center !important;
    padding: 0.08rem 0.15rem !important;
    min-height: 18px !important;
    margin-bottom: 0.02rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(52, 211, 153, 0.08) !important;
    border-radius: 1px !important;
  }
  
  .checkbox-list .checkbox-item:last-child,
  .radio-list .radio:last-child {
    margin-bottom: 0 !important;
  }
  
  .checkbox-list .checkbox-item label,
  .radio-list .radio label {
    font-size: 0.42rem !important;
    font-weight: 500 !important;
    line-height: 0.9 !important;
    margin: 0 !important;
    flex: 1 !important;
  }
  /* Grilles de checkbox/radio ultra-compactes */
  .checkbox-grid,
  .radio-grid {
    gap: 0.05rem !important;
  }
  
  .checkbox-grid .checkbox-item,
  .radio-grid .radio {
    font-size: 0.45rem !important;
    padding: 0.08rem !important;
    min-height: 18px !important;
  }
  
  .checkbox-grid .checkbox-item label,
  .radio-grid .radio label {
    font-size: 0.42rem !important;
    font-weight: 500 !important;
    line-height: 0.9 !important;
  }
  
  .section-title {
    font-size: 0.9rem !important;
    margin-bottom: 0.6rem !important;
    padding-bottom: 0.2rem !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.08) !important;
  }
}

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