:root {
  color-scheme: light;
  --bg: #fcfcfb; --card: #ffffff; --ink: #0b0b0b; --ink2: #52514e; --muted: #6a6964; --line: #dcdbd5; --soft: #f1f0ec;
  --accent: #1c5cab; --accent-d: #0d366b; --accent-l: #e7f0fb; --warn: #9b1c1c;
  --b-ndd: #e4e3dd; --b-0: #9ec5f4; --b-20: #3987e5; --b-40: #1c5cab; --b-60: #0d366b; --plug: #111111;
  --g-dn: #6da7ec; --g-0: #e4e3dd; --g-1: #f2a39f; --g-2: #e34948; --g-3: #9b1c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 14px; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 18px 0 6px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.top { background: var(--accent-d); color: #fff; }
.brandrow { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 4px; gap: 8px; }
.brand { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-size: 1rem; } .brand span { font-size: .8rem; color: #b7d3f6; }
.pill { background: #fff3c4; color: #5a4300; border-radius: 99px; padding: 3px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
nav { display: flex; gap: 2px; }
nav a { color: #cde2fb; text-decoration: none; padding: 10px 14px; font-weight: 600; border-bottom: 3px solid transparent; min-height: 44px; }
nav a.on { color: #fff; border-color: #fff; }
footer { padding: 24px 14px 40px; color: var(--muted); font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
.btn, button { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.ghost, button.ghost { background: #fff; color: var(--accent); }
.btn.small, button.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.danger, button.danger { background: #fff; color: var(--warn); border-color: var(--warn); }
button:disabled { opacity: .45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin: 10px 0; }
.kpi { background: var(--soft); border-radius: 10px; padding: 10px 10px 8px; }
.kpi .l { font-size: .78rem; color: var(--ink2); }
.kpi .v { font-size: 1.65rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .74rem; color: var(--muted); }
.kpi.hot .v { color: var(--accent-d); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.chip { background: var(--soft); border-radius: 99px; padding: 3px 10px; font-size: .82rem; color: var(--ink2); }
.seg { display: inline-flex; border: 1px solid var(--accent); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; background: #fff; color: var(--accent); min-height: 44px; padding: 6px 12px; flex-direction: column; gap: 0; line-height: 1.2; }
.seg button + button { border-left: 1px solid var(--accent); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button small { font-weight: 400; font-size: .72rem; opacity: .9; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; color: var(--ink2); font-weight: 600; }
input, select { font: inherit; min-height: 44px; padding: 6px 10px; border: 1px solid #b9b8b1; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.codes label { border: 1px solid #b9b8b1; border-radius: 8px; padding: 6px 10px; font-size: .85rem; font-weight: 600; cursor: pointer; background: #fff; }
.codes input { display: none; }
.codes label.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--soft); font-size: .78rem; color: var(--ink2); position: sticky; top: 0; }
td.n, th.n { text-align: right; }
tr.link { cursor: pointer; } tr.link:hover td { background: var(--accent-l); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--soft); font-weight: 700; font-size: .8rem; }
.tag.s-plugged { background: var(--plug); color: #fff; } .tag.s-indications { background: var(--b-40); color: #fff; }
.tag.s-ndd { background: var(--b-ndd); } .tag.s-not_tested { background: #fff; border: 1px dashed #6a6964; }
/* exchanger cards */
.excard h2 a { color: var(--ink); text-decoration: none; }
.excard h2 a:hover { text-decoration: underline; }
/* map */
.mapgrid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.mapbox { position: relative; width: 100%; aspect-ratio: 1; max-width: min(100%, 80vh); margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; scroll-margin-top: 8px; }
.mapbox svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.mapbar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.zoom { display: flex; flex-direction: row; gap: 6px; flex: none; }
.zoom button { width: 36px; height: 36px; min-height: 0; padding: 0; font-size: 1.1rem; line-height: 1; background: #fff; color: var(--accent-d); border: 1px solid #8f8e88; box-shadow: none; }
.hint { font-size: .78rem; color: var(--ink2); }
.tip { position: fixed; z-index: 30; background: var(--ink); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: .8rem; pointer-events: none; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #5d5c57; display: inline-block; }
.legend i.hollow { background: #fff; border-style: dashed; }
.legend i.plug { background: var(--plug); position: relative; }
.legend i.plug::after { content: "\00d7"; color: #fff; position: absolute; inset: -4px 0 0 0; text-align: center; font-size: 17px; line-height: 20px; font-style: normal; }
/* sheet */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); gap: 8px; }
.sheet .sh h2 { margin: 0; font-size: 1.1rem; }
.sheet .sb { padding: 12px 14px; overflow-y: auto; }
.sheet .close { min-height: 40px; width: 40px; padding: 0; font-size: 1.4rem; background: #fff; color: var(--ink); border-color: var(--line); }
.ind { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.ind .top1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ind .big { font-size: 1.25rem; font-weight: 700; }
.ind dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; margin: 6px 0 0; font-size: .86rem; }
.ind dt { color: var(--muted); } .ind dd { margin: 0; }
details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.empty { color: var(--muted); padding: 8px 0; }
@media (max-width: 899px) {
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; border-radius: 16px 16px 0 0; max-height: 46vh; display: flex; flex-direction: column; box-shadow: 0 -4px 18px rgba(0,0,0,.25); }
  .sheet.idle { display: none; }
  body.sheet-open { padding-bottom: 46vh; }
}
@media (min-width: 900px) {
  .mapgrid { grid-template-columns: minmax(0, 1fr) 390px; align-items: start; }
  .sheet { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
  .sheet .close { display: none; }
  h1 { font-size: 1.8rem; }
}
/* upload */
.step { border-left: 4px solid var(--line); }
.step.active { border-left-color: var(--accent); }
.step.done { border-left-color: #1c8a4a; }
.step h2 { display: flex; gap: 8px; align-items: center; }
.step h2 .num { background: var(--accent); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.drop { border: 2px dashed #8f8e88; border-radius: 12px; padding: 22px 12px; text-align: center; background: var(--soft); }
.drop.over { border-color: var(--accent); background: var(--accent-l); }
.map-row { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; align-items: center; }
.map-row label { font-weight: 600; font-size: .9rem; }
.map-row label em { color: var(--warn); font-style: normal; }
.warn { color: var(--warn); } .ok { color: #1c6b3a; }
.callout { background: var(--accent-l); border-radius: 10px; padding: 10px 12px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw; }
@media (max-width: 420px) { .map-row { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }
