/* EXTRAS RIAD — feuille de style. Mobile d'abord, zéro dépendance. */
@font-face { font-family: 'Inter'; src: url('/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Playfair'; src: url('/fonts/playfair.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #FBF7F1; --card: #FFFFFF; --ink: #1F1A17; --muted: #6B625A; --line: #E7DFD3;
  --green: #1E3D33; --green-soft: #E6EEE9; --terra: #B8552F; --terra-soft: #F7E6DE;
  --gold: #C69E63; --gold-soft: #F6EDDC; --red: #C62828; --red-soft: #FCE8E6; --ok: #1E8A5D;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,26,23,.06), 0 6px 18px rgba(31,26,23,.06);
  --tap: 44px; --gutter: 16px; --tabs-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: Playfair, Georgia, serif; font-weight: 600; font-size: 1.35rem; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0 0 .6rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ic { width: 22px; height: 22px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.red { color: var(--red) !important; font-weight: 700; }

/* ---------- connexion ---------- */
body.auth { display: grid; place-items: center; min-height: 100dvh; padding: var(--gutter); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.auth-logo { border-radius: 20px; }
.auth-kicker { margin: 12px 0 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.auth-card h1 { font-size: 2rem; margin-top: 2px; }
.auth-sub { color: var(--muted); margin-bottom: 18px; }
.auth-card form { text-align: left; }
.auth-card label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 6px; }
.auth-card input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 54px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); padding: 0; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--green); background: var(--green-soft); }
.pw-eye .ic { width: 22px; height: 22px; }
.auth-card .auth-submit { margin-top: 22px; }
.auth-card label { margin-top: 14px; }
.alert { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }

/* ---------- coquille ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px; background: var(--green); color: #fff; }
.top-back { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.top-title { flex: 1; min-width: 0; }
.top-kicker { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.top-title h1 { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-who { font-size: .8rem; opacity: .85; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; padding: 14px var(--gutter) calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); max-width: 760px; width: 100%; margin: 0 auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); }
.tab-btn { background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.tab-btn.active { color: var(--green); }
.tab-btn.active .ic { stroke-width: 2.2; }

/* ---------- composants ---------- */
.btn { min-height: var(--tap); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.accent { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #F0C9C5; background: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .tab-btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(198,158,99,.6); outline-offset: 2px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.995); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
.field textarea { min-height: 80px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-title { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 18px 0 8px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge.free { background: var(--green-soft); color: var(--green); }
.badge.busy { background: var(--gold-soft); color: #8A6A2E; }
.badge.due { background: var(--terra-soft); color: var(--terra); }
.badge.paid { background: #E3F3EA; color: var(--ok); }
.badge.cat { color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.amount { font-weight: 700; }
.amount.big { font-size: 1.5rem; font-family: Playfair, Georgia, serif; }
.kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi > div { background: var(--card); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .val { font-size: 1.1rem; font-weight: 700; margin-top: 2px; }
@media (max-width: 420px) { .kpi .val { font-size: .95rem; } .kpi .lbl { font-size: .66rem; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.line-price { text-align: right; white-space: nowrap; }
.line-price small { display: block; color: var(--muted); font-weight: 400; font-size: .75rem; }
.reason { font-size: .78rem; color: var(--red); font-style: italic; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 8px; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }
.chip.cat.active { background: var(--chip-color, var(--green)); border-color: var(--chip-color, var(--green)); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; color: var(--green); }
.stepper input { width: 44px; height: 40px; border: 0; text-align: center; font-weight: 700; font-size: 16px; }
.price-input { width: 96px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; text-align: right; font-weight: 700; font-size: 16px; background: #fff; }
.price-input.red { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.sticky-foot { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); padding: 10px var(--gutter); z-index: 15; }
.sticky-foot .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.has-foot { padding-bottom: calc(var(--tabs-h) + 96px + env(safe-area-inset-bottom)); }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.service-btn { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-align: left; min-height: 60px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.service-btn .nm { font-weight: 600; font-size: .92rem; }
.service-btn .pr { color: var(--muted); font-size: .85rem; }
.service-btn.added { border-color: var(--green); background: var(--green-soft); }
.service-btn .cnt { position: absolute; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table td.r, .table th.r { text-align: right; white-space: nowrap; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list li { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 8px; }
.menu-list button { width: 100%; min-height: 56px; background: none; border: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; text-align: left; font-weight: 600; }
.menu-list .desc { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month-nav select { flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 10px; font-size: 16px; font-weight: 600; }
.segment { display: grid; grid-template-columns: 1fr 1fr; background: #EFE9E0; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.segment button { border: 0; background: none; min-height: 40px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.segment button.active { background: #fff; color: var(--green); box-shadow: var(--shadow); }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); }
.log-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.log-item .when { color: var(--muted); font-size: .75rem; }
.log-item.erreur { color: var(--red); }
.log-item.avertissement { color: #8A6A2E; }
.sheet-host { position: fixed; inset: 0; z-index: 50; background: rgba(31,26,23,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--paper); border-radius: 20px 20px 0 0; padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
.sheet h2 { font-family: Playfair, Georgia, serif; font-size: 1.25rem; margin-bottom: 10px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet .actions .btn { flex: 1; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }
@media (min-width: 720px) {
  .kpi { grid-template-columns: repeat(4, 1fr); }
  .service-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .topbar, .tabs, .sticky-foot { display: none; } .content { padding: 0; } }
@media (min-width: 720px) {
  .tabs { left: 50%; right: auto; width: 100%; max-width: 760px; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 16px 16px 0 0; }
}
/* recherche de prestations (écran Commande et gestion du catalogue) */
.search-box { position: relative; display: flex; align-items: center; margin: 14px 0 4px; }
.search-box .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; min-height: 50px; padding: 10px 44px 10px 42px; border: 2px solid var(--gold); border-radius: 14px; background: #fff; font-size: 16px; font-weight: 600; box-shadow: var(--shadow); }
.search-box input::placeholder { font-weight: 400; }
.search-clear { position: absolute; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--line); font-size: 1.2rem; line-height: 1; }
.list li.result { cursor: pointer; }
.list li.result .ic { color: var(--green); }
.badge.off { background: #EEE; color: var(--muted); }
.filters-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filters-row select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 10px; font-size: 15px; }
.tree-sub { padding-left: 10px; border-left: 3px solid var(--line); margin: 6px 0 10px; }
/* aucun défilement horizontal sur téléphone ; les menus déroulants restent dans leur colonne */
html, body { overflow-x: hidden; max-width: 100%; }
.filters-row > * { min-width: 0; }
.filters-row select { width: 100%; max-width: 100%; text-overflow: ellipsis; }
.grid-2 > * { min-width: 0; }
.field select { max-width: 100%; }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* accès du personnel : mot de passe provisoire */
.prov { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.prov span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.prov b { font-family: ui-monospace, Menlo, monospace; font-size: 1.35rem; letter-spacing: .08em; }
.link-msg { font-family: Inter, system-ui, sans-serif; font-size: .92rem; line-height: 1.45; }

/* personnel : liste et formulaire façon caisse */
.plist .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; min-height: 64px; cursor: pointer; }
.plist .item:last-child { border-bottom: 0; }
.plist .item:active { background: var(--green-soft); }
.plist .main { flex: 1; min-width: 0; }
.plist .t, .plist .s { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .t { font-weight: 700; }
.plist .s { font-size: .9rem; color: var(--muted); }
.plist .item > .ic { color: var(--muted); }
.thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); flex: none; display: grid; place-items: center; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { min-height: 48px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--green); box-shadow: var(--shadow); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-bottom: 4px; }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: #D9D2C7; position: relative; cursor: pointer; border: 0; padding: 0; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .5; }
