/*
 * Plancast web — shared design tokens and base component styles (M11,
 * DECISIONS.md D70). Served as-is at /static/app.css (docs/WEB.md §2's
 * "web.static": no build step, no CSS framework, CLAUDE.md §2 simplicity).
 *
 * The only interface since DECISIONS.md D174 (the JavaFX desktop app and its
 * wizard.css are gone; values first taken from it by D68/D69 stay as they
 * are). See docs/DESIGN.md §10 for the token reference this file implements.
 */

:root {
    /* --- Palette « Calque technique » (docs/DESIGN.md §10, DECISIONS.md D176/D177): warm stone canvas,
     * paper surfaces, ink text, one single accent (blueprint blue). No violet anywhere. --- */
    --color-primary: #2456D6;
    --color-primary-hover: #1D49BD;
    --color-primary-pressed: #183E9F;
    --color-primary-soft: #E3EAFB;
    --color-on-primary: #FFFFFF;
    --color-on-primary-subtle: rgba(255, 255, 255, 0.16);
    /* 0.88, not 0.72: a caption on the active tool must reach 4.5:1 on the fill (D177, finding F1). */
    --color-on-primary-muted: rgba(255, 255, 255, 0.88);
    /* The brand as a mark (text, line, focus ring, selection), --color-primary being the brand as a
     * fill under --color-on-primary: one value on the light sheet, two on the dark one (DECISIONS.md D151). */
    --color-accent: #2456D6;

    --color-canvas: #ECEBE7;
    --color-surface: #F7F6F3;
    --color-surface-raised: #FCFBF9;
    --color-surface-muted: #EEEDE9;
    --color-surface-sunken: #E3E2DD;
    --color-border: #D3D2CE;
    --color-border-strong: #B9B7B0;
    /* The boundary of a field or a checkbox, 3:1 or more against the panel (WCAG 1.4.11, D181). Hairlines keep --color-border. */
    --color-border-control: #8A877F;

    /* Every text token reaches 4.5:1 on both paper and stone (D177, finding C4). */
    --color-text: #26251E;
    --color-text-secondary: #5E5C55;
    --color-text-tertiary: #6B6962;

    --color-danger: #B00020;
    --color-danger-soft: #FBEAED;
    --color-danger-fill: #B00020;
    --color-danger-fill-hover: #960019;
    --color-danger-fill-pressed: #7E0015;
    --color-warning: #9A4E00;
    --color-warning-soft: #FDF1E2;
    --color-warning-note: color-mix(in srgb, #9A4E00 82%, black);
    --color-success: #1A6E3C;
    --color-success-soft: #E6F6EC;

    --opacity-disabled: 0.45;

    --color-hover-tint: rgba(38, 37, 30, 0.05);
    --color-accent-tint: rgba(36, 86, 214, 0.1);
    --color-pill: rgba(38, 37, 30, 0.92);
    --color-on-pill: #FFFFFF;
    /* No shadow on panels: a hairline border separates them (D177). These resolve per theme through var(). */
    --shadow-panel: none;
    --shadow-card: none;
    --shadow-segment: 0 0 0 1px var(--color-border);
    /* The only "shadow" left is functional: the keyboard focus ring, solid accent on a hairline of surface. */
    --focus-ring: 0 0 0 1px var(--color-surface), 0 0 0 3px var(--color-accent);
    --focus-ring-danger: 0 0 0 1px var(--color-surface), 0 0 0 3px var(--color-danger);

    /* Shape: 4px on controls, 6px on panels, never more (D177). */
    --radius-control: 4px;
    --radius-panel: 6px;

    /* --- The plan (docs/DESIGN.md §15, §23.1): every color it uses, here and nowhere else.
     * Walls and dimensions in ink on the stone sheet; amber/red only for what to check (D177, finding I1). --- */
    --plan-grid: #E0DFDA;
    /* Point density in one quiet slate-teal, light to dark (D179): red keeps one meaning, a doubtful wall. */
    --plan-density-sparse: #7F95A6;
    --plan-density-medium: #5B7487;
    --plan-density-dense: #2F4A5E;
    --plan-station-disc: #F7F6F3;
    --plan-halo: rgba(236, 235, 231, 0.95);
    --plan-halo-solid: #ECEBE7;
    --plan-room-fill: rgba(247, 246, 243, 0.92);
    --plan-room-fill-selected: rgba(227, 234, 251, 0.92);
    --plan-overlap-fill: rgba(251, 226, 229, 0.88);
    --plan-overlap-stroke: #C82828;
    --plan-ghost-fill: rgba(247, 246, 243, 0.9);
    --plan-wall-assumed: #D6D4CE;
    --plan-wall-entered: #4A4842;
    --plan-wall-exterior: #A3A19A;
    --plan-wall-ink: #26251E;
    --plan-wall-medium: #DC9614;
    --plan-wall-high: #C82828;
    --plan-dimension: #26251E;
    --plan-dimension-alert: #C82828;
    --plan-tape-pill: #E3EAFB;
    --plan-room-name: #26251E;
    --plan-room-area: #5E5C55;
    --plan-accent-hover: rgba(36, 86, 214, 0.6);
    --plan-accent-halo: rgba(36, 86, 214, 0.16);
    --plan-danger-halo: rgba(176, 0, 32, 0.14);

    /* Line drawing (DECISIONS.md D138/D139), on the same stone sheet as the rest of the canvas. */
    --plan-line-sheet: #ECEBE7;
    --plan-line-grid: #E0DFDA;
    --plan-line-ink: #26251E;
    --plan-line-medium: #C97A00;
    --plan-line-high: #C82828;
    --plan-line-accent: #2456D6;
    --plan-line-accent-hover: rgba(36, 86, 214, 0.55);
    --plan-line-accent-halo: rgba(36, 86, 214, 0.16);
    --plan-line-tape-pill: #E3EAFB;
    --plan-line-text: #26251E;
    --plan-line-text-secondary: #5E5C55;
    --plan-line-text-tertiary: #6B6962;
    --plan-line-text-halo: rgba(236, 235, 231, 0.95);
    /* DECISIONS.md D171: a computed wall end, neutral grey - none of the walls', points' or selection's hues. */
    --plan-line-anchor: #8A877F;

    /* System font stack: each OS's native UI font, no font file bundled (CLAUDE.md §2; offline on the Pi). */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Measurements (cotes, areas, number inputs, version): system monospace, tabular figures (D177). */
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --font-size-base: 14px;
    /* Minimum height of anything tapped on a touch screen (the pointer: coarse blocks). */
    --touch-target: 44px;

    color-scheme: light;
}

/* --- The dark theme (docs/DESIGN.md §26, DECISIONS.md D151/D177): theme.js sets data-theme on <html>
 * before anything paints. A real blueprint: deep blue-black sheet, surfaces a step lighter, light ink,
 * a light blueprint blue for marks, faint blue grid. --- */
:root[data-theme="dark"],
:root[data-theme="graphite"] {
    color-scheme: dark;
    scrollbar-color: #34496E transparent;

    --color-primary: #2456D6;
    --color-primary-hover: #2C60E2;
    --color-primary-pressed: #1E4BC0;
    --color-primary-soft: #1C3260;
    --color-accent: #82A8FF;

    --color-canvas: #0E1A2E;
    --color-surface: #14233B;
    --color-surface-raised: #22365A;
    --color-surface-muted: #1A2B47;
    --color-surface-sunken: #0B1526;
    --color-border: #22344F;
    --color-border-strong: #536A93;
    --color-border-control: #6D84AD;

    --color-text: #E8EDF5;
    --color-text-secondary: #AEBBD0;
    --color-text-tertiary: #93A2BC;

    --color-danger: #FF8A9B;
    --color-danger-soft: #3A1723;
    --color-danger-fill: #CF2C47;
    --color-danger-fill-hover: #D5324D;
    --color-danger-fill-pressed: #B8253E;
    --color-warning: #FFC24B;
    --color-warning-soft: #362A10;
    --color-warning-note: #FFC24B;
    --color-success: #4FD98D;
    --color-success-soft: #10301F;

    --opacity-disabled: 0.55;

    --color-hover-tint: rgba(232, 237, 245, 0.06);
    --color-accent-tint: rgba(130, 168, 255, 0.14);
    --color-pill: rgba(232, 237, 245, 0.96);
    --color-on-pill: #0E1A2E;

    --plan-grid: #172A47;
    --plan-density-sparse: #4F6D86;
    --plan-density-medium: #7896AE;
    --plan-density-dense: #B4CCDD;
    --plan-station-disc: #0E1A2E;
    --plan-halo: rgba(14, 26, 46, 0.92);
    --plan-halo-solid: #0E1A2E;
    --plan-room-fill: rgba(20, 35, 59, 0.88);
    --plan-room-fill-selected: rgba(130, 168, 255, 0.12);
    --plan-overlap-fill: rgba(255, 92, 114, 0.22);
    --plan-overlap-stroke: #FF5C72;
    --plan-ghost-fill: rgba(14, 26, 46, 0.9);
    --plan-wall-assumed: #2A3D5E;
    --plan-wall-entered: #8C9BB8;
    --plan-wall-exterior: #4E6185;
    --plan-wall-ink: #E8EDF5;
    --plan-wall-medium: #FFC24B;
    --plan-wall-high: #FF5C72;
    --plan-dimension: #DCE4F0;
    --plan-dimension-alert: #FF8A9B;
    --plan-tape-pill: #1C3260;
    --plan-room-name: #E8EDF5;
    --plan-room-area: #AEBBD0;
    --plan-accent-hover: rgba(130, 168, 255, 0.65);
    --plan-accent-halo: rgba(130, 168, 255, 0.2);
    --plan-danger-halo: rgba(255, 92, 114, 0.2);

    --plan-line-sheet: #0E1A2E;
    --plan-line-grid: #172A47;
    --plan-line-ink: #E8EDF5;
    --plan-line-medium: #FFC24B;
    --plan-line-high: #FF5C72;
    --plan-line-accent: #82A8FF;
    --plan-line-accent-hover: rgba(130, 168, 255, 0.65);
    --plan-line-accent-halo: rgba(130, 168, 255, 0.2);
    --plan-line-tape-pill: #1C3260;
    --plan-line-text: #E8EDF5;
    --plan-line-text-secondary: #AEBBD0;
    --plan-line-text-tertiary: #93A2BC;
    --plan-line-text-halo: rgba(14, 26, 46, 0.92);
    --plan-line-anchor: #9AA5B8;
}

/* --- Three more sheets (docs/DESIGN.md §42, DECISIONS.md D207), after locadmin's 60/30/10 themes: each
 * keeps its paper (60) and its ink (30); the 10 stays a blue, because on a plan amber and red already
 * mean "to check" and "doubtful" - locadmin's orange, red and pink accents would say it of a selection.
 * Only what differs from the sheet each one starts from is written here. --- */

/* Porcelaine: ivory sheet, white paper, navy ink - a print of the plan. The navy is also the fill of the
 * main button and the active tool; selection, focus and links keep a blue, apart from the navy walls. */
:root[data-theme="porcelain"] {
    --color-primary: #14213D;
    --color-primary-hover: #22325A;
    --color-primary-pressed: #0C1529;
    --color-primary-soft: #E2E8F6;
    --color-accent: #1F4FC2;

    --color-canvas: #F2EFE9;
    --color-surface: #FFFFFF;
    --color-surface-raised: #FFFFFF;
    --color-surface-muted: #F3F0EA;
    --color-surface-sunken: #E8E4DC;
    --color-border: #DDD8CE;
    --color-border-strong: #C2BCB0;
    --color-border-control: #8C8578;

    --color-text: #14213D;
    --color-text-secondary: #4A5470;
    --color-text-tertiary: #5A6480;

    --color-hover-tint: rgba(20, 33, 61, 0.05);
    --color-accent-tint: rgba(31, 79, 194, 0.1);
    --color-pill: rgba(20, 33, 61, 0.92);

    --plan-grid: #E3DFD6;
    --plan-station-disc: #FFFFFF;
    --plan-halo: rgba(242, 239, 233, 0.95);
    --plan-halo-solid: #F2EFE9;
    --plan-room-fill: rgba(255, 255, 255, 0.92);
    --plan-room-fill-selected: rgba(226, 232, 246, 0.92);
    --plan-ghost-fill: rgba(255, 255, 255, 0.9);
    --plan-wall-assumed: #D9D4CA;
    --plan-wall-entered: #3C4660;
    --plan-wall-exterior: #A29C90;
    --plan-wall-ink: #14213D;
    --plan-dimension: #14213D;
    --plan-tape-pill: #E2E8F6;
    --plan-room-name: #14213D;
    --plan-room-area: #4A5470;
    --plan-accent-hover: rgba(31, 79, 194, 0.6);
    --plan-accent-halo: rgba(31, 79, 194, 0.16);

    --plan-line-sheet: #F2EFE9;
    --plan-line-grid: #E3DFD6;
    --plan-line-ink: #14213D;
    --plan-line-accent: #1F4FC2;
    --plan-line-accent-hover: rgba(31, 79, 194, 0.55);
    --plan-line-accent-halo: rgba(31, 79, 194, 0.16);
    --plan-line-tape-pill: #E2E8F6;
    --plan-line-text: #14213D;
    --plan-line-text-secondary: #4A5470;
    --plan-line-text-tertiary: #5A6480;
    --plan-line-text-halo: rgba(242, 239, 233, 0.95);
    --plan-line-anchor: #8C8578;
}

/* Polaire: cold pale grey sheet, a blueprint's sky-blue grid and tints, deep ink, azure mark. */
:root[data-theme="polar"] {
    --color-primary: #0B62B0;
    --color-primary-hover: #0A5599;
    --color-primary-pressed: #084780;
    --color-primary-soft: #DCEBF5;
    --color-accent: #0B62B0;

    --color-canvas: #F1F3F4;
    --color-surface: #F7FAFC;
    --color-surface-raised: #FFFFFF;
    --color-surface-muted: #E6F0F7;
    --color-surface-sunken: #E1E8ED;
    --color-border: #D3DEE6;
    --color-border-strong: #A9BCCB;
    --color-border-control: #74899B;

    --color-text: #0F2233;
    --color-text-secondary: #44586B;
    --color-text-tertiary: #53677A;

    --color-hover-tint: rgba(15, 34, 51, 0.05);
    --color-accent-tint: rgba(11, 98, 176, 0.1);
    --color-pill: rgba(15, 34, 51, 0.92);

    --plan-grid: #D2E2EE;
    --plan-station-disc: #FAFBFC;
    --plan-halo: rgba(241, 243, 244, 0.95);
    --plan-halo-solid: #F1F3F4;
    --plan-room-fill: rgba(250, 251, 252, 0.92);
    --plan-room-fill-selected: rgba(220, 235, 245, 0.92);
    --plan-ghost-fill: rgba(250, 251, 252, 0.9);
    --plan-wall-assumed: #D0DCE5;
    --plan-wall-entered: #3B4F61;
    --plan-wall-exterior: #9AAAB8;
    --plan-wall-ink: #0F2233;
    --plan-dimension: #0F2233;
    --plan-tape-pill: #DCEBF5;
    --plan-room-name: #0F2233;
    --plan-room-area: #44586B;
    --plan-accent-hover: rgba(11, 98, 176, 0.6);
    --plan-accent-halo: rgba(11, 98, 176, 0.16);

    --plan-line-sheet: #F1F3F4;
    --plan-line-grid: #D2E2EE;
    --plan-line-ink: #0F2233;
    --plan-line-accent: #0B62B0;
    --plan-line-accent-hover: rgba(11, 98, 176, 0.55);
    --plan-line-accent-halo: rgba(11, 98, 176, 0.16);
    --plan-line-tape-pill: #DCEBF5;
    --plan-line-text: #0F2233;
    --plan-line-text-secondary: #44586B;
    --plan-line-text-tertiary: #53677A;
    --plan-line-text-halo: rgba(241, 243, 244, 0.95);
    --plan-line-anchor: #7E93A5;
}

/* Graphite: the dark sheet without its blue - neutral greys, silver ink, the same light blue mark. */
:root[data-theme="graphite"] {
    scrollbar-color: #4A4A4F transparent;

    --color-primary-soft: #1E2A44;

    --color-canvas: #1C1C1E;
    --color-surface: #242426;
    --color-surface-raised: #333336;
    --color-surface-muted: #2C2C2F;
    --color-surface-sunken: #161618;
    --color-border: #343437;
    --color-border-strong: #5C5C61;
    --color-border-control: #77777D;

    --color-text: #E4E5E8;
    --color-text-secondary: #ABADB3;
    --color-text-tertiary: #96989F;

    --color-hover-tint: rgba(228, 229, 232, 0.06);
    --color-pill: rgba(228, 229, 232, 0.96);
    --color-on-pill: #1C1C1E;

    --plan-grid: #2A2A2D;
    --plan-station-disc: #1C1C1E;
    --plan-halo: rgba(28, 28, 30, 0.92);
    --plan-halo-solid: #1C1C1E;
    --plan-room-fill: rgba(36, 36, 38, 0.88);
    --plan-ghost-fill: rgba(28, 28, 30, 0.9);
    --plan-wall-assumed: #3A3A3E;
    --plan-wall-entered: #9A9CA3;
    --plan-wall-exterior: #5A5A60;
    --plan-wall-ink: #E4E5E8;
    --plan-dimension: #DCDDE1;
    --plan-tape-pill: #1E2A44;
    --plan-room-name: #E4E5E8;
    --plan-room-area: #ABADB3;

    --plan-line-sheet: #1C1C1E;
    --plan-line-grid: #2A2A2D;
    --plan-line-ink: #E4E5E8;
    --plan-line-tape-pill: #1E2A44;
    --plan-line-text: #E4E5E8;
    --plan-line-text-secondary: #ABADB3;
    --plan-line-text-tertiary: #96989F;
    --plan-line-text-halo: rgba(28, 28, 30, 0.92);
    --plan-line-anchor: #9A9CA3;
}

/* Touch (tablet, findings I4/I5): every control, tool row and checkbox at least 44px tall, text a step larger. */
@media (pointer: coarse) {
    :root {
        --font-size-base: 15px;
    }
}

:root[data-theme="dark"] ::selection,
:root[data-theme="graphite"] ::selection {
    background-color: rgba(130, 168, 255, 0.35);
}

/* The checkbox is drawn, in both themes (D181): each browser's own box has its own border, too faint in
 * some (WCAG 1.4.11) and a neutral gray foreign to the blueprint sheet in Chrome's dark one. Same size and
 * focus ring as before. */
input[type="checkbox"] {
    appearance: none;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-control);
    border-radius: var(--radius-control);
    transition: background-color 0.1s ease;
}

