@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #FAF7F0;
  --bg-soft: #F1ECE0;
  --ink: #211D16;
  --ink-soft: #58513F;
  --muted: #9A917A;
  --line: #E7E0CE;
  --paper: #FFFFFF;

  --pine: #234B3A;
  --pine-solid-dark: #17342A;
  --pine-soft: #E4EEE8;
  --gold: #C98A2E;
  --gold-soft: #FBEFDA;
  --terracotta: #C1553D;
  --terracotta-soft: #FBE6E0;
  --sage: #4F8F63;
  --sage-soft: #E5F1E7;

  --shadow-sm: 0 1px 2px rgba(33,29,22,0.06);
  --shadow-md: 0 6px 20px rgba(33,29,22,0.08);
  --shadow-lg: 0 20px 45px rgba(23,52,38,0.14);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font-body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
#root { min-height: 100vh; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0; }
::selection { background: var(--gold-soft); }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* --------------------------------- Génériques -------------------------------- */

.ticket { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.p-4 { padding: 18px; }
.p-5 { padding: 22px; }
.p-6 { padding: 26px; }
.p-8 { padding: 36px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 22px; }
.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 22px; }
.my-1 { margin: 4px 0; }
.w-full { width: 100%; }
.text-sm { font-size: 13.5px; }
.small { font-size: 12px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.muted { color: var(--muted); }
.text-sage { color: var(--sage); }
.text-tomato, .text-terracotta { color: var(--terracotta); }
.flex-col { display: flex; flex-direction: column; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

button, input, select { font-family: var(--font-body); font-size: 14px; }

.btn { font-family: var(--font-body); font-weight: 600; cursor: pointer; border: none; border-radius: var(--radius-sm); transition: transform .12s ease, background .15s ease, filter .15s ease, box-shadow .15s ease; padding: 9px 16px; background: var(--paper); color: var(--ink); display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--pine); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--pine-solid-dark); box-shadow: var(--shadow-md); }
.btn-amber, .btn-gold { background: var(--gold); color: white; box-shadow: var(--shadow-sm); }
.btn-amber:hover:not(:disabled), .btn-gold:hover:not(:disabled) { filter: brightness(0.94); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: var(--bg-soft); }
.btn-danger { background: var(--terracotta); color: white; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); }
.btn-xs { padding: 6px 12px; font-size: 12.5px; }
.sq { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn { background: transparent; border: none; cursor: pointer; padding: 7px; border-radius: 8px; color: var(--ink-soft); display: inline-flex; }
.icon-btn:hover { background: var(--bg-soft); color: var(--terracotta); }
.link-btn { background: none; border: none; color: var(--pine); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }

.input { font-family: var(--font-body); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); padding: 10px 13px; width: 100%; transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-soft); }
.input-sm { padding: 7px 10px; font-size: 13.5px; margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.field > span { color: var(--ink-soft); font-weight: 500; }
.label-xs { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

.alert { padding: 13px 14px; border-radius: var(--radius-sm); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert-danger { background: var(--terracotta-soft); color: var(--terracotta); }
.alert-amber { background: var(--gold-soft); color: var(--gold); }
.alert-sage { background: var(--sage-soft); color: var(--sage); }
.alert.small { padding: 9px 10px; }

.badge { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.badge-amber { background: var(--gold-soft); color: var(--gold); }
.badge-sage { background: var(--sage-soft); color: var(--sage); }
.badge-tomato { background: var(--terracotta-soft); color: var(--terracotta); }
.badge-rupture { background: var(--terracotta); color: white; }

.chip-row { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13.5px; padding: 8px 15px; }
.chip.active { background: var(--pine); color: white; border-color: var(--pine); }

.page-title { font-size: 26px; margin-bottom: 22px; display: flex; align-items: center; gap: 12px; }
.page-title .icon { color: var(--gold); }

.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.list-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.list-row:last-child { border-bottom: none; }
.stock-view { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; align-items: center; gap: 8px; }

.day-title { font-weight: 700; font-size: 14px; color: var(--pine); margin-bottom: 14px; font-family: var(--font-display); }
.order-menu { margin-bottom: 12px; }
.order-card { display: flex; flex-direction: column; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 20px; color: var(--muted); gap: 10px; }
.empty-state .icon { color: var(--line); }

/* ------------------------------- Écran de connexion --------------------------- */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #EFE6D2 0%, var(--bg) 55%); }
.auth-wrap { width: 100%; max-width: 430px; }
.auth-logo-row { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 30px; }
.auth-logo { width: 62px; height: 62px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--pine), var(--sage)); box-shadow: var(--shadow-lg); color: white; }
.auth-title { text-align: center; }
.auth-title h1 { font-size: 27px; }
.auth-title p { font-size: 13.5px; color: var(--muted); margin-top: 6px; }

.role-tabs { padding: 5px; display: flex; gap: 4px; margin-bottom: 16px; }
.role-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; font-size: 12px; background: transparent; color: var(--ink-soft); border-radius: 12px; }
.role-tab.active { background: var(--pine); color: white; }

.auth-card { padding: 26px; }
.auth-modes { display: flex; gap: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.mode-tab { background: none; border: none; padding-bottom: 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.mode-tab.active { color: var(--pine); border-bottom-color: var(--gold); }
.form-col { display: flex; flex-direction: column; gap: 13px; }

.segmented { display: flex; gap: 8px; }
.seg-opt { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px; font-size: 13.5px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.seg-opt:has(input:checked) { background: var(--gold); color: white; border-color: var(--gold); }
.seg-opt input { accent-color: var(--gold); }

.auth-footnote { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; line-height: 1.6; }

/* ------------------------------------ App shell -------------------------------- */

.app-shell { display: flex; min-height: 100vh; width: 100%; }

.sidebar { width: 264px; flex-shrink: 0; display: flex; flex-direction: column; padding: 20px 16px; background: var(--pine); color: white; background-image: linear-gradient(175deg, var(--pine) 0%, var(--pine-solid-dark) 100%); }
@media (max-width: 767px) { .sidebar { display: none; } }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; margin-bottom: 34px; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.sidebar-brand .icon { color: var(--gold); }
.sidebar-role { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 22px; font-size: 13px; background: rgba(255,255,255,0.08); border-radius: 10px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-link { display: flex; align-items: center; gap: 13px; padding: 11px 12px; font-size: 13.5px; text-align: left; background: transparent; color: rgba(255,255,255,0.85); border: none; border-radius: 10px; cursor: pointer; }
.sidebar-link.active { background: rgba(255,255,255,0.16); color: white; }
.sidebar-link.active .icon { color: var(--gold); }
.sidebar-link:hover { background: rgba(255,255,255,0.1); }
.sidebar-logout { display: flex; align-items: center; gap: 10px; padding: 11px 12px; font-size: 13.5px; margin-top: 16px; background: rgba(0,0,0,0.18); color: white; border: none; border-radius: 10px; cursor: pointer; }
.sidebar-logout:hover { background: rgba(0,0,0,0.28); }

.app-main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-greeting { font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.balance-pill { display: flex; align-items: center; gap: 7px; padding: 8px 14px; font-size: 13.5px; font-weight: 700; background: var(--sage-soft); color: var(--sage); border-radius: 999px; }
.notif-wrap { position: relative; }
.notif-bell { position: relative; padding: 9px; color: var(--ink-soft); }
.notif-badge { position: absolute; top: -3px; right: -3px; font-size: 10px; font-weight: 700; width: 17px; height: 17px; border-radius: 999px; background: var(--terracotta); color: white; display: flex; align-items: center; justify-content: center; }
.notif-panel { position: absolute; right: 0; margin-top: 10px; width: 330px; z-index: 20; max-height: 400px; overflow-y: auto; box-shadow: var(--shadow-lg); }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13.5px; }
.notif-item { padding: 13px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.notif-item.unread { background: var(--gold-soft); }

.main-area { flex: 1; overflow-y: auto; padding: 26px; }
@media (min-width: 768px) { .main-area { padding: 36px; } }

/* ---------------------------------- Stock / Menu -------------------------------- */

.category-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.category-tab { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.category-tab.active { background: var(--pine-soft); border-color: var(--pine); color: var(--pine); }

.stock-item-name { display: flex; align-items: center; gap: 8px; }
.rupture-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; background: var(--terracotta); color: white; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }

.menu-section-label { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 14px 0 8px; }
.menu-section-label .icon { color: var(--gold); }
.pick-grid { display: flex; flex-direction: column; gap: 6px; }
.pick-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; background: var(--paper); }
.pick-item:hover { border-color: var(--pine); }
.pick-item.checked { background: var(--pine-soft); border-color: var(--pine); }
.pick-item input { accent-color: var(--pine); }
.pick-item .rupture-tag { margin-left: auto; }
.pick-count { font-size: 11px; color: var(--muted); font-weight: 500; }

.order-option { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer; margin-bottom: 6px; }
.order-option:hover { border-color: var(--pine); }
.order-option.checked { background: var(--pine-soft); border-color: var(--pine); }
.order-option input { accent-color: var(--pine); }

/* ------------------------------------- Modale ------------------------------------ */

.modal-backdrop { position: fixed; inset: 0; background: rgba(23,20,14,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; padding: 28px; text-align: center; }
.modal-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--terracotta-soft); color: var(--terracotta); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.modal-box h3 { font-size: 19px; margin-bottom: 10px; }
.modal-box p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ------------------------------------- Jeux ------------------------------------ */

.game-tile { text-align: left; }
.game-tile .game-icon { color: var(--gold); margin-bottom: 6px; }
.memory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.memory-card { height: 68px; font-size: 26px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: white; border-radius: var(--radius-sm); }
.reflex-btn { width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 17px; border-radius: var(--radius-md); }

.balance-card { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 22rem; }
.balance-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--sage-soft); color: var(--sage); display: flex; align-items: center; justify-content: center; }
.balance-amount { font-size: 32px; font-family: var(--font-display); }
