/* ==========================================================================
   TAMAD Lunch — Design system (partagé admin + participant)
   Palette dérivée du logo officiel : vert ≈ #4F7A0B / #6F9E14, gris anthracite ≈ #404040
   ========================================================================== */

@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-400.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-500.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-600.woff") format("woff"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-500.woff") format("woff"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap; src: url("../fonts/cormorant-600.woff") format("woff"); }

:root {
  /* Couleurs */
  --brand: #4f7a0b;          /* actions principales (contraste AA sur blanc : 5.1) */
  --brand-hover: #416508;
  --brand-bright: #6f9e14;   /* accent décoratif (vert du logo) */
  --brand-soft: #f0f5e4;
  --brand-line: #d5e3b5;
  --ink: #2a2c28;            /* texte principal */
  --ink-2: #404040;          /* gris anthracite du logo */
  --muted: #666b62;          /* texte secondaire (AA) */
  --line: #e4e5df;
  --line-strong: #cfd1c8;
  --bg: #fafaf7;
  --surface: #ffffff;
  --warn: #8a4b08;
  --warn-bg: #fff4e0;
  --warn-line: #f0cf95;
  --danger: #a82a1f;
  --danger-bg: #fdecea;
  --danger-line: #f2bdb7;
  --info: #2f5d7c;
  --info-bg: #eaf3f9;

  /* Typographie */
  --font-body: "Montserrat", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;

  /* Espacements & formes */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(30, 40, 20, .05);
  --shadow-md: 0 8px 28px rgba(30, 40, 20, .10);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --focus: 0 0 0 3px rgba(79, 122, 11, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
h1, h2 { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 34px; } h2 { font-size: 26px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
.num { font-variant-numeric: tabular-nums; }
.stack > * + * { margin-top: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: 600 14px/1 var(--font-body); letter-spacing: .01em; cursor: pointer; text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease);
  background: var(--brand); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--bg); border-color: var(--ink-2); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger-solid { background: var(--danger); }
.btn.danger-solid:hover { background: #8d2118; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.lg { min-height: 56px; padding: 0 28px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 36px; height: 36px; min-height: 36px; padding: 0; }

/* ---------- Champs ---------- */
.field { display: block; }
.field + .field { margin-top: var(--s-4); }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.label .opt { font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; font: 400 15px/1.4 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23404040' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.input.sm, .select.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.error-msg { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; font-weight: 500; color: var(--danger); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.grid-2 > .field, .grid-3 > .field { margin-top: 0; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; cursor: pointer; }

/* ---------- Cartes / badges / alertes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
.card.flat { border-radius: var(--r-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--s-4); flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: #c4dcec; }
.badge.neutral::before { border-radius: 2px; }
.badge.plain::before { display: none; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert strong { display: block; }
.alert.success { background: var(--brand-soft); border-color: var(--brand-line); color: #2f4d05; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.alert.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.alert.info { background: var(--info-bg); border-color: #c4dcec; color: var(--info); }

/* Alerte allergie : visible mais pas alarmante */
.allergy-tag { display: inline-flex; align-items: flex-start; gap: 6px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); font-size: 13px; font-weight: 500; line-height: 1.35; }
.allergy-tag .icon { width: 15px; height: 15px; margin-top: 1px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fcfcfa; white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfdf9; }
.table tr.is-cancelled td { color: var(--muted); }
.table tr.is-cancelled .cell-main { text-decoration: line-through; }
.table .actions { white-space: nowrap; text-align: right; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 12px 16px; background: none; border: 0; border-bottom: 2px solid transparent; font: 600 14px var(--font-body); color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; border-radius: 0; text-decoration: none; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"], .tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Segmented (jours) ---------- */
.segmented { display: inline-flex; background: #eeefe9; border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: 600 13px var(--font-body); color: var(--ink-2); cursor: pointer; min-height: 34px; transition: background .15s, color .15s; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.segmented button:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, .6); }

/* ---------- Modale ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(28, 32, 24, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; animation: fade .18s var(--ease); backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-md); animation: rise .22s var(--ease); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 22px 24px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h2 { font-size: 26px; }
.modal-body { padding: 8px 24px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 420px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md); animation: rise .25s var(--ease); }
.toast.success .icon { color: #b6dd6b; }
.toast.error { background: var(--danger); }

/* ---------- États vides ---------- */
.empty { text-align: center; padding: 44px 24px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: rgba(255, 255, 255, .6); }
.empty .icon { width: 30px; height: 30px; color: var(--brand-bright); margin: 0 auto 12px; stroke-width: 1.5; }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, #eeefe9 25%, #f6f7f2 37%, #eeefe9 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.logo-restaurant { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: #fff; flex: none; }
.logo-restaurant.lg { width: 64px; height: 64px; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
}

/* Chiffres alignés (Cormorant utilise par défaut des chiffres elzéviriens) */
h1, h2, .n, .big-stat .n, .stat .n, .sum-row b, .day-tab .d, .p-h2, .p-hero h1 { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
