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

/* Seul correctif de thème sombre restant : le dégradé de la zone
   d'extraction, qui ne se dérive pas d'un jeton unique.
   Les 42 autres règles [data-theme="dark"] ont disparu avec le passage aux
   jetons de rôle. */
[data-theme="dark"] .input-section {
  background: linear-gradient(135deg, var(--surface-card) 0%, #24302A 100%);
}


html, body { overflow-x: hidden; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ── */
header {
  background: var(--surface-header);
  padding: 28px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.18);
  box-shadow: 0 10px 30px rgba(var(--ink-rgb), 0.06);
  backdrop-filter: blur(10px);
}
.logo-mark {
  width: 40px; height: 40px;
  background: var(--rust);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0;
  flex-shrink: 0;
  background-image: url('/icons/utensils-white.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 62%;
}
header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.01em;
}
header h1 span { color: var(--gold-text); font-style: italic; }
.header-count {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--warm);
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  transition: all 0.3s;
}
.header-count.has-recipes { color: var(--gold-text); border-color: rgba(var(--rating-rgb), 0.3); }
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: var(--surface-card);
  color: var(--warm);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}
.mobile-menu-toggle:hover { border-color: var(--gold-text); background: var(--surface-card); color: var(--gold-text); }

/* ── Input zone ── */
.input-section {
  background: linear-gradient(135deg, var(--surface-page) 0%, var(--surface-sunken) 100%);
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}
.input-section::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.input-section::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 30%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(var(--rating-rgb), 0.1) 0%, transparent 70%);
  pointer-events: none;
}
.input-label {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--warm);
  font-style: italic;
  margin-bottom: 16px;
  display: block;
}
.url-row {
  display: flex;
  gap: 10px;
  max-width: 760px;
  position: relative;
  z-index: 1;
}
.url-input {
  flex: 1;
  padding: 14px 20px;
  border-radius: 10px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.14);
  background: var(--surface-card);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  backdrop-filter: blur(4px);
}
.url-input::placeholder { color: rgba(122,138,130,0.8); }
.url-input:focus {
  border-color: var(--rust);
  background: var(--surface-card);
}
.btn-extract {
  padding: 14px 28px;
  background: var(--rust);
  color: var(--text-on-accent);
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.btn-extract:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-extract:active { transform: translateY(0); }
.btn-extract:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-extract .spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text-on-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-extract.loading .spinner { display: block; }
.btn-extract.loading .btn-label { display: none; }

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

.error-msg {
  margin-top: 12px;
  color: #FF8A6B;
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 6px;
  opacity: 0; transition: opacity 0.3s;
  max-width: 760px;
}
.error-msg.visible { opacity: 1; }

/* ── Content area ── */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px;
}

/* ── Empty state ── */
.empty-state {
  padding: 8px 0 24px;
}
.onboarding-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 28px;
  align-items: start;
}
.onboarding-copy { padding-top: 10px; }
.empty-icon { font-size: 2.4rem; margin-bottom: 14px; }
.empty-state h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--warm);
  margin-bottom: 10px;
  line-height: 1.2;
}
.empty-state p { color: var(--mid); font-size: 0.95rem; max-width: 560px; }
.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.onboarding-btn {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--warm);
  padding: 10px 14px;
  font: 600 0.86rem 'DM Sans', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.onboarding-btn:hover { border-color: var(--warm); background: var(--pale); }
.onboarding-btn.primary { background: var(--rust); color: var(--text-on-accent); border-color: var(--rust); }
.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.onboarding-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.onboarding-card strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 5px;
}
.onboarding-card span {
  display: block;
  color: var(--mid);
  font-size: 0.82rem;
  line-height: 1.45;
}
.onboarding-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  background: rgba(var(--rating-rgb), 0.08);
  color: var(--mid);
  font-size: 0.84rem;
  border-radius: 0 8px 8px 0;
}
.onboarding-banner {
  display: none;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.onboarding-banner.visible { display: flex; }
.onboarding-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--warm);
  font-size: 1.25rem;
}
.onboarding-banner-copy { flex: 1; min-width: 0; }
.onboarding-banner-copy strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.onboarding-banner-copy span {
  display: block;
  color: var(--mid);
  font-size: 0.84rem;
  line-height: 1.4;
}
.onboarding-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.onboarding-banner-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--mid);
  cursor: pointer;
  font-size: 1rem;
}
.onboarding-banner-close:hover { color: var(--wine); border-color: rgba(155, 42, 58, 0.25); }
@media (max-width: 760px) {
  .onboarding-panel { grid-template-columns: 1fr; gap: 22px; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .empty-state h2 { font-size: 1.45rem; }
  .onboarding-banner { align-items: flex-start; flex-direction: column; }
  .onboarding-banner-actions { width: 100%; justify-content: flex-start; }
}

/* ── Recipe grid ── */
#recipe-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

/* ── Recipe card ── */
.recipe-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow 0.25s, transform 0.25s;
  animation: slideUp 0.4s ease both;
}
.recipe-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--pale);
}
/* Placeholder d'image absente. C'était un 🥘 de 3rem centré sur un dégradé :
   un emoji géant, rendu différemment selon l'OS, qui donnait l'air d'une
   image cassée. Remplacé par la marque de l'application, discrète et
   cohérente avec le reste. */
