/* ==========================================================================
   Résidence Maison Bleue — feuille de style
   Chrome de marque : bleu-blanc élégant (bleu nuit + accent bleu clair).
   Data-viz : palette catégorielle validée (voir skill dataviz) —
   bleu/orange/aqua/jaune pour Chambres/Bar/Restaurant/Chicha.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Marque — bleu-blanc */
  --brand-navy: #0a2d4d;
  --brand-navy-deep: #061b30;
  --brand-navy-light: #164b7a;
  --brand-accent: #1f6fc4;
  --brand-accent-light: #5aa2e8;

  /* Surfaces & encre (teinte bleu-blanc, chart surfaces proches du défaut dataviz) */
  --surface-0: #eef4fb;
  --surface-1: #ffffff;
  --surface-2: #eaf1f9;
  --text-primary: #0c1e2e;
  --text-secondary: #45596e;
  --text-muted: #7c8da2;
  --border: rgba(10, 45, 79, 0.12);
  --gridline: #dde6f0;
  --baseline: #b9c6d6;

  /* Modules (couleurs catégorielles fixes — jamais permutées) */
  --mod-chambres: #2a78d6;   /* slot 1 bleu */
  --mod-bar: #eb6834;        /* slot 2 orange */
  --mod-restaurant: #1baf7a; /* slot 3 aqua */
  --mod-chicha: #eda100;     /* slot 4 jaune */
  --mod-stock: #008300;      /* slot 6 vert */
  --mod-depot: #7a5c3e;      /* slot 7 brun (dépôt d'alcool) */
  --mod-barvip: #c2185b;     /* slot 8 magenta (bar VIP) */
  --mod-commandes: #6a4fb3;  /* slot 9 violet (commandes clients) */

  /* Statuts (palette fixe, jamais réutilisée ailleurs) */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow-card: 0 1px 2px rgba(10,45,79,0.05), 0 6px 20px rgba(10,45,79,0.08);
  --shadow-pop: 0 10px 30px rgba(6,27,48,0.22);
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-0: #0b1420;
    --surface-1: #101d2c;
    --surface-2: #16283b;
    --text-primary: #ffffff;
    --text-secondary: #c3d0dd;
    --text-muted: #8fa0b3;
    --border: rgba(255,255,255,0.12);
    --gridline: #26364a;
    --baseline: #3a4c62;
    --mod-chambres: #3987e5;
    --mod-bar: #d95926;
    --mod-restaurant: #199e70;
    --mod-chicha: #c98500;
    --mod-stock: #008300;
    --mod-depot: #a3805a;
    --mod-barvip: #e0498a;
    --mod-commandes: #9075d1;
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0b1420;
  --surface-1: #101d2c;
  --surface-2: #16283b;
  --text-primary: #ffffff;
  --text-secondary: #c3d0dd;
  --text-muted: #8fa0b3;
  --border: rgba(255,255,255,0.12);
  --gridline: #26364a;
  --baseline: #3a4c62;
  --mod-chambres: #3987e5;
  --mod-bar: #d95926;
  --mod-restaurant: #199e70;
  --mod-chicha: #c98500;
  --mod-stock: #008300;
  --mod-depot: #a3805a;
  --mod-barvip: #e0498a;
  --mod-commandes: #9075d1;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--surface-0);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 700; margin: 0; }
p { margin: 0; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Écran de chargement ---------- */
.boot-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: linear-gradient(160deg, var(--brand-navy-deep), var(--brand-navy));
  color: #fff;
}
.boot-screen .boot-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: var(--shadow-pop); }
.boot-screen .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25); border-top-color: var(--brand-accent-light);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Écran d'accueil (choix employé) ---------- */
.gate {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(31,111,196,0.22), transparent 60%),
    linear-gradient(160deg, var(--brand-navy-deep), var(--brand-navy) 55%, #103a5f);
  color: #fff; padding: 40px 20px; text-align: center;
}
.gate .crest {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  background: #fff; display: block; margin: 0 auto 18px; box-shadow: var(--shadow-pop);
  border: 3px solid rgba(255,255,255,0.5);
}
.gate h1 {
  font-size: clamp(26px, 4vw, 38px); letter-spacing: 0.3px; margin-bottom: 6px;
}
.gate .subtitle { color: rgba(255,255,255,0.72); margin-bottom: 36px; font-size: 15px; }
.gate .prompt { font-size: 14px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--brand-accent-light); margin-bottom: 16px; font-weight: 600; }

