/*
 * Kopaïlot — composants du design system « Carnet ».
 * Les variables viennent de tokens/*.css (copiés tels quels depuis le handoff).
 * Mobile d'abord ; desktop à partir de 900 px.
 */

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
strong, b { font-weight: var(--weight-strong); }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-small); }
.strong { font-weight: var(--weight-strong); }
.accent { color: var(--accent-text); }
.danger { color: var(--danger); }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.stack--tight { gap: var(--space-3); }
.stack--loose { gap: var(--space-10); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 899.98px) {
  .only-desktop { display: none !important; }
}

@media (min-width: 900px) {
  body { font-size: var(--text-body-desk); }
  .only-mobile { display: none !important; }
}

/* ---------- Mise en page ---------- */

.app { min-height: 100vh; }

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--page-pad-mobile);
  display: flex;
  flex-direction: column;
  gap: var(--space-9);
}

.page--narrow { max-width: 720px; }

@media (min-width: 900px) {
  .app { display: flex; gap: var(--space-6); padding: var(--space-6); align-items: flex-start; }
  .app__main { flex: 1; min-width: 0; }
  .page { padding: var(--page-pad-desk); gap: var(--space-11); }
}

.page-head { display: flex; flex-direction: column; gap: var(--space-2); }
.page-head__row { display: flex; align-items: flex-end; gap: var(--space-7); }
.page-head__row > .title-page { flex: 1; }
.eyebrow { font-size: var(--text-small); color: var(--text-muted); }

.title-page, .title-section {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tracking-display);
  color: var(--text);
  border-bottom: var(--underline-page) solid var(--accent);
}

.title-page { font-size: var(--text-page-title); line-height: var(--leading-tight); padding-bottom: 10px; }
.title-section { font-size: var(--text-section); line-height: 1.2; padding-bottom: 7px; border-bottom-width: var(--underline-section); }
.title-plain { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--text-section); letter-spacing: var(--tracking-display); line-height: 1.2; }

.section { display: flex; flex-direction: column; gap: var(--space-5); }

.home-grid { display: flex; flex-direction: column; gap: var(--space-12); }
.home-aside { display: flex; flex-direction: column; gap: var(--space-10); }

@media (min-width: 900px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-12); align-items: start; }
}

/* ---------- Cartes ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card--padded { padding: var(--pad-card); }
.card__row { padding: var(--pad-card); }
.card__row + .card__row, .card > * + .card__row { border-top: var(--border-hair) solid var(--line); }
.card__foot {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-11);
  padding: var(--space-5) var(--pad-card);
  border-top: var(--border-hair) solid var(--line);
  background: var(--surface-2);
  font-size: 14px; color: var(--text-muted);
}
.card__foot strong { color: var(--text); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-5);
  padding: var(--space-12) var(--pad-card);
  text-align: center; color: var(--text-muted);
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: var(--hit-min);
  padding: 0 var(--space-7);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--weight-strong);
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
}

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost { background: transparent; color: var(--accent-text); }
.btn--danger { background: var(--danger); color: var(--bg); }
.btn--ghost-danger { background: transparent; color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 var(--space-5); font-size: 13px; }
.btn--sm.btn--touch { min-height: var(--hit-min); }
.btn--lg { min-height: 52px; font-size: 16px; }
.btn--block { display: flex; width: 100%; }
.btn--pill { border-radius: var(--radius-pill); }
.btn--icon { width: var(--hit-min); padding: 0; font-size: 20px; }

.link { color: var(--accent-text); font-weight: var(--weight-strong); }

@media (hover: hover) {
  a.link:hover, .link-hover:hover { opacity: 0.8; }
}

form.button_to { display: contents; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-self: flex-start; align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--text-badge); font-weight: var(--weight-strong);
  white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted);
}
.badge--ok { background: var(--accent-soft); color: var(--accent-text); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--late { background: var(--danger-soft); color: var(--danger); }

.info-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px;
  border: 1.5px solid currentColor; border-radius: 999px;
  font-size: 10px; font-weight: var(--weight-strong); font-style: normal; line-height: 1;
  color: var(--text-muted); vertical-align: 2px;
}

/* ---------- Chips ---------- */

.chip {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  min-height: var(--hit-min);
  padding: 0 var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.chip--sm { min-height: 34px; }
.chip.is-selected, .chip[aria-pressed="true"], input:checked + .chip {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--weight-strong);
}