.card-no-img {
  height: 200px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  position: relative;
}
.card-no-img::after {
  content: '';
  width: 48px;
  height: 48px;
  background: var(--text-muted);
  opacity: 0.35;
  -webkit-mask: url('/icons/utensils-white.svg') no-repeat center / contain;
  mask: url('/icons/utensils-white.svg') no-repeat center / contain;
}

.card-body { padding: 22px 24px 24px; }

.card-source {
  font-size: 0.72rem;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.card-source a { color: inherit; text-decoration: none; }
.card-source a:hover { color: var(--rust); }

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 12px;
  cursor: text;
}
.card-title:hover::after {
  content: ' ✏️';
  font-size: 0.75rem;
  opacity: 0.5;
  font-family: 'DM Sans', sans-serif;
}
.card-title-input {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 12px;
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--rust);
  background: transparent;
  outline: none;
  padding: 0 0 2px 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.meta-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--pale);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--warm);
  font-weight: 500;
}

.categories {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
}
.cat-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Accordion sections ── */
.accordion { border-top: 1px solid var(--border); }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-header {
  width: 100%;
  background: none;
  border: none;
  padding: 14px 0;
  text-align: left;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  transition: color 0.2s;
}
.accordion-header:hover { color: var(--rust); }
.accordion-header .count-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--pale);
  color: var(--warm);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}
.accordion-arrow {
  font-size: 0.75rem;
  transition: transform 0.25s;
  margin-left: auto;
  color: var(--mid);
}
.accordion-header.open .accordion-arrow { transform: rotate(180deg); }

.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}
.accordion-body.open { max-height: 2000px; }
.accordion-content { padding-bottom: 14px; }

/* Sous-section header dans la liste d'ingrédients */
.ing-section-header {
  font-size: 0.72rem; font-weight: 700; color: var(--warm);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 0 3px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px; grid-column: 1 / -1;
}
.ing-section-header::before { display: none; }
[data-theme="dark"] .ing-section-header { color: var(--gold-text); border-bottom-color: rgba(var(--accent-rgb), 0.1); }

/* Ingredients list */
.ingredients-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.ingredients-list li {
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: 5px 0;
  display: flex; align-items: flex-start; gap: 8px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.07);
}
.ingredients-list li::before {
  content: '·';
  color: var(--rust);
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Instructions list */
.instructions-list { list-style: none; }
.instructions-list > li {
  display: flex; gap: 14px;
  margin-bottom: 12px;
  font-size: 0.87rem;
  color: var(--text-primary);
  line-height: 1.6;
}
.step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--rust);
  color: var(--text-on-accent);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--warm);
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}

/* ── Card actions ── */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.card-actions-row {
  display: flex;
  gap: 8px;
}
/* Boutons texte (rangée principale) */
.btn-sm {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--warm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
.btn-sm:hover { background: var(--pale); border-color: var(--warm); }
.btn-sm.danger:hover { color: var(--wine); border-color: var(--wine); background: rgba(155, 42, 58, 0.08); }
.btn-sm.primary:hover { color: var(--text-on-accent); background: var(--rust); border-color: var(--rust); }
/* Boutons icône (rangée secondaire) */
.btn-icon {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  position: relative;
}
.btn-icon:hover { background: var(--pale); border-color: var(--warm); }
/* Tooltip natif amélioré */
.btn-icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--surface-page);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.btn-icon:hover::after { opacity: 1; }

/* ── Search bar ── */
.search-bar {
  margin-bottom: 28px;
  position: relative;
}
.search-input {
  width: 100%;
  max-width: 480px;
  padding: 12px 16px 12px 42px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}
.search-input::placeholder { color: var(--mid); }
.search-input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1); }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mid);
  font-size: 1rem;
  pointer-events: none;
}
.no-results {
  text-align: center;
  padding: 48px 20px;
  color: var(--mid);
}
.no-results span { font-size: 2rem; display: block; margin-bottom: 12px; }
.no-results p { font-size: 0.9rem; }

/* ── User tags ── */
.user-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 14px;
}
.user-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(var(--rating-rgb), 0.12);
  border: 1px solid rgba(var(--rating-rgb), 0.4);
  color: var(--gold-text);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}
