/* Portail C&A — système visuel v25 (identité C&A Consultants).
   Menu latéral anthracite avec le logo sur fond blanc, dégradé jaune → orange → rouge du logo pour l'élément actif ;
   le rouge franc reste réservé aux alarmes. Thème clair uniquement : le logo est conçu pour un fond clair. */
:root {
  color-scheme: light;
  --bg: #f4f4f5; --surface: #ffffff; --surface-2: #f7f7f8; --surface-3: #ececef; --border: #e3e3e7; --border-strong: #c9c9cf;
  --text: #1d1d21; --muted: #5f5f68; --faint: #8b8b94;
  --accent: #c2541a; --accent-hover: #a54614; --accent-bg: #fdf0e5; --accent-text: #9a3f0e;
  --brand-1: #f6b733; --brand-2: #ee7d27; --brand-3: #e2342d; --brand-grad: linear-gradient(90deg, #f6b733, #ee7d27 55%, #e2342d);
  --ink: #2b2b2f;
  --ok: #15803d; --ok-bg: #e6f5ea; --late: #a45a06; --late-bg: #fcf1de; --lost: #c01d1d; --lost-bg: #fde7e7;
  --never: #6a4fb3; --never-bg: #eeeaf9; --free: #6b6b74; --free-bg: #ececef;
  --side-bg: #38383c; --side-bg-2: #4a4a4f; --side-text: #e6e6ea; --side-muted: #a3a3ab; --side-active: #ffffff;
  --radius: 8px; --radius-lg: 12px; --side: 248px; --top: 56px;
  --shadow-1: 0 1px 2px rgba(16, 16, 20, .05); --shadow-2: 0 8px 28px rgba(16, 16, 20, .16);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 21px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 650; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ---------- structure : barre latérale + barre supérieure */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 12px 16px 10px; font-weight: 700; font-size: 15px; color: var(--ink); flex: none;
         background: #fff; border-bottom: 4px solid; border-image: var(--brand-grad) 1; }
.brand:hover { text-decoration: none; }
.brand img { height: 46px; width: auto; display: block; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #3b7bf0, #1f55d1); display: grid; place-items: center; color: #fff; }
.brand .logo .icon { width: 16px; height: 16px; stroke-width: 2; }
.brand small { display: block; font-weight: 600; font-size: 11.5px; color: #77777f; line-height: 1.2; }
.nav { padding: 10px 10px 14px; display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: var(--side-text); font-size: 14px; }
.nav a:hover { background: var(--side-bg-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-bg-2); color: var(--side-active); font-weight: 650; box-shadow: inset 3px 0 0 var(--brand-2); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--brand-3); color: #fff; }
.nav .sub { display: flex; flex-direction: column; margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .12); }
.nav .sub a { padding: 5px 10px; font-size: 13px; color: var(--side-muted); }
.nav .sub a.active { background: var(--side-bg-2); color: #fff; }
.nav .sub a .n { margin-left: auto; font-size: 11px; color: var(--side-muted); }
.nav .sub a .alert-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff6b5e; flex: none; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 16px 10px 5px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 18px; font-size: 11.5px; color: var(--side-muted); border-top: 1px solid rgba(255, 255, 255, .07); }

.content { min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px;
       position: sticky; top: 0; z-index: 20; }
.top .js-menu { display: none; }
.top .where { font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .where strong { color: var(--text); font-weight: 600; }
.top .spacer { flex: 1; }
.client-pick { display: flex; align-items: center; gap: 8px; margin: 0; }
.client-pick label { margin: 0; font-size: 12px; white-space: nowrap; }
.client-pick select { font-weight: 600; padding: 5px 28px 5px 10px; border-color: var(--border); background-color: var(--surface-2); }
.top-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); border: 0; background: none; padding: 0; }
.top-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.top-btn .count { position: absolute; top: 2px; right: 0; font-size: 10px; font-weight: 700; min-width: 16px; padding: 0 4px; line-height: 16px; border-radius: 8px; background: var(--lost); color: #fff; text-align: center; }
.menu { position: relative; }
.menu > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 20px; color: var(--text); font-size: 13px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
            box-shadow: var(--shadow-2); padding: 6px; z-index: 40; }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font-size: 14px; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.main { padding: 22px 26px 48px; max-width: 1560px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.crumb a { color: var(--muted); } .crumb a::after { content: " ›"; color: var(--faint); }
footer { color: var(--faint); font-size: 12px; margin-top: 28px; }

/* ---------- cartes, indicateurs, tuiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-1); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; } .card.flush > .card-head { padding: 14px 18px 0; } .card.flush > .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow-1); border-left: 3px solid var(--border-strong); }
.kpi .l { font-size: 12.5px; color: var(--muted); } .kpi .v { font-size: 25px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--muted); } .kpi .d { font-size: 12px; color: var(--faint); }
.kpi.ok { border-left-color: var(--ok); } .kpi.ok .v { color: var(--ok); }
.kpi.late { border-left-color: var(--late); } .kpi.late .v { color: var(--late); }
.kpi.lost { border-left-color: var(--lost); } .kpi.lost .v { color: var(--lost); }
.kpi.accent { border-left-color: var(--accent); }
.kpi .small-v { font-size: 17px; }
.card .kpis { margin-bottom: 0; } .card .kpi { box-shadow: none; background: var(--surface-2); border-color: transparent; border-left: 3px solid var(--border-strong); }
.card .kpi.ok { border-left-color: var(--ok); } .card .kpi.late { border-left-color: var(--late); } .card .kpi.lost { border-left-color: var(--lost); } .card .kpi.accent { border-left-color: var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.tile { display: block; background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; color: var(--text); border: 1px solid transparent; border-left: 3px solid var(--ok); }
.tile:hover { border-color: var(--border-strong); border-left-color: var(--ok); text-decoration: none; }
.tile .name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.tile .val { font-size: 21px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile .meta { font-size: 11.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--faint); }
.tile.s-retard { border-left-color: var(--late); } .tile.s-perdu { border-left-color: var(--lost); } .tile.s-jamais, .tile.s-libre { border-left-color: var(--free); }
.tile.alarm { background: var(--lost-bg); border-left-color: var(--lost); } .tile.alarm .val { color: var(--lost); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.st { font-weight: 600; } .st-ok { color: var(--ok); } .st-retard { color: var(--late); } .st-perdu { color: var(--lost); } .st-jamais { color: var(--never); } .st-libre { color: var(--free); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); } .b-retard { background: var(--late-bg); color: var(--late); } .b-perdu { background: var(--lost-bg); color: var(--lost); }
.b-jamais { background: var(--never-bg); color: var(--never); } .b-libre { background: var(--free-bg); color: var(--free); } .b-accent { background: var(--accent-bg); color: var(--accent-text); }

/* ---------- sélecteurs */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
        color: var(--muted); font-size: 13px; cursor: pointer; margin: 0; }
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip.on, .chip:has(input:checked) { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.chip input { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg a, .seg button, .seg label { padding: 5px 12px; font-size: 13px; color: var(--muted); border: 0; border-left: 1px solid var(--border); border-radius: 0; background: none; margin: 0; cursor: pointer; }
.seg > :first-child { border-left: 0; } .seg a:hover, .seg button:hover, .seg label:hover { background: var(--surface-2); text-decoration: none; }
.seg a.on, .seg button.on, .seg label:has(input:checked) { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a .count { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--muted); }
.tabs a .count.hot { background: var(--lost); color: #fff; }
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-form { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.period-form input[type=date], .period-form input[type=datetime-local] { padding: 4px 8px; font-size: 13px; }
.chart, .heat-wrap { position: relative; }
.chart-tip { position: absolute; z-index: 6; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; line-height: 1.45;
             padding: 6px 9px; border-radius: 7px; white-space: nowrap; box-shadow: var(--shadow-2); }
.chart-tip strong { display: block; font-size: 12.5px; } .chart-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.stab { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; } .stab::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--late); }
.stab.ok::before { background: var(--ok); } .stab.ko::before { background: var(--lost); }
.period-form button { padding: 5px 12px; font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; display: inline-flex; }
.search input { padding-left: 32px; min-width: 220px; }
.search .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }

/* ---------- graphiques */
.chart { width: 100%; min-height: 320px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px; margin-top: 10px; font-size: 13px; }
.legend label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); margin: 0; font-size: 13px; padding: 2px 0; }
.legend label.off { color: var(--faint); }
.legend .v { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.uplot .u-title { font-size: 14px; font-weight: 600; color: var(--text); }
.uplot .u-legend { font-size: 12px; color: var(--muted); }
.heat-wrap { position: relative; }
.heat-wrap canvas { width: 100%; display: block; border-radius: 6px; }
.heat-scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.heat-scale .bar { flex: 0 0 180px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #2b6cf0, #35c0d8, #58c36a, #f2c230, #e5562f); }
.heat-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; }

/* ---------- tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
th { font-size: 11.5px; color: var(--muted); font-weight: 650; background: var(--surface-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; } th[data-sort]:hover { color: var(--text); }
th[data-sort].asc::after { content: " ▲"; font-size: 9px; } th[data-sort].desc::after { content: " ▼"; font-size: 9px; }
tbody tr:hover td, table.hover tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 650; background: var(--surface-2); }
td.out { color: var(--lost); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.card .table-wrap { box-shadow: none; }
.table-wrap.scroll { max-height: 420px; overflow-y: auto; } .table-wrap.scroll th { position: sticky; top: 0; z-index: 1; }
table.edit input:not([type=checkbox]) { width: 100%; min-width: 120px; }
table.dense th, table.dense td { padding: 5px 10px; font-size: 13px; }

/* ---------- formulaires et boutons */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
.inline-label { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: 14px; margin: 0; font-weight: 400; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; flex: none; }
input[disabled], select[disabled] { background: var(--surface-2); color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > div { min-width: 140px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input:not([type=checkbox]):not([type=radio]), .form-grid select, .form-grid textarea { width: 100%; }
.hint { font-size: 12px; color: var(--faint); margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.page-head .actions, .card-head .actions { margin-top: 0; }
button, .btn { font: inherit; font-size: 13.5px; font-weight: 500; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
               color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; line-height: 1.3; white-space: nowrap; }
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: #000; border-color: #000; }
button.danger, .btn.danger { color: var(--lost); border-color: color-mix(in srgb, var(--lost) 45%, var(--border)); }
button.danger:hover { background: var(--lost-bg); }
button.ghost, .btn.ghost { border-color: transparent; background: none; color: var(--muted); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
button.icon-btn, .btn.icon-btn { padding: 6px; border-color: transparent; background: none; color: var(--muted); }
button.icon-btn:hover, .btn.icon-btn:hover { background: var(--surface-3); color: var(--text); }
button.sm, .btn.sm { padding: 4px 10px; font-size: 12.5px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 400; }
form.inline { display: inline; }
details > summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); margin: 0; font-size: 14px; cursor: pointer; font-weight: 400; }
.check-item:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.check-item .meta { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--faint); margin-bottom: 6px; stroke-width: 1.3; }
.empty h3 { font-size: 15px; color: var(--text); }
.w100 { width: 100%; } .mt { margin-top: 16px; } .mb0 { margin-bottom: 0; } .nowrap { white-space: nowrap; } .right { margin-left: auto; }
.pre { white-space: pre-wrap; margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 500; }
.note { background: var(--accent-bg); color: var(--accent-text); border-radius: var(--radius); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.note.warn { background: var(--late-bg); color: var(--late); } .note.bad { background: var(--lost-bg); color: var(--lost); }
.error { background: var(--lost-bg); color: var(--lost); padding: 8px 12px; border-radius: var(--radius); }

/* ---------- messages */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.flash { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-2); max-width: 420px; display: flex; gap: 10px; align-items: center; }
.flash .icon { color: #5fd494; }
.flash.out { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }

/* ---------- fenêtres de dialogue */
dialog { border: 0; border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 28, .5); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font-size: 16px; }
.dlg-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100vh - 210px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.dlg-foot .left { margin-right: auto; }

/* ---------- blocs (tableaux de bord et vue d'un groupe) */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-grid > .card { margin-bottom: 0; min-width: 0; }
.dash-grid .w-full { grid-column: span 12; } .dash-grid .w-twothirds { grid-column: span 8; } .dash-grid .w-half { grid-column: span 6; } .dash-grid .w-third { grid-column: span 4; }
@media (max-width: 1100px) { .dash-grid .w-twothirds, .dash-grid .w-half, .dash-grid .w-third { grid-column: span 12; } }
.dash-block .card-head { margin-bottom: 10px; }
.dash-block .block-sub { font-size: 12px; color: var(--faint); font-weight: 400; }
.dash-block.editing { border-style: dashed; border-color: var(--border-strong); }
.dash-block.dragging { opacity: .4; }
.dash-block.drop-before { box-shadow: -4px 0 0 var(--accent); } .dash-block.drop-after { box-shadow: 4px 0 0 var(--accent); }
.block-tools { display: flex; align-items: center; gap: 2px; margin: -4px -6px -4px 0; }
.block-tools form { display: contents; }
.block-tools .handle { cursor: grab; color: var(--faint); padding: 6px 4px; display: inline-flex; }
.edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--accent-bg); color: var(--accent-text); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; }
.edit-bar .spacer { flex: 1; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 16px; }
.kind { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; margin: 0; color: var(--text); }
.kind:hover { border-color: var(--border-strong); background: var(--surface-2); }
.kind:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 1px var(--accent); }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind .icon { width: 22px; height: 22px; color: var(--accent); }
.kind strong { font-size: 13.5px; } .kind span { font-size: 12px; color: var(--muted); line-height: 1.35; font-weight: 400; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.dash-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; color: var(--text); box-shadow: var(--shadow-1); }
.dash-card:hover { border-color: var(--accent); text-decoration: none; }
.dash-card strong { font-size: 15px; } .dash-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 9px 12px; margin-bottom: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; }
.bulkbar.active { border-style: solid; border-color: var(--accent); background: var(--accent-bg); }
.bulkbar .js-count { font-weight: 600; min-width: 130px; }
.bulkbar details[open] { flex-basis: 100%; } .bulkbar details .row { margin-top: 8px; }
.block-settings { margin-bottom: 12px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius); }

