/* Back-offices (salon et plateforme) */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--s5); background: var(--ink); color: var(--paper); }
.topbar h1 { font-size: var(--step-2); }
.topbar .who { display: flex; align-items: center; gap: var(--s3); font-size: var(--step--1); color: color-mix(in srgb, var(--paper) 75%, transparent); }
.topbar .btn { background: transparent; color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.topbar .btn:hover { background: color-mix(in srgb, var(--paper) 10%, transparent); }
.topbar a { color: var(--paper); }

.tabs { display: flex; gap: 2px; padding: 0 var(--s5); background: var(--surface); border-bottom: 1.5px solid var(--line); overflow-x: auto; }
.tab { flex: 0 0 auto; padding: var(--s3) var(--s4); border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }

.page { width: min(1240px, 100%); margin: 0 auto; padding: var(--s5); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.page-head h2 { font-size: var(--step-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }
.panel + .panel { margin-top: var(--s5); }
.panel h3 { font-size: var(--step-2); margin-bottom: var(--s2); }
.panel > p.muted { margin-bottom: var(--s4); max-width: 70ch; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: var(--step--1); color: var(--muted); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.off { color: var(--muted); }
.badge.bad { color: var(--pole); }
.badge.solid { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.login form { width: min(400px, 100%); background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--r-md); padding: var(--s6) var(--s5); display: grid; gap: var(--s4); }
.login h1 { font-size: var(--step-4); }

/* Statistiques du jour */
.stats { display: flex; flex-wrap: wrap; gap: var(--s5); margin-bottom: var(--s4); }
.stat strong { display: block; font-family: var(--f-display); font-size: var(--step-3); line-height: 1; }
.stat span { font-size: var(--step--1); color: var(--muted); }

/* ---------- Agenda (colonnes = chaises / employés) ---------- */
.agenda { --ppm: 1.6px; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(170px, 1fr)); overflow-x: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); }
.agenda-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: var(--s3); border-bottom: 1.5px solid var(--line); border-left: 1px solid var(--line); font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); }
.agenda-head small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.agenda-corner { border-bottom: 1.5px solid var(--line); }
.agenda-times { position: relative; }
.agenda-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda-col { position: relative; border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% calc(var(--ppm) * 60); }
.agenda-closed { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(-45deg, #f1f4f3 0 6px, #e6ebea 6px 12px); }
.appt {
  position: absolute; left: 4px; right: 4px; padding: 4px 8px; border-radius: 6px; overflow: hidden; cursor: pointer; text-align: left;
  background: var(--accent-soft); border: 1.5px solid var(--accent); border-left-width: 5px; font-size: 0.8rem; line-height: 1.25; color: var(--ink);
}
.appt:hover { background: color-mix(in srgb, var(--accent) 22%, white); }
.appt .t { font-family: var(--f-display); font-weight: 700; font-size: 0.95rem; }
.appt .c { font-weight: 600; }
.appt .s { color: var(--ink-2); }
.appt.short { padding-top: 2px; padding-bottom: 2px; }
.appt.short .s, .appt.short .b { display: none; }
.appt .b { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.appt.paid { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, white); }
.appt.done { opacity: .55; }
.appt.no_show { border-color: var(--pole); background: color-mix(in srgb, var(--pole) 7%, white); }
.appt.cancelled { display: none; }
.buffer { position: absolute; left: 4px; right: 4px; background: repeating-linear-gradient(90deg, transparent 0 4px, var(--line-strong) 4px 5px); opacity: .6; border-radius: 0 0 4px 4px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--pole); z-index: 1; }
.cancelled-list { margin-top: var(--s4); }

/* Boîtes de dialogue */
dialog { border: 1.5px solid var(--ink); border-radius: var(--r-md); padding: 0; width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(21, 32, 31, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.dlg-head h3 { font-size: var(--step-2); }
.dlg-body { padding: var(--s5); display: grid; gap: var(--s4); }
.dlg-foot { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: var(--s2) var(--s4); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* Listes de cases à cocher */
.checks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.slot-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 200px; overflow: auto; }
.slot-pick button { min-height: 38px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-family: var(--f-display); font-weight: 600; cursor: pointer; }
.slot-pick button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Horaires */
.hours-grid { display: grid; gap: var(--s2); }
.hours-row { display: grid; grid-template-columns: 110px auto 1fr; gap: var(--s3); align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.hours-row .ranges { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.hours-row input[type=time] { width: 120px; }

/* Lignes éditables (services, employés) */
.rows { display: grid; gap: var(--s3); }
.row-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: var(--s4); display: grid; gap: var(--s3); }
.row-card.inactive { opacity: .6; }
.row-grid { display: grid; gap: var(--s3); grid-template-columns: 2fr 3fr 110px 130px; align-items: end; }
@media (max-width: 760px) { .row-grid { grid-template-columns: 1fr 1fr; } .row-grid > :nth-child(2) { grid-column: 1 / -1; order: 3; } }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; }

/* Scanner */
.scanner { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .scanner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cam { position: relative; background: #0d1413; border-radius: var(--r-md); aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; color: #cfd8d6; text-align: center; padding: var(--s4); }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.live::after { content: ''; position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .8); border-radius: 12px; pointer-events: none; }
.verdict { border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); overflow: hidden; }
.verdict-top { padding: var(--s5); color: #fff; background: var(--ok); }
.verdict-top.used { background: var(--pole); }
.verdict-top.wait { background: var(--ink-2); }
.verdict-top strong { display: block; font-family: var(--f-display); font-size: var(--step-4); line-height: 1; }
.verdict .kv { padding: var(--s5); }
.verdict .dlg-foot { border-top: 1px solid var(--line); }

/* Réglages */
.settings-grid { display: grid; gap: var(--s5); }
.copy-row { display: flex; gap: var(--s2); align-items: center; }
.copy-row code { flex: 1; min-width: 0; padding: var(--s2) var(--s3); background: var(--paper); border-radius: var(--r-sm); overflow-x: auto; white-space: nowrap; font-size: var(--step--1); }
.template-preview { white-space: pre-wrap; background: #e7f6e9; border-radius: var(--r-md); padding: var(--s4); border: 1px solid #c4e3c9; max-width: 420px; font-size: var(--step--1); }
.template-preview .img { display: grid; place-items: center; aspect-ratio: 1; max-width: 140px; background: white; border-radius: 6px; margin-bottom: var(--s3); font-size: 0.75rem; color: var(--muted); border: 1px dashed var(--line-strong); }
.credentials { background: var(--ink); color: var(--paper); border-radius: var(--r-md); padding: var(--s5); display: grid; gap: var(--s2); }
.credentials code { font-size: var(--step-1); color: #fff; }
.credentials a { color: #9fe1e5; }
.empty { padding: var(--s6); text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); }
.settings-grid .panel + .panel { margin-top: 0; }

@media (max-width: 640px) {
  .topbar { padding: var(--s3) var(--s4); }
  .topbar h1 { font-size: var(--step-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .who a, .topbar .who span { display: none; }
  .tabs { padding: 0 var(--s2); }
  .page { padding: var(--s4); }
}
.appt.short > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