.user-tag:hover { background: rgba(var(--rating-rgb), 0.25); }
.user-tag.active { background: var(--gold); color: var(--text-on-accent); border-color: var(--gold-text); }
.tag-remove {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.55;
  /* La zone cliquable ne faisait que 8×14 px, sous le minimum de 24×24
     recommandé pour un pointeur. Le remplissage est compensé par des marges
     négatives pour ne pas déformer la pastille. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  margin: -6px -8px -6px -4px;
}
.tag-remove:hover { opacity: 1; }
.tag-add-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px;
  border-radius: 20px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--mid);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.tag-add-btn:hover { border-color: var(--gold-text); color: var(--warning); background: rgba(var(--rating-rgb), 0.08); }
.tag-input {
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: rgba(var(--rating-rgb), 0.08);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  outline: none;
  width: 130px;
}

/* ── Active tag filter pill ── */
.active-filter {
  display: none;
  align-items: center; gap: 8px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--mid);
}
.active-filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--gold);
  color: var(--text-on-accent);
  font-size: 0.78rem;
  font-weight: 600;
}
.active-filter-pill button {
  background: none; border: none; cursor: pointer;
  color: var(--text-on-accent); opacity: 0.8; font-size: 1rem; line-height: 1;
  padding: 0; font-family: 'DM Sans', sans-serif;
}
.active-filter-pill button:hover { opacity: 1; }

/* ── Search wrap + sort ── */
.search-sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-sort-row .search-input { max-width: none; }
.sort-buttons { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sort {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--warm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.btn-sort:hover { background: var(--pale); border-color: var(--warm); }
.btn-sort.active { background: var(--warm); color: var(--text-on-accent); border-color: var(--warm); }

/* ── Group tabs bar ── */
.groups-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.group-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--warm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 44px;
  user-select: none;
  box-shadow: var(--shadow);
}
.group-tab:hover { background: var(--pale); border-color: var(--warm); }
.group-tab.active { background: var(--warm); color: var(--text-on-accent); border-color: var(--warm); }
.tab-count { font-size: 0.7rem; font-weight: 600; opacity: 0.7; }
.tab-delete {
  font-size: 0.9rem;
  opacity: 0.5;
  line-height: 1;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  font-family: 'DM Sans', sans-serif;
}
.tab-delete:hover { opacity: 1; }
.tab-rename-input {
  padding: 5px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--warm);
  background: var(--pale);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  width: 130px;
  min-height: 36px;
}
.group-tab-new {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  color: var(--mid);
}
.group-tab-new:hover { color: var(--warm); border-color: var(--warm); background: var(--pale); }
.group-name-input {
  padding: 9px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--warm);
  background: var(--pale);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  width: 180px;
  min-height: 44px;
}

/* ── Card group chips ── */
.card-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.card-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  color: var(--warm);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}
.card-group-chip:hover { background: var(--warm); color: var(--text-on-accent); }

/* ── Group panel inside card ── */
.group-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--pale);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.group-panel.open { display: flex; }
.group-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.group-panel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--warm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
  user-select: none;
  font-family: 'DM Sans', sans-serif;
}
.group-toggle-chip:hover { border-color: var(--warm); background: rgba(var(--accent-rgb), 0.06); }
.group-toggle-chip.in-group { background: var(--warm); color: var(--text-on-accent); border-color: var(--warm); }
.group-panel-empty { font-size: 0.82rem; color: var(--mid); font-style: italic; }
.group-panel-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}
.group-move-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--mid);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
  user-select: none;
  font-family: 'DM Sans', sans-serif;
}
.group-move-chip:hover { border-color: var(--gold-text); color: var(--gold-text); background: rgba(var(--rating-rgb), 0.07); }

/* ── Notation ⭐ ── */
.star-rating {
  display: flex;
  gap: 1px;
  margin: 10px 0 2px;
}
.star {
  font-size: 1.15rem;
  color: rgba(var(--rating-rgb), 0.45);
  cursor: pointer;
  transition: color 0.12s, transform 0.1s;
  user-select: none;
  line-height: 1;
  padding: 2px;
}
.star.filled { color: var(--rating-graphic); }
.star:hover { transform: scale(1.2); color: var(--rating-graphic); }
[data-theme="dark"] .star { color: rgba(var(--rating-rgb), 0.5); }

/* ── Favori ── */
.btn-favorite {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(var(--ink-rgb), 0.45);
  backdrop-filter: blur(6px);
  color: var(--text-on-accent);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}
.btn-favorite:hover { background: rgba(var(--accent-rgb), 0.75); transform: scale(1.12); }
.btn-favorite.active { background: rgba(var(--accent-rgb), 0.85); }
.card-img-wrap { position: relative; }
.btn-photo-edit {
  position: absolute; bottom: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.52); border: none; color: #FFFFFF;
  font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
  backdrop-filter: blur(4px); z-index: 2;
}
.card-img-wrap:hover .btn-photo-edit { opacity: 1; }
@media (max-width: 600px) { .btn-photo-edit { opacity: 0.75; } }