.chips { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.chips--scroll {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--space-7)); padding: 0 var(--space-7);
}
.chips--scroll::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
  .chips--scroll { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .chips--scroll .chip { min-height: 34px; }
}

.subject-chip {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  min-height: 52px; padding: 7px var(--space-6);
  border: 1px solid var(--line); border-radius: var(--radius-subject);
  background: var(--surface); color: var(--text);
  text-align: left; cursor: pointer;
}
.subject-chip__name { font-weight: var(--weight-strong); font-size: 15px; }
.subject-chip__client { font-size: var(--text-badge); color: var(--text-muted); }
.subject-chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.subject-chip.is-selected .subject-chip__client { color: var(--on-accent); }
input:focus-visible + .subject-chip, input:focus-visible + .chip, input:focus-visible + .hour-btn { outline: 2px solid var(--accent); outline-offset: 2px; }

.subject-chip--more {
  min-height: 52px; padding: 0 var(--space-6);
  border: 1px dashed var(--text-muted); border-radius: var(--radius-subject);
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: var(--weight-strong);
}

.topic-search {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.topic-search__group { padding: var(--space-4) var(--space-4) var(--space-1); font-size: var(--text-small); font-weight: var(--weight-strong); color: var(--text-muted); }
.topic-search__item {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  min-height: var(--hit-min); padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 15px;
}
.topic-search__item.is-selected { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* ---------- Formulaires ---------- */

.field { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; border: 0; margin: 0; padding: 0; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.field__label { font-size: var(--text-label); font-weight: var(--weight-strong); color: var(--text); padding: 0; }
.field__aside, .field__hint { font-size: var(--text-small); color: var(--text-muted); }
.field__error { font-size: var(--text-small); font-weight: 500; color: var(--danger); }
.field__error:empty { display: none; }

.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }

.input {
  width: 100%;
  min-height: var(--field-height);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-field);
  line-height: 1.45;
  outline: none;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
.input.is-invalid, .field--error .input { border-color: var(--danger); }
textarea.input { min-height: 104px; resize: vertical; }
input[type="date"].input, input[type="month"].input { min-width: 0; }
select.input {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.input--file { padding: 0; min-height: 0; border: 0; background: transparent; }

.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.radio-card {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 60px; padding: var(--space-4) var(--space-6);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.radio-card__title { font-weight: var(--weight-strong); }
.radio-card__sub { font-size: var(--text-small); color: var(--text-muted); }
input:checked + .radio-card { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
input:checked + .radio-card .radio-card__sub { color: var(--on-accent); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); min-height: var(--hit-min); cursor: pointer; }
.switch input { appearance: none; flex-shrink: 0; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background var(--dur-2); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-seg); transition: transform var(--dur-2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.hour-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
@media (min-width: 900px) { .hour-picker { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.hour-btn {
  min-height: var(--field-height);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 17px; font-weight: var(--weight-strong);
}
.hour-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.stepper { display: flex; align-items: center; gap: var(--space-3); }
.stepper__btn {
  display: flex; align-items: center; justify-content: center;
  width: var(--field-height); height: var(--field-height); flex-shrink: 0;
  border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 22px;
}
.stepper__input {
  width: 84px; min-height: var(--field-height);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  text-align: center; font-size: 18px; font-weight: var(--weight-strong);
  outline: none;
}
.stepper__input:focus { border-color: var(--accent); }
.stepper__suffix { font-size: var(--text-small); color: var(--text-muted); }

.check-list { display: flex; flex-direction: column; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; }
.check-row { display: flex; align-items: center; gap: var(--space-5); min-height: var(--hit-min); padding: var(--space-2) var(--space-6); cursor: pointer; }
.check-row + .check-row { border-top: var(--border-hair) solid var(--line); }
.check-row input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.check-row__title { flex: 1; }
.check-row__note { font-size: var(--text-small); color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.check-row--quiet .check-row__title { color: var(--text-muted); }
.more-months { align-self: flex-start; padding: var(--space-1) 0; border: 0; background: none; font-weight: 500; }

.advanced-toggle { align-self: flex-start; padding: var(--space-3) 0; border: 0; background: none; color: var(--accent-text); font-weight: var(--weight-strong); }

.segmented { display: inline-flex; align-self: flex-start; padding: 3px; gap: 3px; border-radius: 15px; background: var(--surface-2); }
.segmented__item {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 var(--space-7);
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: var(--weight-strong);
  color: var(--text-muted);
}
.segmented__item.is-selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow-seg); }

html { scroll-behavior: smooth; }

.sticky-chips {
  position: sticky; top: 0; z-index: 5;
  margin: calc(-1 * var(--space-3)) 0; padding: var(--space-3) 0;
  background: var(--bg);
}
.billing-month { display: flex; flex-direction: column; gap: var(--space-5); scroll-margin-top: 76px; }
@media (min-width: 900px) { .billing-month { scroll-margin-top: 64px; } }

.month-nav { display: flex; align-items: center; gap: var(--space-3); }
.month-nav__title { min-width: 180px; text-align: center; font-family: var(--font-display); font-size: var(--text-month); letter-spacing: var(--tracking-display); }

/* ---------- Tuiles et listes ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-tiles); }

.stat-tile {
  display: flex; flex-direction: column; gap: var(--space-2);
  min-height: 96px; min-width: 0;
  padding: var(--pad-card);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.stat-tile--wide { grid-column: 1 / -1; }
.stat-tile__label { font-size: var(--text-small); color: var(--text-muted); }
.stat-tile__value { font-family: var(--font-display); font-size: var(--text-stat); line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile__value--sm { font-size: var(--text-stat-sm); }
.stat-tile__sub { margin-top: auto; font-size: var(--text-small); color: var(--text-muted); }

.todo { display: flex; align-items: flex-start; gap: var(--space-5); padding: var(--pad-card); }
.todo + .todo { border-top: var(--border-hair) solid var(--line); }
.todo__dot { width: 8px; height: 8px; margin-top: 7px; flex-shrink: 0; border-radius: 999px; background: var(--accent); }
.todo__dot--late { background: var(--danger); }
.todo__dot--warn { background: var(--warn); }
.todo__dot--muted { background: var(--line); }
.todo__body { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 0; }
.todo__title { font-weight: var(--weight-strong); }
.todo__sub { font-size: var(--text-small); color: var(--text-muted); }
.todo .btn { min-height: var(--hit-min); }

.session-row {
  display: flex; align-items: center; gap: var(--space-5);
  width: 100%; min-height: 62px;
  padding: var(--space-4) var(--pad-card);
  color: var(--text);
}
.session-row + .session-row { border-top: var(--border-hair) solid var(--line); }
.session-row__main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.session-row__detail { font-size: var(--text-small); color: var(--text-muted); }
.session-row__figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.day-group { display: flex; flex-direction: column; gap: var(--space-3); }
.day-group__title { padding: 0 2px; font-size: var(--text-small); font-weight: var(--weight-strong); color: var(--text-muted); }

.summary {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: var(--border-hair) solid var(--line);
}
.summary__title { font-family: var(--font-display); font-size: var(--text-section); letter-spacing: var(--tracking-display); }
.summary__stats { font-size: var(--text-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Lignes de liste génériques (factures, frais, clients…) */
.list-row { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--pad-card); }
.list-row--cancelled { color: var(--text-muted); }
.list-row--cancelled .num, .list-row--cancelled .strong { text-decoration: line-through; }
.list-row + .list-row { border-top: var(--border-hair) solid var(--line); }
.list-row__line { display: flex; justify-content: space-between; align-items: center; gap: var(--space-5); }

.thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.thumb--empty { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); }

/* ---------- Facturation ---------- */

.billing-head, .billing-row__grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 110px 110px 130px minmax(170px, 1.2fr);
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-4) var(--pad-card);
}
.billing-head { border-bottom: var(--border-hair) solid var(--line); background: var(--surface-2); font-size: var(--text-small); color: var(--text-muted); }
.billing-row + .billing-row { border-top: var(--border-hair) solid var(--line); }
.billing-row__grid { min-height: 56px; }
.billing-row__invoices { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.calc-detail__invoices { display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-3); border-top: var(--border-hair) solid var(--line); }
.calc-detail__invoices .calc-detail__line { align-items: center; }
.billing-row__mobile { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--pad-card); }

.calc-link {
  padding: 0; border: 0; background: none;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  text-decoration: underline dotted; text-underline-offset: 4px;
}
.retained { font-weight: var(--weight-strong); font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0; border: 0; background: none; }
.retained--adjusted { font-weight: 800; }

.amount-box {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: transparent; text-align: left;
}
.amount-box__value { font-size: var(--text-amount); font-weight: var(--weight-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }

.calc-detail {
  display: flex; flex-direction: column; gap: var(--space-3);
  margin: 0 var(--pad-card) var(--pad-card);
  padding: var(--pad-card);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
}
.calc-detail__line { display: flex; justify-content: space-between; gap: var(--space-7); }
.calc-detail__total { display: flex; justify-content: space-between; gap: var(--space-7); padding-top: var(--space-3); border-top: var(--border-hair) solid var(--line); font-weight: var(--weight-strong); }
.adjust-form { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-1); }
.adjust-form__grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 900px) { .adjust-form__grid { grid-template-columns: 160px 1fr; } }

