/* Styles de l'app — tokens de la maquette (voir CLAUDE.md, section Design) */
:root {
  color-scheme: dark;
  --bg: #0D0D12;
  --surface: #17171F;
  --surface-2: #1C1C25;
  --surface-3: #23232E;
  --border: #22222D;
  --nav: #121218;
  --text: #F4F4F6;
  --muted: #A3A3B1;
  --placeholder: #8E8E9C;
  --accent: #C8F560;
  --on-accent: #0D0D12;
  --protein: #FF7A93;
  --carbs: #FFC857;
  --fat: #A99BFF;
  --warn-bg: #2A2313;
  --warn: #FFD98A;
  --warn-soft: #E9D7AE;
  --danger: #FF7A93;
  --dashed: #3A3A48;
  --font-title: 'Bricolage Grotesque', system-ui, sans-serif;
  --font: 'DM Sans', system-ui, sans-serif;
  --nav-h: 80px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 400 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
img { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#vue { min-height: 100dvh; }
.page {
  max-width: 560px; margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px;
}

/* ---------- Titres */
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; }
.h1 { margin: 0; font-family: var(--font-title); font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.h2 { margin: 0; font-family: var(--font-title); font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.head { display: flex; flex-direction: column; gap: 4px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.small { font-size: 12px; }
.error { color: var(--danger); margin: 0; font-size: 14px; }

/* ---------- Cartes, boutons, champs */
.card { background: var(--surface); border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-title { font-weight: 700; font-size: 15px; margin: 0; }
.btn {
  height: 48px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 15px;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--surface-2); color: var(--danger); }
.btn-big { height: 52px; border-radius: 16px; }
.btn:disabled { opacity: .5; }
.link-btn {
  min-height: 44px; border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.link-btn:hover { color: var(--text); }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.field {
  flex: 1; min-width: 0; height: 48px; background: var(--surface-3); border-radius: 14px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted);
}
.field input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text); font-weight: 500; }
.field-block { flex: none; }
.field:focus-within { outline: 2px solid var(--accent); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
.input, textarea.input, select.input {
  width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: var(--surface-3); color: var(--text);
  padding: 10px 12px; outline: none;
}
.input:focus { outline: 2px solid var(--accent); }
textarea.input { resize: vertical; line-height: 1.4; }
.inline { display: flex; gap: 8px; align-items: center; }

/* ---------- Pastilles */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.pill { padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pill-label { color: var(--muted); }
.pill button { border: 0; background: none; color: var(--muted); padding: 0; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Bandeaux */
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 18px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.warn strong { display: block; font-size: 14px; }
.warn span { font-size: 13px; color: var(--warn-soft); line-height: 1.4; }
.notice { border-radius: 20px; border: 1.5px dashed var(--dashed); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Grille de recettes */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-radius: 20px; padding: 8px 8px 12px; text-decoration: none; color: var(--text); }
.tile { height: 104px; border-radius: 14px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.time-badge {
  position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px;
  background: rgba(13, 13, 18, .78); color: var(--text); font-size: 12px; font-weight: 600; z-index: 1;
}
.tile-name { padding: 0 4px; font-weight: 600; font-size: 14px; line-height: 1.25; min-height: 36px; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; }
.thumbs img { height: 72px; border-radius: 10px; }

/* Chargement pendant l'import */
.loader { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.loader-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.loader-bar span { display: block; width: 40%; height: 100%; border-radius: 999px; background: var(--accent); animation: loader-slide 1.4s ease-in-out infinite; }
@keyframes loader-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.loader-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.loader-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); opacity: .5; transition: opacity .3s, color .3s; }
.loader-steps li::before { content: ''; width: 18px; height: 18px; flex-shrink: 0; box-sizing: border-box; border-radius: 999px; border: 2px solid var(--surface-3); }
.loader-steps li.current { color: var(--text); opacity: 1; font-weight: 600; }
.loader-steps li.current::before { border-color: var(--surface-3); border-top-color: var(--accent); animation: loader-spin .8s linear infinite; }
.loader-steps li.done { opacity: 1; }
.loader-steps li.done::before { border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230D0D12' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
.loader-thumbs img { animation: loader-pulse 1.6s ease-in-out infinite; }
@keyframes loader-pulse { 50% { opacity: .55; } }
.link-btn.is-disabled { opacity: .5; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .loader-bar span, .loader-steps li.current::before, .loader-thumbs img { animation: none; }
  .loader-bar span { width: 100%; opacity: .6; }
}

/* ---------- Barre de navigation */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); background: var(--nav); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); background: var(--nav); border-top: 1px solid var(--border);
}
.actionbar-inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; flex-direction: column; }
.actionbar-buttons { display: flex; gap: 10px; }
.actionbar-buttons .btn { flex: 1; }
.actionbar-buttons .grow { flex: 1.3; }

/* ---------- Fiche recette */
.hero { height: 240px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .icon-btn { position: absolute; top: max(20px, env(safe-area-inset-top)); left: 20px; background: rgba(13, 13, 18, .78); z-index: 1; }
.hero .source { color: var(--text); position: absolute; top: calc(max(20px, env(safe-area-inset-top)) + 8px); right: 20px; padding: 6px 12px; border-radius: 999px; background: rgba(13, 13, 18, .78); font-size: 12px; font-weight: 600; z-index: 1; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-photo { position: absolute; right: 20px; bottom: 44px; display: flex; gap: 8px; z-index: 1; }
.hero-btn {
  min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(13, 13, 18, .78);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.hero-btn:has(+ input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet {
  margin-top: -28px; position: relative; background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 24px 20px calc(140px + env(safe-area-inset-bottom)); max-width: 560px; margin-left: auto; margin-right: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.title-input { font-family: var(--font-title); font-size: 24px; font-weight: 800; line-height: 1.15; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-time { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.round-plus { width: 30px; height: 30px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.round-plus::after { content: ''; position: absolute; inset: -7px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 999px; padding: 4px; }
.stepper button { width: 36px; height: 36px; border: 0; border-radius: 999px; background: var(--surface-3); color: var(--text); font-weight: 700; font-size: 18px; position: relative; }
.stepper button::after { content: ''; position: absolute; inset: -4px; }
.stepper span { min-width: 84px; text-align: center; font-weight: 700; font-size: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.ing { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.ing-qty { width: 64px; flex-shrink: 0; font-weight: 700; font-size: 14px; }
.ing-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ing-name strong { font-weight: 600; font-size: 14px; }
.step { display: flex; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.step-num { width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.step-section { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 6px 0 0; }
.edit-row { background: var(--surface); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.edit-grid { display: grid; grid-template-columns: 64px 92px minmax(0, 1fr); gap: 8px; }
.title-input { resize: none; }
.edit-tools { display: flex; justify-content: flex-end; gap: 4px; flex-shrink: 0; }
.edit-tools button { width: 40px; height: 44px; border: 0; border-radius: 10px; background: var(--surface-3); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.edit-tools button:disabled { opacity: .35; }
.add-btn { height: 52px; border-radius: 16px; border: 1.5px dashed var(--dashed); background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; width: 100%; }
.field-label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 0; }

/* ---------- Dialogues et toasts */
dialog {
  border: 0; border-radius: 24px; background: var(--surface); color: var(--text); padding: 20px; width: min(360px, calc(100% - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog p { margin: 0 0 16px; font-size: 15px; line-height: 1.4; }
dialog .dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; }
dialog.sheet-dialog { margin: auto auto 0; width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 80dvh; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; z-index: 50;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