/* ── Ajusteur de portions ── */
.portion-adjuster {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  background: var(--card-bg);
}
.portion-btn {
  width: 30px; height: 28px;
  border: none;
  background: transparent;
  color: var(--warm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif;
}
.portion-btn:hover { background: var(--pale); }
.portion-display {
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  min-width: 60px;
  text-align: center;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── Panneau épicerie ── */
.grocery-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(var(--ink-rgb), 0.4);
  z-index: 600;
  backdrop-filter: blur(2px);
}
.grocery-backdrop.open { display: block; }
.grocery-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(400px, 100vw);
  background: var(--card-bg);
  z-index: 700;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(var(--ink-rgb), 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.grocery-panel.open { transform: translateX(0); }
.grocery-panel-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.grocery-panel-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; font-weight: 600; color: var(--ink);
}
.grocery-panel-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
}
.grocery-panel-empty {
  text-align: center; padding: 48px 20px;
  color: var(--mid); font-size: 0.9rem;
}
.grocery-panel-empty span { font-size: 2rem; display: block; margin-bottom: 10px; }
.grocery-recipe-group { margin-bottom: 20px; }
.grocery-recipe-name {
  font-size: 0.75rem; font-weight: 700; color: var(--warm);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.grocery-recipe-remove {
  background: none; border: none; cursor: pointer;
  color: var(--mid); font-size: 0.85rem; padding: 0;
  transition: color 0.2s;
}
.grocery-recipe-remove:hover { color: var(--wine); }
.grocery-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.07);
}
.grocery-item:last-child { border-bottom: none; }
.grocery-checkbox {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 5px; border: 2px solid var(--border);
  cursor: pointer; appearance: none;
  background: var(--cream);
  transition: all 0.15s;
  margin-top: 2px;
}
.grocery-checkbox:checked {
  background: var(--warm); border-color: var(--warm);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 12px; background-repeat: no-repeat; background-position: center;
}
.grocery-item-text {
  font-size: 0.88rem; color: var(--ink); line-height: 1.4; flex: 1;
  transition: all 0.15s;
}
.grocery-item-text.checked { text-decoration: line-through; color: var(--mid); }
.grocery-panel-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-shrink: 0;
}
.btn-grocery-action {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--warm); font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.btn-grocery-action:hover { background: var(--pale); border-color: var(--warm); }
.btn-grocery-action.danger:hover { color: var(--wine); border-color: var(--wine); background: rgba(155, 42, 58, 0.08); }
/* Bouton épicerie dans le header */
.btn-header-grocery {
  display: none;
  align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 20px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.14);
  background: var(--surface-sunken); color: var(--warm);
  font-family: 'DM Sans', sans-serif; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s;
  margin-left: 10px;
}
.btn-header-grocery:hover { background: var(--surface-card); border-color: var(--gold-text); }
.grocery-badge {
  background: var(--rust); color: var(--text-on-accent);
  border-radius: 10px; padding: 1px 6px;
  font-size: 0.7rem; font-weight: 700; min-width: 18px; text-align: center;
}