.mark-paid { display: flex; gap: var(--space-3); }
.mark-paid__date { flex: 1; min-width: 0; min-height: var(--hit-min); padding-top: 6px; padding-bottom: 6px; }

.invoice-grid { display: flex; flex-direction: column; gap: var(--space-4); }
@media (min-width: 900px) {
  .invoice-grid { display: grid; grid-template-columns: minmax(0, 1fr) 110px 100px 140px 290px; align-items: center; gap: var(--space-5); }
}

/* Déclarations */
.quarter { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--pad-card); }
.quarter + .quarter { border-top: var(--border-hair) solid var(--line); }
.quarter__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-5); }
.quarter__title { font-family: var(--font-display); font-size: var(--text-section); letter-spacing: var(--tracking-display); line-height: 1.2; }
.figures { display: flex; flex-direction: column; gap: var(--space-2); }
.figures__line { display: flex; justify-content: space-between; gap: var(--space-7); }
.figures__line--total { padding-top: var(--space-3); border-top: var(--border-hair) solid var(--line); font-weight: var(--weight-strong); }

/* Congés */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.calendar__dow { padding-bottom: var(--space-1); text-align: center; font-size: var(--text-small); color: var(--text-muted); }
.calendar__day {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--field-height);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: var(--weight-strong); font-variant-numeric: tabular-nums;
}
.calendar__day--weekend { border-color: transparent; background: transparent; color: var(--text-muted); font-weight: 400; cursor: default; }
.calendar__day--off { background: var(--surface-2); border-color: var(--surface-2); color: var(--text-muted); text-decoration: line-through; }
.calendar__day--today { border-color: var(--accent); }

