/* Autonomia Design - dark: same palette as the fleet overview (supervision); light
   below, chosen by the system or by the topbar button (data-theme, base.html).
   Labels drawn on the aerial photo keep their own colours in both. */
:root {
    color-scheme: dark;
    --bg: #0b1220;
    --panel: #0f172a;
    --panel-2: #111827;
    --tile: #16223a;                         /* a block within a panel (layout editor) */
    --tile-head: #1d2b48;                    /* a section header within a tile */
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #14b8a6;
    --accent-2: #f59e0b;
    --border: rgba(148, 163, 184, 0.15);
    --ok: #22c55e;
    --danger: #ef4444;
    /* Compliance messages, everywhere: orange = works but beyond what is recommended,
       red = non-compliant (check-warn / check-error). Bright on the dark panels. */
    --check-warn: #fb923c;
    --check-error: #f87171;
    --on-accent: #042f2e;                    /* text on an accent background */
    --overlay: rgba(11, 18, 32, 0.85);       /* legends and tips over the map or a chart */
    --hover: rgba(20, 184, 166, 0.15);
    --backdrop: rgba(2, 6, 23, 0.6);
    --relief: #334155;                       /* far horizon chart */
    --relief-line: #94a3b8;
    --near: #a0714a;                         /* near obstacles (buildings, roofs) */
    --near-line: #c99a6e;
    --trees: #3f8f4a;
    --trees-line: #6cc077;
    --peak: #e2e8f0;
    --path-label: #fbbf24;
    /* Each variant's colour in the comparisons (variant_compare.js): categorical, in this order. */
    --variant-1: #3987e5; --variant-2: #d95926; --variant-3: #199e70; --variant-4: #c98500;
    --variant-5: #d55181; --variant-6: #008300; --variant-7: #9085e9; --variant-8: #e66767;
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --panel: #ffffff;
    --panel-2: #eef2f6;
    --tile: #f4f7fa;
    --tile-head: #e6ecf2;
    --text: #0f172a;
    --muted: #526175;
    --accent: #0f766e;
    --accent-2: #b45309;
    --border: rgba(15, 23, 42, 0.14);
    --ok: #15803d;
    --danger: #dc2626;
    --check-warn: #c2410c;      /* dark orange, readable on white */
    --check-error: #b91c1c;
    --on-accent: #ffffff;
    --overlay: rgba(255, 255, 255, 0.92);
    --hover: rgba(15, 118, 110, 0.12);
    --backdrop: rgba(15, 23, 42, 0.35);
    --relief: #cbd5e1;
    --relief-line: #64748b;
    --near: #a0714a;
    --near-line: #6f4a2c;
    --trees: #4e9a52;
    --trees-line: #2f6b34;
    --peak: #334155;
    --path-label: #b45309;
    --variant-1: #2a78d6; --variant-2: #eb6834; --variant-3: #1baf7a; --variant-4: #eda100;
    --variant-5: #e87ba4; --variant-6: #008300; --variant-7: #6250d6; --variant-8: #e34948;
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg: #f3f5f8;
        --panel: #ffffff;
        --panel-2: #eef2f6;
        --tile: #f4f7fa;
        --tile-head: #e6ecf2;
        --text: #0f172a;
        --muted: #526175;
        --accent: #0f766e;
        --accent-2: #b45309;
        --border: rgba(15, 23, 42, 0.14);
        --ok: #15803d;
        --danger: #dc2626;
    --check-warn: #c2410c;      /* dark orange, readable on white */
    --check-error: #b91c1c;
        --on-accent: #ffffff;
        --overlay: rgba(255, 255, 255, 0.92);
        --hover: rgba(15, 118, 110, 0.12);
        --backdrop: rgba(15, 23, 42, 0.35);
        --relief: #cbd5e1;
        --relief-line: #64748b;
        --near: #a0714a;
        --near-line: #6f4a2c;
        --trees: #4e9a52;
        --trees-line: #2f6b34;
        --peak: #334155;
        --path-label: #b45309;
        --variant-1: #2a78d6; --variant-2: #eb6834; --variant-3: #1baf7a; --variant-4: #eda100;
        --variant-5: #e87ba4; --variant-6: #008300; --variant-7: #6250d6; --variant-8: #e34948;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* The hidden attribute always wins over component display rules (.btn, .toggle...). */
[hidden] { display: none !important; }

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.study-pdfs a.pdf-ready::after { content: ' ✓'; }

/* Layout */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 32px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); white-space: nowrap; }
.brand span { color: var(--accent); font-weight: 400; }
.topbar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; font-size: 0.9rem; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a[aria-current] { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 2px; }
.topbar nav .nav-account { border-left: 1px solid var(--border); padding-left: 20px; }
.topbar nav .nav-account .chip { margin: 0 0 0 4px; }

/* Breadcrumb (navigation.py): where the page is, above its title. */
.breadcrumb { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: -12px 0 14px; font-size: 0.85rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.breadcrumb li { display: flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] { color: var(--text); }
.breadcrumb .btn-return { border-color: var(--accent); color: var(--accent); }

.page { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { margin-top: 4px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
}
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin-bottom: 0; }
.empty { text-align: center; padding: 40px; display: flex; flex-direction: column; gap: 16px; align-items: center; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .detail-layout { grid-template-columns: minmax(0, 1fr); } }
/* Two columns: the map follows the scroll of the long left column, as tall as the screen allows. */
@media (min-width: 1001px) {
    .detail-layout > .map-card { position: sticky; top: 16px; }
    .detail-layout > .map-card .map { height: calc(100vh - 150px); min-height: 420px; }
}

/* Buttons */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-small { padding: 5px 12px; font-size: 0.8rem; }
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }

/* Messages */
.messages { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.msg { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); }
.msg-success { border-color: var(--ok); }
.msg-error { border-color: var(--danger); }
.form-errors ul { margin: 6px 0 0; padding-left: 20px; }
.msg-info, .msg-warning { border-color: var(--accent-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 400; font-size: 0.8rem; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td.nowrap { white-space: nowrap; }
.table th a.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.table th a.th-sort:hover { color: var(--text); text-decoration: underline; }
.table th a.th-sort.active { color: var(--text); font-weight: 600; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table-form td { padding: 6px; }
.table-form input[type=text], .table-form input[type=number] { width: 100%; min-width: 70px; }

.chip-inactive { opacity: .5; text-decoration: line-through; }
/* A list's filter (the projects' statuses): chips to click, the chosen one marked. */
.list-filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; }
.list-filters a.chip { margin: 0; padding: 4px 12px; font-size: 0.82rem; color: var(--text); text-decoration: none; }
.list-filters a.chip:hover { border-color: var(--accent); }
.list-filters a.chip-chosen { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.list-filters a.chip-chosen .muted { color: inherit; opacity: .8; }
.chip { display: inline-block; padding: 2px 8px; margin: 1px 4px 1px 0; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 0.75rem; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; border: 1px solid var(--border); }
.status-draft { color: var(--muted); }
.status-quoted { color: var(--accent-2); border-color: var(--accent-2); }
.status-sent { color: var(--accent); border-color: var(--accent); }
.status-won { color: var(--ok); border-color: var(--ok); }
.status-lost { color: var(--danger); border-color: var(--danger); }

/* Forms */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-address { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 0.6fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
@media (max-width: 800px) { .grid-3, .grid-address { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; color: var(--muted); }
.card > .field { margin-top: 14px; }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=url], input[type=password],
input[type=tel], select, textarea {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
    font: inherit; font-size: 0.9rem; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.errorlist { list-style: none; color: var(--danger); font-size: 0.8rem; }

.autocomplete { position: relative; }
.suggestions {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin-top: 4px; list-style: none;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.suggestions li { padding: 8px 12px; cursor: pointer; font-size: 0.9rem; }
.suggestions li:hover { background: var(--hover); }

/* Project detail */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.notes { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--muted); }
.map { height: 520px; border-radius: 10px; overflow: hidden; }
.toggle { font-size: 0.85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }

@media (max-width: 640px) {
    .topbar, .page { padding-left: 16px; padding-right: 16px; }
    .map { height: 380px; }
}

/* Roof editor */
.editor-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: 1fr; } }
.editor-panel { display: flex; flex-direction: column; gap: 14px; }
.editor-panel .card-head { margin-bottom: 0; }
.editor-map { height: calc(100vh - 230px); min-height: 480px; }
/* The map stays in view while a long side panel scrolls (two-column layout),
   sharing the screen height with the power curve when it is open. */
@media (min-width: 1001px) {
    .editor-map-card { position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column; }
    .editor-map-card .map-frame { flex: 1 1 auto; min-height: 260px; display: flex; flex-direction: column; }
    .editor-map-card .editor-map { flex: 1 1 auto; height: auto; min-height: 260px; }
    .editor-map-card .curve-pane { flex: 0 1 auto; max-height: 60%; overflow-y: auto; }
}
/* The editors' status line (instructions while drawing, results): over the top of
   the map, where the user is looking - under it, it was often out of sight. */
.map-frame { position: relative; }
.map-message {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
    max-width: min(640px, calc(100% - 120px)); margin: 0; padding: 8px 14px; border-radius: 8px;
    background: var(--overlay); color: var(--text); font-size: 0.9rem; text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); pointer-events: none;
}
.map-message:empty { display: none; }
#editor-status.error { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Fields whose labels wrap differently: their inputs on one line. */
.grid-2.align-end { align-items: end; }
.actions-wrap { flex-wrap: wrap; justify-content: flex-start; }
.btn:disabled { opacity: 0.5; cursor: default; }

.plane-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plane-list li {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; font-size: 0.85rem;
}
.plane-list li span:not(.quality) { grid-column: 1; color: var(--muted); font-size: 0.8rem; }
.plane-list li .quality { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.plane-list li:hover { border-color: var(--accent); }
.plane-list li.selected { border-color: var(--accent-2); }
/* A row that unfolds in place (expandable_row.js): header button, details inside the frame. */
.plane-list li.expandable { display: block; padding: 0; cursor: default; }
.plane-list li.expandable.selected { background: var(--panel-2); }
.row-head {
    display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; width: 100%;
    padding: 8px 10px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.plane-list .row-head .row-chevron { grid-column: 1; grid-row: 1 / span 2; color: var(--muted); transition: transform 0.15s; }
.plane-list .row-head[aria-expanded="true"] .row-chevron { transform: rotate(90deg); color: var(--accent-2); }
.plane-list .row-head strong { grid-column: 2; }
.plane-list .row-head .row-summary { grid-column: 2; color: var(--muted); font-size: 0.8rem; }
.plane-list .row-head .quality { grid-column: 3; grid-row: 1 / span 2; }
.plane-list li.expandable > :not(.row-head) { margin: 0 10px 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.plane-list li.expandable > :not(.row-head) .plane-details { border-top: 0; padding-top: 0; }
.plane-details { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.angles-save { display: flex; flex-direction: column; gap: 6px; }
/* A creation not finished yet (a drawn obstacle waiting for its description). */
.editor-panel .plane-details.pending-step { border: 1px dashed var(--accent-2); border-radius: 10px; padding: 12px; }
.pending-step-title { margin: 0; color: var(--accent-2); font-size: 0.9rem; }

.quality { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.quality-good { color: var(--ok); border-color: var(--ok); }
.quality-fair { color: var(--accent-2); border-color: var(--accent-2); }
.quality-poor { color: var(--danger); border-color: var(--danger); }
.quality-action { background: none; font-family: inherit; line-height: inherit; cursor: pointer; }
.quality-action:hover:not(:disabled) { background: var(--hover); }
.quality-action:disabled { cursor: progress; opacity: 0.6; }
.run-progress {
    position: relative; display: inline-block; vertical-align: middle; width: 11em; overflow: hidden;
    border: 1px solid var(--accent); border-radius: 999px; background: var(--panel-2);
    font-size: 0.7rem; padding: 2px 8px; text-align: center; white-space: nowrap; cursor: progress;
}
.run-progress > span { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 30%, transparent); transition: width 0.3s; }
.run-progress > em { position: relative; font-style: normal; color: var(--accent); }
.quality-note { overflow-wrap: anywhere; font-size: 0.8rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }

.vertex-handle {
    width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent-2); cursor: grab;
}
.map-toggles { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }

/* Layout editor */
.variant-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.layout-summary { font-size: 1rem; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.layout-summary strong { color: var(--accent); }
.zone-mode { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
.plane-details select { font-size: 0.85rem; }
.obstacle-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.variant-switch { align-items: center; }
.layout-links { margin-top: 14px; }
.map-toggles { align-items: center; }
.icon-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.map-legend {
    background: var(--overlay); color: var(--text); font-size: 0.75rem; padding: 6px 10px;
    border-radius: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.map-legend-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.measure-label {
    background: rgba(255, 255, 255, 0.9); color: #0b1220; font-size: 0.7rem; font-weight: 600;
    padding: 1px 5px; border-radius: 4px; white-space: nowrap; pointer-events: none;
}
.offset-grid { display: grid; grid-template-columns: 1fr auto auto 80px; gap: 6px; align-items: center; font-size: 0.8rem; }
.measure-label { display: inline-block; }
.measure-angle { background: rgba(245, 158, 11, 0.95); color: #0b1220; }
.near-miss-label { background: rgba(249, 115, 22, 0.95); color: #0b1220; }
.measure-live { pointer-events: none; }
.production-line { font-size: 0.85rem; margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Production chart */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: rgba(148, 163, 184, 0.15); stroke-width: 1; }
.chart-baseline { stroke: rgba(148, 163, 184, 0.45); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: 'Sora', sans-serif; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--text); margin-bottom: 8px; }
.chart-legend i, .chart-tooltip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-subtitle { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.chart-tooltip {
    position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; white-space: nowrap; color: var(--text);
}
.chart-table { margin-top: 10px; font-size: 0.85rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table th.variant-head { text-align: center; color: var(--text); }
.stringing { font-size: 0.8rem; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.check::before { margin-right: 6px; }
.check-ok { color: var(--ok); }
.check-ok::before { content: '✓'; }
/* The two levels of every compliance message (equipment, cables, protections…):
   orange, works but beyond what is recommended; red, non-compliant. */
.check-warn { color: var(--check-warn); }
.check-warn::before { content: '⚠'; }
.check-error { color: var(--check-error); }
.check-error::before { content: '✕'; }
.check-detailed { cursor: help; position: relative; }
.check-detail {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px;
    padding: 8px 10px; border-radius: 8px; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    white-space: pre-line; font-size: 0.78rem; line-height: 1.45; font-weight: 400;
}
.check-detailed:hover .check-detail, .check-detailed:focus .check-detail, .check-detailed.open .check-detail { display: block; }
.check-info { font-weight: 600; opacity: 0.85; }
.equipment-section { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.equipment-section h3 { font-size: 0.9rem; font-weight: 600; }
/* Équipement (equipment_panel.js): groups in the diagram's order, one control per line, the checks
   of each element under its field. */
.eq-group { display: flex; flex-direction: column; gap: 10px; }
.eq-group + .eq-group { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.eq-group > h4 { margin: 0; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.eq-group .field { gap: 4px; min-width: 0; }
.eq-group .field > select, .eq-group .field > input[type=number], .eq-pair select, .eq-pair input { width: 100%; min-width: 0; font-size: 0.85rem; }
.eq-pair, .controller-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 58px 30px; gap: 6px; align-items: center; }
.controller-line { margin-bottom: 6px; }
.controller-line .btn { width: 30px; padding-left: 0; padding-right: 0; }
.eq-group .eq-short > input[type=number] { width: calc(50% - 5px); }
.eq-pair-wide { grid-template-columns: minmax(0, 1fr) 112px; }
.eq-pair.eq-pair-alone { grid-template-columns: minmax(0, 1fr); }
.eq-pair-alone > :not(:first-child) { display: none; }
.eq-times { color: var(--muted); font-size: 0.85rem; }
.eq-halves { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.eq-add { align-self: flex-start; }
.eq-summary { font-size: 0.8rem; padding: 6px 10px; border-radius: 8px; background: var(--tile-head); }
#stringing-report { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
#stringing-report:empty { display: none; }
.field-checks { display: flex; flex-direction: column; gap: 2px; font-size: 0.78rem; line-height: 1.35; }
.field-checks:empty { display: none; }
#equipment-outputs { font-size: 0.78rem; }
.mode-switch { display: flex; gap: 8px; }
.mode-switch [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.select-box { position: absolute; border: 1.5px dashed #f59e0b; background: rgba(245, 158, 11, 0.12); pointer-events: none; z-index: 5; }

/* Power curve pane (above the layout map) */
.curve-pane { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.curve-pane[hidden] { display: none; }
.curve-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.curve-date { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.curve-date input[type=range] { width: 160px; accent-color: var(--accent); }
.curve-date input[type=date] { width: auto; padding: 4px 8px; }
.curve-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-size: 0.85rem; margin-bottom: 4px; }
.curve-head .chart-legend { margin-bottom: 0; }
.curve-body { display: flex; flex-direction: column; gap: 6px; }
.curve-pane .curve-summary { font-size: 0.82rem; }
.curve-pane .hint { margin: 0; }
.curve-chart { min-height: 178px; display: flex; flex-direction: column; }
.curve-message { margin: auto 0; text-align: center; }
.curve-warning { font-size: 0.78rem; padding: 6px 10px; }
.curve-footer { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; }
.energy-scale { font-size: 0.75rem; display: flex; flex-direction: column; gap: 3px; width: 280px; }
.energy-bar { height: 10px; border-radius: 3px; }
.energy-ticks { display: flex; justify-content: space-between; color: var(--text); font-variant-numeric: tabular-nums; }
.curve-popup .maplibregl-popup-content { background: var(--panel); color: var(--text); font-size: 0.78rem; padding: 6px 10px; border: 1px solid var(--border); }
.curve-popup { pointer-events: none; }
.curve-popup .maplibregl-popup-tip { display: none; }
.curve-summary { font-size: 0.9rem; }
.chart-cross { stroke: rgba(148, 163, 184, 0.6); stroke-width: 1; }
.chart-legend i.dotted { background: none; border-top: 2px dotted; height: 0; border-radius: 0; width: 14px; vertical-align: 3px; }
/* Far horizon chart */
.horizon-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.horizon-head .btn { white-space: nowrap; }
.horizon-chart svg { display: block; }
.horizon-relief { fill: var(--relief); stroke: var(--relief-line); stroke-width: 1; }
.horizon-near { fill: var(--near); fill-opacity: 0.85; stroke: var(--near-line); stroke-width: 1; }
.horizon-trees { fill: var(--trees); fill-opacity: 0.85; stroke: var(--trees-line); stroke-width: 1; }
.chart-legend i.horizon-swatch-far { background: var(--relief); border: 1px solid var(--relief-line); }
.chart-legend i.horizon-swatch-near { background: var(--near); }
.chart-legend i.horizon-swatch-trees { background: var(--trees); }
.shading-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.horizon-peak-mark { fill: var(--peak); }
.horizon-peak { fill: var(--text); font-size: 11px; font-family: 'Sora', sans-serif; font-weight: 600; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.horizon-path-label { fill: var(--path-label); paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.horizon-table td, .horizon-table th { padding: 4px 8px; }
.chart-legend i.dashed { background: none; border-top: 2px dashed; height: 0; border-radius: 0; width: 14px; vertical-align: 3px; }
.stack-small { display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.model-section { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.model-section h3 { font-size: 0.9rem; font-weight: 600; }
/* Stockage section (storage_panel.js): one row per kind of file - what, size and disk, action. */
.storage-rows { display: flex; flex-direction: column; }
.storage-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.storage-row:last-child { border-bottom: none; }
.storage-what { flex: 1 1 260px; display: flex; flex-direction: column; font-size: 0.9rem; }
.storage-what .hint { margin-top: 2px; }
.storage-size { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.storage-action { min-width: 90px; display: flex; justify-content: flex-end; }
.storage-error { color: var(--danger); }
/* Drone photos uploaded and processed by WebODM (survey_panel.js) */
.odm-section { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.odm-section h3 { font-size: 0.9rem; font-weight: 600; }
.external-survey > summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.external-survey[open] > summary { margin-bottom: 8px; }
.odm-drop { border: 1px dashed var(--border); border-radius: 8px; padding: 14px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.odm-drop.dragging { border-color: var(--accent); background: var(--hover); }
.progress-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.odm-stages { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.odm-stages li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.odm-stages li.current { color: var(--text); font-weight: 600; }
.odm-stages li.done { color: var(--ok); }
.share-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.share-list li { display: flex; gap: 6px; }
.share-list input { flex: 1; font-size: 0.75rem; }

/* Customer links */
.share-create { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-create #share-label { flex: 1 1 220px; }
.share-create select, .share-create input[type=date] { width: auto; }
.share-items { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.share-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.share-url { display: flex; gap: 6px; }
.share-url input { flex: 1; min-width: 0; font-size: 0.78rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.share-actions input[type=date] { width: auto; padding: 2px 6px; }
.share-visits summary { cursor: pointer; color: var(--muted); display: inline; margin-left: 6px; list-style: none; }
.share-visits summary::-webkit-details-marker { display: none; }
/* Inline, the summary loses its marker: one of our own, turned when open. */
.share-visits summary::before { content: '▸ '; }
.share-visits[open] summary::before { content: '▾ '; }
.share-visits ul { list-style: none; margin-top: 4px; color: var(--muted); }

/* Collapsible sections (collapsible_sections.js) */
.section-toggle { display: flex; align-items: baseline; gap: 8px; min-width: 0; background: none; border: none; padding: 0;
    color: inherit; font: inherit; cursor: pointer; text-align: left; }
.section-chevron { color: var(--muted); font-size: 0.8rem; transition: transform 0.15s; }
.section-summary { display: none; color: var(--muted); font-size: 0.85rem; font-weight: 400;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* A flex item (not inline): a long summary ends with an ellipsis instead of overflowing. */
.card.collapsed .section-summary { display: block; }
.section-toggle { max-width: 100%; }
.card > h2, .card-head > h2 { min-width: 0; }
.card.collapsed .section-chevron { transform: rotate(-90deg); }
.card.collapsed > :not(h2):not(.card-head), .card.collapsed .card-head > :not(h2) { display: none; }
.card.collapsed h2, .card.collapsed .card-head { margin-bottom: 0; }
.card[data-section] h2 { min-width: 0; }

/* Site consumption */
.consumption-total { font-size: 0.95rem; }
.bill-box { margin-bottom: 14px; }
.bill-proposal { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.bill-values { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 0.88rem; }
.bill-values dt { color: var(--muted); }
.bill-values dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bill-warnings { margin: 0; padding-left: 18px; font-size: 0.8rem; color: var(--accent-2); display: grid; gap: 3px; }
@media (max-width: 560px) {
    .bill-values { grid-template-columns: 1fr; gap: 0; }
    .bill-values dd { margin-bottom: 6px; }
}
.appliance-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.appliance { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.appliance-line { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 0.8rem; color: var(--muted); }
.appliance-line input[type=text] { flex: 1; min-width: 0; }
.appliance-line input[type=number] { width: 72px; padding: 4px 6px; }
.appliance-line select { width: auto; padding: 4px 6px; font-size: 0.8rem; }
.appliance-name { min-width: 0; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appliance-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: none; border: none; padding: 0;
    color: inherit; font: inherit; cursor: pointer; text-align: left; }
.appliance.collapsed .appliance-details { display: none; }
.appliance.collapsed .section-chevron { transform: rotate(-90deg); }
.appliance.collapsed { padding: 6px 10px; }
.appliance-kwh { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.appliance-line label { display: inline-flex; align-items: center; gap: 4px; }
#c-add { width: auto; max-width: 100%; padding: 4px 8px; font-size: 0.8rem; }

/* Energy and financial simulation */
.variant-tabs { flex-wrap: wrap; }
.energy-settings { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 0.85rem; color: var(--muted); }
.energy-settings select, .energy-settings input { width: auto; padding: 4px 8px; }
.energy-settings input[type=number] { width: 110px; }
/* Simulations under way (energy_panel.js): all together, then each variant's step */
.energy-progress { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; }
.energy-progress > summary { list-style: none; cursor: pointer; }
.energy-progress > summary::-webkit-details-marker { display: none; }
.energy-progress-head { display: flex; gap: 8px; }
.energy-progress-head strong { flex: 1; }
.energy-progress-head::before { content: '▸'; color: var(--muted); }
.energy-progress[open] .energy-progress-head::before { content: '▾'; }
.energy-progress-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.energy-progress-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.energy-progress-name { font-weight: 600; flex: 0 1 220px; overflow-wrap: anywhere; }
.energy-progress-step { flex: 1 1 200px; color: var(--muted); }
.energy-progress-pct { font-variant-numeric: tabular-nums; }
.energy-progress-list .progress-bar { flex-basis: 100%; height: 4px; }
.energy-progress-list li.done .energy-progress-step { color: var(--ok); }
.energy-progress-list li.done .energy-progress-step::before { content: '✓ '; }
.energy-progress-list li.error .energy-progress-step { color: var(--danger); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.kpi-detail { font-size: 0.72rem; color: var(--muted); }
.assumptions { margin: 6px 0 0 18px; color: var(--muted); font-size: 0.8rem; display: flex; flex-direction: column; gap: 3px; }
.curve-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 0.9rem; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Modal window (energy charts) */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: var(--backdrop); }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
    width: min(980px, 100%); max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-box h3 { font-size: 0.9rem; font-weight: 600; margin-top: 6px; }
body.modal-open { overflow: hidden; }
.chart-legend i.dot { border-radius: 50%; }
.generator-settings summary { cursor: pointer; font-size: 0.85rem; }
.generator-settings .energy-settings { margin-top: 8px; }
.modal-box .curve-date input[type=range] { width: 320px; max-width: 60vw; }
/* The site's own prompt (dialog.js) */
.dialog-box { width: min(460px, 100%); }
.dialog-box h2 { font-size: 1.1rem; }
.dialog-error { color: var(--danger); font-size: 0.85rem; margin: 0; }
.dialog-text { margin: 0; white-space: pre-line; line-height: 1.5; }
/* PVGIS unavailable: the other source offered (design_fetch.js) */
.solar-data-box { width: min(560px, 100%); }
.solar-data-box p { font-size: 0.9rem; }
.month-figures { font-size: 0.85rem; }

/* Quote actions under the variants table */
.check-inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }
.gap-measure { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 0.8rem; margin-top: 8px; }
/* Strings (strings_panel.js) and Câblage (wiring_panel.js): places on the plan, strings, their DC cables, other cables. */
.equipment-section .eq-group .hint, .equipment-section .eq-group .check { margin: 0; }
.equipment-section .eq-group > .check { font-size: 0.8rem; }
.place-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; gap: 6px; align-items: center; font-size: 0.85rem; }
.place-row .btn:last-child { padding-left: 0; padding-right: 0; }
.wiring-choice { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 8px; background: var(--tile-head); font-size: 0.85rem; }
.wiring-choice p { margin: 0; }
.wiring-choice .actions { margin: 0; }
.string-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.string-row { display: flex; flex-direction: column; gap: 5px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
              font-size: 0.8rem; cursor: pointer; }
.string-row:hover { border-color: var(--accent); }
.string-row.selected { border-color: var(--accent-2); background: var(--panel-2); cursor: default; }
.string-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.string-head .swatch { margin-right: 0; flex: none; }
.string-head .string-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.string-head .string-name { flex: 1; min-width: 0; font-size: 0.8rem; padding: 3px 6px; }
.string-head .btn { flex: none; }
.string-meta { color: var(--muted); font-size: 0.75rem; }
.string-io { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); font-size: 0.75rem; }
.string-io select { width: auto; padding: 2px 4px; font-size: 0.75rem; }
.string-io select.unit-named { max-width: 150px; text-overflow: ellipsis; }
.cable-line { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; }
.cable-line + .cable-line { border-top: 1px dashed var(--border); padding-top: 8px; }
.cable-head[title]:not([title=""]) { cursor: help; }
.cable-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: end; }
.cable-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; color: var(--muted); min-width: 0; }
.cable-fields select, .cable-fields input { width: 100%; min-width: 0; font-size: 0.8rem; padding: 3px 5px; }
.length-input { display: flex; align-items: center; gap: 4px; color: var(--text); }
.cable-facts { font-size: 0.75rem; }
.cable-facts[title]:not([title=""]) { cursor: help; }
.dialog-box .check { margin: 0; font-size: 0.8rem; }
.proposal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
/* The proposal's window: the devices the strings go to, then the strings proposed for them. */
.string-devices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.device-line { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 0.85rem; }
.device-line[hidden] { display: none; }
.device-line select { min-width: 0; }
.device-count { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.device-count input { width: 60px; }
.proposal-preview { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; min-height: 40px; }
.proposal-preview p { margin: 0; }
.string-row.string-cable { cursor: default; }
@media (max-width: 560px) {
    .device-line { grid-template-columns: minmax(0, 1fr) auto; }
    .device-line > span:first-child { grid-column: 1 / -1; }
}

/* What the customer study includes (Liens client). */
.study-content { display: flex; flex-direction: column; gap: 10px; font-size: 0.85rem; margin: 12px 0 6px;
                 padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.content-title { font-weight: 600; }
.content-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.content-checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }
.content-fields { display: grid; grid-template-columns: max-content minmax(0, 240px); gap: 8px 12px; align-items: center; }
.content-fields label { color: var(--muted); white-space: nowrap; }
.content-fields select { width: 100%; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; }
.model-crop { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.model-crop input { width: 60px; }
.share-content summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.share-content .study-content { margin: 8px 0 2px; }
.controller-line select { font-size: 0.85rem; min-width: 0; }
.string-parallel { font-size: 0.75rem; color: var(--accent); white-space: nowrap; }

/* Equipment pages (views_catalog.py). */
.catalog-tabs { flex-wrap: wrap; margin: 0 0 14px; }
.catalog-tabs a { text-decoration: none; }
/* The tabs of the open family (Réglages: _tabs.html), under the families. */
.catalog-tabs:has(+ .sub-tabs) { margin-bottom: 0; }
.sub-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 16px; padding: 10px 2px 8px; border-bottom: 1px solid var(--border); }
.sub-tabs a { color: var(--muted); text-decoration: none; font-size: 0.88rem; padding-bottom: 6px; margin-bottom: -9px; border-bottom: 2px solid transparent; }
.sub-tabs a:hover { color: var(--text); }
.sub-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.catalog-search { display: flex; gap: 8px; margin: 0 0 14px; max-width: 720px; }
.catalog-search select { width: auto; }
.catalog-search input[type=search] { flex: 1; min-width: 200px; }
.catalog-search select { max-width: 45%; }
.catalog-search .inline-check { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
/* Matériel › Fournisseurs: a product searched among all the suppliers (supplier_search.js). */
.supplier-search .autocomplete { flex: 1; min-width: 200px; }
.supplier-search .autocomplete input[type=search] { width: 100%; }
.supplier-suggestions { max-height: 70vh; overflow-y: auto; }
.supplier-suggestions li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.supplier-suggestions li.active { background: var(--hover); }
.supplier-suggestions .s-name { min-width: 0; }
.supplier-suggestions .s-name mark { background: none; color: var(--accent); font-weight: 600; }
.supplier-suggestions .s-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; text-align: right; }
.supplier-results { margin-bottom: 18px; }
.supplier-results .result-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.catalog-notes { max-width: 360px; }
.catalog-add summary { cursor: pointer; list-style: none; }
.catalog-add a { display: block; padding: 2px 0; }
.stars-cell { color: var(--accent-2); letter-spacing: 1px; white-space: nowrap; }
.vat-yes { color: var(--ok); display: inline-flex; vertical-align: middle; }
.vat-no { color: var(--danger); font-weight: 600; }
.field-check .inline-check { display: flex; gap: 8px; align-items: center; }
/* A datasheet's values read by the AI in the manufacturer's datasheet (_datasheet_ai.html, _ai_note.html): marked
   until checked and saved, each with the line it comes from. */
.ai-filled, .ai-filled-sample { background: rgba(255, 196, 0, 0.18); border-color: rgba(214, 158, 0, 0.9); }
.ai-filled-sample { padding: 0 4px; border-radius: 3px; border: 1px solid rgba(214, 158, 0, 0.9); }
.ai-note { display: block; margin-top: 3px; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.ai-note mark { background: rgba(255, 196, 0, 0.45); color: inherit; padding: 0 1px; border-radius: 2px; }
.ai-note-differs { color: var(--danger); }
.ai-reading > .hint, .ai-reading > .msg { margin-bottom: 12px; }
.ai-reading-form .actions { justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
/* The manufacturer's datasheet beside a datasheet's form (datasheet_viewer.js): the page narrows to its left. */
.sheet-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 46vw; z-index: 40; display: flex; flex-direction: column;
    background: var(--panel); border-left: 1px solid var(--border); box-shadow: -6px 0 18px rgba(0, 0, 0, 0.15); }
.sheet-panel[hidden] { display: none; }
.sheet-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.sheet-bar a { margin-left: auto; font-size: 0.85rem; }
.sheet-panel iframe { flex: 1; width: 100%; border: 0; background: #fff; }
body.with-sheet .page, body.with-sheet .topbar { margin-right: 46vw; }
body.with-sheet .page .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .sheet-panel { width: 100vw; }
    body.with-sheet .page, body.with-sheet .topbar { margin-right: 0; }
}
/* A product's selling price and its mode (catalog_product_suppliers.html). */
.price-form { display: grid; gap: 8px; margin: 8px 0; }
.price-field input { max-width: 180px; }
.price-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.price-mode { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.price-mode .inline-check { display: flex; gap: 8px; align-items: baseline; }
/* A product's prices over time (_price_history.html): one axis (€ HT), thin step lines, end labels, legend. */
.price-chart { width: 100%; max-width: 760px; height: auto; display: block; }
.price-chart .grid { stroke: var(--border); stroke-width: 1; opacity: 0.6; }
.price-chart .axis, .price-chart .end-label { fill: var(--muted); font-size: 11px; }
.price-chart .end-label { fill: var(--text); }
.price-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.price-chart .mark { stroke: var(--panel); stroke-width: 2; }
.price-chart .hit { fill: transparent; cursor: help; }
.price-chart .series-1 { stroke: var(--variant-1); } .price-chart .mark.series-1 { fill: var(--variant-1); }
.price-chart .series-2 { stroke: var(--variant-2); } .price-chart .mark.series-2 { fill: var(--variant-2); }
.price-chart .series-3 { stroke: var(--variant-3); } .price-chart .mark.series-3 { fill: var(--variant-3); }
.price-chart .series-4 { stroke: var(--variant-4); } .price-chart .mark.series-4 { fill: var(--variant-4); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0 0 6px;
    font-size: 0.8rem; color: var(--muted); }
.legend-line { display: inline-block; width: 16px; height: 2px; margin-right: 6px; vertical-align: middle; }
.legend-line.series-1 { background: var(--variant-1); } .legend-line.series-2 { background: var(--variant-2); }
.legend-line.series-3 { background: var(--variant-3); } .legend-line.series-4 { background: var(--variant-4); }
.price-table { margin-top: 8px; }
.price-table td.num, .price-table td:first-child { white-space: nowrap; }
/* When the products were last synchronised from Invoice Ninja, and the button to do it (suppliers' pages). */
.sync-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
/* The reading of a supplier's webshop under way (supplier_scan.js). */
.scan-progress { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.scan-progress progress { width: 220px; height: 10px; accent-color: var(--accent); }
td .scan-progress { margin: 0; }
td .scan-progress progress { width: 120px; }
/* A supplier's products (catalog_supplier.html, supplier_catalog.js): ticked, by category. */
.supplier-catalog .tick { width: 28px; text-align: center; }
.supplier-catalog .tick input { width: auto; margin: 0; }
.supplier-catalog .supplier-group th { background: var(--tile-head); text-align: left; }
.supplier-catalog .num { white-space: nowrap; }
.supplier-catalog tbody.collapsed tr:not(.supplier-group) { display: none; }
.group-toggle { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.group-arrow { display: inline-block; width: 1em; }
.linked-mark { color: var(--ok); font-weight: 700; }
.group-actions { margin: 0 0 8px; }
/* A coffret's components (box_components.js): the whole width, one row each. */
.field:has(.box-components) { grid-column: 1 / -1; }
.box-component-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.box-component { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 10px;
                 border: 1px solid var(--border); border-radius: 8px; }
.box-component label:not(.inline-check) { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem;
                                          color: var(--muted); }
.box-component input[type=text] { width: 110px; }
.box-component input[inputmode=decimal] { width: 80px; }
.box-component select { width: auto; }
.box-component-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.danger-zone { margin-top: 18px; display: flex; gap: 12px; align-items: center; }
/* Deleting a project (its Modifier page). */
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.project-delete { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.project-delete h2 { margin-bottom: 0; }
/* Settings pages (views_settings.py): short fields side by side, texts full width. */
.settings-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.settings-fields .field:has(textarea) { grid-column: 1 / -1; }
/* A translation's French text, under it (Réglages, Textes de l'étude). */
.settings-original { grid-column: 1 / -1; margin-top: -6px; }
.settings-original .pre-line { white-space: pre-line; margin-top: 4px; }
.profile-preview { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 2px; height: 48px; margin-top: -6px; }
.profile-preview i { flex: 1; background: var(--accent); opacity: 0.75; border-radius: 2px 2px 0 0; min-height: 1px; }
.settings-fields .field:has(input[name$=_profile]) { grid-column: 1 / -1; }
tr.muted td a { color: var(--muted); }

/* Theme button (theme.js). */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); cursor: pointer;
                font-size: 0.9rem; line-height: 1; width: 28px; height: 28px; }
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }

/* Layout editor: 2D / 3D switch (layout_3d.js). */
.view-switch { margin-right: 6px; }
.view-switch .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.map-2d-tools { display: contents; }
.map-2d-tools[hidden] { display: none !important; }
.layout-3d { border: 0; border-radius: 10px; width: 100%; background: var(--panel-2); }

/* Project page, variants table: sizing under the name. */
.variant-sizing { font-size: 0.8rem; }
.variants-table .num { white-space: nowrap; }
.variants-table td { overflow-wrap: anywhere; }
.variants-table .drag-col { width: 1.5em; padding-right: 0; }
.variants-table .drag-handle { cursor: grab; touch-action: none; user-select: none; color: var(--muted); font-size: 1.1em; }
.variants-table tr.dragging { opacity: .6; background: var(--tile); }
.variants-table tr.dragging .drag-handle { cursor: grabbing; }
.variants-table .active-col { width: 1%; text-align: center; }
.variants-table tr.variant-inactive > td:not(.drag-col):not(.active-col) { opacity: .5; }

/* Layout editor side panel (redesign lot 1). Two levels, told apart by surface,
   never by a line: blocks (Équipement, Câblage, Zones) are tiles of their own;
   the sections of a zone are banded headers inside its tile. */
.editor-panel { gap: 12px; }
.panel-tile { background: var(--tile); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.panel-tile > summary, .tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px;
    font-size: 0.95rem; font-weight: 700; }
.panel-tile > summary { cursor: pointer; list-style: none; }
.panel-tile > summary::-webkit-details-marker { display: none; }
.panel-tile > summary::before { content: '▸'; color: var(--accent); margin-right: 2px; transition: transform .15s; }
.panel-tile[open] > summary { margin-bottom: 10px; }
.panel-tile[open] > summary::before { transform: rotate(90deg); }
.panel-tile > summary > span:first-of-type { flex: 1; }
.tile-head { margin-bottom: 10px; }
.editor-panel .equipment-section { border-top: 0; padding-top: 0; }
.editor-panel .equipment-section > h3:first-child { display: none; }
.editor-panel .plane-details { border-top: 0; padding-top: 12px; }
.editor-panel .stringing { border-top: 0; margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--tile-head); }
.inspector-section > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer;
    font-size: 0.85rem; font-weight: 600; list-style: none; padding: 7px 10px; border-radius: 8px; background: var(--tile-head); }
.inspector-section > summary::-webkit-details-marker { display: none; }
.inspector-section > summary::before { content: '▸'; color: var(--muted); margin-right: 2px; transition: transform .15s; }
.inspector-section[open] > summary::before { transform: rotate(90deg); }
.inspector-section > summary > span:first-of-type { flex: 1; }
.section-modified { font-size: 0.75rem; font-weight: 600; color: var(--accent-2); }
.inspector-body { display: flex; flex-direction: column; gap: 10px; padding: 10px 2px 6px; }
.help { display: inline; }
.help > summary { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%;
    border: 1px solid var(--border); font-size: 0.7rem; cursor: pointer; list-style: none; color: var(--muted); vertical-align: middle; }
.help > summary::-webkit-details-marker { display: none; }
.help[open] > summary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.help > p { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.settings-search { position: relative; }
.settings-search input { width: 100%; }
.settings-search-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
    list-style: none; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.settings-search-results li { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.settings-search-results li.active, .settings-search-results li:hover { background: var(--panel-2); }
.settings-search-results .result-label { font-size: 0.88rem; }
.settings-search-results .result-place { font-size: 0.75rem; color: var(--muted); }
.search-hit { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; transition: outline-color .3s; }

.block-alerts { font-size: 0.75rem; font-weight: 600; }
.names-proposal { padding: 8px 10px; border-radius: 8px; background: var(--tile-head); }
.names-proposal ul { margin: 4px 0 8px; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 0.85rem; }

/* Layout editor, redesign lot 2a: a rail of working modes (Zones, Matériel, Câblage) left
   of the inspector, each mode showing its own block; a synthesis line above, each figure a
   way to where it is set. */
/* Only the layout editor has the rail (the roof editor keeps its two columns). */
.editor-layout.with-rail { grid-template-columns: 84px 340px minmax(0, 1fr); }
@media (max-width: 1000px) { .editor-layout.with-rail { grid-template-columns: 1fr; } }
.mode-rail { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
.mode-rail button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: inherit; font-size: 0.78rem;
    cursor: pointer; position: relative; }
.mode-rail button:hover { color: var(--text); background: var(--hover); }
.mode-rail button[aria-pressed="true"] { color: var(--text); background: var(--tile); border-color: var(--accent); font-weight: 600; }
.mode-rail .mode-icon { font-size: 1.25rem; line-height: 1; }
.mode-badge { position: absolute; top: 4px; right: 6px; font-size: 0.7rem; font-weight: 700; }
.mode-badge:empty { display: none; }
@media (max-width: 1000px) { .mode-rail { flex-direction: row; position: static; } .mode-rail button { flex: 1; } }
.mode-off { display: none !important; }
.layout-synthesis { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.layout-synthesis:empty { display: none; }
.synth { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; }
.synth:hover { border-color: var(--accent); background: var(--hover); }
.synth b { color: var(--accent); font-variant-numeric: tabular-nums; }
.synth .muted { font-size: 0.8rem; }
.synth.check-warn::before, .synth.check-error::before { margin-right: 0; }

/* A setting departing from its automatic / default value: an amber rule on its left
   (the colour of its section's "modifié"), its label amber, its ↺ to go back. */
.field.is-modified { box-shadow: inset 3px 0 0 var(--accent-2); padding-left: 10px; border-radius: 2px; }
.field.is-modified > label { color: var(--accent-2); }
.reset-default { border: 1px solid var(--accent-2); background: transparent; color: var(--accent-2); border-radius: 999px;
    width: 20px; height: 20px; padding: 0; font-size: 0.8rem; line-height: 1; cursor: pointer; vertical-align: middle; margin-left: 4px; }
.reset-default:hover { background: var(--accent-2); color: var(--panel); }

.variant-name-head { justify-content: flex-start; }
.variant-name-head h2 { flex: 1; }
.variant-name-head h2 input { width: 100%; font: inherit; }
.btn.icon-only { padding: 4px 8px; }
.general-section { display: flex; flex-direction: column; gap: 10px; }
.general-section textarea { width: 100%; resize: vertical; font: inherit; }
.general-status { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 8px; background: var(--tile-head); }
.general-status p { margin: 0; font-size: 0.88rem; }
.general-status .actions { margin-top: 6px; }

/* Map filters (layout editor, lot 2b): legend over the map. */
.filter-legend { background: var(--overlay); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 10px; min-width: 220px; max-width: 280px; display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; }
.filter-legend .filter-title { font-weight: 600; }
.filter-legend .filter-row { display: flex; align-items: center; gap: 6px; }
.filter-legend .filter-row select { font-size: 0.8rem; }
.filter-legend .filter-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.filter-legend input[type=range] { width: 100%; }
.filter-bar { height: 8px; border-radius: 4px; }
.filter-ticks { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-select select { font-size: 0.8rem; }
.history-buttons { display: inline-flex; gap: 6px; }
.history-buttons .btn:disabled { opacity: 0.4; cursor: default; }

/* Project page in steps (redesign lot 5): a rail of the study's steps, each showing
   only its own sections; the map only for the steps that need it. */
.project-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .project-layout { grid-template-columns: 1fr; } }
.step-rail { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
.step-rail > button { display: grid; grid-template-columns: 26px minmax(0, 1fr) 10px; align-items: center; gap: 8px; text-align: left;
    padding: 9px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
    font: inherit; cursor: pointer; }
.step-rail > button:hover { background: var(--hover); }
.step-rail > button[aria-pressed="true"] { background: var(--tile); border-color: var(--accent); }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
    background: var(--tile-head); color: var(--muted); }
.step-rail > button[aria-pressed="true"] .step-num { background: var(--accent); color: var(--on-accent); }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-label { font-size: 0.88rem; font-weight: 600; }
.step-hint { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); }
.step-dot.step-done { background: var(--ok); border-color: var(--ok); }
.step-dot.step-warn { background: var(--accent-2); border-color: var(--accent-2); }
.step-search { margin-top: 8px; }
.detail-layout.no-map { grid-template-columns: minmax(0, 1fr); }
.step-off { display: none !important; }
@media (max-width: 1000px) { .step-rail { position: static; flex-direction: row; overflow-x: auto; } .step-rail > button { min-width: 160px; } }

/* Equipment configurator (layout editor, lot 2c): in the map's place in Matériel mode. */
.editor-layout.with-rail > .editor-map-card, .editor-layout.with-rail > .editor-config-card { grid-column: 3; grid-row: 1; }
@media (max-width: 1000px) { .editor-layout.with-rail > .editor-map-card, .editor-layout.with-rail > .editor-config-card { grid-column: auto; grid-row: auto; } }
.editor-config-card { display: flex; flex-direction: column; gap: 16px; }
.config-diagram { overflow-x: auto; }
.config-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; }
.config-add:empty { display: none; }
.config-orphans { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 0.86rem; }
.config-orphans:empty { display: none; }
.config-orphan { background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.config-orphan:hover { text-decoration: underline; }
.config-add-item.active { border-color: var(--accent); color: var(--accent); }
.config-help h4 { margin: 12px 0 6px; font-size: 0.9rem; }
.config-checks { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.86rem; }
.config-action { text-align: right; width: 1%; white-space: nowrap; }
.config-price { white-space: nowrap; }
.config-intro h2 { margin-bottom: 4px; }
.config-block { background: var(--tile); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.config-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.config-head h3 { margin: 0; font-size: 1rem; }
.config-head select { max-width: 320px; }
.config-progress { max-width: 520px; }
.config-progress p { margin: 0 0 6px; }
.config-progress-pct { font-variant-numeric: tabular-nums; }
.config-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.config-table th { text-align: left; color: var(--muted); font-weight: 400; font-size: 0.78rem; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.config-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: middle; }
.config-table tr:last-child td { border-bottom: 0; }
.config-table tr.chosen td { background: var(--hover); }
.config-table tr.chosen td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.config-pct { white-space: nowrap; }
.config-bar { display: inline-block; width: 90px; height: 7px; border-radius: 4px; background: var(--tile-head); vertical-align: middle; overflow: hidden; }
.config-bar i { display: block; height: 100%; background: var(--accent); }
.config-tag { font-size: 0.7rem; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 6px; margin-left: 4px; white-space: nowrap; display: inline-block; }
.config-verdict { max-width: 260px; font-size: 0.8rem; }
/* Long messages (a panel left out...): three lines, the whole in the tooltip. */
.config-clamp .check { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Consumption by appliance (project page), as in the study (study.css). */
.consumption-pie .pie-body { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.consumption-pie .pie-chart svg { width: 160px; height: 160px; }
.consumption-pie .pie-chart path { stroke: var(--panel); stroke-width: 2; }
.consumption-pie .pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; min-width: 200px; flex: 1; max-width: 380px; font-size: 0.88rem; }
.consumption-pie .pie-legend li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.consumption-pie .pie-legend strong { font-variant-numeric: tabular-nums; }
.consumption-pie .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* A long select searched by typing (searchable_select.js). */
/* A long list to tick (ticks_filter.js): ticked first, filtered, scrolled in a bounded box. */
.field-ticks { grid-column: 1 / -1; }
.ticks-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ticks-bar input[type=search] { flex: 1 1 220px; width: auto; }
.ticks-bar .inline-check { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.ticks-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.field-ticks > div[id] { max-height: 232px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; align-content: start; }
.field-ticks > div[id] label { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; color: var(--text); }
.ticks-none { font-size: 0.85rem; color: var(--muted); margin: 0; }
.searchable-select { position: relative; }
.searchable-select input { width: 100%; }
.tile-actions { display: inline-flex; gap: 6px; }

/* Site visit notes pinned on the maps (lot 7). */
.site-note-pin { font-size: 22px; line-height: 1; cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.site-note-popup .maplibregl-popup-content, .site-note-form { color: #0f172a; }
.site-note-text { margin: 0 0 4px; white-space: pre-line; }
.site-note-meta { margin: 0 0 6px; font-size: 0.75rem; }
.site-note-form textarea { width: 240px; font: inherit; }
.site-note-form .actions { display: flex; gap: 6px; margin-top: 6px; }

/* Map layers in a menu (layout editor, lot 7): the toolbar stays on one or two lines. */
.map-layers { position: relative; display: inline-block; }
.map-layers > summary { list-style: none; cursor: pointer; }
.map-layers > summary::-webkit-details-marker { display: none; }
.map-layers-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; gap: 8px;
    padding: 10px 12px; min-width: 260px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }

/* Row gap handle (flat roof zone, layout editor). */
.row-handle { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: 15px; cursor: ns-resize; box-shadow: 0 0 0 3px rgba(255, 255, 255, .85), 0 2px 6px rgba(0, 0, 0, .4); }

/* The variants side by side: Déclinaisons and Bilan (variant_compare.js) */
.compare-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 0.85rem; }
.compare-toolbar:empty { display: none; }
.compare-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.compare-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 10px; border-radius: 999px; font: inherit; font-size: 0.8rem;
    border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.compare-chip[aria-pressed="false"] { color: var(--muted); }
.compare-chip[aria-pressed="false"] .swatch { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--muted); }
.compare-chip:disabled { cursor: default; }
.compare-ref-field select { width: auto; margin-left: 4px; }
.compare-scroll { overflow-x: auto; }
.compare-table th { vertical-align: top; min-width: 160px; }
.compare-table th:first-child { min-width: 0; }
.compare-table th strong { color: var(--text); font-size: 0.9rem; }
.compare-name { white-space: nowrap; }
.compare-table th.compare-ref { box-shadow: inset 0 -2px 0 var(--accent); }
.compare-ref-tag, .compare-ref-set { display: block; margin-top: 2px; font-size: 0.72rem; }
.compare-ref-tag { color: var(--accent); }
.compare-ref-set { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-family: inherit; text-decoration: underline dotted; }
.compare-ref-set:hover { color: var(--accent); }
.compare-table td:first-child { color: var(--muted); white-space: nowrap; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.compare-table td { vertical-align: top; }
.compare-equipment { margin-top: 4px; font-size: 0.74rem; line-height: 1.35; }
.compare-group-head td { padding: 12px 0 4px; border-bottom: 1px solid var(--border); position: static !important; }
.compare-group-head button { background: none; border: 0; padding: 0; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text);
    text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.compare-group.folded .section-chevron { transform: rotate(-90deg); }
.compare-group .section-chevron { display: inline-block; transition: transform .15s; }
.compare-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.compare-gap { font-size: 0.74rem; color: var(--muted); font-weight: 400; white-space: nowrap; }
.compare-gap.gap-good { color: var(--ok); }
.compare-gap.gap-bad { color: var(--accent-2); }
.compare-bar { height: 4px; margin-top: 4px; max-width: 160px; border-radius: 2px; background: var(--tile-head); overflow: hidden; }
.compare-bar i { display: block; height: 100%; border-radius: 2px; }
.compare-detail { font-size: 0.74rem; }
.compare-best { color: var(--ok); font-weight: 600; }
.compare-best .compare-detail { font-weight: 400; }
.compare-same td:not(:first-child) { color: var(--muted); }
.compare-table td .tip { font-size: 0.75rem; opacity: 0.7; cursor: help; }
.compare-status { font-size: 0.74rem; font-weight: 400; }
.compare-charts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.compare-chart-tabs { flex-wrap: wrap; align-items: center; }
.compare-month { font-size: 0.85rem; margin-left: auto; }
.compare-month select { width: auto; margin-left: 4px; }
.margin-search { display: flex; gap: 8px; margin-bottom: 10px; max-width: 480px; }

/* Roof editor: the detection's proposals (roof_detect.js) */
.detect-section { border: 1px dashed #f59e0b; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.detect-section .card-head { margin-bottom: 0; }
.detect-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.detect-list li { padding: 4px 6px; border-radius: 6px; }
.detect-list li:hover { background: var(--hover); }
.detect-meta { margin-left: 24px; font-size: 0.8rem; }
.coords { user-select: all; font-variant-numeric: tabular-nums; }

/* Context menu on the roof editor's map (vertex_menu.js) */
.map-context-menu { position: absolute; z-index: 10; display: flex; flex-direction: column; min-width: 180px; padding: 4px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.map-context-menu button { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; color: var(--text); cursor: pointer; font: inherit; font-size: 0.86rem; }
.map-context-menu button:hover:not(:disabled) { background: var(--hover); }
.map-context-menu button:disabled { color: var(--muted); cursor: default; }
.potential summary { cursor: pointer; font-weight: 600; margin: 4px 0 8px; }
.potential-table td { vertical-align: top; }
.potential-table tr[data-plane]:hover td { background: var(--hover); }
.potential-table { font-size: 0.8rem; }
.potential-table th, .potential-table td { padding: 5px 4px; }
.potential-table td:not(:first-child) { white-space: nowrap; }

/* Project page, variants table: the quote's actions as icons next to its status, the
   discounts (fetched) and the VAT; the project's discounts folded below. */
.nowrap { white-space: nowrap; }
.quote-cell form { display: inline; }
.icon-action { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--accent); cursor: pointer;
    font: inherit; font-size: 0.85rem; line-height: 1; padding: 3px 6px; margin-left: 2px; vertical-align: 1px; }
.icon-action:hover { background: var(--hover); border-color: var(--accent); }
.icon-action-warn { color: var(--accent-2); border-color: var(--accent-2); }
.discount-cell, .vat-cell { color: inherit; white-space: nowrap; }
.discount-cell small { color: var(--muted); }
.variants-table td:has(.vat-cell), .variants-table td:has(.discount-cell) { overflow-wrap: normal; }
.project-discounts { margin-top: 12px; font-size: 0.9rem; }
.project-discounts > summary { cursor: pointer; font-weight: 600; }
.project-discounts form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.discount-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.discount-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.discount-field input[type=number], .discount-row input[type=number] { width: 72px; text-align: right; }

/* Layout editor, Financier block (finance_panel.js). */
.finance-section { display: flex; flex-direction: column; gap: 14px; }
.finance-section .field > p { margin-top: 4px; font-size: 0.85rem; }
.discount-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 6px 0;
    border-bottom: 1px solid var(--border); }
.discount-name { display: flex; flex-direction: column; min-width: 0; }
.discount-name small { font-size: 0.75rem; overflow-wrap: anywhere; }
.discount-added { grid-column: 1 / -1; font-size: 0.75rem; color: var(--accent); }
.finance-total { font-size: 0.85rem; }

/* Quote templates (Réglages): lines edited in place, help texts as tooltips. */
.tip { cursor: help; color: var(--muted); font-size: 0.8em; font-weight: 400; }
.template-lines .line-row { cursor: pointer; }
.template-lines .line-row:hover td, .template-lines .line-row[aria-expanded=true] td { background: var(--hover); }
.template-lines .line-row[aria-expanded=true] td { border-bottom-color: transparent; }
.template-lines .row-toggle { width: 1.5em; color: var(--muted); transition: transform .15s; }
.template-lines .line-row[aria-expanded=true] .row-toggle { transform: rotate(90deg); color: var(--accent); }
.template-lines .line-saved td { background: var(--hover); transition: background 1s; }
.line-editor-row > td { padding: 4px 10px 14px; background: var(--hover); }
.line-editor { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.line-form { display: flex; flex-direction: column; gap: 8px; }
.line-section > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.line-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-bottom: 6px; }
.line-fields .field { gap: 2px; }
.line-fields .field label { font-size: 0.78rem; }
.line-fields .field-wide { grid-column: span 2; }
.line-fields .field-check { align-self: end; }
.line-fields input, .line-fields select { width: 100%; font-size: 0.85rem; }
.line-fields .field-check input { width: auto; }
/* Tooltip (tips.js), in place of the title attribute that Safari shows late or never. */
.tip-bubble { position: fixed; z-index: 1000; max-width: min(360px, calc(100vw - 16px)); padding: 7px 10px; border-radius: 8px;
    background: var(--panel-2); color: var(--text); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    font-size: 0.78rem; font-weight: 400; line-height: 1.45; white-space: pre-line; pointer-events: none; text-align: left; }
.tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }

/* Réglages, Surcharges (views_surcharges.py): the types edited as a table. */
.surcharge-types td { vertical-align: top; }
.surcharge-types .surcharge-position input { width: 64px; }
.surcharge-types .surcharge-name input { min-width: 160px; }
.surcharge-types .surcharge-value input { width: 96px; }
.surcharge-types .surcharge-notes input { min-width: 200px; width: 100%; }

/* Layout editor, Financier: the variant's surcharges. */
.surcharge-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 6px 0;
    border-bottom: 1px solid var(--border); }
.surcharge-row .surcharge-label { display: flex; flex-direction: column; min-width: 0; }
.surcharge-row .surcharge-label input[type=text] { width: 100%; }
.surcharge-row .surcharge-label small { font-size: 0.75rem; }
.surcharge-row .surcharge-value input { width: 80px; text-align: right; }
.surcharge-row .surcharge-value select { width: auto; }
.surcharge-row .surcharge-options { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px;
    font-size: 0.8rem; }

/* Réglages, Fournisseurs d'énergie: a tariff's tables (tariff_editor.js) */
.tariff-periods { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tariff-periods input { width: 180px; }
.tariff-grid input { width: 100px; }
.tariff-grid td:first-child input { width: 70px; }
.tariff-rules select, .tariff-rules input { max-width: 220px; }
.tariff-rule-actions { white-space: nowrap; }

/* Fournisseurs d'énergie: who the site buys from (blue) and who buys its surplus (green) */
.energy-group-title { font-size: 1.15rem; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.energy-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
               letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; color: #fff; }
.energy-pill-buy { background: #3987e5; }
.energy-pill-sell { background: #199e70; }
.energy-card.energy-buy { background: rgba(57, 135, 229, 0.09); border-left: 4px solid #3987e5; }
.energy-card.energy-sell { background: rgba(25, 158, 112, 0.10); border-left: 4px solid #199e70; }
.energy-row-supplier td:first-child { box-shadow: inset 4px 0 0 #3987e5; }
.energy-row-buyer td:first-child { box-shadow: inset 4px 0 0 #199e70; }
.offer-brackets input { width: 140px; }

/* Equipment certificates (datasheet page, project's Démarches). */
.chip-error { color: var(--check-error); border-color: currentColor; }
.chip-warn { color: var(--check-warn); border-color: currentColor; }
.cert-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; }
.cert-problems .check-info { font-weight: 400; color: var(--muted); }
.cert-item { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cert-meta { font-size: 0.85rem; }
.cert-edit > summary { cursor: pointer; width: fit-content; }
.cert-edit[open] > summary { margin-bottom: 8px; }
.cert-standards > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; }
.cert-standards label { font-weight: 400; display: flex; gap: 6px; align-items: center; }
.cert-table td { vertical-align: top; }
.cert-table .cert-problems { font-size: 0.8rem; }

/* The single-line diagram's symbols (Réglages). Drawn black on white, as on the printed diagram. */
.sld-symbols { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.sld-symbol-card { margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 0.8rem; }
.sld-symbol-card svg { background: #fff; border-radius: 4px; max-width: 100%; height: auto; }
.sld-symbol-card { min-width: 0; }
.sld-symbol-card figcaption { width: 100%; overflow-wrap: anywhere; }
.inline-heading { display: inline; font-size: 1rem; }

/* The single-line diagram's page (Démarches): the A3 sheet, white as printed. */
.sld-sheet { padding: 8px; overflow: auto; position: relative; max-height: 85vh; }
.sld-sheet .sld-page { display: block; width: 100%; min-width: 900px; height: auto; background: #fff; border-radius: 4px; user-select: none; }
/* The editor (single_line_editor.js). */
.sld-editor { display: flex; flex-direction: column; gap: 6px; }
.sld-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sld-toolbar .mode-switch { margin: 0; }
.sld-toolbar-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.sld-sheet.sld-adding svg { cursor: crosshair; }
.sld-page [data-id] { cursor: pointer; }
.sld-page .sld-frame { pointer-events: stroke; }
.sld-page .sld-selected { filter: drop-shadow(0 0 1.6px #e11d48) drop-shadow(0 0 1px #e11d48); }
.sld-page .sld-ghost { fill: rgba(37, 99, 235, 0.06); stroke: #2563eb; stroke-width: 1; stroke-dasharray: 4 2; pointer-events: none; }
.sld-page .sld-ghost-wire { fill: none; stroke: #2563eb; stroke-width: 1.2; stroke-dasharray: 4 2; pointer-events: none; }
.sld-text-input { position: absolute; z-index: 5; font-size: 0.8rem; padding: 2px 6px; }

/* Utilisateurs › Journal (views_accounts.ActivityView): the filters on one line. */
.activity-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.activity-filters .field { min-width: 140px; }
.activity-filters .actions { margin-left: auto; }
.read-only { border: 0; padding: 0; margin: 0; min-width: 0; }

/* The superadmin's scope (views_spaces.py): the espace chosen, or the default values. */
.scope-switch { flex-shrink: 0; }
.scope-switch select { font-size: 0.85rem; padding: 4px 8px; width: auto; max-width: 190px; }
.readonly-banner { background: var(--panel-2); border-bottom: 1px solid var(--border); text-align: center; padding: 6px 16px; font-size: 0.85rem; }
/* Its editing controls (base.html: window.DesignReadOnly): those of the markup marked .edit-only are hidden,
   and .view-only says what stands instead ("Voir" for "Éditer"). */
.read-only-account .edit-only { display: none !important; }
body:not(.read-only-account) .view-only { display: none !important; }
/* Its settings shown, not editable (read_only.js): the value plainly, no field to type in. */
.read-only-account :is(input, select, textarea):disabled { background: transparent; border-style: dashed; color: inherit; opacity: 1; cursor: default; }
.defaults-banner { background: var(--accent-2); color: #111; text-align: center; padding: 6px 16px; font-size: 0.85rem; font-weight: 600; }
/* A row of a list with default values (spaces.py): a default one, seen in an espace; removed from it
   (_hide_default.html: no longer proposed there). */
.chip-default { opacity: .75; font-style: italic; }
.chip-removed { border-color: var(--accent-2); }
.card.is-removed > :not(.card-head) { opacity: .6; }
.hide-default { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex-shrink: 0; }
.hide-default.msg { margin-bottom: 14px; }
.default-rows { list-style: none; padding: 0; margin: 0; }
.default-rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
/* A secret of another service (forms.SecretInput): masked, without being a password field. */
.secret-input { -webkit-text-security: disc; text-security: disc; }
/* The Invoice Ninja link tried (secret_field.js): the button says it works, or the message why not. */
.ninja-test { align-items: center; flex-wrap: wrap; }
.ninja-test .msg { margin: 0; flex: 1 1 260px; }
.btn.btn-ok { border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* The deleted espaces (space_archive.py), under the espaces' list. */
.archived-spaces { margin-top: 18px; }
/* A suspended espace (views_spaces.py), seen by the superadmin. */
.suspended-banner { background: var(--danger, #c0392b); color: #fff; text-align: center; padding: 6px 16px; font-size: 0.85rem; font-weight: 600; }
.layer-state { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: -4px 0 10px; font-size: 0.8rem; }
.layer-state > * { white-space: nowrap; }
/* A setting and its state (_layer.html) under it, one cell of the grid (Réglages, marges, limits). */
.layered-field { display: flex; flex-direction: column; }
.layered-field .layer-state { order: -1; margin: 0 0 6px; }
/* « Réglage par défaut » / « Réglage local » (_layer.html, layer_toggle.js). */
.layer-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.8rem; }
.layer-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.layer-switch { position: relative; width: 30px; height: 17px; border-radius: 999px; background: var(--panel-2);
    border: 1px solid var(--border); flex-shrink: 0; transition: background .15s; }
.layer-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%;
    background: var(--muted, #888); transition: transform .15s; }
.layer-toggle input:checked + .layer-switch { background: var(--accent); border-color: var(--accent); }
.layer-toggle input:checked + .layer-switch::after { transform: translateX(13px); background: #fff; }
.layer-toggle input:focus-visible + .layer-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.follows-default .layer-label { font-style: italic; opacity: .8; }
.follows-default .field { opacity: .6; }
/* A feature the stack does not offer (stack.py): its name, no box. */
.not-offered { opacity: .7; }
.layered-field .settings-original { margin-top: 6px; }
.settings-fields > .layered-field:has(textarea) { grid-column: 1 / -1; }
.card > .hint + .settings-fields { margin-top: 10px; }
/* An espace's use of its quotas (_space_usage.html: Espaces, Utilisateurs). */
.space-usage { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 24px; }
.space-usage li { display: flex; gap: 6px; align-items: baseline; }
/* A new datasheet started from a default product's (views_catalog.DatasheetEditView, ?depuis=). */
.copy-datasheet { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.copy-datasheet select { width: auto; max-width: 420px; }

/* Matériel list: products imported into it, their datasheet to fill (catalog_list.html) */
.pending-sheets { margin-bottom: 16px; }
.pending-sheets .row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.pending-sheets .row-actions .inline-form { display: inline-flex; }
.supplier-import td.num { white-space: nowrap; }
.supplier-import .margin-input { width: 7em; }
.supplier-import .margin-input:disabled { opacity: .45; }
.supplier-import select[name^="action-"] { min-width: 11.5em; }

/* sun.store: products followed by link, their sellers' offers */
.follow-card { margin-bottom: 16px; }
.follow-form input[type=url] { flex: 1; min-width: 20em; }
.offers-row > td { background: var(--surface-2, transparent); padding-top: 0; }
.offers-block { padding: 4px 0 8px 12px; }
.offers-block .table td, .offers-block .table th { padding: 4px 8px; font-size: .92em; }
.offers-block tr.offer-used td { font-weight: 600; }
.offers-block .text-error { color: var(--error, #b42318); }
.market-search { margin-top: 8px; }
.market-results { margin-top: 10px; }
.market-results .market-offers-cell { width: 1%; white-space: nowrap; }
.market-results .row-actions { width: 1%; white-space: nowrap; text-align: right; }
.market-results .market-offers-row > td { padding: 0 0 8px 16px; }
.market-results table.market-offers td, .market-results table.market-offers th { font-size: .9em; padding: 3px 8px; }
.market-title { margin-top: 22px; }
.group-actions .import-ticked { margin-left: auto; }
.import-below { justify-content: flex-end; margin-top: 10px; }
/* Invoice Ninja sync message: the products added / deactivated, folded */
.sync-details summary { cursor: pointer; }
.sync-details p { margin: 8px 0 2px; font-weight: 600; }
.sync-details ul { margin: 0; padding-left: 20px; }
/* Datasheet form: the chosen product's suppliers and its datasheet */
.product-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; }
.product-source a { margin-left: 4px; }
.sheet-bar select { flex: 1 1 auto; min-width: 0; }