/* ── Modal partage ── */
.share-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(var(--ink-rgb), 0.55); z-index: 800;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.share-modal-overlay.open { display: flex; }
.share-modal {
  background: var(--card-bg); border-radius: 20px;
  width: 100%; max-width: 460px;
  box-shadow: 0 24px 80px rgba(var(--ink-rgb), 0.3);
  animation: slideUp 0.25s ease both;
  padding: 28px;
}
.share-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; color: var(--ink); margin-bottom: 6px;
}
.share-modal p { font-size: 0.85rem; color: var(--mid); margin-bottom: 16px; }
.share-link-row {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.share-link-input {
  flex: 1; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--cream);
  color: var(--ink); font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem; outline: none;
}
.btn-copy {
  padding: 10px 16px; border-radius: 10px;
  background: var(--warm); color: var(--text-on-accent); border: none;
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: background 0.2s;
  white-space: nowrap;
}
.btn-copy:hover { background: var(--accent-hover); }
.btn-copy.copied { background: #2E7D32; }
.share-expiry { font-size: 0.78rem; color: var(--mid); margin-bottom: 20px; }
.share-modal-actions { display: flex; gap: 8px; }

/* ── Bouton "Ajouter à la main" ── */
.manual-link { margin-top: 14px; }
.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.btn-manual {
  background: none;
  border: none;
  color: var(--warm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(60,110,85,0.28);
}
.btn-manual:hover { color: var(--rust); text-decoration-color: var(--rust); }
.btn-manual.loading { opacity: 0.65; pointer-events: none; }
.ocr-hint {
  margin-top: 8px;
  color: var(--mid);
  font-size: 0.78rem;
  max-width: 760px;
  position: relative;
  z-index: 1;
}

/* ── Modal recette manuelle ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--ink-rgb), 0.65);
  z-index: 500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  margin: auto;
  box-shadow: 0 24px 80px rgba(var(--ink-rgb), 0.3);
  animation: slideUp 0.3s ease both;
}
.modal-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  z-index: 1;
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 600;
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--mid);
  transition: all 0.2s;
}
.modal-close:hover { background: var(--pale); color: var(--ink); border-color: var(--warm); }
.modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-label .req { color: var(--rust); }
.form-input, .form-textarea {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--cream);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}
.form-input.invalid { border-color: var(--wine); }
.form-textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 0.74rem; color: var(--mid); }
.form-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--warm);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
/* Dynamic lists */
.dynamic-list { display: flex; flex-direction: column; gap: 8px; }
.dynamic-item { display: flex; gap: 8px; align-items: flex-start; }
.item-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--pale);
  color: var(--warm);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 10px;
}
.dynamic-item .form-input,
.dynamic-item .form-textarea { flex: 1; }
.btn-remove-item {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--mid);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  margin-top: 6px;
}
.btn-remove-item:hover { color: var(--wine); border-color: var(--wine); background: rgba(155, 42, 58, 0.08); }
.drag-handle {
  flex-shrink: 0;
  width: 20px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--mid);
  cursor: grab;
  font-size: 1.1rem;
  opacity: 0.4;
  transition: opacity 0.15s;
  user-select: none;
  margin-top: 6px;
}
.drag-handle:active { cursor: grabbing; }
.dynamic-item:hover .drag-handle { opacity: 0.85; }
.dynamic-item.dragging { opacity: 0.35; }
.dynamic-item.drag-over { outline: 2px solid var(--rust); outline-offset: 2px; border-radius: 8px; }
.btn-add-item {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--mid);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-add-item:hover { border-color: var(--warm); color: var(--warm); background: var(--pale); }
.modal-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-cancel {
  padding: 11px 20px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--warm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { background: var(--pale); }
.btn-save-recipe {
  padding: 11px 24px;
  border-radius: 10px;
  border: none;
  background: var(--rust);
  color: var(--text-on-accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-save-recipe:hover { background: var(--accent-hover); }
/* Badge recette maison sur la carte */
.card-source.manual-source { color: var(--gold-text); }
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .modal-body { padding: 18px 20px; }
  .modal-footer { padding: 14px 20px 20px; }
  .modal-header { padding: 18px 20px 14px; }
}

/* ── Print mode ── */
@media print {
  header, .input-section, .card-actions, .accordion-header,
  .groups-bar, .group-panel, .search-bar { display: none !important; }
  .accordion-body { max-height: none !important; }
  .recipe-card { box-shadow: none; break-inside: avoid; }
}

/* ── Tablette (≤ 1024px) ── */
@media (max-width: 1024px) {
  .content { padding: 36px 32px; }
  .input-section { padding: 36px 32px; }
  header { padding: 22px 32px; }
}

/* ── Tablette portrait & mobile (≤ 768px) ── */
@media (max-width: 768px) {
  header, .input-section, .content { padding-left: 20px; padding-right: 20px; }
  .input-section { padding-top: 28px; padding-bottom: 28px; }
  .content { padding-top: 28px; padding-bottom: 28px; }
  #recipe-list { grid-template-columns: 1fr; gap: 20px; }
  .ingredients-list { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
  .search-sort-row { flex-direction: column; align-items: stretch; }
  .sort-buttons { justify-content: flex-end; }
  /* Touch targets agrandis */
  .btn-sm { padding: 12px 14px; min-height: 44px; font-size: 0.82rem; }
  .accordion-header { padding: 16px 0; min-height: 44px; }
  .btn-extract { padding: 14px 20px; min-height: 44px; }
  .url-input { padding: 14px 16px; font-size: 1rem; }
}

/* ── Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  header, .input-section, .content { padding-left: 16px; padding-right: 16px; }
  .card-body { padding: 16px 18px 18px; }
  /* Header compact — cacher les éléments non essentiels */
  header { gap: 10px; }
  .logo-mark { width: 34px; height: 34px; font-size: 0; }
  header h1 { font-size: 1.15rem; }
  .header-username { display: none; }
  .quota-badge { display: none !important; }
  .header-count { display: none; }
  #user-info { gap: 4px; }
  .btn-explorer {
    width: 34px;
    min-width: 34px;
    padding: 5px 0;
    justify-content: center;
    font-size: 0;
  }
  .btn-explorer::after {
    content: '🌍';
    font-size: 0.9rem;
    line-height: 1;
  }
  .btn-header-grocery { margin-left: 0; padding: 5px 8px; }
  .btn-logout { padding: 5px 7px; font-size: 0.68rem; }
  .btn-premium { padding: 5px 7px; font-size: 0.68rem; }
}

@media (max-width: 480px) {
  .header-right-controls { margin-left: auto; }
  .mobile-menu-toggle.visible { display: inline-flex; }
  .btn-header-cart.visible { display: flex; }
  #user-info.visible {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    margin-left: 0;
    min-width: 220px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(var(--accent-rgb), 0.12);
    background: var(--card-bg);
    box-shadow: 0 18px 40px rgba(var(--ink-rgb), 0.14);
    backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #user-info.visible.open { display: flex !important; }
  #user-info.visible:not(.open) { display: none !important; }
  #user-info .header-username {
    display: block;
    color: var(--ink);
    padding: 2px 4px 8px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
  }
  #user-info .quota-badge:not([style*="display:none"]):not(:empty) {
    display: inline-flex !important;
    justify-content: center;
    background: var(--pale);
    border-color: rgba(var(--accent-rgb), 0.12);
    padding: 8px 10px;
  }
  #user-info .quota-badge[style*="display:none"],
  #user-info .quota-badge:empty {
    display: none !important;
  }
  #user-info .btn-explorer,
  #user-info .btn-header-grocery,
  #user-info .btn-premium,
  #user-info .btn-logout {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    justify-content: flex-start;
    padding: 8px 10px;
    font-size: 0.78rem;
  }
  #user-info .btn-explorer::after { content: none; }
}

