@font-face{font-family:"Archivo";font-weight:500;font-style:normal;font-display:swap;src:url(/fonts/archivo-500.woff2) format("woff2")}
@font-face{font-family:"Archivo";font-weight:700;font-style:normal;font-display:swap;src:url(/fonts/archivo-700.woff2) format("woff2")}
@font-face{font-family:"Archivo";font-weight:800;font-style:normal;font-display:swap;src:url(/fonts/archivo-800.woff2) format("woff2")}
@font-face{font-family:"Public Sans";font-weight:400;font-style:normal;font-display:swap;src:url(/fonts/public-sans-400.woff2) format("woff2")}
@font-face{font-family:"Public Sans";font-weight:600;font-style:normal;font-display:swap;src:url(/fonts/public-sans-600.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Mono";font-weight:400;font-style:normal;font-display:swap;src:url(/fonts/plex-mono-400.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Mono";font-weight:500;font-style:normal;font-display:swap;src:url(/fonts/plex-mono-500.woff2) format("woff2")}
/* Layout : écran partagé — plan à gauche, tableau type tableur à droite, en-tête d'une seule ligne. */
:root{
  --bg:#EEF1F4; --sheet:#FFFFFF; --ink:#142030; --muted:#5A6676; --rule:#D5DCE3; --rule-strong:#A3AEBA; --row-alt:#F7F9FA;
  --accent:#1F4FD1; --accent-soft:#E4EAFB; --accent-ink:#FFFFFF;
  --signal:#D25A1C; --ok:#1E7A55; --warn:#A86A00; --bad:#C0261F;
  --st-loue:#BFE3D1; --st-vacant:#FBE3D6; --st-preavis:#F7D98C; --st-nr:#FFFFFF;
  --tv-afaire:#F8D58F; --tv-encours:#F5B48A; --tv-termine:#A9DDB9; --tv-none:#FFFFFF;
  --dpe-a:#009C6D; --dpe-b:#52B153; --dpe-c:#A5CC74; --dpe-d:#F4E70F; --dpe-e:#F0B50F; --dpe-f:#EB8235; --dpe-g:#D7221F; --dpe-none:#E1E5EA;
  --wall:#142030; --hall:#F3F1E4;
  --cat-locatif:#9EC5F0; --cat-commercial:#F2B880; --cat-annexe:#C9B8E8; --cat-commun:#E6E1C8; --cat-exterieur:#B9DFA6; --cat-technique:#C7CDD4; --cat-none:#FFFFFF;
  --sticker:#FFE98A; --sticker-edge:#9C7A12;
  --f-display:"Archivo","Arial Narrow",system-ui,sans-serif;
  --f-body:"Public Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,"SFMono-Regular",Menlo,monospace;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#0E141B; --sheet:#16202A; --ink:#E3E8EE; --muted:#97A3B0; --rule:#2A3541; --rule-strong:#4A5767; --row-alt:#19242F;
  --accent:#86A2FF; --accent-soft:#1D2947; --accent-ink:#0E141B; --signal:#FF8E52; --ok:#5CCB9B; --warn:#F2B84B; --bad:#FF7B72;
  --st-loue:#285E49; --st-vacant:#6A3A27; --st-preavis:#77612A; --st-nr:#16202A;
  --tv-afaire:#7A5A1E; --tv-encours:#7A3E1E; --tv-termine:#2B6A45; --tv-none:#16202A;
  --dpe-none:#2E3945; --wall:#C9D2DC; --hall:#22261F; color-scheme:dark;
  --cat-locatif:#2F4F78; --cat-commercial:#7A4E26; --cat-annexe:#4E4270; --cat-commun:#3A3826; --cat-exterieur:#35552A; --cat-technique:#3A434D; --cat-none:#16202A;
}}
:root[data-theme="dark"]{
  --bg:#0E141B; --sheet:#16202A; --ink:#E3E8EE; --muted:#97A3B0; --rule:#2A3541; --rule-strong:#4A5767; --row-alt:#19242F;
  --accent:#86A2FF; --accent-soft:#1D2947; --accent-ink:#0E141B; --signal:#FF8E52; --ok:#5CCB9B; --warn:#F2B84B; --bad:#FF7B72;
  --st-loue:#285E49; --st-vacant:#6A3A27; --st-preavis:#77612A; --st-nr:#16202A;
  --tv-afaire:#7A5A1E; --tv-encours:#7A3E1E; --tv-termine:#2B6A45; --tv-none:#16202A;
  --dpe-none:#2E3945; --wall:#C9D2DC; --hall:#22261F; color-scheme:dark;
  --cat-locatif:#2F4F78; --cat-commercial:#7A4E26; --cat-annexe:#4E4270; --cat-commun:#3A3826; --cat-exterieur:#35552A; --cat-technique:#3A434D; --cat-none:#16202A;
}

*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{margin:0; background:var(--bg); color:var(--ink); font-family:var(--f-body); font-size:15px; line-height:1.45; padding-inline:16px}
button,select,input,textarea{font:inherit; color:inherit}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
.muted{color:var(--muted)} .small{font-size:.82rem}
.logo{font-family:var(--f-display); font-weight:800; font-size:1.4rem; letter-spacing:-.01em}
.btn{font-size:.88rem; font-weight:600; border:1px solid var(--accent); background:var(--accent); color:var(--accent-ink); border-radius:7px; padding:7px 14px; cursor:pointer; white-space:nowrap}
.btn:disabled{opacity:.5; cursor:not-allowed}
.link{border:0; background:none; color:var(--accent); cursor:pointer; padding:4px 2px; font-size:.88rem; text-decoration:underline; text-underline-offset:3px; text-decoration-color:color-mix(in srgb, var(--accent) 40%, transparent)}

/* ---------- en-tête ---------- */
.app{display:flex; flex-direction:column; height:100%; max-width:1680px; margin-inline:auto}
.top{display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; padding-block:12px 6px}
.brand{display:flex; gap:12px; align-items:baseline; flex-wrap:wrap; margin-right:auto}
.brand span{font-size:.85rem; color:var(--muted)}
.brand .version{font-size:.75rem; font-variant-numeric:tabular-nums}
.search input{width:220px; max-width:100%; border:1px solid var(--rule-strong); border-radius:7px; padding:7px 11px; background:var(--sheet)}
.actions{display:flex; align-items:center; gap:10px 14px; flex-wrap:wrap}
.sync{font-size:.8rem; color:var(--muted); display:inline-flex; gap:6px; align-items:center; min-width:96px; justify-content:flex-end}
.sync::before{content:""; width:8px; height:8px; border-radius:50%; background:var(--rule-strong)}
.sync[data-s="ok"]::before{background:var(--ok)} .sync[data-s="busy"]::before{background:var(--warn)} .sync[data-s="ro"]::before{background:var(--accent)} .sync[data-s="err"]::before{background:var(--bad)}
.who{font-size:.85rem; color:var(--muted)}
.subbar{display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 18px; margin:0 0 10px}
.hint{margin:0; font-size:.86rem; color:var(--muted)}
.layout-ctl{display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px}
.layout-ctl .narrow-only{display:none}

/* ---------- écran partagé ----------
   Plan and table: which are shown (data-show), where the plan sits (data-order) and the plan's
   share of the screen (--plan-fr / --table-fr), as chosen by the account. The bar between
   them (.splitter) resizes. */
.split{--plan-fr:.4fr; --table-fr:.6fr; flex:1; min-height:0; display:grid; padding-bottom:16px;
  grid-template-columns:minmax(260px,var(--plan-fr)) 14px minmax(360px,var(--table-fr)); grid-template-areas:"plan split table"}
.plan-pane{grid-area:plan} .table-pane{grid-area:table}
.split[data-order="plan-right"]{grid-template-columns:minmax(360px,var(--table-fr)) 14px minmax(260px,var(--plan-fr)); grid-template-areas:"table split plan"}
.split[data-order="plan-top"]{grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(160px,var(--plan-fr)) 14px minmax(200px,var(--table-fr)); grid-template-areas:"plan" "split" "table"}
.split[data-show="plan"], .split[data-show="table"]{grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); grid-template-areas:"only"}
.split[data-show="plan"] .plan-pane, .split[data-show="table"] .table-pane{grid-area:only}
.split[data-show="plan"] :is(.table-pane,.splitter), .split[data-show="table"] :is(.plan-pane,.splitter){display:none}
.splitter{grid-area:split; position:relative; cursor:col-resize; touch-action:none; border-radius:6px}
.splitter::after{content:""; position:absolute; left:50%; top:50%; width:4px; height:44px; transform:translate(-50%,-50%); border-radius:2px; background:var(--rule-strong)}
.split[data-order="plan-top"] .splitter{cursor:row-resize}
.split[data-order="plan-top"] .splitter::after{width:44px; height:4px}
.splitter:hover::after, .splitter.dragging::after, .splitter:focus-visible::after{background:var(--accent)}
.split.resizing{user-select:none; cursor:col-resize}
.split.resizing[data-order="plan-top"]{cursor:row-resize}
.pane{background:var(--sheet); border:1px solid var(--rule); border-radius:10px; display:flex; flex-direction:column; min-height:0; min-width:0; overflow:hidden}
.pane-bar{display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center; justify-content:space-between; padding:10px 12px; border-bottom:1px solid var(--rule)}
@media (max-width:1100px){
  /* Narrow screens: one above the other, in the chosen order; no resizing */
  .app{height:auto} .table-box{max-height:none}
  .split, .split[data-order], .split[data-show]{display:flex; flex-direction:column; gap:14px}
  .splitter{display:none}
  .split[data-order="plan-right"] .table-pane{order:-1}
  .split:not([data-order="plan-right"]):not([data-show="plan"]) .plan-pane{position:sticky; top:0; z-index:3; max-height:58vh}
  .layout-ctl .wide-only{display:none} .layout-ctl .narrow-only{display:inline-block}
}

