/* Outil de relecture : panneau dense à gauche, plan plein écran, fiche à droite */
:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #17202a; --muted: #5d6b78; --line: #d8dee4;
  --accent: #0b5cad; --accent-ink: #fff; --ok: #1d7a46; --warn: #a35a00; --bad: #b3261e; --zone: #e07000;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 10px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.link { border: none; background: none; color: var(--accent); padding: 4px 6px; }
button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }
.note { color: var(--ok); min-height: 1.2em; overflow-wrap: anywhere; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: grid; gap: 8px; }
.login-card h1 { margin: 0; font-size: 22px; }

.app { display: grid; grid-template-columns: 380px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: baseline; }
.tools, .who { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chk { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.chk input { width: auto; }
#btn-zone.on { background: var(--zone); border-color: var(--zone); color: #fff; }

.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: none; border-radius: 0; border-bottom: 2px solid transparent; background: none; padding: 9px 4px; }
.tabs button.on { color: var(--accent); background: none; border-bottom-color: var(--accent); font-weight: 600; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--zone); color: #fff; font-size: 11px; }
.badge:empty { display: none; }
.tab { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.filters { padding: 10px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 6px; align-items: center; }
.count { padding: 6px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.list { overflow: auto; flex: 1; min-height: 0; }

.it { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #eef1f4; cursor: pointer; }
.it:hover, .it.sel { background: #eaf2fb; }
.it img { width: 26px; height: 26px; }
.it .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .m { font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); } .pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.warn { color: var(--warn); border-color: var(--warn); } .pill.zone { color: var(--zone); border-color: var(--zone); }

.rm { padding: 8px 10px; border-bottom: 1px solid #eef1f4; cursor: pointer; display: grid; gap: 3px; }
.rm:hover { background: #fff6ec; }
.rm .h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.rm .x { white-space: pre-wrap; overflow-wrap: anywhere; }
.rm .reply { border-left: 3px solid var(--accent); padding-left: 8px; color: var(--muted); white-space: pre-wrap; }

.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #fff; }
#map.zoning { cursor: crosshair; }
.hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--zone); color: #fff; padding: 6px 12px; border-radius: 6px; z-index: 800; }

.mk { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px solid var(--c, #0b5cad); display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.mk img { width: 18px; height: 18px; pointer-events: none; }
.mk.dec-ok { --c: var(--ok); } .mk.dec-bad { --c: var(--bad); } .mk.dec-warn { --c: var(--warn); }
.mk.sel { box-shadow: 0 0 0 4px #ffd400, 0 1px 3px rgba(0,0,0,.35); }
.mk .n { position: absolute; top: -7px; right: -9px; background: var(--zone); color: #fff; font: 600 10px/14px var(--sans); min-width: 14px; height: 14px; border-radius: 7px; text-align: center; padding: 0 3px; }
.mk.small { width: 16px; height: 16px; border-width: 1.5px; } .mk.small img { width: 12px; height: 12px; }

.detail { position: fixed; top: 52px; right: 12px; width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 64px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 900; padding: 14px; }
.detail .close { position: absolute; top: 6px; right: 6px; border: none; font-size: 20px; line-height: 1; }
.detail h2 { margin: 0 24px 4px 0; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.detail h2 img { width: 32px; height: 32px; }
.detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 3px 10px; font-size: 13px; }
.kv b { font-weight: 500; color: var(--muted); }
.kv span { overflow-wrap: anywhere; }
.card { display: grid; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.card h3 { margin: 0; font-size: 14px; }
.stack { display: grid; gap: 6px; }

dialog { border: 1px solid var(--line); border-radius: 10px; width: min(460px, calc(100vw - 32px)); padding: 16px; }
dialog h3 { margin: 0 0 10px; }
dialog #dlg-body { display: grid; gap: 8px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

table.syn { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.syn th, table.syn td { padding: 5px 10px; border-bottom: 1px solid #eef1f4; text-align: left; }
table.syn td.num, table.syn th.num { text-align: right; }
table.syn tr.fam td { background: #f1f5f9; font-weight: 600; }

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 45vh minmax(0, 1fr); }
  .panel { border-right: none; border-bottom: 1px solid var(--line); }
  .mapwrap { min-height: 300px; }
  .detail { top: auto; bottom: 8px; max-height: 60vh; }
}