/* ── Écrans tactiles : pas d'effet hover ── */
@media (hover: none) {
  .recipe-card:hover { transform: none; box-shadow: var(--shadow); }
  .btn-extract:hover { transform: none; }
}

/* ── Auth screen ── */
#auth-screen {
  display: none;
  position: fixed;
  inset: 0;
  /* Utilisait var(--ink), le jeton de TEXTE : l'écran de connexion était
     sombre en thème clair et devenait clair en thème sombre. */
  background: var(--surface-page);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#auth-screen.visible { display: flex; }
.auth-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--cream);
  font-weight: 600;
}
.auth-logo h1 span { color: var(--gold-text); font-style: italic; }
.auth-card {
  background: var(--card-bg);
  border-radius: 20px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  overflow: hidden;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 16px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mid);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.active { color: var(--rust); border-bottom-color: var(--rust); }
.auth-form { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--cream);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1); }
.auth-error {
  font-size: 0.82rem;
  color: var(--wine);
  min-height: 18px;
}
.auth-btn {
  padding: 13px;
  background: var(--rust);
  color: var(--text-on-accent);
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}
.auth-btn:hover { background: var(--accent-hover); }
/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px 16px 32px;
  margin-top: 8px;
}
.btn-bug {
  background: none; border: none; color: var(--mid);
  font-family: 'DM Sans', sans-serif; font-size: 0.78rem;
  cursor: pointer; opacity: 0.6; transition: opacity 0.2s;
}
.btn-bug:hover { opacity: 1; }

