/* Le bureau : bureau de nuit (sombre) et version claire. Polices hébergées sur le serveur (fonts.css), sinon celles du système. */
:root {
  --bg: #141C27; --surface: #1B2532; --surface-2: #10161F; --line: #2A3747; --grid: #223041;
  --fg: #E6EDF3; --muted: #A9B6C4; --faint: #8E9AA8; --brass: #E8C27A; --brass-dark: #2B2117;
  --mint: #5FD3BC; --mint-ink: #0D2622; --amber: #F2B35B; --red: #E8785A; --violet: #A89BFF;
  --bubble-a: #DDF3EE; --bubble-a-ink: #13302A; --bubble-t: #F8E7C8; --bubble-t-ink: #3A2810;
  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --text: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body.light {
  --bg: #F3F5F8; --surface: #FFFFFF; --surface-2: #FFFFFF; --line: #D9DFE6; --grid: #E3E8EE;
  --fg: #17202B; --muted: #4F5C6B; --faint: #5E6B7A; --brass: #7A5418; --mint: #0E7C6B; --amber: #9A5B0C;
  --red: #B4472E; --violet: #6B5BD6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--text); font-size: 16px; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
main { min-height: 100vh; padding-bottom: calc(72px + var(--safe-bottom)); max-width: 560px; margin: 0 auto; }
.loading { padding: 40px 20px; color: var(--muted); }
h1, h2 { font-family: var(--display); font-weight: 700; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; color: var(--brass); }
p { margin: 0; line-height: 1.5; }
.pad { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.btn { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 0; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--mint); color: var(--mint-ink); }
body.light .btn.primary { color: #FFFFFF; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.warn { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.grow { flex: 1 1 0; }
.btn:disabled { opacity: .5; cursor: default; }
label { font-weight: 700; font-size: 15px; display: block; margin-bottom: 6px; }
input[type=text], input[type=password] { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font-size: 16px; }
.error { color: var(--red); font-weight: 700; }
.ok { color: var(--mint); font-weight: 700; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .06em; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--brass); text-align: center; user-select: all; }

/* Barre du bas */
#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface-2); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); z-index: 10; }
#nav a { flex: 1 1 0; min-height: 58px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--faint); border-top: 3px solid transparent; }
#nav a[aria-current=page] { color: var(--brass); border-top-color: var(--brass); }

/* Le bureau illustré */
.office { position: relative; background: #1E2A3A; padding: 16px 14px 0; overflow: hidden; color: #E6EDF3; }
.office .floor { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background-color: #4A3426; background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 2px, transparent 2px 22px); }
.office .window { position: relative; height: 34px; margin: 10px 0 4px; border: 4px solid #2A3747; border-radius: 5px; overflow: hidden; }
.office .window svg { width: 100%; height: 100%; display: block; }
.desks { position: relative; display: flex; gap: 4px; }
.desk { position: relative; flex: 1 1 0; min-width: 0; height: 178px; padding-top: 22px; display: block; }
.desk svg { width: 100%; height: 100%; display: block; }
.desk.off { filter: saturate(.55) brightness(.85); }
.plate { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); padding: 3px 8px; background: #2B2117; border: 1px solid #6B5435; border-radius: 5px; font-family: var(--display); font-weight: 700; font-size: 12px; color: #E8C27A; white-space: nowrap; }
.closeup { position: relative; height: 196px; background: #1E2A3A; overflow: hidden; color: #E6EDF3; }
.closeup svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.closeup .back { position: absolute; left: 12px; top: 12px; min-height: 40px; padding: 0 12px; display: flex; align-items: center; border-radius: 10px; background: rgba(16,22,31,.85); font-weight: 700; font-size: 14px; }
.closeup .plate-big { position: absolute; right: 12px; top: 12px; padding: 6px 12px; background: #2B2117; border: 1px solid #6B5435; border-radius: 6px; text-align: right; }
.closeup .plate-big b { display: block; font-family: var(--display); font-size: 18px; color: #E8C27A; }
.closeup .plate-big span { font-size: 11px; color: #C8B48C; }
.bubble { padding: 12px 14px; border-radius: 14px 14px 14px 3px; font-size: 15px; line-height: 1.45; display: block; }
.bubble.a { background: var(--bubble-a); color: var(--bubble-a-ink); }
.bubble.t { background: var(--bubble-t); color: var(--bubble-t-ink); }
.closeup .bubble { position: absolute; left: 12px; right: 12px; bottom: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.35); font-size: 14px; }
.caret { display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -.15em; background: currentColor; animation: caret 1s steps(1) infinite; }
@keyframes caret { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }

/* Marchés, onglets, alertes */
.markets { display: flex; gap: 10px; }
.market { flex: 1 1 0; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.market b { font-family: var(--display); font-size: 16px; display: block; }
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.tabs button { flex: 1 1 0; min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tabs button[aria-pressed=true] { background: var(--brass); color: var(--brass-dark); }
body.light .tabs button[aria-pressed=true] { color: #FFFFFF; }
.alert { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--grid); }
.alert:first-of-type { border-top: 0; }
.alert time { font-size: 13px; color: var(--faint); }
.alert .t { font-weight: 700; }
.alert .acts { display: flex; gap: 8px; align-items: center; }
.alert .acts button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-weight: 700; cursor: pointer; }
.alert .acts button[aria-pressed=true] { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }

/* Analyse */
.headline b { font-family: var(--display); font-size: 30px; display: block; }
.headline span { color: var(--amber); font-size: 17px; }
.chart { --chart-bg: #0C1219; border-radius: 14px; background: #0C1219; border: 1px solid var(--grid); padding: 6px; }
body.light .chart { --chart-bg: #FFFFFF; background: #FFFFFF; }
.chart svg { display: block; width: 100%; height: auto; }
.crumb { font-size: 14px; color: var(--violet); }
.leg { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--grid); font-size: 15px; }
.leg b { display: inline-block; min-width: 38px; }
.card > .leg:first-child, .card > h2 + .leg { border-top: 0; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.chip.done { background: rgba(95,211,188,.16); color: var(--mint); }
.chip.now { background: rgba(242,179,91,.18); color: var(--amber); }
.chip.next { background: rgba(142,154,168,.16); color: var(--faint); }
.scen { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); font-size: 15px; line-height: 1.45; }
.scen b { color: var(--brass); }

/* Réglages */
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.switch-row .lbl { font-weight: 700; font-size: 16px; }
.switch { flex: none; width: 56px; height: 34px; border-radius: 17px; border: 0; padding: 3px; cursor: pointer; display: flex; background: #3A4656; }
body.light .switch[aria-checked=false] { background: #B8C1CC; }
.switch span { width: 28px; height: 28px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch[aria-checked=true] { background: var(--mint); }
.switch[aria-checked=true] span { transform: translateX(22px); }
.summary { padding: 12px 14px; border-radius: 14px; background: rgba(95,211,188,.14); line-height: 1.45; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: #E8C27A; color: #2B2117; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 20px; flex: none; }
.steps { margin: 0; padding-left: 20px; line-height: 1.6; }

/* Hors connexion et messages courts (v37) */
#offline { position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: #3A2E12; color: #F8E7C8; font-size: 14px; line-height: 1.4; max-width: 560px; margin: 0 auto; }
#offline[hidden], #toast[hidden] { display: none; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + var(--safe-bottom)); z-index: 30; max-width: 528px; margin: 0 auto; padding: 12px 14px; border-radius: 12px; background: var(--fg); color: var(--bg); font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
details.card > summary { cursor: pointer; list-style: none; min-height: 32px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: " ▾"; color: var(--muted); }
details.card[open] > summary::after { content: " ▴"; }
.pseudos { margin: 0; padding-left: 20px; line-height: 1.8; }
