/* Adlight : couleurs du logo (indigo #175974) et du site (sarcelle #206B68), DM Sans comme adlight.fr.
   Un seul élément marquant : la ligne de transport qui raconte chaque consultation. Le reste reste sobre. */
[hidden] { display: none !important; }
@font-face { font-family: "DM Sans"; src: url("fonts/dmsans.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
:root {
  --indigo: #175974; --indigo-deep: #0f4257; --teal: #206b68; --mint: #e4f5f3; --amber: #a9560f; --amber-soft: #fbefe2; --red: #a3302a;
  --ink: #12303d; --muted: #55707c; --line: #d5e2e6; --hollow: #b8cad1; --bg: #ffffff; --sunk: #f3f8f9; --raised: #ffffff; --on-accent: #ffffff;
  /* Alias attendus par la bulle de retour et l'assistant (widgets.css, repris du socle) */
  --surface: var(--bg); --surface-raised: var(--raised); --surface-sunk: var(--sunk); --ink-muted: var(--muted); --forest: var(--indigo); --forest-strong: var(--indigo-deep);
  --cream: #ffffff; --sun: var(--amber); --sky: var(--mint); --lagoon-strong: var(--teal); --signal-ok: var(--teal); --signal-warn: var(--amber);
  --font-sans: "DM Sans", "Gill Sans", "Trebuchet MS", sans-serif; --radius-sm: 6px; --radius-md: 12px; --radius-pill: 20px;
}
@media (prefers-color-scheme: dark) {
  :root { --indigo: #6fb6d3; --indigo-deep: #93cbe1; --teal: #6cc4bd; --mint: #17373c; --amber: #eda35e; --amber-soft: #3b2a18; --red: #ec8a83;
    --ink: #e5f0f3; --muted: #9db4bd; --line: #2d4752; --hollow: #456270; --bg: #10232b; --sunk: #172e38; --raised: #172e38; --on-accent: #0c1d24; --cream: #0c1d24; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.5 var(--font-sans); font-optical-sizing: auto; }
a { color: var(--indigo); text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Connexion */
#gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--sunk); }
#gate form { width: min(400px, 100%); display: grid; gap: 14px; }
.gate-logo { width: 150px; }
#gate h1 { font-size: 24px; margin: 8px 0; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
#gate input { width: 100%; }

/* Boutons */
.btn { border: 1px solid var(--indigo); background: var(--indigo); color: var(--on-accent); padding: 7px 16px; border-radius: var(--radius-sm); cursor: pointer; font: 600 14px/20px var(--font-sans); text-decoration: none; display: inline-block; }
.btn:hover { background: var(--indigo-deep); }
.btn.quiet { background: transparent; color: var(--indigo); border-color: var(--line); }
.btn.quiet:hover { border-color: var(--indigo); background: var(--sunk); }
.btn:disabled { opacity: .55; cursor: default; }

/* En-tête */
header { background: #175974; color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 10px max(16px, env(safe-area-inset-left)); }
.brand img { height: 30px; display: block; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button { background: none; border: 0; color: #d6e8ef; padding: 7px 11px; font: 500 14.5px/20px var(--font-sans); cursor: pointer; border-radius: var(--radius-sm); border-bottom: 2px solid transparent; }
nav button:hover { color: #fff; background: rgba(255,255,255,.08); }
nav button.on { color: #fff; border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom-color: #fff; font-weight: 600; }
nav button:focus-visible, .brand:focus-visible { outline-color: #fff; }

.tab { max-width: 1160px; margin: 0 auto; padding: 26px 16px 110px; }
.tab h1 { font-size: 30px; margin: 0 0 6px; max-width: 26em; }
.tab h2 { font-size: 18px; margin: 34px 0 6px; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 18px; }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 6px; }
.filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--bg); color: var(--ink); padding: 6px 12px; cursor: pointer; font: 500 14px/20px var(--font-sans); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--mint); color: var(--indigo-deep); font-weight: 600; }
.count { margin: 8px 0 0; font-size: 14px; color: var(--muted); }

/* La ligne : chaque consultation se lit comme une ligne de transport */
.line { --c: var(--indigo); display: grid; grid-template-columns: repeat(4, 1fr); position: relative; min-width: 300px; }
.line.exploitation { --c: var(--teal); }
.stop { position: relative; padding-top: 18px; font-size: 12.5px; line-height: 1.25; color: var(--muted); text-align: center; }
.stop::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 4px; background: var(--hollow); }
.stop:first-child::before { left: 50%; }
.stop:last-child::before { right: 50%; }
.stop.l.r::before { background: var(--c); }
.stop.l:not(.r)::before { background: linear-gradient(to right, var(--c) 50%, var(--hollow) 50%); }
.stop.r:not(.l)::before { background: linear-gradient(to right, var(--hollow) 50%, var(--c) 50%); }
.stop:first-child.r::before { background: var(--c); }
.stop:last-child.l::before { background: var(--c); }
.stop i { position: absolute; top: 0; left: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--hollow); }
.stop.done i { background: var(--c); border-color: var(--c); }
.stop.now i { background: var(--bg); border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 24%, transparent); }
.stop.urgent i { border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 28%, transparent); }
.stop b { display: block; font-weight: 500; color: var(--ink); }
.stop.urgent b { color: var(--amber); font-weight: 700; }
.stop.ghost b { color: var(--muted); font-weight: 400; }

/* Listes */
.rows { border-top: 1px solid var(--line); margin-top: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 8px 28px; padding: 13px 8px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; font: inherit; }
.row:hover { background: var(--sunk); }
.row.plain { grid-template-columns: minmax(0, 1fr) auto; cursor: default; }
.row.plain:hover { background: none; }
.row h3 { font-size: 15.5px; margin: 0 0 2px; font-weight: 600; line-height: 1.32; }
.row p { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink) !important; margin-top: 3px !important; }
.tag { font-size: 12.5px; font-weight: 600; color: var(--teal); }
.tag { display: inline-block; }
.tag::first-letter { text-transform: uppercase; }
.tag.conseil { color: var(--indigo); }
.tag.warn { color: var(--amber); }
.tag.comp { color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Accueil */
.hero { font-size: clamp(30px, 4.6vw, 44px) !important; font-weight: 600; letter-spacing: -.02em; max-width: 20em !important; }
.home { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 0 42px; }
.side h2:first-child, .home > div > h2:first-child { margin-top: 18px; }
.side .row { grid-template-columns: 1fr; padding: 10px 2px; }
.empty { padding: 22px 8px; color: var(--muted); border-bottom: 1px solid var(--line); }

/* Tableau de suivi */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 12px; overflow-x: auto; padding: 10px 0 14px; }
.col { background: var(--sunk); border-radius: var(--radius-md); padding: 10px; min-height: 180px; }
.col h3 { font-size: 14px; margin: 2px 2px 10px; display: flex; justify-content: space-between; }
.lead { display: block; width: 100%; text-align: left; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; cursor: pointer; color: inherit; font: inherit; }
.lead:hover { border-color: var(--indigo); }
.lead strong { font-size: 14px; display: block; line-height: 1.3; overflow-wrap: anywhere; font-weight: 600; }
.lead small { color: var(--muted); display: block; margin-top: 3px; overflow-wrap: anywhere; }
.lead small.due { color: var(--amber); font-weight: 600; }

/* Panneau de détail */
#drawer { position: fixed; inset: 0 0 0 auto; width: min(620px, 100vw); background: var(--bg); border-left: 1px solid var(--line); box-shadow: -14px 0 40px rgba(10,40,55,.14); z-index: 30; overflow-y: auto; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { #drawer { animation: none; } }
#drawer-body { padding: 18px 20px 120px; }
#drawer h2 { font-size: 21px; margin: 6px 0 4px; }
#drawer h3 { font-size: 15.5px; margin: 24px 0 6px; }
.close { float: right; border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 8px; }
#drawer .line { margin: 18px 0; }
.reco { padding: 10px 0; border-bottom: 1px solid var(--line); }
.reco button.linklike { background: none; border: 0; padding: 0; font: 600 15px var(--font-sans); color: var(--indigo); cursor: pointer; text-align: left; }
.reco ul { margin: 3px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.fields input, .fields select { width: 100%; }
.note { background: var(--mint); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; margin: 10px 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: var(--radius-sm); z-index: 80; font-size: 14px; max-width: calc(100vw - 32px); }
.error { color: var(--red); }

@media (max-width: 820px) {
  header { padding: 8px 12px; }
  nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  nav button { white-space: nowrap; flex: none; }
  .tab { padding-top: 18px; }
  .tab h1 { font-size: 25px; }
  .home { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row.plain { grid-template-columns: minmax(0, 1fr); }
  .line { min-width: 0; }
  .stop { font-size: 11.5px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .col { min-height: 0; }
  #drawer { width: 100vw; }
}