/* Menu « Plus » */
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); min-height: 56px; padding: 0 var(--pad-card); }
.menu-row + .menu-row { border-top: var(--border-hair) solid var(--line); }
.menu-row__chevron { color: var(--text-muted); font-size: 20px; }

/* Justificatif */
.scan-status[data-tone="ok"] { color: var(--accent-text); font-weight: 500; }
.scan-status[data-tone="error"] { color: var(--danger); font-weight: 500; }
.input.is-prefilled { background: var(--accent-soft); }
.receipt-preview { display: block; max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); object-fit: contain; background: var(--surface-2); }

/* ---------- Navigation ---------- */

.tabbar {
  position: fixed; z-index: 32;
  left: var(--nav-inset); right: var(--nav-inset); bottom: calc(var(--nav-bottom) + env(safe-area-inset-bottom) * 0.5);
  height: var(--nav-height);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-1);
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--nav-bg);
  box-shadow: var(--shadow-nav);
}
.tabbar__item {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  flex: 1 1 0;
  height: var(--nav-item); min-width: var(--hit-min);
  border-radius: var(--radius-pill);
  color: var(--nav-ink);
  transition: background var(--dur-2), padding var(--dur-2);
}
.tabbar__item[aria-current="page"] { flex: 0 0 auto; padding: 0 14px 0 12px; background: var(--accent); color: var(--on-accent); }
.tabbar__label { display: none; font-family: var(--font-display); font-size: var(--text-nav); letter-spacing: 0.01em; white-space: nowrap; }
.tabbar__item[aria-current="page"] .tabbar__label { display: inline; }

.sidenav { display: none; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidenav {
    position: sticky; top: var(--space-6);
    display: flex; flex-direction: column; gap: var(--space-1);
    width: var(--sidebar-width); flex-shrink: 0;
    height: calc(100vh - 2 * var(--space-6));
    overflow-y: auto; scrollbar-width: none;
    padding: 26px 12px 14px;
    border-radius: var(--radius-sidebar);
    background: var(--nav-bg);
    box-shadow: var(--shadow-nav);
  }
  .sidenav__brand { padding: 0 14px 22px; font-family: var(--font-display); font-size: var(--text-brand); letter-spacing: var(--tracking-display); color: var(--nav-brand); }
  .sidenav__item {
    display: flex; align-items: center; gap: var(--space-5);
    min-height: 48px; padding: 0 16px 0 14px;
    border-radius: var(--radius-pill);
    color: var(--nav-ink); font-size: 15px;
    transition: background var(--dur-2);
  }
  .sidenav__item[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: var(--weight-strong); }
  .sidenav__item--secondary { min-height: 42px; font-size: 14px; }
  .sidenav__separator { height: 1px; margin: var(--space-4) 14px; background: var(--nav-ink); opacity: 0.2; }
  .sidenav__spacer { flex: 1; min-height: var(--space-5); }
}

