/* REVO Pilotage — charte Revo Travaux (noir, or #CC9833, crème), ergonomie inspirée d'iOS / macOS. */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/fonts/jakarta.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f5f2ed;
  --sand: #f5eedc;
  --sand-ink: #2b2417;
  --ink: #000000;
  --ink-2: #5c544a;
  --ink-3: #9a9088;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --gold: #cc9833;
  --gold-d: #9c761f;
  --gold-l: #e3be66;
  --gold-text: #9c761f;
  --red: #d14b3a;
  --green: #2e7d4f;
  --blue: #2c6fb7;
  --chrome: rgba(250, 248, 245, 0.78);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.18);
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Plus Jakarta Sans', 'DM Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #171717;
    --surface-2: #222120;
    --sand: #2b2417;
    --sand-ink: #f5eedc;
    --ink: #f5f2ed;
    --ink-2: #c9c0b4;
    --ink-3: #8a8178;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);
    --gold-text: #e3be66;
    --red: #f07a68;
    --green: #6cc596;
    --blue: #7fb2ee;
    --chrome: rgba(23, 23, 23, 0.72);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 60%, transparent); outline-offset: 2px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Coque : barre latérale (bureau) / barre d'onglets (mobile) ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px 18px; border-right: 1px solid var(--line);
  background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .wordmark { font-weight: 800; letter-spacing: -0.02em; font-size: 19px; }
.brand .wordmark b { color: var(--gold); font-weight: 800; }
.brand small { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-s);
  text-decoration: none; font-weight: 600; color: var(--ink-2); transition: background 0.2s, color 0.2s;
}
.nav a:hover { background: var(--line); color: var(--ink); }
.nav a[aria-current='page'] { background: var(--ink); color: var(--bg); }
.nav a[aria-current='page'] svg { color: var(--gold-l); }
.nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--gold); color: #000; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 13px; color: var(--ink-3); display: grid; gap: 10px; }
.sync-btn { display: inline-flex; align-items: center; gap: 8px; }
.sync-btn.is-spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { padding: 28px clamp(16px, 4vw, 48px) 120px; max-width: 1180px; width: 100%; }