/* ---------- alertes */
.sev { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--late); }
.sev.critique::before { background: var(--lost); } .sev.information::before { background: var(--accent); }
.event { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); }
.event:last-child { border-bottom: 0; }
.event .bar { align-self: stretch; border-radius: 2px; background: var(--late); }
.event.critique .bar { background: var(--lost); } .event.information .bar { background: var(--accent); } .event.closed .bar { background: var(--border-strong); } .event.attente .bar { background: var(--late); }
.event .t { font-weight: 600; font-size: 14px; } .event .d { font-size: 12.5px; color: var(--muted); }

/* ---------- plan avec sondes */
.plan { position: relative; line-height: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); user-select: none; }
.plan img { width: 100%; height: auto; display: block; }
.plan canvas.heat { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: blur(6px); }
.marker { position: absolute; transform: translate(-50%, -50%); line-height: 1.2; text-align: center; background: var(--surface); color: var(--text);
          border: 2px solid var(--ok); border-radius: 8px; padding: 2px 7px; font-size: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); white-space: nowrap; }
.marker .mv { display: flex; gap: 7px; justify-content: center; font-size: 14px; font-weight: 700; }
.chart-title { margin: 14px 0 6px; font-size: 13px; } .legend-key { grid-column: 1 / -1; font-size: 12px; color: var(--muted); } .chart-title:first-child { margin-top: 0; }
.point-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto; }
.point-opts label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; color: var(--text); font-size: 13px; }
.point-opts select { padding: 3px 6px; font-size: 12.5px; }
.marker .mn { display: block; color: var(--muted); font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.marker.st-retard { border-color: var(--late); } .marker.st-perdu, .marker.alarm { border-color: var(--lost); } .marker.st-jamais, .marker.st-libre { border-color: var(--free); }
.marker.alarm .mv { color: var(--lost); }
.marker.unplaced { opacity: .8; border-style: dashed; }
.plan.editing .marker { cursor: grab; touch-action: none; } .plan.editing .marker.dragging { cursor: grabbing; z-index: 5; }
.plan:not(.editing) .marker.unplaced { display: none; }

/* ---------- appareils : statuts, pictogrammes, cartes-filtres, fiche */
.sb { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
      background: var(--free-bg); color: var(--free); }
.sb::before, .sdot { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: currentColor; flex: none; }
.sdot { margin-right: 6px; color: var(--free); }
button.sb { border: 0; cursor: pointer; line-height: 1.5; } button.sb:hover { filter: brightness(.95); box-shadow: 0 0 0 1px currentColor; }
.s-en_service { color: var(--ok); } .sb.s-en_service { background: var(--ok-bg); }
.s-reserve { color: var(--free); }
.s-etalonnage { color: var(--accent-text); } .sb.s-etalonnage { background: var(--accent-bg); } .sdot.s-etalonnage { color: var(--accent); }
.s-maintenance { color: var(--late); } .sb.s-maintenance { background: var(--late-bg); }
.s-hors_service { color: var(--lost); } .sb.s-hors_service { background: var(--lost-bg); }
h1.with-badge { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.batt { display: inline-block; vertical-align: -2px; width: 22px; height: 11px; border: 1.5px solid var(--muted); border-radius: 3px; padding: 1px; position: relative; margin-right: 3px; }
.batt::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: var(--muted); border-radius: 0 1px 1px 0; }
.batt i { display: block; height: 100%; border-radius: 1px; background: var(--ok); width: 100%; }
.batt.l3 i { width: 75%; } .batt.l2 i { width: 50%; background: var(--late); } .batt.l1 i { width: 28%; background: var(--late); }
.batt.l0 { border-color: var(--lost); } .batt.l0::after { background: var(--lost); } .batt.l0 i { width: 12%; background: var(--lost); }
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; vertical-align: -1px; margin-right: 3px; }
.sig i { width: 3px; border-radius: 1px; background: var(--border-strong); }
.sig i:nth-child(1) { height: 4px; } .sig i:nth-child(2) { height: 7px; } .sig i:nth-child(3) { height: 10px; } .sig i:nth-child(4) { height: 13px; }
.sig.l1 i:nth-child(-n+1), .sig.l2 i:nth-child(-n+2) { background: var(--late); }
.sig.l3 i:nth-child(-n+3), .sig.l4 i { background: var(--ok); }
.sig.l0 i:first-child { background: var(--lost); }

.statcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 14px; }
.statcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
            box-shadow: var(--shadow-1); white-space: normal; text-align: left; font-weight: 400; }
.statcard:hover { border-color: var(--border-strong); background: var(--surface); }
.statcard .l { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; } .statcard .v { font-size: 22px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.statcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-bg); }
.statcard.zero .v { color: var(--faint); font-weight: 500; }
.statcard.alert .v { color: var(--lost); } .statcard.warn .v { color: var(--late); }

.gw-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; margin-bottom: 14px; }
.gw-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); box-shadow: var(--shadow-1); }
.gw-card:hover { border-color: var(--accent); text-decoration: none; } .gw-card.bad { border-left: 3px solid var(--lost); }
.gw-ico { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.gw-main { display: flex; flex-direction: column; min-width: 0; flex: 1; } .gw-state { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.selbar { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 14px; border-radius: var(--radius); background: var(--accent-bg); color: var(--accent-text); font-size: 13.5px; }
table.devices td { padding: 7px 10px; }
.tags { display: flex; gap: 4px; overflow: hidden; white-space: nowrap; max-width: 230px; } .tags .tag { margin: 2px 0 0; flex: none; } table.devices th { padding-left: 10px; padding-right: 10px; }
table.devices th.c, table.devices td.c { width: 34px; padding-right: 0; }
.dev-name { font-weight: 650; color: var(--text); font-size: 14px; } .dev-name:hover { color: var(--accent); }
.tag { display: inline-block; padding: 0 7px; margin: 2px 4px 0 0; border-radius: 5px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; line-height: 18px; }
a.tag:hover { color: var(--accent-text); background: var(--accent-bg); text-decoration: none; }
.row-actions { text-align: right; white-space: nowrap; } .row-actions > * { margin-left: 4px; }
.block { display: block; }
.seg.wrap { flex-wrap: wrap; } .seg label { display: inline-flex; align-items: center; }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.grid-2.flat { gap: 14px 28px; }
.big-fact { font-size: 30px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; } .big-fact small { font-size: 14px; font-weight: 500; color: var(--muted); }
.dl.facts { padding-top: 14px; border-top: 1px solid var(--border); }
.form-grid.tight { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.mt-s { margin-top: 6px; } .pad { padding: 0 18px; }
.setlist { border-top: 1px solid var(--border); margin-top: 12px; }
.setrow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.setrow:last-child { border-bottom: 0; }
.setrow .k strong { display: block; font-size: 13.5px; font-weight: 600; } .setrow .k span { font-size: 12px; color: var(--muted); }
.setrow .v { font-size: 14px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; } .setrow .a { min-width: 104px; text-align: right; }
.setrow progress { width: 110px; height: 8px; vertical-align: middle; margin-right: 8px; accent-color: var(--ok); } .setrow progress.warn { accent-color: var(--late); }
.tagname { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); }
@media (max-width: 700px) { .setrow { grid-template-columns: 1fr; } .setrow .a { text-align: left; } }
.place { margin-bottom: 6px; }
.props { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 28px; margin: 0; }
.props > div { padding: 9px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.props dt { font-size: 12px; color: var(--muted); } .props dd { margin: 1px 0 0; font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; } .inline-form select { padding: 4px 8px; font-size: 13px; }
.grid-2.top { align-items: start; }
.js-series { min-height: 120px; color: var(--muted); } .js-series.loading::before { content: "Chargement des mesures…"; font-size: 13px; }
.js-series .chart { min-height: 0; margin-bottom: 8px; color: var(--text); }
dialog.xwide { width: min(1080px, calc(100vw - 32px)); }
.chan-table input { min-width: 0 !important; } .chan-table input.n { text-align: right; width: 78px; } .chan-table td:first-child input { min-width: 170px !important; }
.place { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--text); border: 1px solid transparent; }
.place:hover { border-color: var(--accent); text-decoration: none; } .place strong { font-size: 15px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline.scroll { max-height: 420px; overflow-y: auto; }
.timeline li { position: relative; padding: 0 0 12px 10px; display: flex; flex-direction: column; font-size: 13.5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline li.now::before { border-color: var(--ok); background: var(--ok); }
.admin-zone { margin-top: 26px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--accent-bg) 35%, transparent); }
.admin-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--accent-text); }
.admin-head > div { display: flex; flex-direction: column; } .admin-head span { font-size: 12.5px; color: var(--muted); }
.admin-zone .grid-2 { align-items: start; }
.dl dd { min-width: 0; } form.reveal { display: flex; gap: 4px; margin: 4px 0 2px; } form.reveal input { padding: 3px 8px; font-size: 12.5px; width: 120px; }
.swap { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: start; }
.swap-col select { width: 100%; font-weight: 600; }
.swap-info { display: flex; flex-direction: column; margin-top: 8px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-height: 62px; }
.swap-arrow { margin-top: 26px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; }
@media (max-width: 640px) { .swap { grid-template-columns: 1fr; } .swap-arrow { margin: 0 auto; transform: rotate(90deg); } }
.status-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.status-grid .kind strong { display: flex; align-items: center; }