.icon { display: block; flex-shrink: 0; }

/* ---------- Bouton + → × ---------- */

.fab {
  position: fixed; z-index: 33;
  right: 16px; bottom: calc(var(--fab-bottom) + env(safe-area-inset-bottom) * 0.5);
  display: flex; align-items: center; justify-content: center;
  width: var(--fab-size); height: var(--fab-size);
  border: 0; border-radius: var(--radius-fab);
  background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow-fab);
  transition: background-color var(--dur-3) ease, box-shadow var(--dur-3) ease;
}
.fab__glyph { display: block; transition: transform var(--dur-4) var(--ease-spring); }
body:has(#panel .sheet) .fab { background: var(--second); color: var(--on-second); box-shadow: var(--shadow-fab-open); }
body:has(#panel .sheet) .fab__glyph { transform: rotate(135deg); }

@media (min-width: 900px) { .fab { display: none; } }

/* ---------- Panneaux : formulaire Session (feuille) et formulaires secondaires (modale) ---------- */

#panel:empty { display: none; }

.scrim { display: none; }

.sheet {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.sheet__head, .modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 56px; padding: 0 var(--space-2); flex-shrink: 0;
  border-bottom: var(--border-hair) solid var(--line);
  background: var(--surface);
}
.sheet__side, .modal__side { display: flex; min-width: 76px; }
.sheet__side--end, .modal__side--end { justify-content: flex-end; }
.sheet__title, .modal__title { font-family: var(--font-display); font-size: var(--text-section); letter-spacing: var(--tracking-display); text-align: center; }
.sheet__body, .modal__body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: var(--space-10);
  padding: var(--space-9) var(--space-7);
}
.sheet__foot, .modal__foot {
  display: flex; flex-direction: column; gap: var(--space-3); flex-shrink: 0;
  padding: var(--space-5) var(--space-7) var(--space-10);
  border-top: var(--border-hair) solid var(--line);
  background: var(--surface);
}
/* Mobile : le pied laisse la place au bouton × et à la barre flottante. */
.sheet__foot { padding-right: 88px; padding-bottom: calc(100px + env(safe-area-inset-bottom) * 0.5); }
.sheet__form, .modal__form { display: contents; }

.confirm { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-sm); background: var(--danger-soft); }
.confirm__actions { display: flex; gap: var(--space-3); }
.confirm__actions > * { flex: 1; }

.modal {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  max-height: 92vh;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.modal__foot { padding-bottom: calc(var(--space-10) + env(safe-area-inset-bottom)); }
.scrim--modal { display: block; position: fixed; inset: 0; z-index: 39; background: var(--scrim); }

@media (min-width: 900px) {
  .scrim { display: block; position: fixed; inset: 0; z-index: 29; background: var(--scrim); }
  .sheet { left: auto; width: 460px; box-shadow: var(--shadow-panel); }
  .sheet__foot { padding-right: var(--space-7); padding-bottom: var(--space-10); }
  .modal {
    left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%);
    width: 540px; max-height: 88vh;
    border-radius: var(--radius-card);
  }
  .modal--panel {
    left: auto; right: 0; top: 0; bottom: 0; transform: none;
    width: 460px; max-height: none;
    border-radius: 0;
    box-shadow: var(--shadow-panel);
  }
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: 168px;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  pointer-events: none;
}
@media (min-width: 900px) { .toasts { bottom: 28px; } }
.toast {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: var(--weight-strong);
  box-shadow: var(--shadow-toast);
  white-space: nowrap;
  animation: toast-in var(--dur-2) ease-out;
}
.toast--alert { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Connexion ---------- */

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-11) var(--space-7); }
.login__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--space-10); }
.login__brand { font-family: var(--font-display); font-size: var(--text-page-title); line-height: var(--leading-tight); border-bottom: var(--underline-page) solid var(--accent); padding-bottom: 10px; }