.tabs{display:flex; gap:4px; flex-wrap:wrap}
.tabs button{border:1px solid transparent; background:none; border-radius:7px; padding:6px 12px; cursor:pointer; color:var(--muted); font-weight:600}
.tabs button[aria-pressed="true"]{background:var(--ink); color:var(--sheet)}
.tabs button:hover:not([aria-pressed="true"]){border-color:var(--rule)}
.seg{display:inline-flex; align-items:center; gap:0; border:1px solid var(--rule-strong); border-radius:7px; overflow:hidden}
.row-ctl{display:flex; align-items:center; gap:8px}
.seg-label{font-size:.8rem; color:var(--muted)}
.seg button:first-child{border-left:0}
.seg button{border:0; border-left:1px solid var(--rule); background:var(--sheet); padding:5px 11px; cursor:pointer; font-size:.86rem}
.seg button[aria-pressed="true"]{background:var(--accent-soft); color:var(--accent); font-weight:600}
.seg.small button{font-size:.8rem; padding:4px 9px}
.seg.small button:first-child{border-left:0}
.chk{display:inline-flex; gap:6px; align-items:center; font-size:.86rem; cursor:pointer}
.chk input{accent-color:var(--accent); width:16px; height:16px}
.count{font-size:.86rem; color:var(--muted)}

