/* Thème « secours » : sombre par défaut, dégradé cyan → rouge */
:root {
  --bg: #0b0f14; --surface: rgba(17,23,35,.85); --surface-solid: #111723; --surface-2: #18202b; --border: #1c2430;
  --text: #e7edf3; --muted: #9fb2c3; --accent: #61dafb; --accent-2: #8fe6ff; --accent-soft: rgba(97,218,251,.12);
  --red: #ff3b30; --grad: linear-gradient(90deg, #61dafb, #ff3b30); --grad-bar: linear-gradient(90deg, #61dafb, #ff3b30, #61dafb);
  --ok: #34d399; --ok-soft: rgba(52,211,153,.12); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12); --bad: #ff5a52; --bad-soft: rgba(255,59,48,.12);
  --shadow: 0 20px 60px rgba(0,0,0,.35); --radius: 18px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6fa; --surface: #ffffff; --surface-solid: #ffffff; --surface-2: #eaf0f6; --border: #d8e1ea;
  --text: #0f1722; --muted: #536476; --accent: #0a84b8; --accent-2: #066b96; --accent-soft: rgba(10,132,184,.1);
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #d62d22; --bad-soft: #fee2e2;
  --shadow: 0 10px 30px rgba(15,23,34,.08); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.8rem; margin: .2em 0 .4em; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .6em; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 20px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- en-tête ---------- */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.brand b { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); padding: 7px 11px; border-radius: 9px; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.search { margin-left: auto; }
.search input { width: 230px; }
.user { display: flex; align-items: center; gap: 8px; }
.burger { display: none; }
.pill-count { background: var(--bad); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 6px; margin-left: 4px; font-weight: 700; }

/* ---------- formulaires & boutons ---------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.filters > * { width: auto; min-width: 150px; }
.filters input[type=search] { flex: 1; min-width: 200px; }

/* ---------- blocs ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 10px 0 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 14px; color: var(--muted); font-weight: 600; border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; font: inherit; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .on { color: var(--accent); border-bottom-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; border: 1px dashed var(--border); border-radius: var(--radius); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 500; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
table.list th, table.list td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* ---------- badges ---------- */
.lb { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 28px; padding: 0 7px; border-radius: 6px; font-weight: 800; font-size: .88rem; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.lb.metro { border-radius: 50%; min-width: 30px; width: 30px; height: 30px; padding: 0; }
.lb.tram { border-top: 3px solid currentColor; border-bottom: 3px solid currentColor; border-radius: 2px; }
.lb.rail { border-radius: 8px; }
.lb.big { height: 54px; min-width: 64px; font-size: 1.6rem; padding: 0 12px; }
.lb.metro.big { width: 56px; min-width: 56px; }
.lines-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.lines-grid a:hover { text-decoration: none; transform: translateY(-1px); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag.service, .tag.accepte, .tag.valide { background: var(--ok-soft); color: var(--ok); }
.tag.commande, .tag.attente { background: var(--warn-soft); color: var(--warn); }
.tag.reforme, .tag.refuse { background: var(--bad-soft); color: var(--bad); }
.tag.preserve, .tag.reserve, .tag.transfere { background: var(--accent-soft); color: var(--accent); }
.tag.role-admin { background: var(--bad-soft); color: var(--bad); }
.tag.role-modo { background: var(--accent-soft); color: var(--accent); }

/* ---------- véhicules ---------- */
.veh { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.veh:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.veh .thumb { aspect-ratio: 16/10; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 2rem; overflow: hidden; }
.veh .thumb img { width: 100%; height: 100%; object-fit: cover; }
.veh .body { padding: 10px 12px 12px; }
.veh .num { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.veh .sub { color: var(--muted); font-size: .85rem; }

/* ---------- photos ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ph { position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4/3; }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.ph:hover img { transform: scale(1.04); }
.ph .cap { position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: .82rem; display: flex; justify-content: space-between; gap: 6px; }
.ph .cap b { font-size: .95rem; }
.ph:hover { text-decoration: none; }
.hero { position: relative; border-radius: 20px; overflow: hidden; min-height: 320px; display: flex; align-items: flex-end; background: linear-gradient(135deg, #1e3a8a, #2563eb 55%, #0ea5e9); color: #fff; margin-bottom: 22px; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(0,0,0,.7)); }
.hero .in { position: relative; z-index: 1; padding: 28px; width: 100%; }
.hero h1 { font-size: 2.3rem; margin: 0 0 6px; }
.hero p { margin: 0 0 14px; opacity: .92; max-width: 640px; }
.hero .credit { font-size: .8rem; opacity: .85; }
.viewer { background: #000; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; }
.viewer img { max-height: 78vh; width: auto; }
.likebtn.on { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border: 0; }

/* ---------- ligne ---------- */
.line-head { border-radius: 20px; padding: 24px; display: flex; gap: 20px; align-items: center; margin-bottom: 20px; }
.line-head h1 { margin: 0; }
.line-head .meta { opacity: .9; }
#map { height: 380px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; }
.stops { columns: 2; column-gap: 20px; font-size: .9rem; margin: 10px 0 0; padding-left: 18px; }
.stops li { break-inside: avoid; margin-bottom: 3px; }
.net-block { margin-bottom: 22px; }
.net-block h3 { display: flex; align-items: center; gap: 8px; }

/* ---------- propositions / panel ---------- */
.prop { display: grid; grid-template-columns: 200px 1fr; gap: 16px; margin-bottom: 14px; }
.prop .pimg { border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4/3; }
.prop .pimg img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.prop.noimg { grid-template-columns: 1fr; }
.prop pre { white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: .85rem; margin: 6px 0; }
.panel-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.side a { padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.side a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side a.on { background: var(--accent-soft); color: var(--accent); }
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; margin-top: 4px; }
.lookup-list button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.lookup-list button:hover { background: var(--surface-2); }
.chosen { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--surface-2); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: .85rem; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); }
.drop img { max-height: 300px; margin: 0 auto 10px; border-radius: 10px; }
.notif { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; }
.notif.unread { background: var(--accent-soft); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 22px 0; align-items: center; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; z-index: 100; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); color: #fff; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.barrow { display: grid; grid-template-columns: 160px 1fr 50px; gap: 10px; align-items: center; margin: 6px 0; font-size: .9rem; }
.foot { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 0; font-size: .85rem; }
.foot-in { display: flex; flex-direction: column; gap: 6px; }

/* ---------- mobile ---------- */
@media (max-width: 1050px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px; }
  .nav.open { display: flex; }
  .burger { display: block; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: 1.1rem; }
  .split, .panel-layout { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; overflow-x: auto; }
}
@media (max-width: 700px) {
  .search { display: none; }
  .top-in { gap: 10px; }
  .user .hide-m { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .prop { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .line-head { flex-direction: column; align-items: flex-start; }
  .stops { columns: 1; }
  .kv { grid-template-columns: 110px 1fr; }
  .barrow { grid-template-columns: 100px 1fr 40px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
@media (max-width: 480px) { .brand span { display: none; } .user { gap: 5px; } }

/* ---------- habillage « secours » ---------- */
body { background: radial-gradient(1200px 500px at 10% -10%, rgba(97,218,251,.08), transparent 60%), radial-gradient(1000px 500px at 100% 0%, rgba(255,59,48,.07), transparent 60%), var(--bg); background-attachment: fixed; }
h1, h2 { font-weight: 800; }
h2 { position: relative; padding-bottom: 10px; }
h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 70px; height: 3px; border-radius: 3px; background: var(--grad-bar); }
.top { background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: 1px solid var(--border); }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a { color: var(--text); border-radius: 10px; position: relative; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--surface-2); color: var(--text); }
.nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--grad); }
.card, .stat, .veh, table.list, .empty, .lookup-list, .line-head { border-radius: var(--radius); }
.card, .stat, .veh { background: var(--surface); box-shadow: var(--shadow); }
.stat b { font-size: 2rem; font-weight: 900; }
.stat:hover, .veh:hover { border-color: rgba(97,218,251,.45); }
.btn { border-radius: 12px; background: var(--surface-solid); }
.btn.primary { background: var(--grad); border: 0; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); box-shadow: 0 6px 20px rgba(255,59,48,.18); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.1); }
.btn.ok { background: #16a34a; border-color: #16a34a; }
a.btn.sm, button.btn.sm { border-radius: 99px; }
input, select, textarea { background: var(--surface-solid); border-color: var(--border); border-radius: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(97,218,251,.4); }
.tabs .on { color: var(--text); border-image: var(--grad) 1; }
.side a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--red); }
.pill-count { background: var(--red); }
.hero { min-height: 420px; border: 1px solid var(--border); box-shadow: var(--shadow); background: radial-gradient(800px 400px at 0% 100%, rgba(97,218,251,.35), transparent 60%), radial-gradient(800px 400px at 100% 0%, rgba(255,59,48,.35), transparent 60%), #0e1520; }
.hero::after { background: linear-gradient(180deg, rgba(11,15,20,.25), rgba(11,15,20,.88)); }
.hero .in { text-align: center; display: flex; flex-direction: column; align-items: center; padding: 40px 28px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 900; letter-spacing: -.03em; text-shadow: 0 4px 30px rgba(0,0,0,.5); }
.hero p { font-size: 1.08rem; }
.hero .row { justify-content: center; }
.grad-txt { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.alert { border: 1px solid rgba(255,59,48,.55); background: rgba(255,59,48,.08); box-shadow: 0 0 30px rgba(255,59,48,.15); border-radius: 14px; padding: 14px 18px; margin-bottom: 12px; }
.alert b.t { color: var(--bad); display: block; margin-bottom: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border: 1px solid rgba(52,211,153,.4); color: var(--ok); background: rgba(11,15,20,.6); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tag { border-radius: 99px; }
.ph { border-radius: 14px; border: 1px solid var(--border); }
.foot { background: transparent; }
.toast { background: var(--surface-solid); color: var(--text); border: 1px solid var(--border); }
.bar > i { background: var(--grad); }
.grad-txt { white-space: nowrap; }