/* ---------- connexion */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #4a4a4f, #2b2b2f); }
.login { width: min(400px, 100%); margin: 0; padding: 28px; }
.login .brand { height: auto; padding: 0 0 16px; margin-bottom: 16px; color: var(--text); background: none; }
.login .brand img { height: 63px; }
.login .brand small { color: var(--muted); }
.login button.w100 { justify-content: center; padding: 9px; }

/* ---------- petit écran */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: var(--side); transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-2); }
  .top { padding: 0 12px; } .top .js-menu { display: inline-grid; } .top .where { display: none; }
  .client-pick label { display: none; } .menu > summary .name { display: none; }
  .main { padding: 16px 14px 40px; }
  .chart { min-height: 250px; }
  .search input { min-width: 0; width: 100%; }
}
@media print {
  .side, .top, .toasts, .no-print, .block-tools, .edit-bar { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; } body { background: #fff; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}

/* mise à jour du firmware */
.fw-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.fw-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.fw-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.fw-choice input { margin-top: 3px; }
.ota-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }
.ota-steps li.on { color: inherit; font-weight: 600; } .ota-steps li.on::marker { content: "▶ "; color: var(--accent); }
.ota-steps li.ok { color: var(--ok); } .ota-steps li.ok::marker { content: "✓ "; }
.ota-steps li.ko { color: var(--lost); font-weight: 600; } .ota-steps li.ko::marker { content: "✗ "; }
.ota-steps progress { width: 180px; height: 8px; vertical-align: middle; accent-color: var(--ok); }
/* mise à jour en série */
#batch-table tr.on td { background: var(--accent-bg); }
.js-state.ok-text { color: var(--ok); } .js-state.bad-text { color: var(--lost); }
.ota-now { font-size: 15px; } .ota-now strong { font-size: 17px; }
.ota-run progress { width: 180px; height: 8px; vertical-align: middle; accent-color: var(--ok); }
.mb { margin-bottom: 16px; }

/* ------------------------------------------------------------------ deux espaces : Surveillance / Administration C&A */
.space-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-3); margin-right: 12px; }
.space-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.space-switch a:hover { text-decoration: none; color: var(--text); }
.space-switch a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.space-admin .space-switch a.on { color: #a8640c; }
.space-admin .side { --side-bg: #1f1a12; --side-bg-2: #2f281c; --side-muted: #a99a80; --side-text: #e3d9c6; }
.space-admin .side .nav a.active { background: #b5730d; }
.space-admin .side .brand .logo { background: #b5730d; }
.space-admin header.top { box-shadow: inset 0 -3px 0 #b5730d; }
@media (max-width: 900px) { .space-switch a { padding: 5px 8px; } .space-switch a svg + * { display: none; } }
@media (max-width: 1100px) { .space-switch ~ .where { display: none; } }

/* ---------- v25 : onglets des tableaux de bord, blocs transversaux, mode modification avec panneau, partage */
.dtabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.dtabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dtabs a:hover { color: var(--text); text-decoration: none; }
.dtabs a.on { color: var(--text); border-bottom-color: var(--brand-2); }
.star { color: var(--brand-2); margin-right: 4px; }
.dinfo { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; color: var(--muted); font-size: 13px; margin: 9px 0 18px; }
.dinfo span { display: inline-flex; align-items: center; gap: 5px; } .dinfo strong { color: var(--text); font-weight: 600; }
.dash-block.k-etat > .card-head { display: none; }
.dash-block.k-etat { padding: 0; border: 0; background: none; box-shadow: none; }
.dash-block.k-etat.editing > .card-head { display: flex; padding: 0 2px 8px; }
.statusl { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand-2);
           border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow-1); }
.statusl strong { font-size: 15.5px; } .statusl .spacer { flex: 1; }
.gcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.gcard { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.gcard-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.gcard-head a { color: var(--text); font-size: 15px; }
.gvals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.gv { background: var(--surface); border-radius: 8px; padding: 8px 10px; }
.gv .l { font-size: 12px; color: var(--muted); } .gv .v { font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
.gv .v small { font-size: 12.5px; font-weight: 500; color: var(--muted); } .gv .r { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gfoot { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }

.ed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.ed-main { min-width: 0; }
.dash-block.editing { cursor: pointer; outline: 2px dashed var(--border-strong); outline-offset: -2px; }
.dash-block.editing:hover { outline-color: var(--muted); }
.dash-block.editing.selected { outline: 2px solid var(--brand-2); box-shadow: 0 0 0 4px var(--accent-bg); }
.addzone { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px; padding: 18px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
           color: var(--muted); font-weight: 600; }
.addzone:hover { border-color: var(--brand-2); color: var(--accent); text-decoration: none; }
.ed-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); position: sticky; top: calc(var(--top) + 12px);
            max-height: calc(100vh - var(--top) - 24px); overflow-y: auto; box-shadow: var(--shadow-1); }
.ptabs { display: flex; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.ptabs a { flex: 1; text-align: center; padding: 10px 4px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 3px solid transparent; }
.ptabs a:hover { color: var(--text); text-decoration: none; } .ptabs a.on { color: var(--text); border-bottom-color: var(--brand-2); }
.pbody { padding: 14px 16px 16px; }
.pbody h3 { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.panel-form label:not(.chip):not(.inline-label) { display: block; } .panel-form > input, .panel-form > select { width: 100%; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lib { display: flex; flex-direction: column; gap: 7px; }
.lib a { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; background: var(--surface-2); color: var(--text); }
.lib a:hover { border-color: var(--brand-2); background: var(--accent-bg); text-decoration: none; }
.lib a .icon { margin-top: 2px; color: var(--muted); }
.lib strong { display: block; font-size: 14px; } .lib small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.share { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.srow { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.srow .si { color: var(--muted); padding-top: 2px; } .srow .sn { flex: 1; min-width: 0; }
.srow .sn strong { display: block; } .srow .sn small { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.srow select { font-size: 13px; padding: 3px 26px 3px 8px; }
.add-ref { width: 100%; border-style: dashed; border-color: var(--border-strong); background-color: var(--surface-2); font-weight: 600; }
.reach { background: var(--surface-2); border-radius: 9px; padding: 9px 11px; font-size: 13px; color: var(--muted); }
.reach strong { color: var(--text); }
.row-btns { display: inline-flex; gap: 2px; margin: 0; } form.inline { display: inline; margin: 0; }
@media (max-width: 1150px) { .ed-layout { grid-template-columns: minmax(0, 1fr); } .ed-panel { position: static; max-height: none; } }
@media (max-width: 700px) {
  .top { gap: 6px; } .client-pick label, .menu > summary .name { display: none; }
  .client-pick select { max-width: 120px; min-width: 0; padding-right: 22px; } .space-switch { margin-right: 0; }
  .space-switch a { font-size: 0; gap: 0; padding: 6px 9px; } /* icônes seules : Surveillance, Administration */
}

/* ---------- v25b : « Gérer les tableaux » et panneau de partage, comme la maquette */
.manage td { vertical-align: top; padding-top: 11px; padding-bottom: 11px; }
.manage .row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.manage button.sm, .manage .btn.sm { padding: 3px 10px; }
.proto-note { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--border); margin-top: 22px; padding-top: 10px; }
.share-panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 16px 0 8px; font-weight: 700; }
.share-panel h4:first-of-type { margin-top: 2px; }
.share-panel .srow { align-items: flex-start; }
.share-panel .si { font-size: 16px; line-height: 22px; padding: 0; }
.share-panel .sx { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 14px; cursor: pointer; }
.share-panel .sx:hover { color: var(--lost); }
.share-panel .chk { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; cursor: pointer; }
.share-panel .chk small { display: block; color: var(--muted); font-weight: 400; }
.add-ref { border: 1px dashed var(--muted); border-radius: 10px; padding: 8px 10px; }

/* ---------- v25c : page Sondes simplifiée (comme la maquette) */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 18px; padding: 4px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.fchip b { margin-left: 3px; color: var(--text); font-weight: 650; }
.fchip:hover { border-color: var(--border-strong); }
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; } .fchip.on b { color: #fff; }
.filters .search { margin-left: auto; }
.devices.simple:not(.selectable) .selcol { display: none; }
.devices.simple tr.click { cursor: pointer; } .devices.simple tr.click:hover td { background: var(--surface-2); }
.devices.simple td.lost { color: var(--lost); font-weight: 600; }
.actions-menu > summary { list-style: none; } .actions-menu > summary::-webkit-details-marker { display: none; }
.actions-menu .menu-pop { min-width: 290px; }
@media (max-width: 700px) { .filters .search { margin-left: 0; width: 100%; } .filters .search input { width: 100%; } }

/* ---------- v25d : Sondes — une barre de filtres attachée au tableau, barre d'actions flottante pour les sondes cochées */
.count-pill { display: inline-block; vertical-align: middle; margin-left: 6px; font-size: 13px; font-weight: 650; color: var(--muted); background: var(--surface-3); border-radius: 10px; padding: 1px 9px; }
.dev-card { overflow: hidden; }
.dev-card .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.dev-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dev-bar .search input { min-width: 260px; }
.dev-bar .seg b, .fchip b { font-weight: 650; margin-left: 4px; }
.dev-bar .seg button { display: inline-flex; align-items: center; }
.dev-bar .spacer { flex: 1; }
.fchip.warn { border-color: #f1d19c; background: var(--late-bg); color: var(--late); } .fchip.warn b { color: var(--late); }
.fchip.bad { border-color: #f3b9b9; background: var(--lost-bg); color: var(--lost); } .fchip.bad b { color: var(--lost); }
.fchip.warn.on, .fchip.bad.on { background: var(--ink); border-color: var(--ink); color: #fff; } .fchip.warn.on b, .fchip.bad.on b { color: #fff; }
.devices.simple tr:has(input[name=sel]:checked) td { background: var(--accent-bg); }
.selbar.float { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: #fff; padding: 8px 8px 8px 18px;
                border-radius: 12px; box-shadow: var(--shadow-2); gap: 8px; }
.selbar.float button { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff; }
.selbar.float button:hover { background: rgba(255, 255, 255, .2); }
.selbar.float .js-count { margin-right: 6px; }
@media (max-width: 700px) { .dev-bar .search, .dev-bar .search input { width: 100%; min-width: 0; } .selbar.float { left: 12px; right: 12px; transform: none; flex-wrap: wrap; } }
.selbar.float .js-count { white-space: nowrap; }
@media (min-width: 901px) { .selbar.float { left: calc(50% + var(--side) / 2); } }

.plan-list { display: flex; flex-direction: column; gap: 6px; }
.plan-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; }
.plan-row > span { flex: 1; min-width: 0; } .plan-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row small { display: block; color: var(--muted); font-size: 12px; } .plan-row form { margin: 0; }
.motif-row input { flex: 1; min-width: 240px; }
.equip-pick { display: flex; flex-direction: column; gap: 4px; } .equip-pick.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.bad-txt { color: var(--bad, #c2332a); }
.sig-preview { max-height: 70px; max-width: 260px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 4px; }
.new-eq { margin-top: 8px; } .new-eq summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.nav a.sub-link { padding-left: 34px; font-size: 13px; }

/* Fiches liste + détail (utilisateurs, comptes, équipes) */
.lf-split { display: grid; grid-template-columns: minmax(250px, 330px) 1fr; gap: 16px; align-items: start; }   /* liste + fiche (utilisateurs, comptes, équipes) */
@media (max-width: 900px) { .lf-split { grid-template-columns: 1fr; } }
.search.w100 { flex: 1; } .search.w100 input { width: 100%; }
.ulist { display: flex; flex-direction: column; gap: 6px; }
.urow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.urow:hover { text-decoration: none; border-color: var(--border-strong); } .urow.on { border-color: var(--accent); background: var(--accent-bg); }
.urow .av, .fiche-head .av { border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-weight: 700; flex: none; }
.urow .av { width: 32px; height: 32px; font-size: 12px; } .urow.on .av { background: var(--accent); color: #fff; }
.urow .t { flex: 1; min-width: 0; } .urow .t strong { display: block; font-size: 14px; } .urow .t small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fiche-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; } .fiche-head .av { width: 44px; height: 44px; font-size: 16px; background: var(--accent-bg); color: var(--accent-text); }
.fiche-head h2 { margin: 0; } .fiche-head .sub { color: var(--muted); font-size: 13px; } .fiche-head .spacer { flex: 1; }
.fiche-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); } .fiche-foot .spacer { flex: 1; }
.rights { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 16px; }
.rmod { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px 10px; margin: 0; min-width: 0; }
.rmod legend { font-weight: 650; font-size: 13.5px; padding: 0 6px; } .rmod legend .tiny { color: var(--lost); font-weight: 500; margin-left: 6px; }
.rmod.locked { opacity: .55; } .rmod .right { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; font-size: 13.5px; line-height: 1.35; }
.rmod .right input { margin-top: 3px; flex: none; } .rmod .right .tiny { white-space: nowrap; margin-left: auto; }
.danger-box { border: 1px solid var(--lost); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; } .danger-box h3 { margin: 0 0 6px; color: var(--lost); font-size: 14px; }
.small-card { padding: 12px 14px; } .small-card summary { cursor: pointer; font-weight: 600; font-size: 13px; }

.switch-list .sw { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.switch-list .sw:last-child { border-bottom: 0; } .sw .l { font-weight: 600; } .sw .d { font-size: 12px; color: var(--muted); }
.sw input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ok); flex: none; }
/* Droits hérités d'une équipe */
.rmod .right.inh input { accent-color: #1d4ed8; } .badge.b-team { background: #e8efff; color: #1d4ed8; white-space: nowrap; margin-left: auto; }
/* Audit trail : une ligne par entrée, regroupée par jour, détails repliés */
.journal { display: flex; flex-direction: column; gap: 6px; }
.jday { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.jrow { display: grid; grid-template-columns: 78px 150px 1fr; gap: 6px 14px; align-items: start; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 760px) { .jrow { grid-template-columns: 78px 1fr; } .jrow .jwho { grid-column: 2; } .jrow .jbody { grid-column: 1 / -1; } }
.jtime { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; } .jtime time { font-weight: 600; font-size: 13.5px; }
.jwho { font-size: 13.5px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jbody { min-width: 0; font-size: 13.5px; line-height: 1.5; } .jbody .badge { margin-right: 6px; vertical-align: 1px; }
.jreason { font-style: italic; color: var(--muted); font-size: 13px; margin-top: 2px; }
.jdetails { margin-top: 4px; } .jdetails summary { cursor: pointer; color: var(--accent-text); }
.jd { margin-top: 6px; font-size: 12.5px; max-width: 760px; } .jd td, .jd th { padding: 3px 8px; vertical-align: top; } .jd td:first-child { color: var(--muted); white-space: nowrap; }
.legend-fam .badge { margin-right: 2px; }
.badge.fam-creation { background: var(--ok-bg); color: var(--ok); } .badge.fam-modification { background: var(--accent-bg); color: var(--accent-text); }
.badge.fam-suppression { background: var(--lost-bg); color: var(--lost); } .badge.fam-securite { background: var(--surface-3); color: var(--muted); }
.badge.fam-etalonnage { background: #e8efff; color: #1d4ed8; } .badge.fam-appareils { background: var(--late-bg); color: var(--late); }
.badge.fam-plateforme { background: #ece6fb; color: #5b2fb3; }
