/* GMAO — gmao.devinckpaul.com. Ordinateur d'abord : dense, lisible, sans dépendance. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2433;
  --ink2: #4a5468;
  --muted: #7a8396;
  --line: #e1e4ea;
  --line2: #eef0f4;
  --accent: #0b6e8a;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2f6;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --ko: #b91c1c;
  --ko-soft: #fdecec;
  --info: #1d4ed8;
  --info-soft: #e8eefc;
  --radius: 6px;
  --tree: 300px;
  --top: 50px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; background: var(--line2); padding: 1px 4px; border-radius: 3px; }
h1 { font-size: 20px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 span { font-weight: 400; color: var(--ink2); }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 650; }
h2 small, h3 small { font-weight: 400; color: var(--muted); }
h2.sub { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink2); }
h2.ko { color: var(--ko); } h2.warn { color: var(--warn); }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink2); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.boot { padding: 40px; color: var(--muted); }

/* --- Ossature --------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--tree) 1fr; grid-template-rows: var(--top) 1fr; height: 100vh; }
.top { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: #16202e; color: #fff; min-width: 0; }
.brand { display: flex; align-items: baseline; gap: 8px; color: #fff; text-decoration: none !important; white-space: nowrap; }
.logo { font-weight: 800; letter-spacing: 0.06em; font-size: 15px; background: var(--accent); padding: 3px 7px; border-radius: 4px; }
.org { color: #b9c3d3; font-size: 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: thin; }
.tab { color: #c9d2e0; padding: 6px 8px; border-radius: 5px; white-space: nowrap; font-size: 13px; text-decoration: none !important; display: flex; align-items: center; gap: 5px; }
.tab:hover { background: #243145; color: #fff; }
.tab.on { background: #fff; color: var(--ink); font-weight: 600; }
.nb { font-style: normal; font-size: 11px; background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; line-height: 17px; font-weight: 600; }
.nb.warn { background: var(--ko); }
.nb.zero { background: var(--line); color: var(--muted); }
/* Pastille d'enregistrement (20_sync.js) */
.sync { border: 0; border-radius: 12px; padding: 4px 10px 4px 22px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; position: relative; background: #243145; color: #c9d2e0; }
.sync::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #8d99ad; }
.sync.ok::before { background: #4ade80; }
.sync.busy::before { background: #60a5fa; }
.sync.wait::before { background: #fbbf24; }
.sync.ko { background: #5b1d1d; color: #fecaca; }
.sync.ko::before { background: #f87171; }
.sync.local::before { background: #8d99ad; }
.sync:hover { background: #2e3d55; }
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #16202e; }
.screen-card { background: #fff; border-radius: 12px; padding: 32px 36px; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.screen-card h1 { margin: 14px 0 10px; }
.screen-card p { color: var(--ink2); line-height: 1.55; }
.logo.big { display: inline-block; color: #fff; font-size: 18px; padding: 5px 10px; }
/* Bandeau « Tableau de bord » ajouté par la plateforme aux pages d'un site pour
   un compte connecté (http/Bandeau_Proprietaire.cpp) : l'appli a sa propre
   pastille de compte, et le bandeau décalerait sa mise en page plein écran. */
#pf-bandeau { display: none !important; }
.search { position: relative; }
.search input { width: 200px; border: 0; border-radius: 5px; padding: 7px 10px; background: #243145; color: #fff; }
.search input::placeholder { color: #8d99ad; }
.search input:focus { outline: 2px solid var(--accent); background: #fff; color: var(--ink); }
.sres { position: absolute; right: 0; top: 38px; width: 380px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 30; max-height: 60vh; overflow: auto; }
.sr { display: flex; gap: 6px; align-items: center; padding: 7px 10px; color: var(--ink); border-bottom: 1px solid var(--line2); text-decoration: none !important; }
.sr:hover { background: var(--accent-soft); }
.sr small { margin-left: auto; color: var(--muted); font-size: 11px; }

/* --- Arborescence ----------------------------------------------------------- */
.tree { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tree-tools { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.tree-tools input[type=search] { width: 100%; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tree-body { flex: 1; overflow: auto; padding: 6px 4px 20px; font-size: 13px; }
.tree-foot { padding: 7px 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.tkids { margin-left: 14px; border-left: 1px solid var(--line2); }
.tn { display: flex; align-items: center; gap: 3px; padding: 2px 4px; border-radius: 4px; min-width: 0; }
.tn:hover { background: var(--line2); }
.tn.sel { background: var(--accent-soft); }
.tn.sel .tl { color: var(--accent); }
.tn.arch .tl { opacity: 0.5; text-decoration: line-through; }
.tn.loc .tl { font-weight: 600; color: var(--ink); }
.caret { width: 16px; flex: 0 0 16px; border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font-size: 10px; line-height: 16px; }
.tl { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink); text-decoration: none !important; flex: 1; padding: 2px 0; }
.tl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.tl b { font-weight: 600; white-space: nowrap; }
.tn.loc .tl span { color: var(--ink); }
.ki { font-style: normal; color: var(--muted); width: 14px; text-align: center; }
.cnt { font-style: normal; font-size: 11px; color: var(--muted); }
.an { font-style: normal; font-size: 10px; background: var(--ko); color: #fff; border-radius: 8px; padding: 0 5px; font-weight: 700; }
.tree-empty { padding: 14px; color: var(--ink2); font-size: 13px; }
.dot { width: 9px; height: 9px; flex: 0 0 9px; vertical-align: -1px; }

/* --- Pages ------------------------------------------------------------------ */
main { overflow: auto; min-width: 0; outline: none; }
.page { padding: 18px 22px 60px; max-width: 1500px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .toolbar { margin-left: auto; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.el-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.meta { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toolbar.end { justify-content: flex-end; margin-top: 14px; }

.btn { border: 1px solid #cdd2db; background: #fff; color: var(--ink); border-radius: 5px; padding: 6px 12px; font: inherit; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; text-decoration: none !important; line-height: 1.3; }
.btn:hover { background: var(--line2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #095b72; }
.btn.danger { background: #fff; border-color: #e5b4b4; color: var(--ko); }
.btn.danger:hover { background: var(--ko-soft); }
.modal footer .btn.danger { background: var(--ko); color: #fff; border-color: var(--ko); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.xs { padding: 1px 7px; font-size: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, .seg button:focus-visible, .caret:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--line2); color: var(--ink2); white-space: nowrap; border: 0; font-family: inherit; line-height: 18px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ko { background: var(--ko-soft); color: var(--ko); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.state { background: #fff; border: 1px solid var(--line); }
.badge.click { cursor: pointer; }
.badge.click:hover { border-color: var(--accent); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.cols.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.cols.three { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.panel.wide { margin-top: 14px; }
.panel.accent { border-color: var(--accent); background: var(--accent-soft); }
.cols + .panel.wide, .stats + .panel.wide { margin-top: 14px; }
.panel > .btn { margin-top: 10px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink2); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--accent-soft); }
.tbl tr.arch td { opacity: 0.55; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl input:not([type=checkbox]), .tbl select { width: 100%; }
.tbl.map td { vertical-align: middle; }
.page > .tbl, .page > .filters + .tbl { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
td.late { color: var(--warn); }
.life td:nth-child(3) { max-width: 560px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; min-width: 130px; display: flex; flex-direction: column; gap: 2px; }
.panel .stat { background: #fafbfc; }
.stat b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.ko b { color: var(--ko); } .stat.warn b { color: var(--warn); } .stat.ok b { color: var(--ok); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.filters input[type=search] { width: 260px; }
.seg { display: inline-flex; border: 1px solid #cdd2db; border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg.sm button { padding: 3px 9px; font-size: 12px; }
.seg.sm { margin-bottom: 8px; }

.empty { color: var(--muted); padding: 14px; text-align: center; font-size: 13px; background: #fafbfc; border: 1px dashed var(--line); border-radius: 6px; }
.note { color: var(--ink2); font-size: 12.5px; margin: 8px 0; }
.note.warn { color: var(--warn); }
.alert { padding: 9px 12px; border-radius: 6px; margin: 8px 0 12px; display: flex; gap: 10px; align-items: center; }
.alert.ko { background: var(--ko-soft); color: var(--ko); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); font-size: 13px; text-decoration: none !important; background: #fff; }
.chip:hover { border-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 5px 0; border-bottom: 1px solid var(--line2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.list li.click { cursor: pointer; }
.list li.click:hover { background: var(--accent-soft); }
.todo h2 { display: flex; align-items: center; gap: 6px; }
.todo .more { margin-left: auto; font-weight: 400; font-size: 12px; }
details summary { cursor: pointer; }
details summary h2 { display: inline; }

.ek { font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: var(--line2); color: var(--ink2); white-space: nowrap; }
.ek.int { background: var(--ok-soft); color: var(--ok); }
.ek.int.nc { background: var(--warn-soft); color: var(--warn); }
.ek.mv { background: var(--info-soft); color: var(--info); }
.ek.an { background: var(--ko-soft); color: var(--ko); }
.ek.etat { background: #efeaf8; color: #6b3fa0; }

/* --- Indicateurs ------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.kpis.two { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.kpi { text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; font: inherit; color: inherit; }
.kpi:hover { box-shadow: 0 2px 10px rgba(16,24,40,.08); }
.kpi.ok { border-left-color: var(--ok); } .kpi.ko { border-left-color: var(--ko); }
.kpi .kl { font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.kpi b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi.ok b { color: var(--ok); } .kpi.ko b { color: var(--ko); }
.kpi .kt { font-size: 11.5px; color: var(--muted); }
.kpi small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.spark { width: 100%; height: 34px; margin: 4px 0 2px; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.spark .tgt { stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.kpi-big b { font-size: 34px; } .kpi-big.ok b { color: var(--ok); } .kpi-big.ko b { color: var(--ko); }
.kpi-big span { color: var(--muted); }
.chart { width: 100%; height: auto; max-height: 260px; display: block; }
.chart .grid { stroke: var(--line2); }
.chart .ax { font-size: 11px; fill: var(--muted); }
.chart .tgt { stroke: var(--ko); stroke-dasharray: 5 4; stroke-width: 1.2; }
.chart .tgtl { fill: var(--ko); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.chart .pt { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.hbars { display: flex; flex-direction: column; gap: 5px; }
.hb { display: grid; grid-template-columns: 130px 1fr 60px; gap: 8px; align-items: center; font-size: 12.5px; }
.hbl { color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbs { height: 10px; width: 100%; background: var(--line2); border-radius: 3px; }
.hb b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.welcome { max-width: 680px; margin: 60px auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 30px; }
.welcome p { color: var(--ink2); line-height: 1.55; }

/* --- Formulaires ------------------------------------------------------------- */
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #cdd2db; border-radius: 5px; padding: 5px 8px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=color] { padding: 1px; width: 44px; height: 28px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink2); }
.field small { font-size: 11.5px; color: var(--muted); }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 12px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.inrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inrow input:not([type=checkbox]) { flex: 1; }
.checks { display: flex; flex-direction: column; gap: 3px; }
.checks.inline { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
.checks.scroll { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.checks.scroll.tall { max-height: 480px; }
.chk { display: inline-flex; gap: 6px; align-items: baseline; font-size: 13px; cursor: pointer; flex-wrap: wrap; }
.chk.sm { font-size: 12px; color: var(--ink2); }
.chk small { color: var(--muted); }
.chk.std.expired b { color: var(--ko); }
.chk.danger { color: var(--ko); margin: 6px 0; }
.radios { display: flex; gap: 14px; flex-wrap: wrap; }
.radios.col { flex-direction: column; gap: 6px; margin-bottom: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 6px; margin: 0 0 10px; min-width: 0; }
fieldset.nc { border-color: #efc7a3; background: #fffaf4; }
legend { font-size: 12px; font-weight: 650; color: var(--ink2); padding: 0 4px; }
.ctxline { color: var(--ink2); margin: 0 0 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.std-policy { color: var(--muted); font-size: 11.5px; }
.inline-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.inline-form input.grow { flex: 1; min-width: 220px; }
.req { color: var(--ko); }
.steps { display: flex; gap: 6px; margin-bottom: 8px; }
.steps span { padding: 3px 10px; border-radius: 12px; background: var(--line2); font-size: 12px; color: var(--muted); }
.steps span.on { background: var(--accent); color: #fff; }
.settings .tbl td { vertical-align: middle; }

/* --- Fenêtres, menus, bandeaux ---------------------------------------------- */
.modal-ov { position: fixed; inset: 0; background: rgba(15, 22, 34, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: 560px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.modal.wide { width: 820px; }
.modal.xwide { width: 1080px; }
.modal header { display: flex; align-items: center; padding: 14px 18px 10px; border-bottom: 1px solid var(--line2); }
.modal header h2 { margin: 0; font-size: 16px; flex: 1; }
.modal .x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-body { padding: 14px 18px 4px; }
.modal-body p { margin: 0 0 10px; line-height: 1.5; }
.modal-err { margin: 0 18px 8px; padding: 8px 12px; background: var(--ko-soft); color: var(--ko); border-radius: 6px; font-size: 13px; }
.modal footer { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line2); align-items: center; flex-wrap: wrap; }
.ctxmenu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 4px; min-width: 240px; }
.ctxmenu .mi { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 10px; font: inherit; font-size: 13px; border-radius: 4px; cursor: pointer; color: var(--ink); }
.ctxmenu .mi:hover, .ctxmenu .mi:focus { background: var(--accent-soft); outline: none; }
.ctxmenu .mi.danger { color: var(--ko); }
.ctxmenu .mi:disabled { opacity: 0.4; cursor: default; }
.ctxmenu .sep { height: 1px; background: var(--line2); margin: 4px 0; }
.ctxmenu .mtitle { font-size: 11.5px; color: var(--muted); padding: 5px 10px 3px; font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 70; max-width: 460px; }
.toast { background: #16202e; color: #fff; padding: 10px 14px; border-radius: 7px; box-shadow: 0 8px 20px rgba(0,0,0,.2); font-size: 13px; line-height: 1.4; transition: opacity .3s; border-left: 4px solid var(--ok); }
.toast.err { border-left-color: #f87171; }
.toast.warn { border-left-color: #fbbf24; }
.toast.out { opacity: 0; }

/* --- Fiches type tableur ------------------------------------------------------ */
.sheet-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0 10px; background: #fff; max-height: 460px; }
table.sheet { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.sheet th { background: #f3f4f7; color: var(--muted); font-weight: 500; font-size: 11px; padding: 3px 6px; border: 1px solid var(--line); position: sticky; top: 0; }
table.sheet tbody th { position: sticky; left: 0; text-align: center; min-width: 30px; }
table.sheet th.corner { left: 0; z-index: 2; }
table.sheet td { border: 1px solid var(--line); padding: 4px 7px; min-width: 92px; height: 28px; white-space: nowrap; }
table.sheet td.num { text-align: right; }
table.sheet td.b { font-weight: 650; }
table.sheet td.in { background: #fffbe6; }
table.sheet td.judge { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
table.sheet td.err { color: var(--ko); }
table.sheet.editing td { cursor: cell; }
table.sheet.editing td.sel { box-shadow: inset 0 0 0 2px var(--info); background: var(--info-soft); }
table.sheet.editing td.in:empty::after { content: "à saisir"; color: #b8a14a; font-size: 11px; font-style: italic; }
input.cin { width: 100%; min-width: 80px; border: 1px solid #e3cf74; background: #fff; padding: 2px 5px; text-align: right; }
.sheet-msg { font-size: 12px; color: var(--warn); min-height: 16px; margin-bottom: 8px; }
.ed-settings { display: grid; grid-template-columns: 280px 1fr auto; gap: 14px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 10px; }
.ed-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ed-bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.fbar { display: flex; gap: 0; margin-bottom: 4px; }
.fbar .addr { background: #f3f4f7; border: 1px solid #cdd2db; border-right: 0; border-radius: 5px 0 0 5px; padding: 6px 10px; font-weight: 600; min-width: 54px; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.fbar input { flex: 1; border-radius: 0 5px 5px 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.ed-test { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; }
.help p { font-size: 12.5px; line-height: 1.6; color: var(--ink2); margin: 0 0 8px; }

/* --- Étiquettes et impression -------------------------------------------------- */
.lab-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #e9ebef; height: 470px; position: relative; }
.lab-scale { transform-origin: 0 0; transform: scale(0.42); position: absolute; left: 10px; top: 10px; }
.lab-scale .a4 { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.a4 { width: 210mm; height: 297mm; position: relative; overflow: hidden; page-break-after: always; break-after: page; }
.label { position: absolute; display: flex; align-items: center; gap: 1.5mm; padding: 1.5mm 2mm; overflow: hidden; font-family: Arial, Helvetica, sans-serif; color: #000; }
.lab-scale .label { outline: 1px dashed #c7ccd5; }
.label.test { outline: 0.3mm solid #000; justify-content: center; font-size: 14pt; color: #555; }
.lq { flex: 0 0 auto; }
.lq svg { width: 100%; height: 100%; display: block; }
.lt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.lc { font-size: 11pt; font-weight: 700; }
.ln { font-size: 7.5pt; }
.lv { font-size: 7pt; color: #222; }
.lt.small .lc { font-size: 8pt; } .lt.small .ln, .lt.small .lv { font-size: 6pt; }
#print { display: none; }
.report { font-family: Arial, Helvetica, sans-serif; color: #000; padding: 14mm 14mm; max-width: 210mm; }
.report header { border-bottom: 2px solid #000; margin-bottom: 8mm; padding-bottom: 3mm; }
.report h1 { font-size: 18pt; } .report h2 { font-size: 12pt; margin-top: 8mm; }
.rep-prev { border: 1px solid var(--line); border-radius: 6px; max-height: 340px; overflow: auto; }
.rep-prev .report { padding: 16px; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body.printing #app, body.printing .modal-ov, body.printing #toasts, body.printing .ctxmenu { display: none !important; }
  body.printing #print { display: block; }
  .a4:last-child { page-break-after: auto; break-after: auto; }
  .label.test { outline-color: #000; }
}

@media (max-width: 1480px) {
  .org { display: none; }
}

@media (max-width: 900px) {
  :root { --tree: 0px; }
  .tree { display: none; }
  .search input { width: 150px; }
  .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-settings { grid-template-columns: 1fr; }
}