/* ── Modal bogue ── */
.bug-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(var(--ink-rgb), 0.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.bug-overlay.open { display: flex; }
.bug-modal {
  background: var(--card-bg, #fff); border-radius: 16px;
  padding: 28px; max-width: 440px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.bug-modal h3 { font-size: 1.1rem; margin-bottom: 6px; }
.bug-modal p { color: var(--mid); font-size: 0.85rem; margin-bottom: 14px; }
.bug-textarea {
  width: 100%; min-height: 110px; padding: 12px 14px;
  border: 1.5px solid rgba(0,0,0,0.12); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  resize: vertical; background: #F4F6F2; color: var(--ink);
}
.bug-textarea:focus { outline: none; border-color: var(--rust); }
.bug-modal .bug-error { color: var(--wine) !important; font-size: 0.82rem; min-height: 18px; margin: 6px 0 0; font-weight: 500; }
.bug-success { color: var(--success); font-size: 0.85rem; margin: 8px 0 0; }
.bug-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.auth-forgot-link {
  background: none; border: none; padding: 6px 0 0;
  color: var(--mid); font-size: 0.82rem; cursor: pointer;
  text-decoration: underline; font-family: 'DM Sans', sans-serif;
  text-align: center;
}
.auth-forgot-link:hover { color: var(--ink); }
.auth-success {
  font-size: 0.82rem; color: var(--success); min-height: 18px;
}
/* Logout + username in header */
#user-info {
  display: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
#user-info.visible { display: flex; }
.header-username {
  color: var(--gold-text);
  font-size: 0.82rem;
  font-weight: 500;
}
.btn-logout {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: var(--surface-sunken);
  color: var(--mid);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--wine); color: var(--wine); }
/* ── Quota badge & subscription ── */
.quota-badge {
  font-size: 0.72rem;
  color: var(--mid);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}
.quota-badge.warn { color: #f0a050; border-color: rgba(240,160,80,0.3); }
.btn-premium {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 8px;
  border: 1.5px solid var(--gold); background: transparent;
  color: var(--gold-text); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-premium:hover { background: rgba(var(--rating-rgb), 0.12); }

/* ── Paywall modal ── */
.paywall-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(var(--ink-rgb), 0.72); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.paywall-overlay.open { display: flex; }
.paywall-card {
  background: var(--card-bg); border-radius: 20px;
  padding: 40px 36px; max-width: 420px; width: 90%;
  box-shadow: var(--shadow-lg); text-align: center;
  border: 1px solid var(--border);
}
.paywall-icon { font-size: 2.8rem; margin-bottom: 12px; }
.paywall-card h2 {
  font-family: 'Playfair Display', serif; font-size: 1.4rem;
  margin-bottom: 8px; color: var(--ink);
}
.paywall-card p { color: #6B5C50; font-size: 0.92rem; margin-bottom: 20px; line-height: 1.5; }
.paywall-counter {
  display: inline-block; background: var(--pale); border-radius: 12px;
  padding: 8px 20px; font-size: 0.88rem; color: var(--warm);
  font-weight: 600; margin-bottom: 24px;
}
.btn-subscribe {
  width: 100%; padding: 15px 24px; border-radius: 12px;
  background: var(--rust); border: none; color: var(--text-on-accent);
  font-family: 'DM Sans', sans-serif; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.btn-subscribe:hover { background: var(--accent-hover); }
.btn-subscribe:disabled { opacity: 0.6; cursor: not-allowed; }
.paywall-dismiss {
  display: block; margin-top: 14px; font-size: 0.8rem; color: var(--mid);
  cursor: pointer; text-decoration: underline; border: none; background: none;
  font-family: 'DM Sans', sans-serif;
}
.paywall-dismiss:hover { color: var(--ink); }

/* ── Google OAuth ── */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--mid); font-size: 0.78rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface-card); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 0.93rem; font-weight: 500;
  cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  opacity: 1;
}
.btn-google:visited { color: var(--text-primary); }
.btn-google:hover { color: var(--text-primary); }
.btn-google:hover { border-color: #4285F4; box-shadow: 0 0 0 3px rgba(66,133,244,0.1); }
.btn-google svg { flex-shrink: 0; }

/* ── Bouton Explorer dans le header ── */
.btn-explorer {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.14); background: var(--surface-sunken);
  color: var(--mid); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-explorer:hover { border-color: var(--gold-text); color: var(--gold-text); background: var(--surface-card); }

/* ── Bouton visibilité sur la carte ── */
.btn-icon.public { color: var(--success); }
/* ── Bouton conversion d'unités ── */
.btn-icon.converting { color: var(--rust); background: rgba(var(--accent-rgb), 0.08); border-color: rgba(var(--accent-rgb), 0.25); }

/* ── Modal Explorer ── */
.explorer-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(var(--ink-rgb), 0.72); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding-top: 60px;
}
.explorer-overlay.open { display: flex; }
.explorer-modal {
  background: var(--card-bg); border-radius: 20px;
  width: 90%; max-width: 560px; max-height: 80vh;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  overflow: hidden;
}
.explorer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.explorer-header h3 {
  font-family: 'Playfair Display', serif; font-size: 1.15rem; color: var(--ink);
}
.explorer-search-row {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.explorer-search-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 0.93rem;
  background: var(--cream); color: var(--ink);
  outline: none; transition: border-color 0.2s;
}
.explorer-search-input:focus { border-color: var(--rust); }
.explorer-body {
  flex: 1; overflow-y: auto; padding: 12px 24px 20px;
}
.explorer-hint {
  color: var(--mid); font-size: 0.88rem; text-align: center;
  padding: 24px 0;
}
.explorer-user-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  transition: background 0.15s; text-decoration: none;
}
.explorer-user-item:hover { background: var(--pale); }
.explorer-user-avatar {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--warm); color: var(--text-on-accent);
  font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.explorer-user-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.explorer-user-name { font-weight: 600; color: var(--ink); font-size: 0.92rem; }
.explorer-user-count { font-size: 0.78rem; color: var(--mid); }
.explorer-user-arrow { color: var(--mid); font-size: 1rem; margin-left: auto; transition: transform 0.15s; }
.explorer-user-item:hover .explorer-user-arrow { transform: translateX(3px); color: var(--warm); }
.btn-copy-recipe {
  padding: 6px 14px; border-radius: 8px;
  background: var(--rust); border: none; color: var(--text-on-accent);
  font-family: 'DM Sans', sans-serif; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background 0.2s; flex-shrink: 0;
}
.btn-copy-recipe:hover { background: var(--accent-hover); }
.btn-copy-recipe:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-copy-recipe.copied { background: var(--success); }

/* ── Notes ── */
.notes-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 450;
  background: rgba(var(--ink-rgb), 0.6); backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
.notes-modal-overlay.open { display: flex; }
.notes-modal {
  background: var(--card-bg); border-radius: 16px;
  width: 90%; max-width: 480px;
  box-shadow: var(--shadow-lg); padding: 24px;
}
.notes-modal h4 {
  font-family: 'Playfair Display', serif; font-size: 1rem;
  margin-bottom: 12px; color: var(--ink);
}
.notes-textarea {
  width: 100%; min-height: 110px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  resize: vertical; background: var(--cream); color: var(--ink);
  outline: none; transition: border-color 0.2s;
}
.notes-textarea:focus { border-color: var(--rust); }
.notes-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.btn-delete-note {
  margin-right: auto;
  padding: 8px 14px; border-radius: 8px;
  border: 1.5px solid rgba(155,42,58,0.25);
  background: transparent; color: var(--wine, var(--danger));
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  cursor: pointer; transition: all 0.2s;
}
.btn-delete-note:hover { background: rgba(155,42,58,0.08); border-color: var(--wine, var(--danger)); }
/* Texte de note dans l'accordéon */
.notes-accordion-body {
  font-size: 0.88rem;
  line-height: 1.68;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 0 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.notes-accordion-body:hover {
  background: var(--pale);
  padding: 6px 10px;
  margin: -4px -10px;
}
.notes-edit-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--mid);
  margin-top: 8px;
  font-style: italic;
}

/* ── Photo upload ── */
.photo-upload-wrap { display: flex; flex-direction: column; gap: 8px; }
.photo-drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s; color: var(--mid);
  font-size: 0.88rem;
}
.photo-drop-zone:hover { border-color: var(--rust); background: rgba(var(--accent-rgb), 0.04); color: var(--rust); }
.photo-drop-zone.has-image { padding: 0; border-style: solid; overflow: hidden; }
.photo-drop-zone img { width: 100%; max-height: 180px; object-fit: cover; display: block; border-radius: 8px; }
.photo-upload-actions { display: flex; gap: 8px; }
.btn-photo-action {
  flex: 1; padding: 7px; border-radius: 8px; font-size: 0.8rem; font-weight: 500;
  border: 1.5px solid var(--border); background: transparent; color: var(--mid);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.2s;
}
.btn-photo-action:hover { border-color: var(--rust); color: var(--rust); }
.btn-photo-action.danger:hover { border-color: var(--wine); color: var(--wine); }