/* ---------- plan ---------- */
.plan-box{flex:1; min-height:0; padding:10px; display:flex; align-items:center; justify-content:center}
#plan{width:100%; height:100%; max-height:100%; display:block}
@media (max-width:1100px){ #plan{height:auto; max-height:44vh} }
#plan .lot{cursor:pointer}
#plan .lot:focus{outline:none}
#plan .base{transition:fill .2s}
#plan .outline{fill:none; stroke:var(--wall); stroke-width:2}
#plan .lot.hover .outline{stroke:var(--accent); stroke-width:4}
#plan .lot.is-sel .outline, #plan .lot:focus-visible .outline{stroke:var(--accent); stroke-width:6}
#plan .lot.dim{opacity:.2}
#plan .p-label{font-family:var(--f-mono); font-size:16px; letter-spacing:3px; fill:var(--muted)}
#plan .p-hall{fill:var(--hall); stroke:var(--wall); stroke-width:1.5}
#plan .p-wall{stroke:var(--wall); stroke-width:1.3; pointer-events:none}
#plan .p-room{font-size:16px; font-style:italic; fill:var(--muted); pointer-events:none; font-family:var(--f-body)}
#plan .p-tag{fill:var(--sticker); stroke:var(--sticker-edge); stroke-width:1.3; pointer-events:none}
#plan .tag{filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.35))}
#plan .p-num{font-family:var(--f-body); font-size:19px; font-weight:600; fill:#1B1B1B; pointer-events:none}
#plan .p-extra{font-family:var(--f-mono); font-size:11px; fill:var(--muted); pointer-events:none}
#plan .p-badge{fill:var(--accent)}
#plan .p-badge-t{font-family:var(--f-body); font-size:13px; font-weight:600; fill:var(--accent-ink)}
#plan.hide-nums .p-tag,#plan.hide-nums .p-num,#plan.hide-nums .p-extra,#plan.hide-nums .p-badge-g{display:none}
.show-ctl{gap:10px}
.show-ctl .chk{display:inline-flex; align-items:center; gap:4px; font-size:.8rem}

.legend{display:flex; flex-wrap:wrap; gap:6px; padding:10px 12px; border-top:1px solid var(--rule)}
.chip{display:inline-flex; align-items:center; gap:7px; border:1px solid var(--rule); background:var(--sheet); border-radius:99px; padding:4px 11px 4px 8px; font-size:.84rem; cursor:pointer}
.chip b{font-weight:600; color:var(--muted); font-variant-numeric:tabular-nums}
.chip:hover{border-color:var(--rule-strong)}
.chip[aria-pressed="true"]{border-color:var(--accent); background:var(--accent-soft)}
.chip.clear{color:var(--accent); padding-left:11px}
.sw{width:14px; height:14px; border-radius:4px; border:1px solid var(--rule-strong); display:inline-block}
.sw-hatch{background:repeating-linear-gradient(45deg,var(--signal) 0 3px,transparent 3px 7px)}

/* ---------- tableau ---------- */
.table-box{flex:1; min-height:0; overflow:auto}
.sheet{border-collapse:separate; border-spacing:0; width:100%; font-size:.9rem}
.sheet thead{position:sticky; top:0; z-index:2}
.sheet thead th{background:var(--bg); text-align:left; font-weight:600; font-size:.76rem; color:var(--muted); padding:8px 10px; border-bottom:1px solid var(--rule-strong); white-space:nowrap}
.sheet td, .sheet tbody th{padding:5px 8px; border-bottom:1px solid var(--rule); vertical-align:middle; white-space:nowrap; text-align:left; font-weight:400}
.sheet tbody tr.row:nth-of-type(even) td, .sheet tbody tr.row:nth-of-type(even) th{background:var(--row-alt)}
.sheet tbody tr.row{cursor:pointer}
.sheet tbody tr.hover td, .sheet tbody tr.hover th{background:var(--accent-soft)!important}
.sheet tbody tr.is-sel td, .sheet tbody tr.is-sel th{background:var(--accent-soft)!important}
.sheet tbody tr.is-sel th{box-shadow:inset 4px 0 0 var(--accent)}
.sheet tbody th .num{font-family:var(--f-display); font-weight:700; font-size:1.02rem}
.sheet tbody th .sub{display:block; font-size:.76rem; color:var(--muted); line-height:1.2}

.flash td, .flash th{animation:flash 1.4s ease-out}
@keyframes flash{0%{background:color-mix(in srgb,var(--accent) 35%,transparent)}100%{}}
@media (prefers-reduced-motion: reduce){ .flash td, .flash th{animation:none} #plan .base{transition:none} }

.sheet select, .sheet input[type="date"], .sheet input[type="text"]{border:1px solid transparent; border-radius:6px; padding:4px 6px; background:transparent; font-size:.88rem; cursor:pointer}
.sheet select:hover, .sheet input:hover{border-color:var(--rule-strong)}
.sheet select:focus, .sheet input:focus{border-color:var(--accent); outline:none; box-shadow:0 0 0 2px var(--accent-soft)}
.in-occ{min-width:112px; color:var(--ink); font-weight:600}
.in-dpe{width:54px; font-family:var(--f-display); font-weight:800; color:#111!important}
.in-dpe.g{color:#fff!important}
.sheet input[type="date"]{width:122px; background:transparent}
.dpe-date{position:relative; display:inline-flex; align-items:center}
.sheet input.in-date{width:92px; cursor:text; border-color:var(--rule)}
.sheet input.in-date.bad{border-color:var(--bad); color:var(--bad)}
.cal{border:0; background:none; cursor:pointer; padding:2px 3px; font-size:.95rem; line-height:1}
.sheet input.cal-in{position:absolute; right:0; bottom:0; width:1px; height:1px; padding:0; border:0; opacity:0; pointer-events:none}
.in-fin{width:100px; cursor:text!important; border-color:var(--rule)!important}
.trv{display:inline-flex; align-items:center; cursor:pointer; margin-right:6px; padding:4px}
.c-dpe{display:inline-flex; align-items:center; gap:4px}
.trv input{accent-color:var(--signal); width:17px; height:17px}
.trv span{color:var(--muted); font-size:.84rem}
.pill{display:inline-block; padding:2px 10px; border-radius:99px; font-weight:600; font-size:.84rem; border:1px solid var(--rule)}
.dpe{display:inline-grid; place-items:center; min-width:24px; height:20px; padding:0 4px; border-radius:4px; font-family:var(--f-display); font-weight:800; font-size:.82rem; color:#111}
.dpe.g{color:#fff}

.cm{display:inline-flex; align-items:center; gap:8px; border:1px solid transparent; background:none; border-radius:6px; padding:3px 6px; cursor:pointer; max-width:150px; text-align:left}
.cm:hover, .cm.open{border-color:var(--rule-strong); background:var(--sheet)}
.bubble{flex:none; display:inline-grid; place-items:center; min-width:22px; height:22px; padding:0 6px; border-radius:11px; border:1px dashed var(--rule-strong); color:var(--muted); font-size:.8rem; font-weight:600}
.bubble.on{background:var(--accent); border:0; color:var(--accent-ink)}
.cm-last{max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:.84rem}

.sheet tr.detail td{background:var(--bg)!important; white-space:normal; padding:10px 14px 14px}
.thread{display:flex; flex-direction:column; gap:8px; max-width:640px}
.ids{margin:0; font-family:var(--f-mono); font-size:.76rem}
.msg{background:var(--sheet); border:1px solid var(--rule); border-radius:8px; padding:7px 11px; font-size:.88rem; overflow-wrap:anywhere}
.msg .meta{font-size:.76rem; color:var(--muted); margin-bottom:2px}
.tag-int{color:var(--warn); font-weight:600}
.thread-head{display:flex; justify-content:space-between; align-items:center; gap:8px}
.msg .edited{font-style:italic}
.msg-acts{display:flex; flex-wrap:wrap; gap:2px 14px; margin-top:4px}
.msg-acts .link{font-size:.8rem; padding:2px 0}
.msg.editing textarea{width:100%; margin:4px 0 6px; border:1px solid var(--rule-strong); border-radius:8px; padding:7px 10px; background:var(--sheet); color:var(--ink); resize:vertical; font-size:.9rem}
.msg-btns{display:inline-flex; align-items:center; gap:12px; margin-left:auto}
.versions{list-style:none; margin:6px 0 0; padding:2px 0 2px 10px; border-left:3px solid var(--rule); display:flex; flex-direction:column; gap:6px; color:var(--muted)}
.deleted{display:flex; flex-direction:column; align-items:flex-start; gap:6px}
.msg.gone{align-self:stretch; border-style:dashed; color:var(--muted)}
.compose{display:flex; flex-direction:column; gap:8px}
.compose textarea{width:100%; border:1px solid var(--rule-strong); border-radius:8px; padding:7px 10px; background:var(--sheet); resize:vertical; font-size:.9rem}
.compose-bar{display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; align-items:center}
.empty{padding:20px 12px!important; white-space:normal!important}

/* ---------- historique ---------- */
.overlay{position:fixed; inset:0; background:rgba(10,16,24,.45); display:grid; place-items:center; padding:16px; z-index:10}
.dialog{background:var(--sheet); border-radius:12px; width:min(680px,100%); max-height:80vh; display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--rule)}
.dialog-head{display:flex; justify-content:space-between; align-items:center; padding:14px 18px; border-bottom:1px solid var(--rule)}
.dialog-head h2{margin:0; font-family:var(--f-display); font-size:1.15rem}
.history{list-style:none; margin:0; padding:12px 18px; overflow:auto; display:flex; flex-direction:column; gap:8px; font-size:.88rem}
.history li{display:grid; grid-template-columns:150px minmax(0,1fr); gap:10px}
@media (max-width:600px){ .history li{grid-template-columns:minmax(0,1fr)} }

/* ---------- connexion ---------- */
.login{min-height:100%; display:grid; place-items:center; padding-block:24px}
.login-card{width:100%; max-width:360px; padding:26px; display:flex; flex-direction:column; gap:14px; background:var(--sheet); border:1px solid var(--rule); border-radius:12px}
.field{display:flex; flex-direction:column; gap:5px; font-size:.84rem; color:var(--muted)}
.field input{font-size:1rem; padding:8px 10px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.login-card .btn{padding:9px 14px}
.login-err{margin:0; color:var(--bad); font-size:.88rem}
.login-card p{margin:0}

.toast{position:fixed; left:50%; bottom:calc(20px + env(safe-area-inset-bottom, 0px)); transform:translateX(-50%); background:var(--ink); color:var(--sheet); padding:9px 15px; border-radius:8px; font-size:.88rem; z-index:20; max-width:calc(100% - 32px)}
@media (min-width:1101px) and (max-width:1400px){ .cm-last{display:none} .sheet td, .sheet tbody th{padding-inline:6px} }
/* Export PDF : fenêtre de choix */
.pdf-dialog{width:min(460px,100%)}
.pdf-body{padding:16px 18px; display:flex; flex-direction:column; gap:14px; overflow:auto}
.pdf-body fieldset{border:0; margin:0; padding:0; display:flex; flex-direction:column; gap:8px}
.pdf-body legend{font-family:var(--f-display); font-weight:700; font-size:.92rem; margin-bottom:6px; padding:0}
.pdf-body p{margin:0}
.pdf-foot{display:flex; justify-content:flex-end; padding:12px 18px; border-top:1px solid var(--rule)}

/* Plans du géomètre (format 2) : fond de plan, zoom */
.plan-box{position:relative}
#plan.v2{touch-action:none; cursor:grab}
#plan.v2 *{vector-effect:non-scaling-stroke}
#plan.v2 .outline{stroke-width:1.2} #plan.v2 .lot.hover .outline{stroke-width:2.5} #plan.v2 .lot.is-sel .outline{stroke-width:3.5}
#plan .bg-murs{fill:none; stroke:var(--wall); stroke-width:1}
#plan .bg-poche{fill:var(--wall); opacity:.55; stroke:none}
#plan .bg-embrasures{fill:none; stroke:var(--wall); stroke-width:.6; opacity:.6}
#plan .bg-portes{fill:none; stroke:var(--muted); stroke-width:.7}
#plan .bg-fenetres{fill:none; stroke:var(--muted); stroke-width:.8}
#plan .bg-escaliers{fill:none; stroke:var(--muted); stroke-width:.6}
#plan .bg-details{fill:none; stroke:var(--muted); stroke-width:.5; stroke-dasharray:4 3; opacity:.7}
#plan.v2 .p-hall{stroke:none; opacity:.9}
#plan.color-cat .p-hall.cat-commun{fill:var(--cat-commun)} #plan.color-cat .p-hall.cat-exterieur{fill:var(--cat-exterieur)} #plan.color-cat .p-hall.cat-technique{fill:var(--cat-technique)}
#plan .p-hall.dim{opacity:.2}
#plan.v2 .base{opacity:.85}
#plan.v2 .p-room{font-size:13px}
#plan.rooms-off .p-room{display:none}
.zoom-ctl{position:absolute; right:14px; bottom:14px; display:flex; flex-direction:column; gap:4px}
.zoom-ctl button{width:34px; height:34px; border:1px solid var(--rule-strong); background:var(--sheet); color:var(--ink); border-radius:7px; font-size:1.1rem; cursor:pointer; box-shadow:0 1px 4px rgba(0,0,0,.12)}

/* ===== Onglet « Plans » ===== */
.admin{display:flex; flex-direction:column; min-height:100vh; padding-bottom:16px}
.adm-list{max-width:1100px; width:100%; margin:0 auto}
.adm-cards{display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:14px; margin-bottom:18px}
.adm-card{background:var(--sheet); border:1px solid var(--rule); border-radius:10px; padding:16px 18px}
.adm-card h2,.adm-h{font-family:var(--f-display); font-size:1.05rem; margin:0 0 8px}
.adm-h{margin-top:8px}
.file-btn{display:inline-block; margin-top:6px}
.btn.secondary,.file-btn.secondary{background:var(--sheet); color:var(--accent)}
.adm-state{margin:10px 0 0; padding:8px 10px; border-radius:7px; background:var(--accent-soft); font-size:.88rem}
.adm-state.err{background:color-mix(in srgb,var(--bad) 14%,transparent); color:var(--bad)}
.adm-table{width:100%; border-collapse:collapse; background:var(--sheet); border:1px solid var(--rule); border-radius:10px; overflow:hidden}
.adm-table th,.adm-table td{padding:10px 12px; border-bottom:1px solid var(--rule); text-align:left; vertical-align:top; font-size:.9rem}
.adm-table th{font-family:var(--f-display); font-size:.82rem; color:var(--muted)}
.adm-table .sub{display:block; color:var(--muted); font-size:.8rem}
.adm-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}
.link.danger,.danger{color:var(--bad)}
.badge{display:inline-block; font-size:.76rem; font-weight:700; padding:2px 8px; border-radius:99px; background:var(--rule); color:var(--ink)}
.badge.st-publie{background:color-mix(in srgb,var(--ok) 22%,transparent); color:var(--ok)}
.badge.st-brouillon{background:var(--accent-soft); color:var(--accent)}
.badge.st-archive{background:var(--rule); color:var(--muted)}

.adm-editor{display:flex; flex-direction:column; flex:1; min-height:0}
.ed-bar{display:flex; flex-wrap:wrap; gap:8px; align-items:center; background:var(--sheet); border:1px solid var(--rule); border-radius:10px; padding:8px 10px; margin-bottom:10px}
.ed-label{flex:0 1 320px; font:inherit; font-weight:600; padding:6px 9px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.ed-saved{font-size:.8rem; color:var(--muted)} .ed-saved.err{color:var(--bad); font-weight:600}
.ed-spacer{flex:1}
.tool{border:1px solid var(--rule-strong); background:var(--sheet); color:var(--ink); border-radius:7px; padding:6px 10px; cursor:pointer; font-size:.86rem}
.tool[aria-pressed="true"]{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}
.tool:disabled{opacity:.45; cursor:not-allowed}
.ed-body{flex:none; display:grid; grid-template-columns:minmax(0,1fr) 380px; grid-template-rows:minmax(0,1fr); gap:10px; height:calc(100vh - 150px); min-height:420px}
.ed-map{display:flex; flex-direction:column; min-height:0; background:var(--sheet); border:1px solid var(--rule); border-radius:10px; padding:8px}
.ed-levels .dot-todo{display:inline-grid; place-items:center; min-width:18px; height:18px; border-radius:9px; background:var(--bad); color:#fff; font-size:.7rem; margin-left:4px}
.ed-hint{margin:6px 0 0; padding:6px 10px; border-radius:7px; background:var(--accent-soft); font-size:.84rem}
.ed-canvas{position:relative; flex:1; min-height:300px; margin-top:6px}
#adm-plan{width:100%; height:100%; display:block; touch-action:none; cursor:grab; background:var(--sheet)}
.admin[data-mode="draw"] #adm-plan,.admin[data-mode="tag"] #adm-plan{cursor:crosshair}
#adm-plan *{vector-effect:non-scaling-stroke}
#adm-plan .bg-murs{fill:none; stroke:var(--wall); stroke-width:1}
#adm-plan .bg-poche{fill:var(--wall); opacity:.5}
#adm-plan .bg-embrasures,#adm-plan .bg-portes,#adm-plan .bg-fenetres,#adm-plan .bg-escaliers{fill:none; stroke:var(--muted); stroke-width:.6}
#adm-plan .bg-details{fill:none; stroke:var(--muted); stroke-width:.5; stroke-dasharray:4 3; opacity:.6}
#adm-plan .e-hall{fill:var(--cat-commun); opacity:.75; cursor:pointer}
#adm-plan .e-hall:hover{opacity:.95}
#adm-plan .e-hall.is-sel{opacity:1; stroke:var(--accent); stroke-width:2.5}
#adm-plan .e-lot.no-cat .e-lot-fill{stroke:var(--bad); stroke-width:2; stroke-dasharray:6 4}
#adm-plan .e-lot-fill{fill:#7FA7E8; opacity:.42; stroke:#2F5DB3; stroke-width:1; cursor:pointer}
#adm-plan .e-lot.has-data .e-lot-fill{fill:#6FCB9F}
#adm-plan .e-lot:hover .e-lot-fill{opacity:.6}
#adm-plan .e-lot.is-sel .e-lot-fill{fill:var(--accent); opacity:.5; stroke:var(--accent); stroke-width:2.5}
#adm-plan .e-lot.is-link .e-lot-fill{fill:var(--accent); opacity:.35; stroke:var(--accent); stroke-width:3}
#adm-plan .e-part-sel{fill:none; stroke:#111; stroke-width:3; pointer-events:none}
#adm-plan .e-orphan{fill:url(#adm-hatch); stroke:var(--bad); stroke-width:2; cursor:pointer}
#adm-plan .e-orphan.is-sel{stroke-width:4}
#adm-plan .p-room{font-size:13px; font-style:italic; fill:var(--muted); font-family:var(--f-body)}
#adm-plan .p-label{font-family:var(--f-mono); font-size:16px; fill:var(--muted)}
#adm-plan.rooms-off .p-room{display:none}
/* Étiquettes : le numéro de lot posé par-dessus le dessin, qu'on fait glisser */
#adm-plan .e-tag{cursor:grab; filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.35))}
#adm-plan .e-tag.is-drag{cursor:grabbing; opacity:.85}
#adm-plan .e-tag rect{fill:var(--sticker); stroke:var(--sticker-edge); stroke-width:1.2}
#adm-plan .e-tag text{font-family:var(--f-body); font-size:17px; font-weight:700; fill:#1B1B1B; pointer-events:none}
#adm-plan .e-tag.pending rect{fill:#fff; stroke:var(--bad); stroke-width:2; stroke-dasharray:4 3}
#adm-plan .e-tag.pending text{fill:var(--bad)}
#adm-plan .e-tag.is-sel rect{stroke:var(--accent); stroke-width:3}
.admin[data-mode="shape"] #adm-plan .e-tag,.admin[data-mode="draw"] #adm-plan .e-tag{opacity:.45; pointer-events:none}
.admin[data-mode="link"] #adm-plan{cursor:pointer}
#adm-plan .e-handle{fill:#fff; stroke:#111; stroke-width:1.5; cursor:move}
#adm-plan .e-handle.is-vtx{fill:var(--bad); stroke:#fff; stroke-width:2}
#adm-plan .e-handle.mid{fill:var(--accent); stroke:#fff; opacity:.75; cursor:copy}
#adm-plan .e-draft path{fill:color-mix(in srgb,var(--accent) 20%,transparent); stroke:var(--accent); stroke-width:2; stroke-dasharray:5 4}
#adm-plan .e-draft circle{fill:var(--accent); stroke:#fff; stroke-width:1.5}
.ed-legend{display:flex; flex-wrap:wrap; gap:4px 12px; align-items:center; margin:6px 0 0; color:var(--muted)}
.lg{display:inline-block; width:14px; height:10px; border-radius:2px; margin-right:-6px}
.lg-nocat{border:2px dashed var(--bad)} .lg-lot{background:#7FA7E8} .lg-tag{background:var(--sticker); border:1px solid var(--sticker-edge); width:20px} .lg-orphan{background:repeating-linear-gradient(45deg,var(--bad) 0 2px,transparent 2px 5px); border:1px solid var(--bad)} .lg-hall{background:#F2D45C} .lg-data{background:#6FCB9F}
.ed-side{display:flex; flex-direction:column; min-height:0; background:var(--sheet); border:1px solid var(--rule); border-radius:10px; overflow:hidden}
.ed-tabs{display:flex; flex-wrap:wrap; border-bottom:1px solid var(--rule)}
.ed-tabs button{flex:1; border:0; background:none; padding:10px 8px; cursor:pointer; font-size:.86rem; color:var(--muted); border-bottom:2px solid transparent}
.ed-tabs button[aria-pressed="true"]{color:var(--ink); font-weight:700; border-bottom-color:var(--accent)}
.ed-tabs b{color:var(--bad)}
.ed-panel{flex:1; overflow:auto; padding:12px 14px}
.ed-panel h3{font-family:var(--f-display); font-size:.95rem; margin:14px 0 6px} .ed-panel h3:first-child{margin-top:0}
.ed-panel h4{font-size:.86rem; margin:12px 0 4px}
.ed-panel p{margin:4px 0}
.todo{list-style:none; margin:8px 0 0; padding:0; display:flex; flex-direction:column; gap:8px}
.todo li{border:1px solid var(--rule); border-radius:8px; padding:8px 10px; cursor:pointer; font-size:.88rem}
.todo li:hover{border-color:var(--accent)}
.todo-act{display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; margin-top:6px}
.why{display:block; font-size:.78rem; color:var(--muted)}
.btn.small{padding:4px 9px; font-size:.8rem}
.ok-msg{color:var(--ok); font-weight:600}
.lotlist,.ctl,.parts{list-style:none; margin:6px 0 0; padding:0}
.lotlist li,.ctl li[data-go]{display:grid; grid-template-columns:60px 1fr auto; gap:6px; padding:6px 4px; border-bottom:1px solid var(--rule); cursor:pointer; font-size:.86rem}
.ctl li{padding:4px 0; font-size:.86rem}
.lotlist li:hover,.ctl li[data-go]:hover{background:var(--row-alt)}
.parts li{padding:5px 0; border-bottom:1px solid var(--rule); font-size:.86rem}
.parts li.is-sel{font-weight:700}
.part-act{display:inline-flex; gap:8px; margin-left:6px}
.ed-search{width:100%; padding:7px 10px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.admin.ro .ed-legend::after{content:"Lecture seule : créez un brouillon depuis la liste des versions pour retoucher."; margin-left:8px; color:var(--warn)}
@media (max-width:1000px){ .ed-body{grid-template-columns:1fr; height:auto} .ed-canvas{height:60vh} .ed-side{max-height:70vh} }
/* Narrow screens: the pane has a fixed height and the plan takes what the bars leave */
@media (max-width:1100px){ .plan-pane:has(#plan.v2){height:58vh} #plan.v2{height:100%; max-height:100%} }

/* ===== Catégories de zones ===== */
.cat-sw.cat-locatif{background:var(--cat-locatif)} .cat-sw.cat-commercial{background:var(--cat-commercial)} .cat-sw.cat-annexe{background:var(--cat-annexe)}
.cat-sw.cat-commun{background:var(--cat-commun)} .cat-sw.cat-exterieur{background:var(--cat-exterieur)} .cat-sw.cat-technique{background:var(--cat-technique)} .cat-sw.cat-none{background:var(--cat-none)}
.lg.cat-sw{border:1px solid var(--rule-strong)}
.field-inline{display:flex; align-items:center; gap:8px; margin:8px 0; font-size:.88rem}
.field-inline select{font:inherit; padding:5px 8px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.field-inline.danger select{border-color:var(--bad)}
.badge.st-bad{background:color-mix(in srgb,var(--bad) 16%,transparent); color:var(--bad)}
.ctl.blk li{display:block; padding:6px 4px; border-bottom:1px solid var(--rule)}
.ctl.blk li[data-go]{display:block; cursor:pointer}
.zp-dialog{width:min(520px,100%)}
.zp-body{padding:14px 18px; display:flex; flex-direction:column; gap:14px; overflow:auto; min-height:0}
.zp-body fieldset{border:0; margin:0; padding:0; display:flex; flex-direction:column; gap:8px}
.zp-body legend{font-family:var(--f-display); font-weight:700; font-size:.92rem; margin-bottom:6px; padding:0}
.zp-body p{margin:0}
.zp-cats{display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:6px 12px}
.zp-cat .sw{flex:none}
.warn-txt{color:var(--warn); font-weight:600}
.bulk{border:1px solid var(--rule); border-radius:8px; padding:8px 10px; margin-bottom:10px; display:flex; flex-direction:column; gap:6px; font-size:.86rem}
.bulk-row{display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center}
.bulk select{font:inherit; padding:4px 7px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.zp-newcat{justify-self:start; grid-column:1/-1}
.cat-dialog{width:min(720px,100%)}
.cat-body{padding:6px 18px 10px; overflow:auto; min-height:0}
.cat-body h3{font-family:var(--f-display); font-size:.95rem; margin:14px 0 2px}
.cat-body p{margin:2px 0 6px}
.cat-row{display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:6px 0; border-bottom:1px solid var(--rule); font-size:.88rem}
.cat-row input[data-f="label"]{flex:1 1 160px; font:inherit; padding:5px 8px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.cat-row select,.cat-new select{font:inherit; padding:5px 8px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
.cat-row input[type="color"],.cat-new input[type="color"]{width:34px; height:30px; padding:0; border:1px solid var(--rule-strong); border-radius:6px; background:none; cursor:pointer}
.cat-act{display:inline-flex; gap:10px; margin-left:auto}
.cat-new{padding:10px 18px 14px; border-top:1px solid var(--rule)}
.cat-new h3{font-family:var(--f-display); font-size:.95rem; margin:0 0 8px}
.cat-new-row{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.cat-new-row #cat-new-label{flex:1 1 180px; font:inherit; padding:6px 9px; border:1px solid var(--rule-strong); border-radius:7px; background:var(--sheet); color:var(--ink)}
#cat-err{margin:0 18px 12px}
#zone-pick .pdf-foot{display:flex; justify-content:flex-end; gap:14px; align-items:center}
#zp-lot:disabled{opacity:.5}

/* ===== Tableau : tri et filtres par colonne ===== */
.th-btn{border:0; background:none; padding:0; font:inherit; color:inherit; cursor:pointer; white-space:nowrap}
.th-btn:hover{color:var(--ink)}
.sheet thead th[aria-sort="ascending"],.sheet thead th[aria-sort="descending"]{color:var(--ink)}
.sort-ind{font-size:.7rem}
.th-filters td{background:var(--bg); padding:0 6px 6px; border-bottom:1px solid var(--rule-strong)}
.th-filters input,.th-filters select{width:100%; min-width:70px; box-sizing:border-box; font:inherit; font-size:.78rem; padding:3px 6px; border:1px solid var(--rule-strong); border-radius:6px; background:var(--sheet); color:var(--ink)}
.th-filters input:not(:placeholder-shown),.th-filters select:has(option:checked:not([value=""])){border-color:var(--accent); box-shadow:0 0 0 1px var(--accent)}
.sheet thead tr:first-child th{border-bottom:0; padding-bottom:4px}

/* ===== État des lots : un calque de couleur, comme l'occupation ===== */
.in-trv{min-width:96px; color:var(--ink); font-weight:600; margin-right:4px}
.sheet input.in-fin{width:110px; cursor:text; border-color:var(--rule)}

/* ---------- colonnes : déplacer, afficher ou masquer ---------- */
.th-in{display:inline-flex; align-items:center; gap:2px}
.grip{cursor:grab; touch-action:none; user-select:none; color:var(--muted); padding:2px 3px; margin-left:-4px; border-radius:4px; line-height:1}
.grip:hover{color:var(--ink); background:var(--accent-soft)}
.sheet thead th.col-dragging{opacity:.55}
.sheet thead th.col-dragging .grip{cursor:grabbing}
.sheet thead th.drop-before{box-shadow:inset 3px 0 0 var(--accent)}
.sheet thead th.drop-after{box-shadow:inset -3px 0 0 var(--accent)}
.bar-end{display:inline-flex; align-items:center; gap:14px}
.cols-wrap{position:relative}
.cols-menu{position:absolute; right:0; top:calc(100% + 6px); z-index:20; width:min(320px, calc(100vw - 32px)); background:var(--sheet); border:1px solid var(--rule-strong); border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,.18); padding:10px 12px}
.cols-menu p{margin:0 0 8px}
.cols-list{list-style:none; margin:0 0 8px; padding:0}
.cols-list li{display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 0; border-bottom:1px solid var(--rule)}
.cols-list li.fixed .chk{color:var(--muted)}
.cols-list .mv{display:inline-flex; gap:4px}
.cols-list .mv .tool{min-width:32px; min-height:32px; padding:0}
