/* NZG Manager - feuille de style principale */
:root {
  --ground: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #1B1F1D;
  --muted: #5E6660;
  --line: #E4E0D6;
  --line-soft: #EFECE4;
  --brand: #17322A;
  --brand-2: #24493D;
  --brand-hover: #0E211B;
  --gold: #C9A04E;
  --good: #22603C; --good-bg: #E5F2EA;
  --warn: #7A4F00; --warn-bg: #FBF0D9;
  --bad: #9A2B24; --bad-bg: #F8E3E1;
  --info: #22385E; --info-bg: #EAEFF8;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--ground); font-size: 14.5px; line-height: 1.45; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Structure ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--brand); color: #D7E3DC; padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 6px; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 10px; flex: none; object-fit: contain; background: #fff; }
.brand-name { font-weight: 700; font-size: 13px; letter-spacing: .04em; color: #fff; }
.brand-sub { font-size: 11.5px; color: #A9BFB3; }
.nav-groups { display: flex; flex-direction: column; gap: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8FAA9C; padding: 8px 12px 4px; }
.nav { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border-radius: 8px; color: #D7E3DC; text-decoration: none; font-size: 14px; }
.nav:hover { background: #21443A; color: #fff; }
.nav.on { background: #2A5446; color: #fff; font-weight: 600; }
.nav svg { flex: none; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #2C4A40; font-size: 12.5px; color: #C4D4CB; }
.side-foot strong { display: block; color: #fff; font-size: 13px; }
.side-foot a { color: #E2C68C; }
.main { flex: 999 1 560px; min-width: 0; padding: 22px 28px 48px; display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.page-title { margin: 0; font-size: 23px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.entity-switch select { min-height: 40px; padding: 6px 10px; border: 1px solid #D6D1C4; border-radius: 8px; background: #fff; }
.menu-toggle { display: none; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.card-head .card-title { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font-size: 23px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-hover); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #D6D1C4; font-weight: 500; }
.btn-ghost:hover { background: #fff; border-color: var(--brand); color: var(--ink); }
.btn-danger { background: #fff; color: var(--bad); border-color: #E3A9A3; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag-good { background: var(--good-bg); color: var(--good); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-neutral { background: #ECEBE6; color: #4A4F4B; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; }
.alert-success { background: var(--good-bg); color: var(--good); }
.alert-error { background: var(--bad-bg); color: var(--bad); }
.alert-warning { background: var(--warn-bg); color: #6B4500; }
.alert-info { background: var(--info-bg); color: var(--info); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid #D6D1C4; background: #fff; color: var(--ink); text-decoration: none; font-size: 13px; }
.tab:hover { border-color: var(--brand); color: var(--ink); }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: var(--ground); }
.table .actions { white-space: nowrap; text-align: right; }
.table a.row-link { text-decoration: none; color: var(--ink); font-weight: 600; }
.table a.row-link:hover { text-decoration: underline; }
.empty { padding: 26px 0; text-align: center; color: var(--muted); }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label, .label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=number], .field input[type=date],
.field input[type=time], .field input[type=datetime-local], .field input[type=password], .field input[type=search], .field input[type=file], .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid #CFC9BA; border-radius: 8px; background: #fff; }
.field textarea { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, .nav:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; min-height: 32px; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { min-width: 160px; }

/* ---------- Graphiques ---------- */
.chart-box { position: relative; height: 280px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.list-item:first-child { border-top: 0; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.kv:first-child { border-top: 0; }
.kv > span:first-child { color: var(--muted); }

/* ---------- Caisse ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.pos-search { display: flex; gap: 8px; margin-bottom: 12px; }
.pos-search input { flex: 1; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 64vh; overflow-y: auto; padding: 2px; }
.product { min-height: 92px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; cursor: pointer; }
.product:hover { border-color: var(--brand); background: #FBFAF7; }
.product:disabled { opacity: .5; cursor: not-allowed; }
.product .p-name { font-size: 13.5px; font-weight: 600; }
.product .p-meta { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.qty { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.qty button { width: 34px; height: 34px; border: 1px solid #D6D1C4; border-radius: 8px; background: #fff; cursor: pointer; font-size: 16px; }
.total-line { display: flex; justify-content: space-between; font-size: 19px; font-weight: 700; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 6px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.net-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.net-on { background: var(--good-bg); color: var(--good); }
.net-off { background: var(--warn-bg); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Agenda spa ---------- */
.agenda { display: grid; gap: 6px; min-width: 620px; }
.agenda-head { font-size: 12.5px; font-weight: 600; padding: 4px 6px; }
.agenda-head span { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.agenda-hour { font-size: 12px; color: var(--muted); padding-top: 6px; font-variant-numeric: tabular-nums; }
.agenda-slot { min-height: 48px; border-radius: 8px; border: 1px dashed var(--line); display: block; }
a.agenda-slot:hover { border-color: var(--brand); background: #FBFAF7; }
.appt { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; text-decoration: none; min-height: 48px; }
.appt strong { font-size: 12.5px; }
.st-reserve { background: #EAEFF8; color: #22385E; }
.st-confirme { background: #E1EFEC; color: #1E5A53; }
.st-arrive, .st-en_cours { background: #FBEFD6; color: #6B4500; }
.st-termine { background: #ECEBE6; color: #4A4F4B; }
.st-annule, .st-absent { background: #F8E3E1; color: #7E231D; text-decoration: line-through; }

/* ---------- Contrôle d'accès ---------- */
.scan-result { border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.scan-result .big { font-size: 26px; font-weight: 700; }
.scan-ok { background: var(--good-bg); border: 1px solid #9CCBAE; color: #1D4F31; }
.scan-bad { background: var(--bad-bg); border: 1px solid #E3A9A3; color: #7E231D; }
.scan-wait { background: var(--ground); border: 1px dashed #CFC9BA; color: #4A4F4B; }
#qr-reader { width: 100%; max-width: 420px; }

/* ---------- Accueil (choix de l'espace) ---------- */
.hub-body { background: var(--ground); }
.hub-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--brand); color: #D7E3DC; }
.hub-top .brand img { width: 42px; height: 42px; border-radius: 10px; }
.hub-user { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #fff; font-size: 13px; }
.hub-main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 60px; }
.hub-hello h1 { margin: 0 0 4px; font-size: 28px; }
.hub-search { display: flex; gap: 8px; margin: 18px 0 26px; max-width: 720px; }
.hub-search input { flex: 1; min-height: 46px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.hub-card { position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 260px; padding: 22px; border-radius: 16px;
  background: #fff; border: 1px solid var(--line); border-top: 6px solid var(--accent, var(--brand)); text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease; }
a.hub-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(23, 50, 42, .12); color: var(--ink); }
a.hub-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hub-icon { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--accent, var(--brand)); margin-bottom: 6px; }
.hub-title { font-size: 19px; font-weight: 800; letter-spacing: .03em; }
.hub-sub { font-size: 13px; color: var(--muted); }
.hub-desc { font-size: 13.5px; margin-top: 4px; }
.hub-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.hub-stats > span { display: flex; justify-content: space-between; gap: 8px; }
.hub-go { margin-top: auto; padding-top: 12px; font-weight: 700; color: var(--accent, var(--brand)); }
.hub-soon { opacity: .75; border-top-color: #CFC9BA; --accent: #8A8F8B; }
.espace-badge { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.espace-badge i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.espace-badge:hover { background: rgba(255,255,255,.16); color: #fff; }
.top-search { display: flex; gap: 6px; }
.top-search input { min-height: 40px; width: 230px; }

/* ---------- Fiches (onglets, photo, timeline) ---------- */
.profile-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #E9E4D8; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--brand); flex: none; }
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; min-width: 1080px; }
.week-day { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.week-day h3 { margin: 0; font-size: 13.5px; }
.week-day.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.session { display: block; padding: 8px 10px; border-radius: 8px; background: var(--info-bg); color: var(--info); text-decoration: none; font-size: 12.5px; }
.session:hover { filter: brightness(.97); color: var(--info); }
.session.full { background: var(--warn-bg); color: var(--warn); }
.gauge { height: 6px; border-radius: 4px; background: rgba(0,0,0,.08); overflow: hidden; margin-top: 4px; }
.gauge > span { display: block; height: 100%; background: currentColor; }
.gift { border-radius: 14px; padding: 18px; color: #fff; background: linear-gradient(135deg, #17322A, #2E7D74); max-width: 380px; }
.gift .code { font-family: "Courier New", monospace; font-size: 22px; letter-spacing: .12em; font-weight: 700; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--ground); }
.auth-aside { background: var(--brand); color: #D7E3DC; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-aside h1 { color: #fff; font-size: 30px; margin: 18px 0 8px; letter-spacing: .02em; }
.auth-aside p { max-width: 420px; color: #C4D4CB; }
.auth-entities { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-entities span { border: 1px solid #3B5E52; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: #E2C68C; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { margin: 0 0 4px; font-size: 22px; }
.auth-card .field { margin-top: 14px; }
.auth-foot { margin-top: 26px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 84px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 32px; padding: 4px 10px; border: 0; background: transparent; color: var(--brand); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.otp-input { font-size: 26px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Ticket de caisse 80 mm ---------- */
.ticket { width: 76mm; margin: 0 auto; background: #fff; padding: 6mm 3mm; font-size: 12px; color: #000; font-family: "Courier New", monospace; }
.ticket h1 { font-size: 15px; text-align: center; margin: 0; }
.ticket .c { text-align: center; }
.ticket table { width: 100%; border-collapse: collapse; }
.ticket td { padding: 2px 0; vertical-align: top; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.member-card { width: 86mm; height: 54mm; border-radius: 10px; background: var(--brand); color: #fff; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.member-card .qr { background: #fff; padding: 6px; border-radius: 8px; width: 34mm; height: 34mm; display: flex; align-items: center; justify-content: center; }
.member-card .qr img, .member-card .qr canvas { width: 100%; height: 100%; }

/* ---------- Documents A4 (devis, bon de livraison) ---------- */
.a4 { max-width: 880px; margin: 0 auto; padding: 36px 40px; background: #fff; color: #1d1b18; }
.a4-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #C9A961; padding-bottom: 18px; }
.a4-title { font-size: 26px; font-weight: 800; letter-spacing: .08em; color: #8a6d2f; }
.a4-client { margin: 22px 0; padding: 14px 16px; border: 1px solid #e6dfd2; border-radius: 10px; max-width: 380px; margin-left: auto; }
.a4-table th { background: #f6f1e7; }
.a4-table tfoot td { border-top: 2px solid #e6dfd2; }
.a4-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.a4-sign > div { min-height: 90px; border-top: 1px dashed #c9bfae; padding-top: 8px; }
@media print { .a4 { max-width: none; padding: 0; } @page { size: A4; margin: 14mm; } }

@media print {
  .side, .topbar, .no-print, .flashes { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 960px) {
  .pos, .split { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side { padding: 12px; gap: 10px; }
  .side .nav-groups { display: none; }
  .side.open .nav-groups { display: flex; flex-direction: column; gap: 4px; }
  .side-foot { display: none; }
  .side.open .side-foot { display: block; }
  .side-top { display: flex; align-items: center; justify-content: space-between; }
  .menu-toggle { display: inline-flex; background: transparent; color: #fff; border: 1px solid #3B5E52; border-radius: 8px; min-height: 40px; padding: 6px 12px; }
  .main { padding: 16px 14px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 28px 22px; }
  .auth-aside .auth-hide-sm { display: none; }
}