.employee-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; width: 100%; max-width: 720px;
}
.employee-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-l); padding: 22px 14px; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  color: #fff;
}
.employee-card:hover { background: rgba(255,255,255,0.13); transform: translateY(-2px); border-color: rgba(90,162,232,0.6); }
.employee-card .avatar {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--brand-accent-light), var(--brand-accent));
  color: var(--brand-navy-deep); font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.employee-card .name { font-weight: 600; font-size: 15px; }
.employee-card .role { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 3px; }

.gate-footer { margin-top: 40px; }
.owner-link {
  background: none; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.85);
  padding: 10px 20px; border-radius: 999px; font-size: 13px; cursor: pointer; letter-spacing: .3px;
}
.owner-link:hover { border-color: var(--brand-accent-light); color: #fff; }

/* ---------- Modale générique ----------
   La barre du haut (marque + onglets + qui-est-connecté) reste TOUJOURS visible
   et cliquable : la modale s'ouvre juste en dessous, jamais par-dessus. */
.modal-backdrop {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; background: rgba(6,16,26,0.5);
  display: flex; align-items: flex-start; justify-content: center; z-index: 200; padding: 28px 16px;
  backdrop-filter: blur(2px); overflow-y: auto;
}
.modal {
  background: var(--surface-1); border-radius: var(--radius-l); width: 100%; max-width: 480px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--border); max-height: calc(100vh - var(--topbar-h) - 56px); overflow-y: auto;
}
.modal.modal-wide { max-width: 760px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 4px; }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- App shell ---------- */
.topbar {
  background: linear-gradient(120deg, var(--brand-navy-deep), var(--brand-navy) 60%, var(--brand-navy-light));
  color: #fff; display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 18px; position: sticky; top: 0; z-index: 300;
  box-shadow: 0 2px 14px rgba(6,27,48,0.25); flex-shrink: 0;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.topbar .brand .crest-mini {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: #fff; display: block; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.topbar .brand small { display: block; font-weight: 400; font-size: 10.5px; color: rgba(255,255,255,0.65); letter-spacing: .4px; }

.tabs { display: flex; gap: 4px; margin-left: 10px; flex: 1; overflow-x: auto; }
.tab-btn {
  background: none; border: none; color: rgba(255,255,255,0.75); padding: 9px 14px;
  border-radius: 999px; font-size: 13.5px; cursor: pointer; white-space: nowrap; display: flex; gap: 7px; align-items: center;
}
.tab-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.tab-btn.active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(90,162,232,0.55); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.who-chip {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.08);
  padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 12.5px;
}
.who-chip .avatar-mini {
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand-accent-light); color: var(--brand-navy-deep);
  font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.icon-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #fff;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; display:flex; align-items:center; justify-content:center;
}
.icon-btn:hover { background: rgba(255,255,255,0.18); }
.switch-btn {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); color: #fff;
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.switch-btn:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); }

main.view { flex: 1; padding: 22px; max-width: 1320px; width: 100%; margin: 0 auto; }

.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-header h2 { font-size: 22px; }
.view-header .view-sub { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }

/* ---------- Boutons & formulaires ---------- */
.btn {
  border: none; border-radius: var(--radius-m); padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: filter .12s ease, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-accent { background: var(--brand-accent); color: #ffffff; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: rgba(208,59,59,0.12); color: var(--status-critical); }
.btn-danger:hover { background: rgba(208,59,59,0.2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--radius-s); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary); font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-navy-light); outline-offset: 0; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.field-error { font-size: 12.5px; color: var(--status-critical); margin-top: 6px; min-height: 16px; }

/* ---------- Cartes / grilles ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-card); padding: 18px;
}
.section-title { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; display:flex; align-items:center; justify-content:space-between; gap:10px; }

/* Accueil — un carré par service */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; max-width: 920px; }
.home-card {
  aspect-ratio: 1 / 1; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-card); cursor: pointer; padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.home-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--mod-accent, var(--brand-accent)); }