input[type="checkbox"]:hover {
    border-color: var(--color-accent);
}

input[type="checkbox"]:checked {
    border-color: var(--color-primary);
    /* The check mark's color: a data URI cannot read a token; it is --color-on-primary. */
    background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4 6.7 11.5 12.5 4.8' fill='none' stroke='%23FFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-canvas);
    -webkit-font-smoothing: antialiased;
    /* docs/DESIGN.md §28 (DECISIONS.md D157): like a desktop application, the interface itself is not
     * text to select, so no drag on the plan ever highlights it. What is worth copying opts back in. */
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea,
.banner-error,
.banner-warning,
.field-value,
.folder-name,
.folder-path,
.exported-file-name {
    -webkit-user-select: text;
    user-select: text;
}

/* A press on a tool that slips while clicking must not lift a ghost of the link. */
a {
    -webkit-user-drag: none;
}

/* docs/DESIGN.md §28 (DECISIONS.md D157): nothing shows on a quick change of page; past 150 ms, a thin
 * line says the click was taken, instead of a frozen window. */
html.is-navigating body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 100;
    pointer-events: none;
    background-color: var(--color-accent);
    transform-origin: left center;
    transform: scaleX(0);
    animation: navigation-progress 8s cubic-bezier(0.1, 0.7, 0.2, 1) 150ms forwards;
}

@keyframes navigation-progress {
    to {
        transform: scaleX(0.92);
    }
}

@media (prefers-reduced-motion: reduce) {
    html.is-navigating body::before {
        animation: none;
        transform: scaleX(1);
        opacity: 0.6;
    }
}

h1, h2, p {
    margin: 0;
}

a {
    color: inherit;
}

/* --- Top bar: icon+wordmark brand mark (docs/DESIGN.md §9's .brand-mark) --- */

.topbar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 40px;
}

/* "Aller au contenu" (DECISIONS.md D189): the first stop of Tab on every page, out of sight until it has
 * the focus, then laid over the top bar's brand, above it, never under it. */
.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-control);
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(calc(-100% - 16px));
}

.skip-link:focus-visible {
    transform: none;
    outline: none;
    box-shadow: var(--focus-ring);
}

@media (pointer: coarse) {
    .skip-link {
        min-height: var(--touch-target);
    }
}

/* Reached by the skip link: the focus lands on the page itself, the next Tab goes to its first control. */
.page:focus {
    outline: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-panel);
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 700;
    font-size: 16px;
}

.brand-word {
    font-weight: 700;
    font-size: 15px;
}

/* --- Page layout: permanent canvas + floating windows (docs/WEB.md §6.1,
 * DECISIONS.md D105) --- */

/* html/body fill the viewport so `.page` (the area below the top bar) can
 * stretch to the remaining height - the background grid/plan must always
 * cover the full working area, not just as much as the body content needs
 * (ARCHITECTURE.md §9.1, DECISIONS.md D100): "plus jamais un fond blanc, plus jamais un plan
 * enfermé dans un encadré à part". */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

.topbar {
    flex: 0 0 auto;
}

/* The permanent canvas area: every screen, with or without plan data of its
 * own, renders this - `.page-background` is always present (docs/WEB.md
 * §6.1 point 1), never conditional on the current step. */
.page {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}

.page-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    /* docs/WEB.md §6.1 (D109): an open hand over the empty sheet, a closed one while panning. */
    cursor: grab;
    /* The sheet takes every finger itself (pan, pinch); the panels keep the browser's own scrolling. */
    touch-action: none;
}

.page-background .plan-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* The layer every screen's own body/panels live in, above the background -
 * scrolls independently so a tall floating window never hides the canvas
 * behind a page-level scrollbar (DECISIONS.md D100). */
.panel-layer {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* DECISIONS.md D120: the layer itself lets pointer events through to the
     * plan underneath (a room, a wall or a corner can now be picked or
     * dragged directly, docs/DESIGN.md §16-§17); only its floating cards
     * catch them. canvas-pan-zoom.js listens on main.page instead. */
    pointer-events: none;
}

.floating-window,
.floating-panel {
    pointer-events: auto;
    cursor: default;
}

.page.page--panning,
.page.page--panning .page-background {
    cursor: grabbing;
}

/* Default case: a screen's body is a single floating window, centered over
 * the canvas (DECISIONS.md D100). Bounded rather
 * than full width, so the canvas remains visible around it on anything
 * wider than a phone (docs/DESIGN.md §3's "panneaux flottants par-dessus un
 * canevas plein écran" principle, carried over to the web). */