/* ── Bouton dark mode ── */
.btn-darkmode {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 0; cursor: pointer;
  font-size: 1rem; transition: all 0.2s; line-height: 1;
}
.btn-darkmode:hover { border-color: var(--gold-text); }

/* ── Bouton panier header ── */
.btn-header-cart {
  position: relative;
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: none;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}
/* Ce panier compact ne doit apparaître que lorsque #user-info se replie dans
   le menu burger, sous 480 px — il double sinon le bouton d'épicerie de
   #user-info. La règle .visible n'était pas dans une media query, donc le
   panier s'affichait à toutes les largeurs dès la connexion. */
.btn-header-cart:hover { border-color: var(--gold-text); }
.cart-count-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--rust);
  color: var(--text-on-accent);
  border-radius: 10px;
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  display: none;
  pointer-events: none;
}
.cart-count-badge.has-items { display: block; }
@keyframes cart-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.4) rotate(-8deg); }
  65%  { transform: scale(1.2) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.btn-header-cart.pop { animation: cart-pop 0.38s ease; }

/* ============================================================================
   Ergonomie tactile
   Sur écran tactile il n'y a pas de survol, et les cibles fines deviennent
   difficiles à atteindre : la croix de suppression d'un tag mesurait 8×14 px.
   On élargit la zone cliquable sans changer l'apparence, via du remplissage
   compensé par des marges négatives.
   ========================================================================== */
@media (pointer: coarse), (max-width: 600px) {
  .tag-remove {
    padding: 10px 8px;
    margin: -10px -4px -10px 0;
    opacity: 0.75;
  }

  .star {
    padding: 6px 3px;
    margin: -6px -1px;
  }

  .portion-btn {
    width: 40px;
    height: 40px;
  }

  .tag-add-btn {
    padding: 9px 14px;
  }

  /* Les actions de carte étaient à 36 px de haut. */
  .btn-icon {
    height: 44px;
    font-size: 1.15rem;
  }

  .btn-manual,
  .btn-photo,
  .btn-bug {
    padding: 10px 4px;
  }

  .accordion-header {
    min-height: 48px;
  }

  .card-title {
    padding: 4px 0;
  }

  /* Les infobulles ::after des boutons-icônes ne peuvent pas s'ouvrir au
     survol sur tactile ; elles restaient affichées après un appui. */
  .btn-icon::after {
    display: none;
  }
}

/* ============================================================================
   Visibilité du focus
   outline: none était posé sur 12 champs sans remplacement, et aucune règle de
   focus n'existait sur un seul bouton : la navigation au clavier était
   invisible. :focus-visible ne se déclenche qu'au clavier, donc le clic
   souris garde son apparence actuelle.
   ========================================================================== */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Sur fond d'accent, le contour vert se perd : on le passe en clair. */
.btn-extract:focus-visible,
.auth-btn:focus-visible,
.btn-save-recipe:focus-visible,
.onboarding-btn.primary:focus-visible,
.group-tab.active:focus-visible,
.btn-sort.active:focus-visible {
  outline-color: var(--text-on-accent);
  outline-offset: -4px;
}

/* Éléments rendus interactifs au clavier (étoiles, titre éditable, tags). */
.star:focus-visible,
.card-title:focus-visible,
.user-tag:focus-visible,
.tag-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* Lien d'évitement : masqué jusqu'à la tabulation. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--surface-card);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}
.skip-link:focus {
  left: var(--space-3);
  top: var(--space-3);
}