.home-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(10,45,79,0.14); border-color: var(--mod-accent, var(--brand-accent)); }
.home-card:active { transform: translateY(-1px); }
.home-card .hc-icon {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 30px; background: color-mix(in srgb, var(--mod-accent, var(--brand-accent)) 14%, transparent);
}
.home-card .hc-label { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.home-card .hc-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.home-grid-owner { max-width: 460px; }
.home-card-owner { aspect-ratio: auto; padding: 18px; flex-direction: row; justify-content: flex-start; gap: 14px; }
.home-card-owner::before { display: none; }
.home-card-owner .hc-icon { width: 46px; height: 46px; font-size: 22px; background: color-mix(in srgb, var(--brand-accent) 14%, transparent); flex-shrink: 0; }
.home-card-owner .hc-label { font-size: 14.5px; }

.hc-icon-wrap { position: relative; }
.hc-badge {
  position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 999px; background: var(--status-critical); color: #fff; font-size: 11.5px; font-weight: 700;
  align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--surface-1);
}

/* Alertes (stock bas, départs du jour) */
.alert-banner { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.alert-banner:empty { display: none; margin: 0; }
.alert-card { border-radius: var(--radius-l); padding: 16px 18px; border: 1px solid transparent; }
.alert-card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.alert-critical { background: rgba(208,59,59,0.08); border-color: rgba(208,59,59,0.25); }
.alert-critical .alert-card-title { color: var(--status-critical); }
.alert-warning { background: rgba(250,178,25,0.12); border-color: rgba(250,178,25,0.35); }
.alert-warning .alert-card-title { color: #8a5c00; }
:root[data-theme="dark"] .alert-warning .alert-card-title,
:root:where(:not([data-theme="light"])) .alert-warning .alert-card-title { color: #ffcf66; }
.alert-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--surface-1); border-radius: var(--radius-m); padding: 10px 14px; margin-bottom: 8px;
}
.alert-row:last-child { margin-bottom: 0; }
.alert-row-title { font-size: 13.5px; font-weight: 700; }
.alert-row-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.alert-row-supplier { text-align: right; font-size: 12.5px; }
.alert-phone { color: var(--brand-accent); text-decoration: none; font-weight: 600; }
.alert-phone:hover { text-decoration: underline; }

/* Stock */
.stock-qty { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stock-input {
  width: 66px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 6px 4px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
}
.stock-input:focus { outline: 2px solid var(--brand-accent); outline-offset: 0; border-color: transparent; }
tr[data-low="1"] td:first-child { font-weight: 700; }

/* Chambres */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.room-card {
  background: var(--surface-1); border-radius: var(--radius-l); border: 1px solid var(--border);
  padding: 16px; box-shadow: var(--shadow-card); cursor: pointer; position: relative; overflow: hidden;
}
.room-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.room-card[data-status="libre"]::before { background: var(--status-good); }
.room-card[data-status="occupee"]::before { background: var(--status-critical); }
.room-card[data-status="nettoyage"]::before { background: var(--status-warning); }
.room-card[data-status="maintenance"]::before { background: var(--status-serious); }
.room-card .room-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.room-card .room-type { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.room-card .room-price { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 10px; }
.room-card .room-client { font-size: 12.5px; color: var(--text-primary); background: var(--surface-2); border-radius: var(--radius-s); padding: 8px 10px; margin-bottom: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-good { background: rgba(12,163,12,0.12); color: var(--status-good); }
.badge-critical { background: rgba(208,59,59,0.12); color: var(--status-critical); }
.badge-warning { background: rgba(250,178,25,0.18); color: #8a5c00; }
.badge-serious { background: rgba(236,131,90,0.16); color: #a4491f; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .badge-warning { color: #ffcf66; }
  :root:where(:not([data-theme="light"])) .badge-serious { color: #ffb08a; }
}
:root[data-theme="dark"] .badge-warning { color: #ffcf66; }
:root[data-theme="dark"] .badge-serious { color: #ffb08a; }

/* Catalogue (bar / restaurant / chicha) */
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.chip.active { background: var(--mod-accent, var(--brand-navy)); color: #fff; border-color: transparent; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 16px; text-align: left; cursor: pointer; transition: border-color .12s, transform .08s, box-shadow .12s;
}
.product-card:hover { border-color: var(--mod-accent, var(--brand-navy)); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.product-card:active { transform: translateY(0); }
.product-card .p-name { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; min-height: 36px; color: var(--text-primary); }
.product-card .p-price { font-size: 15px; font-weight: 700; color: var(--mod-accent, var(--brand-navy)); }
.product-card .p-formats { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.product-card .p-stock { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.product-card .p-stock.low { color: var(--status-critical); font-weight: 600; }

/* Sélecteur rapide de format (verre / bouteille / coupe…) */
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.variant-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius-m);
  padding: 18px 12px; cursor: pointer; transition: border-color .12s, background .12s;
}
.variant-btn:hover { border-color: var(--brand-accent); background: var(--surface-1); }
.variant-btn .vb-label { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.variant-btn .vb-price { font-size: 13px; font-weight: 600; color: var(--brand-accent); }

/* Éditeur de formats (administration) */
.variant-editor-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.variant-row { display: flex; gap: 8px; align-items: center; }
.variant-row input:first-child { flex: 1.3; }
.variant-row input:nth-child(2) { flex: 1; }

/* Panier de vente rapide */
.cart-panel { position: sticky; top: calc(var(--topbar-h) + 16px); }
.table-field { background: var(--surface-2); border-radius: var(--radius-m); padding: 12px; margin-bottom: 14px; }
.table-field label { color: var(--brand-navy); font-weight: 700; }
.table-input { font-size: 15px; font-weight: 600; }
.cart-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cart-line .cl-name { font-weight: 600; }
.cart-line .cl-meta { color: var(--text-muted); font-size: 11.5px; }
.qty-stepper { display: flex; align-items: center; gap: 6px; }
.qty-stepper button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 13px; }
.cart-total-row { display: flex; justify-content: space-between; padding-top: 12px; font-weight: 700; font-size: 15px; }
.empty-state { text-align: center; color: var(--text-muted); font-size: 13px; padding: 30px 10px; }

/* Bascule « compte du boss » (facture du propriétaire) */
.boss-tab-toggle { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-m); cursor: pointer; transition: background .15s, border-color .15s; }
.boss-tab-toggle:hover { border-color: var(--brand-accent); }
.boss-tab-toggle.on { border-color: var(--brand-accent); background: rgba(236,131,90,0.12); }
.boss-tab-toggle input { margin-top: 2px; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--brand-accent); }
.boss-tab-toggle .btt-title { font-weight: 700; font-size: 13px; }
.boss-tab-toggle .btt-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

/* Tables */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--gridline); }
table.data-table td { padding: 10px; border-bottom: 1px solid var(--gridline); font-variant-numeric: tabular-nums; }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table td.num, table.data-table th.num { text-align: right; }

/* KPI / stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 16px 18px; box-shadow: var(--shadow-card); }
.stat-tile .st-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.stat-tile .st-value { font-size: 26px; font-weight: 700; }
.stat-tile .st-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.stat-tile.accent-chambres { border-top: 3px solid var(--mod-chambres); }
.stat-tile.accent-bar { border-top: 3px solid var(--mod-bar); }
.stat-tile.accent-restaurant { border-top: 3px solid var(--mod-restaurant); }
.stat-tile.accent-chicha { border-top: 3px solid var(--mod-chicha); }
.stat-tile.accent-depot { border-top: 3px solid var(--mod-depot); }
.stat-tile.accent-barvip { border-top: 3px solid var(--mod-barvip); }
.stat-tile.accent-commandes { border-top: 3px solid var(--mod-commandes); }
.stat-tile.accent-total { border-top: 3px solid var(--brand-accent); }
.stat-tile.accent-expense { border-top: 3px solid var(--status-critical); }
.stat-tile.accent-profit { border-top: 3px solid var(--status-good); }

/* Grille dashboard */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* Charts (SVG) */
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--text-secondary); }
.chart-legend .lg-item { display: flex; align-items: center; gap: 6px; }
.chart-legend .lg-swatch { width: 10px; height: 10px; border-radius: 2px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .br-label { width: 128px; flex-shrink: 0; font-size: 12.5px; color: var(--text-secondary); text-align: right; }
.bar-row .br-track { flex: 1; background: var(--surface-2); border-radius: 999px; height: 18px; position: relative; overflow: visible; }
.bar-row .br-fill { height: 100%; border-radius: 999px; min-width: 3px; position: relative; }
.bar-row .br-value { margin-left: 8px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; width: 92px; }

.viz-tooltip {
  position: fixed; pointer-events: none; background: var(--brand-navy-deep); color: #fff;
  padding: 7px 10px; border-radius: 8px; font-size: 12px; z-index: 400; box-shadow: var(--shadow-pop);
  transform: translate(-50%, -110%); white-space: nowrap;
}

.month-select-wrap { display: flex; align-items: center; gap: 10px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--brand-navy-deep); color: #fff; padding: 12px 16px; border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop); font-size: 13.5px; min-width: 220px; animation: toast-in .18s ease;
}
.toast.error { background: #5c1414; }
.toast.success { background: #14401e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.owner-lock-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand-navy-deep), var(--brand-navy)); color: #fff; padding: 20px;
}
.owner-lock-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius-l); padding: 34px; width: 100%; max-width: 380px; text-align: center; }
.owner-lock-card .crest { margin-bottom: 16px; }
.code-input {
  width: 100%; text-align: center; letter-spacing: 8px; font-size: 24px; padding: 14px; border-radius: var(--radius-m);
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #fff; margin-bottom: 14px;
}
.code-input:focus { outline: 2px solid var(--brand-accent-light); }
.owner-lock-card .field label { color: rgba(255,255,255,0.75); }
.owner-lock-card input { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); color: #fff; }

.subtabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.subtab-btn { border: 1px solid var(--border); background: var(--surface-1); padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-secondary); }
.subtab-btn.active { background: var(--brand-navy); color: #fff; border-color: transparent; }

.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface-1); }
.admin-row .ar-main { font-size: 13.5px; font-weight: 600; }
.admin-row .ar-sub { font-size: 11.5px; color: var(--text-muted); }
.admin-row .ar-actions { display: flex; gap: 6px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

.empty-hint { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 13.5px; }

.stock-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  main.view { padding: 14px; }
  .bar-row .br-label { width: 92px; font-size: 11.5px; }
}