.floating-window {
    max-width: 640px;
    width: 92%;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* A form step (docs/DESIGN.md §35, DECISIONS.md D183): one sheet in the canvas panels' style, its
 * title as the page heading, its sections split by a hairline, its actions last. Narrower than the
 * default window: a form reads in one column, the grid stays visible around it. */
.floating-window:has(> .step-sheet) {
    max-width: 520px;
}

.step-sheet {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.step-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-actions:empty {
    display: none;
}

/* The way back closes the sheet, under its hairline, quieter than the step's own action. */
.step-actions--after:last-child {
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.step-help {
    margin-top: -8px;
}

/* Two short fields side by side (a pair of distances, client and operator); one column on a phone. */
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 12px;
}

@media (max-width: 480px) {
    .field-grid {
        grid-template-columns: 1fr;
    }

    .step-sheet {
        padding: 20px 16px;
    }
}

/* Special case (RoomReviewHandler, DECISIONS.md D101): several independent
 * panels anchored to a corner each, rather than one centered window
 * (docs/WEB.md §6.1). */
.panel-stack {
    position: absolute;
    inset: 0;
}

/* Same card look as `.card` (border/radius/shadow/padding/flex) - a floating
 * panel over the canvas is still a card, it is simply positioned at a
 * corner instead of stacked in a column (docs/DESIGN.md §3's "tout élément
 * flottant a une carte blanche + ombre légère"). */
.floating-panel {
    position: absolute;
    width: 320px;
    max-width: calc(100% - 40px);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    padding: 20px;
    box-shadow: var(--shadow-panel);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* docs/DESIGN.md §14 (M12, DECISIONS.md D111): a collapsible section (native <details>/<summary>,
 * closed by default) for content that does not need to show every time a screen reappears -
 * styled rather than left as the browser's bare default marker/outline (never a raw unstyled
 * control). */
.disclosure {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    overflow: hidden;
}

.disclosure > summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 12px;
    background-color: var(--color-surface-muted);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.disclosure > summary::-webkit-details-marker {
    display: none;
}

/* The same drawn chevron as the palette's tool groups (D186): one sign for "this folds" everywhere. */
.disclosure > summary::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 10px 2px 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    color: var(--color-text-tertiary);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.disclosure[open] > summary::before {
    transform: rotate(45deg);
}

.disclosure > summary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.disclosure-content {
    padding: 10px 12px 2px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.floating-panel--top-left {
    top: 20px;
    left: 20px;
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 20px;
    }

    .floating-window {
        width: 100%;
        margin: 24px auto 48px;
        padding: 0 16px;
    }
}

/* Below a three-corner layout's practical minimum width, stack the panels
 * in the normal page flow instead of overlapping them - found necessary by
 * reasoning about the 320px panels: a phone browser can be far narrower
 * than 3 × 320px plus margins. */
@media (max-width: 760px) {
    .panel-stack {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .floating-panel {
        position: static;
        width: 100%;
        max-width: none;
    }
}

/* The two columns of the plan-editing screens (docs/DESIGN.md §23.6, DECISIONS.md D139): Whatever the window's height, nothing overlaps: what does not
 * fit scrolls inside its own card, the inspector stays under the tools and the decisions never
 * scroll. The plan is framed between the columns (canvas-pan-zoom.js). */
.editing-columns {
    position: absolute;
    inset: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.editing-column {
    flex: 0 0 320px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editing-column > .floating-panel {
    position: static;
    width: auto;
    max-width: none;
    min-height: 0;
    padding: 16px;
    gap: 10px;
}

.editing-column > .editing-palette {
    flex: 0 1 auto;
    overflow: hidden;
}

.editing-column > .editing-context {
    flex: 0 1 auto;
    overflow-y: auto;
}

.editing-column > .editing-decisions {
    flex: none;
    margin-top: auto;
}

.editing-palette .divider {
    flex: none;
    margin: 0;
    width: 100%;
}

.editing-scroll {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Inside something that scrolls, nothing shrinks: the list inside the room's card would collapse. */
.editing-scroll > *,
.editing-column > .editing-context > * {
    flex: none;
}

/* docs/DESIGN.md §23.11: when the height runs out, the demo and the measurements give way first, then the
 * tools (their active row kept in sight by plan-edit.js); what the user is doing gives way last. The
 * shrink factors are that order; the minimum heights keep each one recognizable. */
.editing-palette-tools {
    flex: 0 100 auto;
    min-height: 150px;
}

.editing-palette-inspector {
    flex: 0 1 auto;
}

.editing-palette-extras {
    flex: 0 10000 auto;
    min-height: 56px;
}

.editing-palette-extras:has(> .tool-demo[open]) {
    min-height: 88px;
}

.editing-palette-extras:not(:has(> :not([hidden]))) {
    display: none;
}

/* Macs hide their scrollbars until scrolled: an edge that fades says there is more, and only when there is
 * (no scroll range, no running animation, no fade), instead of a row cut in half. Without
 * scroll-driven animations, the list simply clips. */
@property --scroll-fade-top {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

@property --scroll-fade-bottom {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

@keyframes scroll-fade-top {
    from { --scroll-fade-top: 0px; }
    to { --scroll-fade-top: 16px; }
}

@keyframes scroll-fade-bottom {
    from { --scroll-fade-bottom: 16px; }
    to { --scroll-fade-bottom: 0px; }
}

@supports (animation-timeline: scroll()) {
    .editing-scroll,
    .editing-column > .editing-context {
        -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--scroll-fade-top), #000 calc(100% - var(--scroll-fade-bottom)), transparent);
        mask-image: linear-gradient(to bottom, transparent, #000 var(--scroll-fade-top), #000 calc(100% - var(--scroll-fade-bottom)), transparent);
        animation: scroll-fade-top linear both, scroll-fade-bottom linear both;
        animation-timeline: scroll(self), scroll(self);
        animation-range: 0 16px, calc(100% - 16px) 100%;
    }
}

/* A phone cannot show two columns beside a plan: everything in the page's flow, like .panel-stack, starting
 * under a stretch of sheet where the plan is framed (canvas-framing.js, D161): a card never hides it all. */
@media (max-width: 760px) {
    .editing-columns {
        position: static;
        flex-direction: column;
        gap: 16px;
        padding-top: 46vh;
        padding-top: 46dvh;
    }

    .page:has(.plan-point, .wall) .panel-stack {
        padding-top: 46vh;
        padding-top: 46dvh;
    }

    .editing-column {
        flex: none;
    }

    .editing-column > .floating-panel,
    .editing-scroll {
        overflow: visible;
    }
}

/* --- Typography scale (docs/DESIGN.md §2/§9) --- */

.hero {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* The home page's heading, its one action at the right at its natural size (finding F8): a page header, not a
 * full-width bar over the column. The step sheets keep their full-width actions, narrower than this column. */
.home-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.home-header > .button,
.home-header > form {
    flex: none;
    margin-top: 2px;
}

.home-header .button,
.home-header .button-secondary {
    width: auto;
    padding-left: 20px;
    padding-right: 20px;
}

@media (max-width: 480px) {
    .home-header {
        flex-direction: column;
        align-items: stretch;
    }

    .home-header .button,
    .home-header .button-secondary {
        width: 100%;
    }
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
}

.title {
    font-size: 22px;
    font-weight: 700;
}

.subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.caption {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-text-tertiary);
}

/* Touch (tablet, findings I4/I5): a finger needs 44px, whatever the control (D177). */
@media (pointer: coarse) {
    .button,
    .button-secondary,
    .button-danger-outline {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: var(--touch-target);
    }

    .text-field,
    .topbar-home,
    .topbar-theme,
    .segment,
    .tool-row,
    .checkbox-field,
    a.list-row,
    .list-row--action,
    .station-delete,
    .button-ghost,
    .breadcrumb a {
        min-height: var(--touch-target);
    }

    .topbar-home,
    .topbar-theme {
        height: auto;
    }

    .checkbox-field {
        align-items: center;
    }
}

/* --- Card: groups related content (Gestalt proximity, docs/DESIGN.md §7) --- */

.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-panel);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Status banner (docs/DESIGN.md §6): only ever rendered when there is
 * an actual message, same rule as WizardScreens.errorBanner — a handler
 * simply omits the markup rather than toggling visibility client-side. --- */

.banner {
    border-radius: var(--radius-panel);
    border: 1px solid transparent;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
}

.banner-error {
    background-color: var(--color-danger-soft);
    border-color: color-mix(in srgb, var(--color-danger) 35%, transparent);
    color: var(--color-danger);
}

.banner-warning {
    background-color: var(--color-warning-soft);
    border-color: color-mix(in srgb, var(--color-warning) 35%, transparent);
    color: var(--color-warning);
}

.banner-success {
    background-color: var(--color-success-soft);
    border-color: color-mix(in srgb, var(--color-success) 35%, transparent);
    color: var(--color-success);
}

/* Neutral information (DECISIONS.md D134): a normal state worth stating, never
 * a warning - an open room's contour. Same shape as every banner, no hue. */
.banner-info {
    background-color: var(--color-surface-muted);
    border-color: var(--color-border);
    color: var(--color-text);
}

/* --- Status pill: lidar availability (SPEC.md §3.1 "non branché / branché /
 * prêt") as a colored badge rather than plain text — one glance reads the
 * state without reading the words, same intent as docs/DESIGN.md §6's
 * "bandeau de statut coloré". --- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 4px 10px;
    border-radius: var(--radius-control);
    font-size: 12.5px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

.status-pill-not-connected {
    background-color: var(--color-surface-sunken);
    color: var(--color-text-secondary);
}

.status-pill-connected {
    background-color: var(--color-warning-soft);
    color: var(--color-warning);
}

.status-pill-ready {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

/* --- Buttons: states (docs/DESIGN.md §7) --- */

.button {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-control);
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.button:hover {
    background-color: var(--color-primary-hover);
}

.button:active {
    background-color: var(--color-primary-pressed);
}

.button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Disabled state (DECISIONS.md D77): found missing by real visual verification - an enabled and
 * a disabled "Vérifier la pièce" rendered pixel-identical, the only cue being the native
 * attribute itself (invisible to a user). Opacity 0.45 (docs/DESIGN.md §9). */
.button:disabled {
    opacity: var(--opacity-disabled);
    cursor: not-allowed;
}

.button:disabled:hover {
    background-color: var(--color-primary);
}

/* Self-contained rather than a modifier meant to be paired with `.button`
 * (DECISIONS.md D73): an HTML `<a>`/`<button>` has none of `.button`'s shape
 * by default — a call site that used
 * `class="button-secondary"` alone (without also `"button"`) rendered as an
 * unstyled, flex-stretched underlined link, found and fixed in this pass. */
.button-secondary {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    background-color: var(--color-surface);
    color: var(--color-accent);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    padding: 9px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.button-secondary:hover {
    background-color: var(--color-surface-muted);
}

.button-secondary:active {
    background-color: var(--color-surface-sunken);
}

.button-secondary:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--focus-ring);
}

/* Same disabled treatment as `.button:disabled` above (D77) - this is the one that was actually
 * found broken (the "Vérifier la pièce" button stays this class until a room has at least one
 * station, SPEC.md §3.5.2). */
.button-secondary:disabled {
    opacity: var(--opacity-disabled);
    cursor: not-allowed;
}

.button-secondary:disabled:hover {
    background-color: var(--color-surface);
}

/* --- Form fields (docs/DESIGN.md §9's .field-label/.text-field, DECISIONS.md D73) --- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

/* Read-only display of an already-chosen value (e.g. the workspace folder
 * picked via /folders). */
.field-value {
    background-color: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    padding: 8px 12px;
    font-size: var(--font-size-base);
    color: var(--color-text);
    word-break: break-all;
}

.text-field {
    width: 100%;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-control);
    border-radius: var(--radius-control);
    padding: 8px 12px;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* A measurement typed in: monospace, tabular figures, like the cotes on the plan (D177). */
.text-field[type="number"],
.text-field[inputmode="decimal"] {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.text-field::placeholder {
    color: var(--color-text-tertiary);
}

.text-field:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--focus-ring);
}

.text-field:disabled {
    background-color: var(--color-surface-sunken);
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- Checkbox fields: the box itself is drawn at the top of this file (D181, both themes); `accent-color`
 * stays as the fallback color of a browser without `appearance: none`. --- */

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: var(--font-size-base);
    line-height: 1.45;
    color: var(--color-text);
    cursor: pointer;
    padding: 2px 0;
}

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.checkbox-field input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-control);
}

/* --- Breadcrumb (folder browser, docs/WEB.md §4.1): navigable ancestors as
 * links, current directory as plain emphasised text — clicking it would
 * only reload the same page, so it is deliberately not a link. --- */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 2px 5px;
    border-radius: var(--radius-control);
}

.breadcrumb a:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.breadcrumb a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.breadcrumb-separator {
    color: var(--color-text-tertiary);
}

.breadcrumb-current {
    padding: 2px 5px;
    font-weight: 600;
    color: var(--color-text);
}

/* --- Inline form: a text field and its submit button side by side (folder
 * browser's "create a folder here" mini-form) rather than each on its own
 * full-width line. --- */

.inline-form {
    display: flex;
    gap: 10px;
}

.inline-form .text-field {
    flex: 1;
}

.inline-form .button-secondary {
    width: auto;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .inline-form {
        flex-direction: column;
    }
}

/* --- Field stack (DECISIONS.md D75): a <form> has no box styling of its
 * own, so its direct children (a <h2 class="section-title">, several
 * <label class="field">, a submit <button>) stack flush against each
 * other with zero gap - any apparent spacing in that case comes only from
 * each element's own line-height/padding, not a real margin. That reads
 * fine for a single field but breaks down the moment two fields need to
 * look like two distinct groups (docs/DESIGN.md §7's Gestalt proximity),
 * e.g. Calibration's "Mesure proche"/"Mesure éloignée". `.field-stack`
 * makes the <form> a flex column with the same 12px gap already used by
 * `.card` (the same rhythm, not a new one), and a second `.section-title`
 * in the same stack - marking a new group of fields - gets extra top
 * margin so the group boundary reads as 20px (the same "between blocks"
 * spacing used elsewhere, docs/DESIGN.md §9/§10) rather than the same
 * 12px used for fields that belong together. */
.field-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-stack h2.section-title:not(:first-of-type) {
    margin-top: 8px;
}

/* --- List: recent surveys today, any future file/history list tomorrow
 * (docs/DESIGN.md §6 "libellé principal + annotation secondaire") --- */

.list {
    display: flex;
    flex-direction: column;
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.list-row:last-child {
    border-bottom: none;
}

.list-row-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

.list-row-caption {
    font-size: 12.5px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A list row used as a navigable link (folder browser's subdirectory list,
 * DECISIONS.md D73) rather than a passive row (recent surveys above): hover/
 * focus feedback plus a trailing chevron so it reads as "go into this
 * folder", not just a styled label — Nielsen heuristic n°1, docs/DESIGN.md §7. */

a.list-row {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border-radius: var(--radius-control);
    padding: 10px;
    margin: 0 -10px;
    transition: background-color 0.1s ease;
}

a.list-row:hover {
    background-color: var(--color-surface-muted);
}

a.list-row:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

a.list-row::after {
    content: "\203A";
    color: var(--color-text-tertiary);
    font-size: 16px;
    line-height: 1;
}

/* --- Loading dots (DECISIONS.md D163, docs/DESIGN.md §5): the one waiting indicator of the web
 * interface, from the owner's mock-up (commit fc35e2d, removed by D198) - three small
 * spheres (highlight top left, shade bottom right) that swell one after the other, 0.2 s apart, on a
 * 1.2 s cycle. Colors come from the theme only: the brand's mark color, lightened toward white for
 * the highlight and darkened toward black for the shade, so both themes are covered by the same
 * rule. Markup: <span class="loading-dots"><span></span><span></span><span></span></span>, with
 * role="status" and a label from messages_fr.properties when nothing else on the page announces
 * the wait, aria-hidden="true" otherwise. --- */

.loading-dots {
    --loading-dot-color: var(--color-accent);
    --loading-dot-highlight: color-mix(in srgb, var(--color-accent) 45%, white);
    --loading-dot-shade: color-mix(in srgb, var(--color-accent) 62%, black);
    --loading-dot-shadow: var(--shadow-segment);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 14px;
    flex-shrink: 0;
}

.loading-dots > span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%,
            var(--loading-dot-highlight) 0%, var(--loading-dot-color) 45%, var(--loading-dot-shade) 100%);
    box-shadow: var(--loading-dot-shadow);
    transform: scale(0.5);
    opacity: 0.4;
    animation: loading-dots-pulse 1.2s ease-in-out infinite;
}

.loading-dots > span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots > span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-dots-pulse {
    0%, 60%, 100% {
        transform: scale(0.5);
        opacity: 0.4;
    }

    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* On a primary button: the text color, a hint of the button's own color in the shade, no shadow
 * (a shadow under a light dot on a colored fill reads as dirt). */
.loading-dots--on-primary {
    --loading-dot-color: var(--color-on-primary);
    --loading-dot-highlight: var(--color-on-primary);
    --loading-dot-shade: color-mix(in srgb, var(--color-on-primary) 70%, var(--color-primary));
    --loading-dot-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .loading-dots > span {
        animation: none;
        transform: none;
        opacity: 0.7;
    }
}

/* A running capture (DECISIONS.md D205): the dots beside the phase ("Capture en cours…", then
 * "Recalage en cours…"), a hairline bar filled by the lidar's real revolutions, then what the user may
 * do meanwhile. The bar is full and quiet once the lidar is done: the dots alone say the wait goes on. */
.capture-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.capture-status p {
    margin: 0;
}

.capture-status-phase {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

.capture-progress {
    --capture-progress: 0;
    position: relative;
    height: 4px;
    border-radius: 2px;
    background-color: var(--color-surface-sunken);
    overflow: hidden;
}

.capture-progress-fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: var(--color-accent);
    transform: scaleX(var(--capture-progress));
    transform-origin: left center;
    transition: transform 0.3s ease-out, background-color 0.3s ease;
}

.capture-progress--registering .capture-progress-fill {
    background-color: var(--color-border-strong);
}

/* Two lines of hint either way: "Annuler" stays put when the phase changes. */
.capture-status .caption {
    min-height: 2.5em;
}

@media (prefers-reduced-motion: reduce) {
    .capture-progress-fill {
        transition: none;
    }
}

/* --- Restart (docs/DESIGN.md §27, DECISIONS.md D155): a recovery action, so the quietest thing on
 * the home page; its confirmation takes over that same spot, red only when a capture would be lost. --- */

.home-restart {
    display: flex;
    justify-content: center;
}

.home-restart-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: var(--radius-control);
    color: var(--color-text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.1s ease;
}

.home-restart-link svg {
    stroke: var(--color-text-tertiary);
}

.home-restart-link:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.home-restart-link:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.restart-confirm {
    width: 100%;
}

.restart-confirm--capture {
    background-color: var(--color-danger-soft);
    border-color: color-mix(in srgb, var(--color-danger) 35%, transparent);
}

.restart-confirm-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

.restart-confirm--capture .restart-confirm-title {
    color: var(--color-danger);
}

.restart-confirm-text {
    margin: 0;
    font-size: 13px;
    color: var(--color-text);
}

.restart-confirm-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.restart-confirm-actions form {
    margin: 0;
}

.restart-confirm-actions .button,
.restart-confirm-actions .button-secondary {
    width: auto;
    padding: 8px 14px;
}

/* The wait's duration is unknown (docs/DESIGN.md §5): a turning ring, drawn here because the page
 * has nothing else to show. It keeps turning after the "too long" text since polling goes on. */
.restart-waiting {
    align-self: center;
    width: min(100%, 420px);
    margin-top: 12vh;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
}

.restart-waiting .loading-dots {
    margin-bottom: 8px;
}

.restart-waiting .subtitle {
    margin: 0;
    line-height: 1.45;
}

/* --- Plan rendering (DECISIONS.md D79, docs/DESIGN.md §11.2): the room
 * points preview is the first screen to inline PlanSvgRenderer's output
 * (D78) - until now its circles had no class rules at all, so they fell
 * back to SVG's native default fill (plain black for every circle,
 * points included), not a chosen color. --- */

/* The inline <svg> has no width/height attribute (PlanSvgRenderer only sets
 * viewBox, docs/WEB.md §6: no server-side pixel size). */
.plan-svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ===== The plan itself (docs/DESIGN.md §15, DECISIONS.md D120) =====
 * Coordinates are meters: every on-screen size is either a non-scaling stroke
 * (docs/DESIGN.md §11.4's lesson) or a calc() of --plan-px, the length of one
 * screen pixel in meters, set by PlanSvgRenderer and kept current on zoom by
 * canvas-pan-zoom.js. */

.plan-sheet-bg {
    fill: var(--color-canvas);
}

.plan-grid-line {
    stroke: var(--plan-grid);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}

/* docs/DESIGN.md §12.2: sparse -> medium -> dense. PlanSvgRenderer writes only the point's normalized
 * density (--d), so its color follows the theme with no per-theme markup. */
.plan-point {
    --density-low: clamp(0, calc(var(--d, 0) * 2), 1);
    --density-high: clamp(0, calc(var(--d, 0) * 2 - 1), 1);
    fill: color-mix(in srgb,
            color-mix(in srgb, var(--plan-density-dense) calc(var(--density-high) * 100%), var(--plan-density-medium))
            calc(var(--density-low) * 100%),
            var(--plan-density-sparse));
    fill-opacity: 0.75;
    r: calc(var(--plan-px) * 1px);
}

/* A station: a disc of the sheet's color, brand ring, brand center. */
.plan-station {
    fill: var(--plan-station-disc);
    stroke: var(--color-accent);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    r: calc(var(--plan-px) * 5.5px);
}

.plan-station-core {
    fill: var(--color-accent);
    r: calc(var(--plan-px) * 2px);
}

/* docs/DESIGN.md §22 (DECISIONS.md D136): each station's number beside its marker - the number of its
 * row in the station list - and the emphasis that row gives it on hover (brand) or while its
 * deletion awaits confirmation (danger). */
.plan-station-halo {
    fill: transparent;
    r: calc(var(--plan-px) * 13px);
}

.plan-station-number {
    font-family: var(--font-family);
    font-size: calc(var(--plan-px) * 11px);
    font-weight: 700;
    fill: var(--color-text-secondary);
    paint-order: stroke fill;
    stroke: var(--plan-halo);
    stroke-width: calc(var(--plan-px) * 3.5px);
}

.plan-station-marker--emphasized .plan-station-halo {
    fill: var(--plan-accent-halo);
}

.plan-station-marker--emphasized .plan-station {
    stroke-width: 2.5px;
    r: calc(var(--plan-px) * 7px);
}

.plan-station-marker--emphasized .plan-station-number {
    fill: var(--color-accent);
}

.plan-station-marker--danger .plan-station-halo {
    fill: var(--plan-danger-halo);
}

.plan-station-marker--danger .plan-station {
    stroke: var(--color-danger);
}

.plan-station-marker--danger .plan-station-core,
.plan-station-marker--danger .plan-station-number {
    fill: var(--color-danger);
}

/* A closed room reads as a sheet laid on the grid. */
.plan-room-fill {
    fill: var(--plan-room-fill);
}

.plan-room-fill--selected {
    fill: var(--plan-room-fill-selected);
}

/* SPEC.md §3.6's overlap warning, on the plan itself: two tinted rooms make
 * their shared area visibly darker where they overlap. */
.plan-room-fill--overlap {
    fill: var(--plan-overlap-fill);
    stroke: var(--plan-overlap-stroke);
    stroke-width: 1px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
}

/* A room with no wall to draw (open, nothing extracted): a dashed marker. */
.plan-room-ghost {
    fill: var(--plan-ghost-fill);
    stroke: var(--color-text-tertiary);
    stroke-width: 1.5px;
    stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke;
    r: calc(var(--plan-px) * 14px);
}

/* The wall at its real thickness (SPEC.md §6.7): light while assumed, dark
 * once the user entered it. The same-color hairline closes the antialiasing
 * seam between neighbouring bodies. */
.plan-wall-body {
    stroke-width: 0.6px;
    stroke-linejoin: miter;
    vector-effect: non-scaling-stroke;
}

.plan-wall-body--assumed {
    fill: var(--plan-wall-assumed);
    stroke: var(--plan-wall-assumed);
}

.plan-wall-body--entered {
    fill: var(--plan-wall-entered);
    stroke: var(--plan-wall-entered);
}

.plan-wall-exterior {
    stroke: var(--plan-wall-exterior);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}

/* The measured interior face: the strongest line of the plan, in ink. Only a
 * wall that needs attention (SPEC.md §2.4) gets a color - amber or red, a little
 * heavier, no glow (D180) - so the eye finds doubtful walls first. */
.wall {
    fill: none;
    stroke: var(--plan-wall-ink);
    stroke-width: 1.6px;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

/* A room reopened from the assembly: its neighbours where they were placed, seen and out of reach (D160). */
.plan-neighbour-wall {
    stroke: var(--color-text-tertiary);
    stroke-width: 1.2px;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.plan-layer--neighbours {
    pointer-events: none;
}

.plan-room-name--neighbour {
    fill: var(--color-text-tertiary);
}

.wall--low-uncertainty,
.wall--neutral {
    stroke: var(--plan-wall-ink);
}

.wall--medium-uncertainty {
    stroke: var(--plan-wall-medium);
    stroke-width: 2px;
}

.wall--high-uncertainty {
    stroke: var(--plan-wall-high);
    stroke-width: 2px;
}

/* Dimensions: inside the room, parallel to the wall, on a halo of the sheet's color. */
.plan-dimension-halo,
.plan-dimension {
    font-family: var(--font-mono);
    font-size: calc(var(--plan-px) * 11px);
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
    font-variant-numeric: tabular-nums;
}

.plan-dimension-halo {
    fill: var(--plan-halo-solid);
    stroke: var(--plan-halo);
    stroke-width: calc(var(--plan-px) * 3.5px);
    stroke-linejoin: round;
}

.plan-dimension {
    fill: var(--plan-dimension);
}

/* docs/DESIGN.md §38 (D187): the dwelling's overall dimensions, outside the drawing, in the dimensions' ink:
 * thin extension lines, the dimension line, an architect's slash at each end, the length on a halo. */
.plan-overall {
    pointer-events: none;
}

.plan-overall-extension,
.plan-overall-dimension,
.plan-overall-tick {
    stroke: var(--plan-dimension);
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
}

.plan-overall-extension {
    stroke-width: 0.8px;
}

.plan-overall-dimension {
    stroke-width: 1px;
}

.plan-overall-tick {
    stroke-width: 1.6px;
}

.plan-overall-label {
    font-weight: 700;
}

/* docs/DESIGN.md §4: explicit warning, on top of the wall's own color. */
.plan-dimension--alert {
    fill: var(--plan-dimension-alert);
}

/* SPEC.md §7.3: a length entered with a tape reads as such - brand color on a
 * soft pill (a wide round-joined stroke behind the text). */
.plan-dimension--tape {
    fill: var(--color-accent);
    font-weight: 700;
}

.plan-dimension-halo--tape {
    fill: var(--plan-tape-pill);
    stroke: var(--plan-tape-pill);
    stroke-width: calc(var(--plan-px) * 10px);
    font-weight: 700;
}

.plan-dimension-group--hidden {
    display: none;
}

/* SPEC.md §7.1: room name and area at the room's center. */
.plan-room-name,
.plan-room-area {
    font-family: var(--font-family);
    text-anchor: middle;
    dominant-baseline: central;
    paint-order: stroke fill;
    stroke: var(--plan-halo);
    stroke-linejoin: round;
}

.plan-room-name {
    font-size: calc(var(--plan-px) * 13px);
    font-weight: 700;
    fill: var(--plan-room-name);
    stroke-width: calc(var(--plan-px) * 4px);
}

.plan-room-name--ghost {
    fill: var(--color-text-secondary);
    font-weight: 600;
}

.plan-room-area {
    font-family: var(--font-mono);
    font-size: calc(var(--plan-px) * 11.5px);
    fill: var(--plan-room-area);
    stroke-width: calc(var(--plan-px) * 4px);
    font-variant-numeric: tabular-nums;
}

/* An open room's "pièce ouverte" in the area's place (DECISIONS.md D134): a
 * state, not a figure - tertiary, never alarming. */
.plan-room-area--open {
    fill: var(--color-text-tertiary);
}

/* ===== Line drawing (docs/DESIGN.md §15.1, §23.1, DECISIONS.md D138/D139): simple measured lines
 * (no glow since D180), no wall thickness, for the three constraint-editing screens (Vérification de
 * la pièce, Mesures télémètre, Revue du plan). `.plan-svg--lines` is added once by PlanSvgRenderer;
 * every color of this mode is a --plan-line-* token at the top of this file, one set per theme. */

.plan-svg--lines .plan-sheet-bg {
    fill: var(--plan-line-sheet);
}

.plan-svg--lines .plan-grid-line {
    stroke: var(--plan-line-grid);
}

.plan-svg--lines .wall--low-uncertainty,
.plan-svg--lines .wall--neutral {
    stroke: var(--plan-line-ink);
}

.plan-svg--lines .wall--medium-uncertainty {
    stroke: var(--plan-line-medium);
}

.plan-svg--lines .wall--high-uncertainty {
    stroke: var(--plan-line-high);
}

.plan-svg--lines .wall--selected,
.plan-svg--lines .wall-hit:hover + .wall.wall--selected {
    stroke: var(--plan-line-accent);
}

.plan-svg--lines .wall-hit:hover + .wall {
    stroke: var(--plan-line-accent-hover);
}

.plan-svg--lines .plan-room-ghost {
    fill: transparent;
    stroke: var(--plan-line-text-tertiary);
}

.plan-svg--lines .plan-room-fill--selected {
    fill: var(--plan-line-accent-halo);
}

.plan-svg--lines .plan-dimension-halo {
    fill: var(--plan-line-text-halo);
    stroke: var(--plan-line-text-halo);
}

.plan-svg--lines .plan-dimension {
    fill: var(--plan-line-text-secondary);
}

.plan-svg--lines .plan-dimension--alert {
    fill: var(--plan-line-high);
}

.plan-svg--lines .plan-dimension--tape {
    fill: var(--plan-line-accent);
}

.plan-svg--lines .plan-dimension-halo--tape {
    fill: var(--plan-line-tape-pill);
    stroke: var(--plan-line-tape-pill);
}

.plan-svg--lines .plan-room-name,
.plan-svg--lines .plan-room-area {
    stroke: var(--plan-line-text-halo);
}

.plan-svg--lines .plan-room-name {
    fill: var(--plan-line-text);
}

.plan-svg--lines .plan-room-name--ghost {
    fill: var(--plan-line-text-secondary);
}

/* A neighbour shown around a reopened room (D160): its name as quiet as its lines (D161). */
.plan-svg--lines .plan-room-name--neighbour {
    fill: var(--color-text-tertiary);
    font-weight: 500;
}

.plan-svg--lines .plan-room-area {
    fill: var(--plan-line-text-secondary);
}

.plan-svg--lines .plan-room-area--open {
    fill: var(--plan-line-text-tertiary);
}

.plan-svg--lines .plan-station {
    fill: var(--plan-line-sheet);
    stroke: var(--plan-line-accent);
}

.plan-svg--lines .plan-station-core {
    fill: var(--plan-line-accent);
}

.plan-svg--lines .plan-station-number {
    fill: var(--plan-line-text-secondary);
    stroke: var(--plan-line-text-halo);
}

.plan-svg--lines .plan-station-marker--emphasized .plan-station-halo {
    fill: var(--plan-line-accent-halo);
}

.plan-svg--lines .plan-station-marker--emphasized .plan-station-number {
    fill: var(--plan-line-accent);
}

.plan-svg--lines .plan-guide {
    stroke: var(--plan-line-accent);
}

/* .plan-guide-label(-pill): --color-pill. */

/* Handles (docs/DESIGN.md §23.9): solid = joined, open = free; the shape says it even at the smallest
 * size. --handle-r is set by plan-edit.js from the neighbors at the current zoom. */
.plan-svg--lines .plan-corner {
    fill: var(--plan-line-ink);
    stroke: var(--plan-line-sheet);
    stroke-width: 1px;
    r: calc(var(--plan-px) * (var(--handle-r, 3.5) + 0.5) * 1px);
}

/* Five dashes that close up at any radius (2π/5 = 1.2566 of the radius each, 68 % dash): dashes as wide
 * as their gaps faded to a blur at 1x, weaker than the small solid ring (docs/DESIGN.md §23.11). */
.plan-svg--lines .plan-corner--free {
    fill: var(--plan-line-sheet);
    stroke: var(--plan-line-ink);
    stroke-width: 1.25px;
    stroke-dasharray: calc(var(--handle-r, 3.5) * 0.855px) calc(var(--handle-r, 3.5) * 0.402px);
    r: calc(var(--plan-px) * var(--handle-r, 3.5) * 1px);
}

/* Too small for dashes: the open ring says it alone. */
.plan-svg--lines .plan-corner--free.plan-corner--idle {
    stroke-dasharray: none;
}

.plan-corner--idle {
    pointer-events: none;
    cursor: default;
}

.plan-svg--lines .plan-corner--active {
    fill: var(--plan-line-accent);
    stroke: var(--plan-line-sheet);
}

.plan-svg--lines .plan-corner--free.plan-corner--active {
    fill: var(--plan-line-sheet);
    stroke: var(--plan-line-accent);
    stroke-width: 1.75px;
}

/* Picked: an accent disc around a center of the sheet's color. */
.plan-svg--lines .plan-corner--selected,
.plan-svg--lines .plan-corner--free.plan-corner--selected {
    fill: var(--plan-line-sheet);
    stroke: var(--plan-line-accent);
    stroke-width: 3.5px;
    stroke-dasharray: none;
    r: calc(var(--plan-px) * (var(--handle-r, 5.5) - 1.75) * 1px);
}

.plan-corner-halo {
    fill: var(--plan-line-accent);
    opacity: 0.14;
    pointer-events: none;
}

.plan-corner-halo--join {
    opacity: 0.24;
}

/* A computed wall end (docs/DESIGN.md §30, DECISIONS.md D171): a grey reference cross - SketchUp marks a
 * guide point the same way, a small cross of constant on-screen size - over a halo of the sheet's color so
 * that it reads over walls and points alike. The arms are a scale of one screen pixel: the cross keeps its
 * size on zoom. Hidden where an end still sits on it. Under a dragged point about to be put back: accent,
 * and big enough to show around the handle that covers it. */
.plan-anchor {
    pointer-events: none;
}

.plan-anchor--covered {
    display: none;
}

.plan-anchor-halo,
.plan-anchor-mark {
    fill: none;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    transform: scale(var(--plan-px));
}

.plan-anchor-halo {
    stroke: var(--plan-line-sheet);
    stroke-width: 4px;
}

.plan-anchor-mark {
    stroke: var(--plan-line-anchor);
    stroke-width: 1.75px;
}

.plan-anchor--target .plan-anchor-halo,
.plan-anchor--target .plan-anchor-mark {
    transform: scale(calc(var(--plan-px) * 1.75));
}

.plan-anchor--target .plan-anchor-mark {
    stroke: var(--plan-line-accent);
}

/* The cross in front of its explanation, centered on the first line whatever the wrap. */
.computed-end-legend {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.computed-end-legend-mark {
    flex: none;
    width: 13px;
    height: 13px;
    margin-top: calc((1lh - 13px) / 2);
    fill: none;
    stroke: var(--plan-line-anchor);
    stroke-width: 1.75px;
    stroke-linecap: round;
}

/* A point under the pointer wins over the wall it ends. */
.plan-svg--over-point .wall-hit {
    pointer-events: none;
}

/* What a selection rectangle holds, in the weight of a selected wall. */
.plan-svg--lines .wall--caught {
    stroke: var(--plan-line-accent);
    stroke-width: 3px;
}

/* Every gesture that selects speaks the brand color (docs/DESIGN.md §23.9), never a red that would
 * read as one more density color of the cloud. */
.plan-selection-rect {
    fill: var(--color-accent);
    fill-opacity: 0.08;
    stroke: var(--color-accent);
    stroke-width: 1px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.plan-lasso,
.plan-lasso-closing {
    fill: none;
    stroke: var(--color-accent);
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.plan-lasso {
    stroke-width: 1.5px;
}

.plan-lasso-closing {
    stroke-width: 1px;
    stroke-dasharray: 4 3;
}

.plan-lasso-fill {
    fill: var(--color-accent);
    fill-opacity: 0.08;
    stroke: none;
    pointer-events: none;
}

.plan-point--caught {
    fill: var(--color-accent) !important;
    fill-opacity: 1;
    r: calc(var(--plan-px) * 1.25px);
}

.plan-svg--lasso {
    cursor: crosshair;
}

.page--pan-ready,
.page--pan-ready .plan-svg {
    cursor: grab;
}

/* Cutting a wall: its ends named, the foot of the cut, the shape to come. */
.plan-cut-overlay {
    pointer-events: none;
}

.plan-cut-badge {
    fill: var(--plan-line-accent);
    stroke: var(--plan-line-sheet);
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
}

.plan-cut-badge-text {
    font-family: var(--font-family);
    font-size: calc(var(--plan-px) * 11px);
    font-weight: 700;
    fill: var(--plan-line-sheet);
    text-anchor: middle;
    dominant-baseline: central;
}

.plan-cut-tick {
    stroke: var(--plan-line-accent);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.plan-cut-point {
    fill: var(--plan-line-sheet);
    stroke: var(--plan-line-accent);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.plan-cut-shape {
    fill: none;
    stroke: var(--plan-line-accent);
    stroke-width: 1.5px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
}

.plan-cut-foot {
    stroke: var(--plan-line-accent);
    stroke-width: 1px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
}

/* --- Room review: grouping the display toggles and the five actions
 * (DECISIONS.md D82). Both <form>s here have no box styling of their own
 * (the same gap:0 defect D75 already found and fixed on Calibration), so
 * `.field-stack` is applied directly on the <form> itself this time rather
 * than on its ancestor - correcting the placement the RoomReviewHandler
 * (D81) had copied from the ".card.field-stack" convention without actually
 * putting the class on the element that needed it. --- */

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* Groups mutually exclusive actions on one line rather than stacking them -
 * Gestalt proximity (docs/DESIGN.md §7). `flex: 1`
 * on each child overrides .button/.button-secondary's own `width: 100%`
 * (flex-basis wins), so a lone child (e.g. "Confirmer", alone on its row since
 * D134 removed "Accepter cette approximation") still spans the row. */
.button-row {
    display: flex;
    gap: 12px;
}

.button-row > * {
    flex: 1;
}

@media (max-width: 480px) {
    .button-row {
        flex-direction: column;
    }
}

/* A 320px corner panel (.floating-panel) is narrower than the 480px
 * breakpoint above ever anticipated for a *desktop-width* viewport (the
 * breakpoint only fires on an actually narrow screen) - found by a real
 * screenshot, not assumed: three buttons squeezed side by side into
 * `.button-row` inside a floating panel wrapped their labels onto several
 * lines ("Terminer / les / pièces"), fixed by stacking one control per
 * row rather than widening the panel (DECISIONS.md D98 iteration 2). Same
 * fix here: a floating panel's own button/checkbox rows always stack,
 * regardless of viewport width. */
.floating-panel .button-row,
.floating-panel .checkbox-row {
    flex-direction: column;
}

.floating-panel .button-row > * {
    flex: none;
}

/* Separates the "decide" actions (confirm/accept) from the "move on" actions
 * (add station/next room/finish) - a plain hairline rather than another
 * banner or caption, consistent with the "cohérence des composants"
 * heuristic (docs/DESIGN.md §7): no new visual language, just the existing
 * border color used as a divider. Margin left at 0 since .field-stack's own
 * 12px gap already spaces it from its neighbours. */
.divider {
    width: 100%;
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0;
}

/* ===== Direct manipulation on the plan (docs/DESIGN.md §16-§17, DECISIONS.md D121/D122) ===== */

.panel-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

/* A gesture hint: a small key-cap, then what it does. */
.gesture-hints {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gesture-hints li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--color-text-secondary);
}

/* A mouse hint and its finger counterpart (DECISIONS.md D185): each shown only for its own pointer, so a
 * tablet never reads "Molette" or "Clic". */
.gesture-hints li.gesture-hint--touch {
    display: none;
}

@media (pointer: coarse) {
    .gesture-hints li.gesture-hint--touch {
        display: flex;
    }

    .gesture-hints li.gesture-hint--pointer {
        display: none;
    }
}

/* Visible to a screen reader only: what a live region announces when the screen already shows it otherwise. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.gesture-key {
    flex: 0 0 auto;
    min-width: 66px;
    text-align: center;
    font-family: var(--font-family);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background-color: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    padding: 1px 7px;
}

/* Selectable rows (rooms, tools): the whole row is the target (loi de Fitts). */
.room-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: -4px 0 0 0;
}

.room-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-control);
    color: var(--color-text);
    text-decoration: none;
}

.room-row:hover {
    background-color: var(--color-surface-muted);
}

.room-row:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.room-row--selected,
.room-row--selected:hover {
    background-color: var(--color-primary-soft);
}

.room-row-title {
    font-size: 13.5px;
    font-weight: 600;
}

.room-row-caption {
    font-size: 12px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    /* Never past the panel's edge (found with an open room's longer caption, D134): it gives way first. */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-row--warning .room-row-caption {
    color: var(--color-warning);
}

/* A room's row and, beside it, its way back to its own page - always there, no selection first (D206). */
.room-item {
    display: flex;
    align-items: center;
    gap: 2px;
}

.room-item > .room-row {
    flex: 1;
    min-width: 0;
}

/* The selection tints the whole row, its Modifier included. */
.room-item:has(> .room-row--selected) {
    background-color: var(--color-primary-soft);
    border-radius: var(--radius-control);
}

.room-item-edit {
    margin: 0;
    flex: none;
}

/* The selection's inspector: a quiet sunken block. */
.inspector {
    background-color: var(--color-surface-muted);
    border-radius: var(--radius-panel);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* What the tool asks is the first thing to read: secondary text, never tertiary (docs/DESIGN.md §23.9). */
.inspector .caption {
    margin: 0;
    font-weight: 400;
    color: var(--color-text-secondary);
}

/* A result inside the sunken block: compact, one level below a page's banner. */
.inspector .banner {
    padding: 8px 10px;
    border-radius: var(--radius-panel);
    font-size: 12.5px;
}

.inspector-title {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

.button-row--inline {
    flex-direction: row !important;
    display: flex;
    gap: 8px;
    width: 100%;
}

.floating-panel .button-row--inline > form {
    flex: 1;
}

.button-row--inline .button-secondary {
    width: 100%;
}

.inline-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-field .text-field {
    flex: 1;
    min-width: 0;
}

.field-unit {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.inline-field .button {
    width: auto;
}

/* Two secondary ways out on one row: the decisions keep their height for what the column above needs (D161). */
.button-pair {
    display: flex;
    gap: 8px;
}

.button-pair > form {
    flex: 1;
    min-width: 0;
}

.button-pair .button-secondary {
    width: 100%;
    padding-left: 6px;
    padding-right: 6px;
}

/* A short window gives the height to the inspector: the buttons speak for themselves (D161). */
@media (max-height: 760px) {
    .editing-decisions > .caption {
        display: none;
    }
}

/* The decision of the step: taller than an ordinary button (loi de Fitts). */
.button.button-large {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 14.5px;
}

/* --- On the plan --- */

.plan-room--draggable {
    cursor: move;
}

.wall-hit {
    stroke: transparent;
    stroke-width: 14px;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    pointer-events: stroke;
    cursor: pointer;
}

.wall--pickable {
    pointer-events: none;
}

.wall-hit:hover + .wall {
    stroke: var(--plan-accent-hover);
    stroke-width: 2.5px;
}

.wall-hit:hover + .wall.wall--selected,
.wall--selected {
    stroke: var(--color-accent);
    stroke-width: 3px;
}

/* Choosing two walls at the assembly: the first room's other walls cannot be the second (D161). */
.wall-hit--refused {
    cursor: not-allowed;
}

.wall-hit--refused:hover + .wall:not(.wall--selected) {
    stroke: var(--plan-wall-ink);
    stroke-width: 1.6px;
}

/* The turn handle above the selected room. */
.plan-rotate-handle {
    cursor: grab;
}

.plan-rotate-handle line {
    stroke: var(--color-accent);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}

.plan-rotate-handle circle {
    fill: var(--plan-station-disc);
    stroke: var(--color-accent);
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
}

.plan-rotate-handle text {
    font-family: var(--font-family);
    font-size: calc(var(--plan-px) * 13px);
    font-weight: 700;
    fill: var(--color-accent);
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* A small dark pill next to the pointer during a gesture, like a design tool's measurement tooltip. */
.plan-readout {
    font-family: var(--font-mono);
    position: fixed;
    z-index: 10;
    pointer-events: none;
    padding: 4px 9px;
    border-radius: 11px;
    background-color: var(--color-pill);
    color: var(--color-on-pill);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: pre;
}

.is-dragging-plan,
.is-dragging-plan * {
    cursor: grabbing !important;
}

/* The two walls of the assembly's tools (DECISIONS.md D161): numbered as on the plan (.plan-cut-badge). */
.pick-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pick-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: var(--color-text-tertiary);
}

.pick-badge {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 1px solid var(--color-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pick-step-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 1px;
}

.pick-step--current {
    color: var(--color-text);
}

.pick-step--current .pick-badge {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.pick-step--chosen .pick-badge {
    border-color: var(--plan-line-accent);
    background-color: var(--plan-line-accent);
    color: var(--plan-line-sheet);
}

.pick-step--chosen .pick-step-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
}

.pick-step-role {
    color: var(--color-text-secondary);
}

/* Lined up with the steps' own left edge: the ghost's padding hangs out of the block. */
.pick-cancel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 -4px -6px;
}

/* The one figure of a distance: what the plan says now, before what is typed. */
.inspector-reading {
    font-family: var(--font-mono);
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

/* --- Correction palette (docs/DESIGN.md §17, DECISIONS.md D122) --- */

.tool-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* A tool: icon + label + what it takes; the active one filled with the brand color (iMapper's toolbar, docs/DESIGN.md §3). */
.tool-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-control);
    color: var(--color-text);
    text-decoration: none;
}

.tool-row:hover {
    background-color: var(--color-surface-muted);
}

.tool-row:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.tool-row--active,
.tool-row--active:hover {
    background-color: var(--color-primary);
    color: var(--color-on-primary);
}

.tool-icon-box {
    flex: 0 0 24px;
    height: 24px;
    border-radius: var(--radius-control);
    background-color: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-row--active .tool-icon-box {
    background-color: var(--color-on-primary-subtle);
}

.tool-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--color-text-secondary);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tool-row--active .tool-icon {
    stroke: var(--color-on-primary);
}

.tool-label {
    flex: 1;
    font-size: 13.5px;
    font-weight: 600;
}

.tool-caption {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.tool-row--active .tool-caption {
    color: var(--color-on-primary-muted);
}

/* A folding group of tools (DECISIONS.md D138, D186): "Mesurer" / "Ajuster" / "Modifier le contour",
 * only the active tool's group open, so the palette fits with its help at any laptop or tablet height.
 * The header is a quiet control: a chevron that turns, the group's name, the whole row as the target. */
.tool-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 4px;
    margin: 0;
    border-radius: var(--radius-control);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    list-style: none;
}

.tool-group-label::-webkit-details-marker,
.tool-demo-header::-webkit-details-marker {
    display: none;
}

.tool-group-label::before,
.tool-demo-header::before {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    margin: 0 4px 0 3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    color: var(--color-text-tertiary);
}

.tool-group[open] > .tool-group-label::before,
.tool-demo[open] > .tool-demo-header::before {
    transform: rotate(45deg);
}

.tool-group-label:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.tool-group-label:focus-visible,
.tool-demo-header:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* A short tablet (1024×768) at 44px per row: the palette's generic intro gives its two lines to the help,
 * the inspector under the tools already says what to do with the active one (D186). */
@media (pointer: coarse) and (max-height: 800px) {
    .editing-palette-tools > .subtitle {
        display: none;
    }
}

/* A finger needs 44px on these headers too (D177); here, after their own 28px. */
@media (pointer: coarse) {
    .tool-group-label,
    .tool-demo-header {
        min-height: var(--touch-target);
    }

    .tool-demo-dismiss {
        top: 0;
        right: 0;
        min-height: var(--touch-target);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tool-group-label::before,
    .tool-demo-header::before {
        transition: none;
    }
}

/* First use of a tool (DECISIONS.md D137/D138, SPEC.md §3.5.4's "bannière d'aide avec démo") - a
 * quiet card under the usual prompt (D139: what to do now comes first), with a small schematic of the
 * gesture. Since D186 a <details>: open on first use, folded to its title once "J'ai compris" has been
 * pressed (tool-demo.js, localStorage), one click to see it again. */
.tool-demo {
    position: relative;
    background-color: var(--color-primary-soft);
    border-radius: var(--radius-panel);
    padding: 6px 12px;
}

.tool-demo[open] {
    padding-bottom: 12px;
}

.tool-demo-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* The title is the fold's control; the dismissal sits at its right, only while the demo is open. */
.tool-demo-header {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    margin-left: -6px;
    padding-right: 96px;
    border-radius: var(--radius-control);
    cursor: pointer;
    list-style: none;
}

.tool-demo-dismiss {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 6px;
}

.tool-demo .tool-demo-dismiss:hover {
    background-color: var(--color-accent-tint);
}

.tool-demo-body {
    margin-top: 6px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tool-demo-body .tool-demo-canvas {
    flex: none;
}

.tool-demo-body .caption {
    margin: 0;
    font-weight: 400;
    color: var(--color-text-secondary);
}

.tool-demo-canvas {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    padding: 4px;
    width: fit-content;
}

/* A 96×48 schematic: small, it explains a gesture. */
.tool-demo-svg {
    display: block;
    width: 96px;
    height: 48px;
}

.banner--stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.banner--stack .button-row--inline > * {
    flex: 1;
    width: auto;
    text-align: center;
}

/* Two choices side by side in the inspector's width: each on one line. */
.inspector .banner--stack .button-row--inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inspector .banner--stack .button,
.inspector .banner--stack .button-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    white-space: nowrap;
}

.applied-list {
    list-style: none;
    margin: -4px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    color: var(--color-text-secondary);
}

/* Legend of the plan's colors (docs/DESIGN.md §15). */
.legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: var(--color-text-secondary);
}

.legend li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-swatch {
    flex: 0 0 22px;
    height: 4px;
    border-radius: 2px;
}

/* The legend sits on the line-drawing screens: same values as .plan-svg--lines (DECISIONS.md D139). */
.legend-swatch--ink {
    background-color: var(--plan-line-ink);
}

.legend-swatch--amber {
    background-color: var(--plan-line-medium);
}

.legend-swatch--red {
    background-color: var(--plan-line-high);
}

.legend-swatch--tape {
    height: 12px;
    border-radius: var(--radius-control);
    background-color: var(--plan-line-tape-pill);
    border: 1px solid var(--color-accent);
}

/* End handles: only the correction screens' line drawing shows them, its rules are with its colors. */
.plan-corner {
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

/* The measurement being built: a dashed brand line, its length on a dark pill. */
.plan-guide {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 1.5px;
    stroke-dasharray: 6 4;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.plan-guide-label-halo,
.plan-guide-label {
    font-family: var(--font-mono);
    font-size: calc(var(--plan-px) * 11.5px);
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.plan-guide-label-halo {
    fill: var(--color-pill);
    stroke: var(--color-pill);
    stroke-width: calc(var(--plan-px) * 14px);
    stroke-linejoin: round;
}

.plan-guide-label {
    fill: var(--color-on-pill);
}

.plan-guide-label-pill {
    fill: var(--color-pill);
    pointer-events: none;
}

/* ===== Export and Terminé (docs/DESIGN.md §18, DECISIONS.md D124) ===== */

/* A format: the whole row is the target (loi de Fitts); format tag + what it is for. */
.format-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: -4px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.format-option:hover {
    background-color: var(--color-surface-muted);
}

.format-option:has(input:checked) {
    border-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.format-option:has(input:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.format-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.format-option input[type="checkbox"]:focus-visible {
    outline: none;
}

/* A file-type tag, the way a file manager labels a document. */
.format-badge {
    flex: 0 0 38px;
    text-align: center;
    padding: 3px 0;
    border-radius: var(--radius-control);
    background-color: var(--color-surface-sunken);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.format-option:has(input:checked) .format-badge {
    background-color: var(--color-primary);
    color: var(--color-on-primary);
}

.format-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.format-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
}

.format-caption {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* The output folder: icon, its name, then the full path in small (never truncated: word-break). */
.folder-display {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: -4px;
    padding: 10px;
    border-radius: var(--radius-panel);
    background-color: var(--color-surface-muted);
    border: 1px solid var(--color-border);
}

.folder-icon-box {
    flex: 0 0 26px;
    height: 26px;
    border-radius: var(--radius-control);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.folder-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
}

/* Breaks only between folders (<wbr> after each separator), never inside a name. */
.folder-path {
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-tertiary);
    overflow-wrap: anywhere;
}

.folder-display + .caption {
    margin-top: -6px;
}

/* Export (DECISIONS.md D188): the folder on one row, its path on hover only, "Changer" at its end; the format rows
 * a little tighter. The column stays compact so the plan has the window. */
.export-choices .folder-display {
    align-items: center;
    padding: 6px 6px 6px 10px;
}

.export-choices .folder-text {
    flex: 1;
}

.export-choices .folder-display .button-ghost {
    flex: none;
}

.export-choices .format-option {
    padding: 6px 10px;
}

.export-choices .checkbox-row {
    margin-top: -4px;
}

/* What the export will write: plain body text, it is the answer to "what happens if I click?". */
.export-summary {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}

.export-summary--blocked {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-warning);
}

/* docs/DESIGN.md §5 (DECISIONS.md D163): the loading dots on the button while the files are written. */
.button.button--busy,
.button.button--busy:disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 1;
    cursor: progress;
    background-color: var(--color-primary);
}

/* Terminé: iMapper's success modal (docs/DESIGN.md §6) as a corner panel - round green mark,
 * short bold title, then what to do with the files; one quiet button, never a false choice. */
.success-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-mark {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-success-soft);
    border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-mark svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--color-success);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.summary-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-list > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.summary-list dt {
    color: var(--color-text-secondary);
}

.summary-list dd {
    margin: 0;
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* A quiet qualifier under a summary figure (the open rooms an area leaves out, D134). */
.summary-note {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-tertiary);
}

.button-secondary.button-large {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 14.5px;
}

/* Terminé after an export (docs/DESIGN.md §18, DECISIONS.md D126): the folder with its contents,
 * one block - the Export screen's folder display as its header, the written files below it, each
 * with its file-type tag, what it is for and its file name. */
.exported-files {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    overflow: hidden;
    background-color: var(--color-surface);
}

.exported-files .folder-display {
    margin-top: 0;
    border: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
}

.exported-files-list {
    list-style: none;
    margin: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exported-file {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px;
    border-radius: var(--radius-control);
}

/* The whole row downloads the file (DECISIONS.md D152): a large target, a single focus stop. */
a.exported-file {
    color: inherit;
    text-decoration: none;
    transition: background-color 0.1s ease;
}

a.exported-file:hover {
    background-color: var(--color-surface-muted);
}

a.exported-file:active {
    background-color: var(--color-surface-sunken);
}

a.exported-file:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 0;
}

/* The row's action, spelled out: quiet beside "Ouvrir le dossier", the main action otherwise. */
.exported-file-action {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 5px;
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-accent);
}

.exported-file-action svg {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.exported-files--remote .exported-file-action {
    margin-top: 6px;
    padding: 5px 10px;
    border-radius: var(--radius-control);
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    transition: background-color 0.1s ease;
}

.exported-files--remote a.exported-file:hover .exported-file-action {
    background-color: var(--color-primary-hover);
}

.exported-files--remote a.exported-file:active .exported-file-action {
    background-color: var(--color-primary-pressed);
}

.exported-file-missing {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warning);
}

/* From another machine, the server's folder is only worth a quiet closing line. */
.exported-files-note {
    margin: 0;
    padding: 8px 10px;
    border-top: 1px solid var(--color-border);
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-tertiary);
    overflow-wrap: anywhere;
}

.exported-file-name {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* A piece of a file name kept on one line; lines break only between pieces (after "_"). */
.exported-file-name .unbreakable {
    white-space: nowrap;
}

/* The step's actions, stacked: the useful next action, then the quiet way home. */
.button-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* A line icon before a primary button's label (icon + label, never an icon alone). */
.button.button-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-icon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--color-on-primary);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Never stuck on a page (docs/DESIGN.md §19, DECISIONS.md D128) ---
 * The top bar of every wizard page carries the way home - brand, a hairline divider, an
 * "Accueil" control (house + label, never an icon alone), a chevron, the open survey's name - the
 * breadcrumb pattern of Linear/Notion's title bars: always in the same place, whatever the step. */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.topbar-divider {
    flex: 0 0 1px;
    width: 1px;
    height: 20px;
    margin-right: 6px;
    background-color: var(--color-border);
}

.topbar-home-form {
    margin: 0;
    flex: 0 0 auto;
}

.topbar-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: var(--radius-control);
    background-color: transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-home:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.topbar-home:active {
    background-color: var(--color-surface-sunken);
}

.topbar-home:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* During a capture (SPEC.md §4 point 5): shown, so the bar never jumps, but plainly unavailable. */
.topbar-home:disabled {
    opacity: var(--opacity-disabled);
    cursor: not-allowed;
}

.topbar-home:disabled:hover {
    background-color: transparent;
    color: var(--color-text-secondary);
}

.topbar-home-icon,
.topbar-chevron {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar-chevron {
    color: var(--color-text-tertiary);
}

.topbar-crumb {
    min-width: 0;
    max-width: 420px;
    padding-left: 4px;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .topbar {
        gap: 8px;
    }

    .brand-word {
        display: none;
    }

    .topbar-crumb {
        max-width: 150px;
    }
}

/* Where the survey stands: rooms, assembly, export (D160, D161). Set apart from the survey's name, which is
 * also bold, by the same hairline as the brand's; the current phase wears the selection's soft fill. */
.topbar-phases {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 0 10px;
    padding: 0 0 0 12px;
    border-left: 1px solid var(--color-border);
    list-style: none;
    font-size: 13px;
    white-space: nowrap;
}

.topbar-phase {
    padding: 3px 8px;
    border-radius: var(--radius-control);
    color: var(--color-text-tertiary);
}

.topbar-phase--current {
    font-weight: 600;
    background-color: var(--color-primary-soft);
    color: var(--color-accent);
}

@media (max-width: 860px) {
    .topbar-phases {
        display: none;
    }
}

/* Home page: a recent survey is a button that reopens it where it was left - the folder browser's
 * clickable row (a.list-row), title over its folder, chevron at the end. */
.list-row--action {
    width: calc(100% + 20px);
    align-items: center;
    margin: 0 -10px;
    padding: 10px;
    border: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background-color: transparent;
    font-family: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.list-row--action:last-child {
    border-bottom: none;
}

.list-row--action:hover {
    background-color: var(--color-surface-muted);
}

.list-row--action:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.list-row--action::after {
    content: "\203A";
    color: var(--color-text-tertiary);
    font-size: 18px;
    line-height: 1;
}

.list-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Terminé: title and its one-line confirmation under the green mark (iMapper's success modal), no
 * second green box under it. */
.success-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.success-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* A quiet, one-line result of an action (the folder did open): smaller than a banner, which stays
 * for what needs the user's attention. */
.inline-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.inline-status svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.inline-status--success {
    color: var(--color-success);
}

/* Home page: the survey still open when the browser's Back button led here (DECISIONS.md D130/D131)
 * - Linear/Notion's "continue where you left off" card, not a warning: a small primary dot beside
 * the label (open, nothing wrong), the survey's name as the card's title, the step it was left at as
 * its caption, then "Reprendre" (the page's only primary action) beside a narrower "Fermer". */
.resume-card-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.resume-card-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.resume-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-accent);
    flex-shrink: 0;
}

.resume-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resume-card-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.resume-card-actions .button {
    flex: 1;
    width: auto;
}

.resume-card-actions .button-secondary {
    width: auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* --- Station list (docs/DESIGN.md §22, DECISIONS.md D136) ---
 * Numbered badge, title + caption, a quiet
 * "Supprimer" that only turns red when aimed at; the confirmation takes the row's place. */
.station-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.station-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px 6px 6px;
    border-radius: var(--radius-control);
}

.station-row:hover {
    background-color: var(--color-surface-muted);
}

.station-badge {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    background-color: var(--color-primary-soft);
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.station-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.station-row-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.station-row-caption {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-row-caption--warning {
    color: var(--color-warning);
    font-weight: 600;
}

.station-delete {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 8px 0 6px;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.station-delete svg {
    stroke: var(--color-text-tertiary);
}

.station-delete:hover {
    background-color: var(--color-danger-soft);
    color: var(--color-danger);
}

.station-delete:hover svg {
    stroke: var(--color-danger);
}

.station-delete:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.station-delete[aria-disabled="true"] {
    opacity: var(--opacity-disabled);
    pointer-events: none;
}

.station-confirm {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-panel);
    background-color: var(--color-danger-soft);
    border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
}

.station-confirm-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-danger);
}

.station-confirm-text {
    margin: 0;
    font-size: 13px;
    color: var(--color-text);
}

.station-confirm-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.station-confirm-actions form {
    margin: 0;
}

.station-confirm-actions .button,
.station-confirm-actions .button-secondary {
    width: auto;
    padding: 8px 14px;
}

.button.button-danger {
    background-color: var(--color-danger-fill);
}

.button.button-danger:hover {
    background-color: var(--color-danger-fill-hover);
}

.button.button-danger:active {
    background-color: var(--color-danger-fill-pressed);
}

.button.button-danger:focus-visible {
    box-shadow: var(--focus-ring-danger);
}

/* --- Gestures of D140/D141 on the web (docs/DESIGN.md §23.9, DECISIONS.md D142) --- */

.segmented {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: var(--radius-panel);
    background-color: var(--color-surface-sunken);
}

.segment {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.segment:hover {
    background-color: var(--color-hover-tint);
}

.segment--active,
.segment--active:hover {
    background-color: var(--color-surface-raised);
    color: var(--color-accent);
    box-shadow: var(--shadow-segment);
}

.segment:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
    outline-offset: 1px;
}

.segment-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.points-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.points-result {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.points-result-row form {
    margin: 0;
    flex: none;
}

/* A quiet action next to what it acts on: no border or fill until aimed at. */
.button-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px 5px 6px;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-accent);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.button-ghost:hover {
    background-color: var(--color-primary-soft);
}

/* A ghost control that is a link stays a control: no underline. */
a.button-ghost {
    text-decoration: none;
}

/* Leaving a room that has no measure: the panel's last word, quiet and centered under its buttons (D161). */
.button-ghost--quiet {
    align-self: center;
    color: var(--color-text-secondary);
}

.button-ghost:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
    outline-offset: 1px;
}

.button-ghost-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Lined up with the text inside the block above it. */
.undo-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 0 8px 0 6px;
}

/* A keyboard shortcut, as a key cap (docs/DESIGN.md §40, DECISIONS.md D191): Escape on the tool it leads back to,
 * Ctrl+Z beside "Annuler", Escape beside a pick's "Annuler". The gesture hints' key cap, smaller, to sit in a row;
 * shown to a mouse and a keyboard only, a tablet has no keys to press. */
.tool-key,
.shortcut-hint {
    flex: none;
    padding: 0 5px;
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    color: var(--color-text-secondary);
    background-color: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    white-space: nowrap;
}

.tool-key {
    display: none;
    margin-left: -2px;
}

/* On the filled active row, the cap is drawn in the row's own white, as its caption is. */
.tool-row--active .tool-key {
    color: var(--color-on-primary-muted);
    background-color: var(--color-on-primary-subtle);
    border-color: transparent;
}

@media (pointer: fine) {
    .tool-key {
        display: inline-block;
    }
}

@media not (pointer: fine) {
    .shortcut-hint {
        display: none;
    }
}

/* A sentence for one pointer only (DECISIONS.md D185, D191): the mouse and keyboard wording, or its finger counterpart. */
.for-touch {
    display: none;
}

@media (pointer: coarse) {
    .for-touch {
        display: inline;
    }

    .for-pointer {
        display: none;
    }
}

/* Removing part of the plan: unmistakably not an ordinary action, and still not the filled red of what
 * cannot be undone (.button-danger), since this can. */
.button-danger-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 8px 14px;
    border: 1px solid color-mix(in srgb, var(--color-danger) 50%, var(--color-surface));
    border-radius: var(--radius-control);
    background-color: var(--color-surface);
    color: var(--color-danger);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
}

.button-danger-outline svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-danger-outline:hover {
    border-color: var(--color-danger);
    background-color: var(--color-danger-soft);
}

.button-danger-outline:focus-visible {
    box-shadow: var(--focus-ring-danger);
    outline: none;
}

/* Rows of label / field / unit (docs/DESIGN.md §23.9). */
.cut-field {
    display: grid;
    grid-template-columns: 114px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.cut-field .field-label {
    margin: 0;
}

/* A note that goes with something else on the card (docs/DESIGN.md §23.10 point 9): it informs, in normal
 * weight and compact; darker than the warning color, which falls short of 4.5:1 once no longer bold. */
.banner.banner--note {
    padding: 8px 10px;
    border-radius: var(--radius-panel);
    font-size: 12.5px;
    font-weight: 400;
    color: var(--color-warning-note);
}

/* --- The theme picker (docs/DESIGN.md §42, DECISIONS.md D207; was the dark mode switch of D151): in the
 * top bar of every page, far right, same ghost control as "Accueil". A fixed label, so the bar never
 * moves, after a swatch of the sheet in use (paper 60, ink 30, mark 10) drawn from the live tokens: right
 * from the first paint, before any script. Without JavaScript there is nothing to pick, so it does not show. --- */
/* The running version (DECISIONS.md D168): a quiet grey mention, pushed right with the theme switch. */
.topbar-version {
    flex: 0 0 auto;
    margin-left: auto;
    /* Quieter than the switch beside it (finding F5): smaller, set apart by a wider gap. */
    margin-right: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    user-select: text;
}

.theme-picker {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
}

.topbar-version + .theme-picker {
    margin-left: 0;
}

:root:not([data-theme]) .theme-picker {
    display: none;
}

.topbar-theme {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px 0 10px;
    border: none;
    border-radius: var(--radius-control);
    background-color: transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-theme:hover,
.topbar-theme[aria-expanded="true"] {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.topbar-theme:active {
    background-color: var(--color-surface-sunken);
}

.topbar-theme:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.topbar-theme-chevron,
.theme-picker-check {
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar-theme-chevron {
    width: 12px;
    height: 12px;
    color: var(--color-text-tertiary);
    transition: transform 0.15s ease;
}

.topbar-theme[aria-expanded="true"] .topbar-theme-chevron {
    transform: rotate(180deg);
}

/* A sheet in three bands, 60/30/10 as in locadmin: paper, ink, mark. The bar's own swatch reads the live
 * tokens; each option's carries its sheet's literal values (they must show while another one is on). */
.theme-swatch {
    --swatch-paper: var(--color-canvas);
    --swatch-ink: var(--color-text);
    --swatch-mark: var(--color-accent);
    flex: 0 0 auto;
    display: inline-flex;
    width: 32px;
    height: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: 3px;
}

.theme-swatch > span:nth-child(1) {
    flex: 6;
    background-color: var(--swatch-paper);
}

.theme-swatch > span:nth-child(2) {
    flex: 3;
    background-color: var(--swatch-ink);
}

.theme-swatch > span:nth-child(3) {
    flex: 1;
    background-color: var(--swatch-mark);
}

.theme-swatch[data-swatch="light"] { --swatch-paper: #ECEBE7; --swatch-ink: #26251E; --swatch-mark: #2456D6; }
.theme-swatch[data-swatch="porcelain"] { --swatch-paper: #F2EFE9; --swatch-ink: #14213D; --swatch-mark: #1F4FC2; }
.theme-swatch[data-swatch="polar"] { --swatch-paper: #F1F3F4; --swatch-ink: #0F2233; --swatch-mark: #0B62B0; }
.theme-swatch[data-swatch="dark"] { --swatch-paper: #0E1A2E; --swatch-ink: #E8EDF5; --swatch-mark: #82A8FF; }
.theme-swatch[data-swatch="graphite"] { --swatch-paper: #1C1C1E; --swatch-ink: #E4E5E8; --swatch-mark: #82A8FF; }

/* The list: a narrow panel hung under the button, right-aligned, over the plan - a hairline, no shadow (D177). */
.theme-picker-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    width: 208px;
    padding: 4px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-panel);
    background-color: var(--color-surface);
}

.theme-picker-list[hidden] {
    display: none;
}

.theme-picker-group + .theme-picker-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--color-border);
}

.theme-picker-group-label {
    padding: 6px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.theme-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-control);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
}

.theme-picker-option:hover {
    background-color: var(--color-hover-tint);
}

.theme-picker-option:focus-visible {
    outline: none;
    background-color: var(--color-hover-tint);
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

.theme-picker-option[aria-selected="true"] {
    font-weight: 600;
}

.theme-picker-name {
    flex: 1;
}

.theme-picker-check {
    width: 14px;
    height: 14px;
    color: var(--color-accent);
    visibility: hidden;
}

.theme-picker-option[aria-selected="true"] .theme-picker-check {
    visibility: visible;
}

@media (pointer: coarse) {
    .theme-picker-option {
        height: var(--touch-target);
    }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-theme,
    .topbar-theme-chevron {
        transition: none;
    }
}
/* A phone's bar is short: the swatch and the chevron say it, the name stays for assistive technology. */
@media (max-width: 480px) {
    .topbar-theme {
        padding: 0 4px;
    }

    .topbar-theme-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}

/* ===== The lidar in the top bar (DECISIONS.md D204) =====
 * At the right of the bar, before the version: one hairline chip, the state on the left (a dot, then
 * "Lidar 3F2A" or "Lidar non connecté"), "Reconnecter" on the right as a ghost button - the state and
 * its one action read as a pair, the way Linear and Raycast put a status beside its fix. The outcome of
 * a reconnection hangs under it, over the plan, until "Fermer" or the next screen; a success fades. */
.topbar-lidar {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    margin: 0 0 0 auto;
    padding: 0 2px 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 13px;
    white-space: nowrap;
}

.topbar-lidar + .topbar-version {
    margin-left: 16px;
}

.topbar-lidar-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-right: 6px;
    border-right: 1px solid var(--color-border);
    line-height: 20px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.topbar-lidar-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-text-tertiary);
}

.topbar-lidar[data-lidar-connected="true"] .topbar-lidar-dot {
    background-color: var(--color-success);
}

.topbar-lidar-serial {
    margin-left: 2px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-tertiary);
}

.topbar-lidar[data-lidar-connected="true"] .topbar-lidar-off,
.topbar-lidar[data-lidar-connected="false"] .topbar-lidar-on {
    display: none;
}

.topbar-lidar-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 8px;
    border: none;
    border-radius: 3px;
    background-color: transparent;
    color: var(--color-accent);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.topbar-lidar-action:hover {
    background-color: var(--color-primary-soft);
}

.topbar-lidar-action:active {
    background-color: var(--color-surface-sunken);
}

.topbar-lidar-action:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* During a capture (SPEC.md §4 point 5): shown, never hidden, plainly unavailable. */
.topbar-lidar-action:disabled {
    opacity: var(--opacity-disabled);
    cursor: not-allowed;
}

.topbar-lidar-action:disabled:hover {
    background-color: transparent;
}

.topbar-lidar-icon {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* While the server looks for the lidar (a few seconds when it is not there): the dots and "Recherche…". */
.topbar-lidar-dots,
.topbar-lidar-busy,
.topbar-lidar[aria-busy="true"] .topbar-lidar-icon,
.topbar-lidar[aria-busy="true"] .topbar-lidar-idle {
    display: none;
}

.topbar-lidar[aria-busy="true"] .topbar-lidar-dots,
.topbar-lidar[aria-busy="true"] .topbar-lidar-busy {
    display: inline-flex;
}

.topbar-lidar[aria-busy="true"] .topbar-lidar-action {
    cursor: progress;
}

/* A new attempt: the previous outcome no longer holds. */
.topbar-lidar[aria-busy="true"] .topbar-lidar-feedback {
    display: none;
}

.topbar-lidar-dots {
    gap: 4px;
    height: 8px;
}

.topbar-lidar-dots > span {
    width: 7px;
    height: 7px;
}

.topbar-lidar-feedback {
    position: absolute;
    z-index: 200;
    /* Under the bar, not on its edge: the bar is 60px high, the chip 32px. */
    top: calc(100% + 22px);
    right: 0;
    display: flex;
    align-items: baseline;
    gap: 16px;
    width: max-content;
    max-width: min(360px, calc(100vw - 40px));
    white-space: normal;
    font-weight: 500;
    line-height: 1.45;
}

.topbar-lidar-dismiss {
    flex: 0 0 auto;
    margin: -4px -8px -4px 0;
    padding: 4px 8px;
    border: none;
    border-radius: var(--radius-control);
    background-color: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.topbar-lidar-dismiss:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* A success needs no answer: it fades after a few seconds, and lets the plan be clicked through. */
.topbar-lidar-feedback--fading {
    animation: topbar-lidar-fade 5s ease-in forwards;
}

@keyframes topbar-lidar-fade {
    0%, 80% {
        opacity: 1;
        visibility: visible;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-lidar-action {
        transition: none;
    }

    .topbar-lidar-feedback--fading {
        animation-timing-function: steps(1, end);
    }
}

/* A narrower bar gives the survey's name the room first: the serial goes, then on a tablet "Lidar" beside
 * a green dot (all is well, the hint and assistive technology still say it) - never "Lidar non connecté",
 * the state that calls for the action -, then on a phone every word, "Accueil"'s too, as the theme picker's. */
@media (max-width: 1100px) {
    .topbar-lidar-serial {
        display: none;
    }
}

@media (max-width: 1024px) {
    .topbar-lidar-on {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .topbar-lidar[data-lidar-connected="true"] .topbar-lidar-state {
        padding-right: 8px;
    }
}

/* A tablet's bar also holds the phases and the lidar: the theme picker keeps its swatch and its chevron. */
@media (max-width: 1180px) {
    .topbar-theme {
        gap: 6px;
        padding: 0 4px;
    }

    .topbar-theme-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}

@media (max-width: 480px) {
    .topbar-home-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .topbar-lidar {
        padding-left: 8px;
    }

    .topbar-lidar-off,
    .topbar-lidar-idle,
    .topbar-lidar-busy {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (pointer: coarse) {
    .topbar-lidar {
        height: var(--touch-target);
    }

    .topbar-lidar-action {
        height: calc(var(--touch-target) - 6px);
    }
}

/* ===== The canvas's own controls (docs/DESIGN.md §32, DECISIONS.md D178) =====
 * At the bottom of the part of the canvas the panels leave free: canvas-pan-zoom.js keeps --free-left,
 * --free-right and --free-bottom current. Under the panel layer: a card that ever reaches them stays on top. */

.canvas-hud {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.canvas-hud > * {
    position: absolute;
    bottom: var(--free-bottom, 24px);
    pointer-events: auto;
}

.canvas-zoom {
    right: var(--free-right, 24px);
    display: flex;
    gap: 2px;
    padding: 3px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
}

.canvas-zoom-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.canvas-zoom-button--labeled {
    padding: 0 10px 0 8px;
}

.canvas-zoom-button:hover {
    background-color: var(--color-hover-tint);
    color: var(--color-text);
}

.canvas-zoom-button:active {
    background-color: var(--color-surface-sunken);
}

.canvas-zoom-button:focus-visible,
.panel-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.canvas-zoom-icon,
.panel-toggle-icon {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The left panel folds to its header on a tablet-wide window, where the plan needs its room (finding C3).
 * The toggle sits over that header's right end: the left panel is at the same place on every canvas screen
 * (20 px in, 320 px wide). */
.panel-toggle {
    display: none;
    position: absolute;
    z-index: 2;
    top: 32px;
    left: 296px;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    touch-action: manipulation;
}

.panel-toggle:hover {
    background-color: var(--color-hover-tint);
    color: var(--color-text);
}

.panel-toggle[aria-expanded="false"] {
    color: var(--color-accent);
}

@media (min-width: 761px) and (max-width: 1199px) {
    .page:has(.floating-panel--top-left, .editing-column--tools) .panel-toggle {
        display: inline-flex;
    }

    .floating-panel--top-left > .panel-title,
    .editing-column--tools > .floating-panel:first-child > .panel-title {
        padding-right: 40px;
    }

    .page--left-panel-collapsed .floating-panel--top-left > :not(.panel-title),
    .page--left-panel-collapsed .editing-column--tools > .floating-panel:first-child > :not(.panel-title),
    /* The Export's decision (summary, Exporter, Retour) stays: folding makes room for the plan, never hides the way out (D192). */
    .page--left-panel-collapsed .editing-column--tools > .floating-panel ~ .floating-panel:not(.editing-decisions) {
        display: none;
    }
}

@media (pointer: coarse) {
    .canvas-zoom-button {
        min-width: var(--touch-target);
        height: var(--touch-target);
    }

    .panel-toggle {
        top: 26px;
        left: 288px;
        width: var(--touch-target);
        height: var(--touch-target);
    }

}

@media (min-width: 761px) and (max-width: 1199px) and (pointer: coarse) {
    .floating-panel--top-left > .panel-title,
    .editing-column--tools > .floating-panel:first-child > .panel-title {
        padding-right: 48px;
    }
}

/* ===== The plan's legend on the canvas (docs/DESIGN.md §33, DECISIONS.md D179) =====
 * Bottom-left of the free area, the zoom controls bottom-right; one entry per row, like a drawing's key, at
 * every width. Each entry shows only while the plan holds its color. */
.canvas-key {
    left: var(--free-left, 24px);
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
}

.legend--canvas {
    gap: 4px;
    font-size: 12px;
}

.legend.legend--canvas > li {
    display: none;
    gap: 6px;
    white-space: nowrap;
}

.legend--canvas .legend-swatch {
    flex: 0 0 16px;
}

.page:has(.plan-point) .legend--canvas > .legend-item--density,
.page:has(.wall--low-uncertainty, .wall--medium-uncertainty, .wall--high-uncertainty) .legend--canvas > :is(.legend-item--reliable, .legend-item--check, .legend-item--uncertain),
.page:has(.plan-dimension--tape) .legend--canvas > .legend-item--tape {
    display: flex;
}

.page:not(:has(.plan-point, .wall--low-uncertainty, .wall--medium-uncertainty, .wall--high-uncertainty, .plan-dimension--tape)) .legend--canvas {
    display: none;
}

/* The graphic scale (docs/DESIGN.md §34, DECISIONS.md D180): an architect's bar, half ink, half paper,
 * as long on screen as the round length it states. */
.scale-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
}

.scale-bar-rule {
    flex: none;
    height: 5px;
    border: 1px solid var(--plan-wall-ink);
    background: linear-gradient(to right, var(--plan-wall-ink) 50%, transparent 50%);
}

.legend-end {
    color: var(--color-text-tertiary);
}

.legend--canvas .legend-swatch--density {
    flex-basis: 32px;
    height: 6px;
    background: linear-gradient(to right, var(--plan-density-sparse), var(--plan-density-medium), var(--plan-density-dense));
}

@media (pointer: coarse) {
    .canvas-key {
        min-height: 52px;
    }
}

/* ===== Hosted server (docs/WEB.md §9, DECISIONS.md D210) ===== */

/* The account menu: last in the bar, after the version and the theme picker, where Linear and Notion put
 * the person. A quiet control like the theme picker's - monogram, address, chevron - over a list hung
 * under it, the theme list's panel. The DOM order stays (app-shell.js swaps what comes before the version). */
.account-menu {
    position: relative;
    flex: 0 0 auto;
    order: 1;
    margin-left: 4px;
    padding-left: 12px;
    border-left: 1px solid var(--color-border);
}

.account-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px 0 6px;
    border-radius: var(--radius-control);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.account-menu-button::-webkit-details-marker {
    display: none;
}

.account-menu-button:hover,
.account-menu[open] > .account-menu-button {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.account-menu-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.account-menu-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-control);
    background-color: var(--color-primary-soft);
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 700;
}

.account-menu-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-menu-chevron,
.account-menu-icon,
.lidar-bridge-unsupported-icon,
.admin-stop-icon {
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.account-menu-chevron {
    width: 12px;
    height: 12px;
    color: var(--color-text-tertiary);
    transition: transform 0.15s ease;
}

.account-menu[open] .account-menu-chevron {
    transform: rotate(180deg);
}

.account-menu-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    width: 240px;
    padding: 4px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-panel);
    background-color: var(--color-surface);
}

.account-menu-who {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 4px;
    padding: 6px 8px 8px;
    border-bottom: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.account-menu-who-email {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.account-menu-signout {
    margin: 4px 0 0;
    padding-top: 4px;
    border-top: 1px solid var(--color-border);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-menu-item:hover {
    background-color: var(--color-hover-tint);
}

.account-menu-item:focus-visible {
    outline: none;
    background-color: var(--color-hover-tint);
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

.account-menu-icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-secondary);
}

/* The hosted pages' "Accueil" is a link, the wizard's a button: the same control either way. */
a.topbar-home {
    text-decoration: none;
}

/* Below a wide screen, the monogram stands for the address, which stays the control's name: the survey's
 * name in the bar comes first. */
@media (max-width: 1439px) {
    .account-menu-email {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}

/* The account menu takes room the bar had: a hosted bar drops the phases from 1100px (860px otherwise), and
 * the lidar's words from 860px, as a phone's bar does from 640px (D204) - the dot and the icon stay, the hint and assistive technology still say them. */
@media (max-width: 1100px) {
    .topbar:has(.account-menu) .topbar-phases {
        display: none;
    }
}

@media (max-width: 860px) {
    .topbar:has(.account-menu) .topbar-lidar {
        padding-left: 8px;
    }

    .topbar:has(.account-menu) .topbar-lidar-off,
    .topbar:has(.account-menu) .topbar-lidar-idle,
    .topbar:has(.account-menu) .topbar-lidar-busy {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .account-menu {
        margin-left: 0;
        padding-left: 8px;
    }
}

@media (pointer: coarse) {
    .account-menu-button,
    .account-menu-item {
        height: auto;
        min-height: var(--touch-target);
    }
}

/* "Navigateur non compatible": a warning strip across the page under the bar, never over the plan - the
 * lidar cannot be driven from here, everything else still works. Hidden until lidar-bridge.js marks <html>. */
.lidar-bridge-unsupported {
    display: none;
}

/* The bar's own row keeps its 60px: 14px above and below the 32px controls, then the strip. */
[data-lidar-bridge="unsupported"] .topbar {
    flex-wrap: wrap;
    align-content: flex-start;
    row-gap: 0;
    padding-top: 14px;
}

/* Wrapping is for the strip only: the navigation takes the free room instead of pushing a control down. */
[data-lidar-bridge="unsupported"] .topbar-nav {
    flex: 1 1 0;
}

[data-lidar-bridge="unsupported"] .lidar-bridge-unsupported {
    order: 2;
    flex: 1 0 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px -40px -1px;
    padding: 9px 40px;
    border-top: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
    background-color: var(--color-warning-soft);
    color: var(--color-text);
    font-size: 13px;
}

@media (max-width: 480px) {
    [data-lidar-bridge="unsupported"] .lidar-bridge-unsupported {
        margin: 14px -20px -1px;
        padding: 9px 20px;
    }
}

.lidar-bridge-unsupported p {
    margin: 0;
}

.lidar-bridge-unsupported strong {
    color: var(--color-warning);
}

.lidar-bridge-unsupported-icon {
    width: 16px;
    height: 16px;
    color: var(--color-warning);
}

/* Sign-in: a narrow sheet, one column to read; how to get an account under the button. */
.floating-window:has(.hosted-login) {
    max-width: 400px;
    margin-top: 12vh;
}

.hosted-login-help {
    text-align: center;
}

/* Administration: a wider sheet, the accounts read as a table, one line each. */
.floating-window:has(.admin-table) {
    max-width: 880px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    padding: 0 12px 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

.admin-table td {
    height: 48px;
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    vertical-align: middle;
    white-space: nowrap;
}

.admin-table td:last-child,
.admin-table th:last-child {
    padding-right: 0;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table td.admin-email {
    width: 100%;
    max-width: 0;
    font-weight: 600;
    color: var(--color-text);
}

.admin-email-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-email-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-row--disabled td.admin-email {
    color: var(--color-text-tertiary);
}

.admin-self {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: var(--radius-control);
    background-color: var(--color-surface-muted);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.admin-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.admin-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-success);
}

.admin-status--disabled::before {
    background-color: var(--color-text-tertiary);
}

.admin-date {
    font-variant-numeric: tabular-nums;
}

.admin-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.admin-actions form {
    margin: 0;
}

.admin-disable.button-ghost {
    color: var(--color-text-secondary);
}

.admin-disable.button-ghost:hover {
    background-color: var(--color-danger-soft);
    color: var(--color-danger);
}

.admin-password {
    position: relative;
}

.admin-password > summary {
    list-style: none;
}

.admin-password > summary::-webkit-details-marker {
    display: none;
}

.admin-password[open] > summary {
    background-color: var(--color-primary-soft);
}

.admin-password-form {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 300px;
    padding: 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-panel);
    background-color: var(--color-surface);
    white-space: normal;
}

.admin-password-form .field-label {
    overflow-wrap: anywhere;
}

.hosted-rule {
    margin-top: -4px;
}

/* A wide sheet: its actions sit at the right at their own width, not across 880px. */
.admin-step-actions {
    align-items: flex-end;
}

.admin-step-actions .button {
    width: auto;
}

.admin-stop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-stop-row .caption {
    margin: 0;
}

.button-danger-outline.admin-stop {
    flex: 0 0 auto;
    width: auto;
    text-decoration: none;
}

/* The creation date goes first when the sheet narrows: the address and the actions matter more. */
@media (max-width: 960px) {
    .admin-table th:nth-child(4),
    .admin-table td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 760px) {
    .admin-stop-row {
        flex-direction: column;
        align-items: stretch;
    }
}