/* ---------- Titres façon iOS ---------- */
.large-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.large-title h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.large-title p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; max-width: 62ch; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 4px 10px; }
.section-title h2 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.section-title .aside { color: var(--ink-3); font-size: 14px; font-weight: 600; }
.caption { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 0 4px 8px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: transform 0.15s var(--ease-out), background 0.2s, border-color 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:hover { border-color: var(--ink-3); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-d); border-color: var(--gold-d); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-plain { border-color: transparent; background: transparent; color: var(--gold-text); padding: 0 8px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- Carte « Aujourd'hui » : l'anneau d'objectif ---------- */
.hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center;
  background: var(--surface); border-radius: var(--r-l); padding: 26px 28px; box-shadow: var(--shadow);
}
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: color-mix(in srgb, var(--gold) 16%, transparent); stroke-width: 16; }
.ring .bar { fill: none; stroke: url(#gold-grad); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease-out); }
.ring .over { stroke: var(--gold-d); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ring-label > span { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-top: 4px; }
.hero-copy h2 { margin: 0 0 4px; font-size: 15px; font-weight: 650; color: var(--ink-2); }
.hero-copy .big { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.hero-copy .big small { font-size: 0.45em; font-weight: 650; letter-spacing: -0.01em; color: var(--ink-3); }
.hero-copy p { margin: 8px 0 0; color: var(--ink-2); }
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.flow a {
  display: block; text-decoration: none; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-2);
  transition: transform 0.15s var(--ease-out), background 0.2s;
}
.flow a:hover { background: var(--sand); }
.flow a:active { transform: scale(0.97); }
.flow .k { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.flow .v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; }
.flow .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.flow .hot .v { color: var(--red); }

/* ---------- Listes groupées (inset grouped) ---------- */
.group { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); overflow: hidden; }
.row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  width: 100%; padding: 13px 16px; background: none; border: 0; text-align: left; cursor: pointer;
  transition: background 0.15s;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 48px; right: 0; height: 1px; background: var(--line); }
.row:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.row:active { background: var(--surface-2); }
.row .lead { width: 18px; display: grid; place-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.dot.critical { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent); }
.dot.high { background: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 20%, transparent); }
.dot.medium { background: var(--ink-3); }
.dot.low { background: color-mix(in srgb, var(--ink-3) 45%, transparent); }
.row .main { min-width: 0; }
.row .eyebrow { font-size: 12.5px; font-weight: 700; color: var(--gold-text); display: flex; gap: 6px; align-items: center; }
.row .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .next { font-size: 13px; color: var(--green); font-weight: 600; margin-top: 1px; }
.row .trail { display: flex; align-items: center; gap: 8px; color: var(--ink-3); text-align: right; }
.row .amount { font-weight: 750; color: var(--ink); white-space: nowrap; }
.row .amount.neg { color: var(--red); }
.row .chev { width: 16px; height: 16px; opacity: 0.5; }
.src { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* Grille du tableau de bord */
.dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 26px; align-items: start; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: var(--r-m); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .k { font-size: 13px; color: var(--ink-2); font-weight: 650; }
.tile .v { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; }
.tile .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.tile .v.neg { color: var(--red); }
.tile.wide { grid-column: span 2; }
.spark { width: 100%; height: 64px; display: block; margin-top: 8px; }
.spark .line { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; }
.spark .area { fill: url(#spark-grad); }

/* ---------- Contrôle segmenté ---------- */
.segmented {
  position: relative; display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2);
  margin-bottom: 18px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  position: relative; z-index: 1; border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-weight: 650; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: color 0.2s;
}
.segmented button[aria-selected='true'] { color: var(--ink); }
.segmented .n { color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.segmented .thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px var(--line); transition: transform 0.35s var(--spring), width 0.35s var(--spring);
}

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 650; color: var(--ink-3); font-size: 12.5px; padding: 12px 16px 8px; white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr { cursor: pointer; transition: background 0.15s; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table .num { text-align: right; white-space: nowrap; }
.table .sub { color: var(--ink-3); font-size: 13px; }
.table-foot { display: flex; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-weight: 750; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.pill.critical { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.pill.high { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-text); }
.pill.ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.neg { color: var(--red); }

/* Colonnes d'étapes (demandes) */
.lanes { display: grid; gap: 22px; }

/* ---------- Feuille (sheet) de détail ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.32); opacity: 0; transition: opacity 0.35s var(--ease-out); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; top: 10px; right: 10px; bottom: 10px; width: min(500px, calc(100% - 20px));
  background: var(--bg); border-radius: var(--r-l); box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column; transform: translateX(calc(100% + 24px)); transition: transform 0.5s var(--spring);
}
.sheet.open { transform: none; }
.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px;
  background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.sheet-head .kind { font-size: 13px; font-weight: 650; color: var(--ink-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-head h2 { margin: 4px 0 0; font-size: 21px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; }
.grabber { display: none; }
.close {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center; color: var(--ink-2);
}
.sheet-body { position: relative; flex: 1; min-height: 0; align-content: start; overflow-y: auto; padding: 16px 16px 40px; display: grid; gap: 18px; overscroll-behavior: contain; }
.card { background: var(--surface); border-radius: var(--r-m); padding: 14px 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 750; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 0; text-align: right; font-weight: 650; }
.prose { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); max-height: 240px; overflow-y: auto; margin: 0; }
.match {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-m);
  background: var(--sand); color: var(--sand-ink); text-decoration: none;
}
.match strong { display: block; }
.match span { font-size: 13px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 13px;
  font-weight: 650; font-size: 13.5px; cursor: pointer; transition: transform 0.15s var(--ease-out), background 0.2s, color 0.2s;
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

form.stack { display: grid; gap: 12px; align-content: start; }
.dictate textarea { display: block; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
label .hint { font-weight: 500; color: var(--ink-3); }
input[type='text'], input[type='email'], input[type='password'], input[type='date'], input[type='number'], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font-size: 15px;
}
textarea { min-height: 92px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-msg { font-size: 13.5px; min-height: 0; margin: 0; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }
details.more summary { cursor: pointer; font-weight: 750; color: var(--ink-2); font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '+'; color: var(--ink-3); font-weight: 600; }
details.more[open] summary::after { content: '–'; }
details.more[open] summary { margin-bottom: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { font-size: 14px; }
.timeline .who { font-weight: 700; font-size: 13px; }
.timeline .when { color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }
.timeline p { margin: 3px 0 0; white-space: pre-wrap; color: var(--ink-2); }

/* Réglages */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 16px; }
.status-line { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.led { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.led.connected, .led.ok { background: var(--green); }
.led.error { background: var(--red); }
.led.pending, .led.partial { background: var(--gold); }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px; border-radius: var(--r-m); background: var(--sand); color: var(--sand-ink); font-weight: 650;
}

/* Bandeau de notification façon iOS */
.toast {
  position: fixed; z-index: 60; top: 14px; left: 50%; transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 18px; max-width: calc(100% - 32px);
  background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-lg); font-weight: 650; transition: transform 0.5s var(--spring);
}
.toast.show { transform: translate(-50%, 0); }
.toast .dot { background: var(--gold); }

/* ---------- Entrée orchestrée (premier chargement seulement) ---------- */
.reveal { animation: rise 0.7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
::view-transition-old(main-view), ::view-transition-new(main-view) { animation-duration: 0.28s; animation-timing-function: var(--ease-out); }
main { view-transition-name: main-view; }

/* ---------- Connexion & pages de message ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--sand), var(--bg)); }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: var(--r-l); padding: 32px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand { justify-content: center; padding: 0 0 14px; }
.auth-card h1 { margin: 0; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.auth-card .lede { text-align: center; color: var(--ink-2); margin: 6px 0 24px; }
.auth-card p.eyebrow { margin: 0 0 6px; font-weight: 700; color: var(--gold-text); text-align: center; }
.auth-card p { color: var(--ink-2); }

/* ---------- Mobile ---------- */
@media (max-width: 1000px) {
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line);
  }
  .sidebar .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 10.5px; font-weight: 650; border-radius: 10px; min-width: 60px; position: relative; }
  .nav a[aria-current='page'] { background: none; color: var(--gold-text); }
  .nav a[aria-current='page'] svg { color: var(--gold); }
  .nav .badge { position: absolute; top: 0; right: 10px; margin: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .mobile-top { display: flex !important; }
  main { padding-top: 8px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 18px; }
  .ring { width: 150px; height: 150px; }
  .hero-copy { width: 100%; }
  .flow { grid-template-columns: 1fr; text-align: left; width: 100%; }
  .flow a { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .flow a .s { grid-column: 1 / -1; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .sheet .grabber { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; }
  .sheet-head { padding-top: 10px; }
  .hide-sm { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .table td, .table th { padding-left: 12px; padding-right: 12px; }
  .toast { top: auto; bottom: 90px; transform: translate(-50%, 160%); }
  .toast.show { transform: translate(-50%, 0); }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; padding: 12px 16px 0; }
.mobile-top img { height: 26px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* Logo officiel (déposé dans /brand par le script d'installation) */
.brand img.logo { height: 30px; }
@media (prefers-color-scheme: dark) {
  .brand img.logo, .mobile-top img.logo { filter: invert(1) hue-rotate(180deg); }
}
.row .main > span:not(.eyebrow) { display: block; }
.muted { color: var(--ink-3); }
.flow a > div { display: block; }

/* ---------- Saisie rapide ---------- */
.capture-btn { margin: 0 6px 14px; min-height: 44px; }
.capture-btn svg, .fab svg { stroke-width: 2.4; }
.fab {
  display: none; position: fixed; z-index: 31; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--gold) 45%, transparent);
  transition: transform 0.2s var(--spring);
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 26px; height: 26px; margin: auto; }
.capture-date { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--gold-text); }
.capture-date::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.capture-field input { font-size: 18px; font-weight: 650; min-height: 52px; }
.dictate { position: relative; }
.dictate textarea { min-height: 150px; font-size: 16px; padding-right: 70px; line-height: 1.5; }
.mic {
  position: absolute; right: 12px; bottom: 12px; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); display: grid; place-items: center; transition: transform 0.2s var(--spring), background 0.2s;
}
.mic:active { transform: scale(0.92); }
.mic svg { width: 24px; height: 24px; }
.mic.live { background: var(--gold); color: #fff; }
.mic.live::before, .mic.live::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--gold); animation: ripple 1.6s var(--ease-out) infinite;
}
.mic.live::after { animation-delay: 0.8s; }
@keyframes ripple { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.9); opacity: 0; } }
.interim { color: var(--ink-3); font-size: 14px; min-height: 20px; margin: 0; font-style: italic; }
.detected { display: flex; flex-wrap: wrap; gap: 8px; }
.detected .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sand); border-color: transparent; color: var(--sand-ink); animation: pop 0.35s var(--spring) both; }
.detected .chip span { opacity: 0.6; font-weight: 800; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.hint-line { font-size: 13px; color: var(--ink-3); margin: 0; }
.sheet-foot { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--chrome); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.sheet-foot .btn { width: 100%; min-height: 50px; font-size: 16px; }

/* ---------- Médias d'une demande ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 12px; }
.media-grid a, .media-grid .tile-audio {
  position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  animation: pop 0.35s var(--spring) both;
}
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid .badge-kind { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: #fff; }
.media-grid .sync-state { position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px #fff; }
.media-grid .sync-state.pending { background: var(--gold); }
.media-grid .sync-state.error, .media-grid .sync-state.skipped { background: var(--red); }
.tile-audio { display: grid !important; place-items: center; padding: 8px; text-align: center; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.tile-audio audio { width: 100%; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 6px 0 0; }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.2s; }
.rec { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--red); }
.rec::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
input.file-input { display: none; }

@media (max-width: 760px) {
  .fab { display: grid; }
}

/* ================= Responsive : 3 formats =================
   ≥ 1101 px : barre latérale complète
   761–1100 px (tablette, petit portable) : rail d'icônes compact
   ≤ 760 px (téléphone) : barre d'onglets en bas + bouton doré
   ========================================================== */
.shell > div { min-width: 0; }
main { min-width: 0; }

/* Listes compactes (devis, chantiers) utilisées à la place des tableaux sur écran étroit */
.row .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.row .meta b { color: var(--ink); font-weight: 650; }

@media (min-width: 761px) and (max-width: 1100px) {
  .shell { grid-template-columns: 92px minmax(0, 1fr); }
  .sidebar { padding: 16px 8px; align-items: center; }
  .sidebar .brand { padding: 4px 0 14px; }
  .sidebar .brand .wordmark { font-size: 0; }
  .sidebar .brand .wordmark b { font-size: 0; }
  .sidebar .brand .wordmark::before { content: 'R'; font-size: 26px; font-weight: 800; color: var(--ink); }
  .sidebar .brand .wordmark::after { content: '.'; font-size: 26px; font-weight: 800; color: var(--gold); }
  .sidebar .brand small, .sidebar .brand img.logo { display: none; }
  .capture-btn { width: 56px; height: 56px; min-height: 56px; padding: 0; margin: 0 0 14px; border-radius: 18px; font-size: 0; gap: 0; }
  .capture-btn svg { width: 24px; height: 24px; }
  .nav { width: 100%; }
  .nav a { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; text-align: center; position: relative; }
  .nav a[aria-current='page'] { background: var(--ink); }
  .nav .badge { position: absolute; top: 2px; right: 10px; margin: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .sidebar-foot { padding: 6px 0; }
  .sidebar-foot #sync-stamp { display: none; }
  .sidebar-foot .sync-btn { width: 44px; height: 44px; padding: 0; font-size: 0; gap: 0; border-radius: 50%; }
  main { padding: 24px 24px 80px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero-copy { width: 100%; }
}

@media (max-width: 760px) {
  .capture-btn { display: none; }
  .nav a { min-width: 0; flex: 1; }
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: none; padding: 7px 12px; }
  .large-title h1 { font-size: 30px; }
  .banner { padding: 10px 14px; font-size: 14px; }
  .section-title { margin-top: 24px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .row { padding: 12px 14px; gap: 12px; }
  .row .trail .amount { font-size: 14px; }
  .sheet-body { padding: 12px 12px 32px; }
  .card { padding: 14px; }
  .facts dd { text-align: right; word-break: break-word; }
}

/* ================= Mobile : menu déroulant vertical (≤ 760 px) =================
   Barre du haut fixe (menu ☰, logo, page en cours, synchro). Le menu se déroule
   de haut en bas sous la barre, liste pleine largeur avec badges. */
.menu-btn, .menu-scrim, .page-label { display: none; }
@media (max-width: 760px) {
  .mobile-top {
    position: sticky; top: 0; z-index: 40; gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid transparent; transition: border-color 0.2s;
  }
  body.menu-open .mobile-top { border-bottom-color: var(--line); }
  .wordmark-mobile { text-decoration: none; color: inherit; margin-right: auto; display: flex; align-items: center; }
  .wordmark-mobile .brand { padding: 0; }
  .page-label { display: block; font-size: 14px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
  .menu-btn {
    display: grid; place-content: center; gap: 5px; width: 42px; height: 42px; border: 0; border-radius: 12px;
    background: var(--surface); box-shadow: var(--shadow); cursor: pointer; position: relative; padding: 0;
  }
  .menu-btn span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.35s var(--spring), opacity 0.2s; }
  body.menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  body.menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .menu-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--surface); }

  .sidebar {
    position: fixed; z-index: 35; top: var(--top-h, 62px); bottom: auto; left: 0; right: 0; height: auto;
    max-height: calc(100dvh - var(--top-h, 62px)); overflow-y: auto; overscroll-behavior: contain;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 12px 14px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0 0 22px 22px;
    background: var(--bg); box-shadow: var(--shadow-lg);
    clip-path: inset(0 0 100% 0); visibility: hidden;
    transition: clip-path 0.42s var(--spring), visibility 0s linear 0.42s;
  }
  body.menu-open .sidebar { clip-path: inset(0 0 -40px 0); visibility: visible; transition: clip-path 0.42s var(--spring), visibility 0s; }
  .sidebar .brand { display: none; }
  .nav { flex-direction: column; width: 100%; gap: 2px; }
  .nav a {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 14px; min-width: 0; min-height: 52px;
    padding: 12px 14px; font-size: 17px; font-weight: 650; border-radius: 14px; color: var(--ink);
    opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.4s var(--spring), background 0.2s;
  }
  .nav a svg { color: var(--ink-2); }
  body.menu-open .nav a { opacity: 1; transform: none; }
  body.menu-open .nav a:nth-child(2) { transition-delay: 0.03s; }
  body.menu-open .nav a:nth-child(3) { transition-delay: 0.06s; }
  body.menu-open .nav a:nth-child(4) { transition-delay: 0.09s; }
  body.menu-open .nav a:nth-child(5) { transition-delay: 0.12s; }
  .nav a[aria-current='page'] { background: var(--ink); color: var(--bg); }
  .nav a[aria-current='page'] svg { color: var(--gold-l); }
  .nav .badge { position: static; margin-left: auto; min-width: 24px; height: 24px; font-size: 13px; padding: 0 8px; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 12px 14px 0; border-top: 1px solid var(--line); }
  .sidebar-foot #sync-stamp { display: block; }

  .menu-scrim {
    display: block; position: fixed; inset: 0; z-index: 34; background: rgba(0, 0, 0, 0.28);
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
  }
  body.menu-open .menu-scrim { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  main { padding-bottom: 110px; }
  .fab { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .sidebar, .nav a, .menu-btn span { transition: none !important; }
}