/* ==========================================================================
   Page client (menu QR code en chambre) — public/menu.html
   Mobile-first : une seule colonne, panier fixé en bas de l'écran.
   ========================================================================== */
body.menu-page { background: var(--surface-0); }

.menu-shell { max-width: 640px; margin: 0 auto; padding: 18px 16px 100px; }

.menu-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.menu-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.menu-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.menu-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.menu-module-tabs { position: sticky; top: 0; background: var(--surface-0); padding: 6px 0 12px; z-index: 5; }
.menu-product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.menu-cart-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: transparent; pointer-events: none; }
.menu-cart-bar.open { pointer-events: auto; }
.menu-cart-bar .menu-cart-toggle { max-width: 640px; margin: 0 auto; box-shadow: var(--shadow-pop); }

.menu-steps { display: flex; flex-direction: column; gap: 14px; }
.menu-step { display: flex; align-items: center; gap: 12px; opacity: 0.4; }
.menu-step.done, .menu-step.current { opacity: 1; }
.menu-step-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.menu-step.done .menu-step-dot { background: var(--status-good); }
.menu-step.current .menu-step-dot { background: var(--brand-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-accent) 25%, transparent); }
.menu-step-label { font-size: 13.5px; font-weight: 600; color: var(--text-secondary); }
.menu-step.done .menu-step-label, .menu-step.current .menu-step-label { color: var(--text-primary); }
.menu-canceled { text-align: center; font-weight: 700; color: var(--status-critical); padding: 12px 0; }
