/* Imagination — Proxima design system, as applied in the Atlas Proxima mockup
   (AtlasDocumentIntelligence/dev-docs/ATLAS_PROXIMA_MOCKUP.html) and the style guide
   (VBI/STYLE_GUIDE.md). Use the tokens; never raw hex except status colours. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Proxima design tokens ─── */
:root {
    --draft:      #7c3aed;
    --draft-soft: rgba(124, 58, 237, 0.10);
    --bg-primary:    #f8f9fc;
    --bg-primary-rgb: 248, 249, 252;
    --bg-secondary:  #ffffff;
    --bg-tertiary:   #f0f1f5;
    --bg-elevated:   #ffffff;
    --bg-glass:       rgba(0, 0, 0, 0.02);
    --bg-glass-hover: rgba(0, 0, 0, 0.04);

    --text-primary:   #1a1a2e;
    --text-secondary: #6b7084;
    --text-muted:     #9ca3b4;

    --accent:          #2fb383;
    --accent-glow:     rgba(47, 179, 131, 0.15);
    --accent-soft:     rgba(47, 179, 131, 0.08);
    --accent-gradient: linear-gradient(135deg, #2fb383, #34d399);
    --accent-wash:     radial-gradient(120% 100% at 0% 0%, rgba(47, 179, 131, 0.10) 0%, rgba(47, 179, 131, 0.00) 60%);

    --border:        rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);

    --radius-sm:    8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    --shadow-sm:   0 1px 2px  rgba(0, 0, 0, 0.05);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    --scrollbar-thumb:       rgba(0, 0, 0, 0.18);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.32);

    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

    /* Camera points in the plan: a second hue, so they never read as building (accent) or openings. */
    --camera:        #8b5cf6;
    --camera-strong: #7c3aed;
    --camera-soft:   rgba(139, 92, 246, 0.10);
    --camera-wash:   rgba(139, 92, 246, 0.18);
    --camera-line:   rgba(139, 92, 246, 0.45);

    /* Land cover on a landscape site, as the 3D scene tints it: data colours, kept together here. */
    --cover-woodland: #5f7a52;
    --cover-orchard:  #7f9a64;
    --cover-meadow:   #a9b77f;
    --cover-lawn:     #8fba72;
    --cover-field:    #c9b98a;
    --cover-garden:   #93ad7a;
    --cover-heath:    #b3a584;
    --cover-water:    #86aac2;
    --cover-wetland:  #8ea894;
    --cover-sand:     #e2d6b3;
    --cover-rock:     #a9a7a2;
    --cover-paved:    #c7c7c3;
    --cover-building: #bdb6ad;
    --cover-relief:   #ffffff;
    --cover-path:     #dccfae;
    --cover-road:     #8a8a87;
    --cover-wall:     #a39d93;
    --cover-fence:    #b3ada2;

    /* The lightbox is dark in both themes: a photograph is judged best against black. */
    --lightbox-bg:    rgba(10, 12, 16, 0.94);
    --lightbox-text:  #e6edf3;
    --lightbox-muted: rgba(230, 237, 243, 0.65);
    --lightbox-glass: rgba(255, 255, 255, 0.08);
    --lightbox-line:  rgba(255, 255, 255, 0.14);

    /* ─── App background: the brand teal and its tapestry of camera points ───
       Same construction as Chronos. The background carries the brand gradient, darkened, and
       a tapestry of small camera points drawn in line: the point (light teal) and its cone of
       view, as placed in the plan editor. That is where every render starts. The colour logo
       stays in one place only: the app bar.

       Content is never written on the teal. It sits on a light sheet (.main), so no screen
       has to recolour its text. The app bar and the sidebar are the only things on the teal,
       and they rewrite the ink tokens for their subtree (see .appbar, .sidebar).

       The tile is 80 px and holds TWO camera points in quincunx, the second mirrored so it
       looks the other way: without that, the repeat reads as a grid instead of a pattern.
       White line at 14 %, light-teal point at 34 %.

       The gradient starts DARKER than the logo's (#2fb383 → #0d9488): on the same teal the
       logo would vanish and white text would lack contrast. */
    --fond-haut:    #04302a;
    --fond-bas:     #0a5f52;
    --fond-degrade: linear-gradient(160deg, var(--fond-haut) 0%, var(--fond-bas) 100%);
    --fond-motif:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' opacity='0.14'%3E%3Cpath d='M13 27L29 14M13 27L31 24M29 14A17 17 0 0 1 31 24'/%3E%3Cpath d='M67 67L51 54M67 67L49 64M51 54A17 17 0 0 0 49 64'/%3E%3C/g%3E%3Cg fill='%235EEAD4' opacity='0.34'%3E%3Ccircle cx='13' cy='27' r='2.6'/%3E%3Ccircle cx='67' cy='67' r='2.6'/%3E%3C/g%3E%3C/svg%3E");

    /* Line and ink for what is written straight on the teal (app bar, sidebar). */
    --fond-trait:   rgba(255, 255, 255, 0.16);
    --fond-encre:   #ffffff;
    --fond-encre-2: rgba(255, 255, 255, 0.78);
    --fond-encre-3: rgba(255, 255, 255, 0.60);
}
[data-theme="dark"] {
    --draft:      #a78bfa;
    --draft-soft: rgba(167, 139, 250, 0.16);
    --bg-primary:    #0f1419;
    --bg-primary-rgb: 15, 20, 25;
    --bg-secondary:  #161b22;
    --bg-tertiary:   #1e242c;
    --bg-elevated:   #1a2028;
    --bg-glass:       rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);

    --text-primary:   #e6edf3;
    --text-secondary: #9aa4b1;
    --text-muted:     #6b7280;

    --accent-glow: rgba(47, 179, 131, 0.28);
    --accent-soft: rgba(47, 179, 131, 0.14);

    --border:        rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);

    --shadow-sm: 0 1px 2px  rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);

    --scrollbar-thumb:       rgba(255, 255, 255, 0.18);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);

    color-scheme: dark;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}
/* The brand background goes on `body` ONLY: while <html> has none, body's propagates to the
   canvas and covers the whole window. The tapestry is listed first so it paints ABOVE the
   gradient; `fixed` pins it to the window, because a pattern that scrolls draws the eye. */
body {
    background-color: var(--fond-haut);
    background-image: var(--fond-motif), var(--fond-degrade);
    background-attachment: fixed;
}
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); background-clip: padding-box; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1:focus, h1:focus-visible { outline: none; }
button { font-family: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ─── App shell ─── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
}

/* ─── App bar ─── */
.appbar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    padding: 0 20px;
    /* On the teal, not on a white bar. Its ink is rewritten as TOKENS for the whole subtree,
       rather than recolouring the title, the user button and the icons one by one. */
    background: none;
    border-bottom: 1px solid var(--fond-trait);
    flex-shrink: 0;
    z-index: 50;

    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    --accent:         var(--fond-encre);
    --accent-soft:    rgba(255, 255, 255, 0.18);
    --border:         rgba(255, 255, 255, 0.26);
    --bg-glass-hover: rgba(255, 255, 255, 0.14);
}
/* The logo's teal badge would melt into the teal bar: a faint white ring sets it apart. */
.appbar .app-icon { border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); }
/* "Sign out" is a white button elsewhere; on the teal it turns to glass so its white ink reads. */
.appbar .btn-secondary { background: rgba(255, 255, 255, 0.10); }
.appbar .btn-secondary:hover { background: rgba(255, 255, 255, 0.18); }
.appbar-leading, .appbar-trailing { display: flex; align-items: center; gap: 12px; }
.appbar-leading { color: inherit; }
.appbar-leading:hover { text-decoration: none; }
.appbar-center { flex: 1; display: flex; justify-content: center; }
.appbar-title  { font-weight: 600; font-size: 17px; letter-spacing: -0.015em; color: var(--text-primary); }
.app-icon { display: inline-block; flex-shrink: 0; }
.app-icon-sm { width: 28px; height: 28px; }
.app-icon-md { width: 36px; height: 36px; }
.app-icon-lg { width: 64px; height: 64px; }

@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Icon buttons */
.btn-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}
.btn-icon:hover { color: var(--accent); background: var(--accent-soft); }
.btn-icon.danger:hover { color: #ef4444; background: rgba(239, 68, 68, 0.10); }

/* ─── Body layout ─── */
.app-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    /* On the teal, like the app bar, with the same rewritten ink. */
    background: none;

    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    --accent:         var(--fond-encre);
    --accent-soft:    rgba(255, 255, 255, 0.16);
    --bg-glass-hover: rgba(255, 255, 255, 0.10);
    --bg-tertiary:    rgba(255, 255, 255, 0.12);
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
}
.sidebar nav { flex: 1; }
.sidebar-section { margin-bottom: 22px; }
.sidebar-section-label {
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    min-width: 0;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
    text-decoration: none;
}
.nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
}
.nav-item svg { color: var(--text-muted); flex-shrink: 0; transition: color 0.12s ease; }
.nav-item:hover svg { color: var(--text-primary); }
.nav-item.active svg { color: var(--accent); }
.nav-item-count {
    margin-left: auto;
    font: 600 11px 'Inter', system-ui, sans-serif;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-item-count {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.20);
}

/* ─── Main content ─── */
.main {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 28px 32px 40px;
    /* THE SHEET. Every screen sits on it, which is what lets the background be teal without a
       single text colour changing. The margins are what make it float; full-canvas screens
       (picker, workspace) fill it and are clipped to its corners. */
    margin: 0 16px 16px 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
    background-color: var(--bg-primary);
    background-image: var(--accent-wash);
    background-repeat: no-repeat;
    background-size: 600px 400px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page-title { font-weight: 600; font-size: 26px; line-height: 1.3; letter-spacing: -0.02em; color: var(--text-primary); }
.page-sub   { font-size: 13.5px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Breadcrumbs ─── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }

/* ─── Buttons ─── */
/* The kit's screens use .btn-primary / .btn-secondary / .btn-danger alone; Imagination's add .btn. */
.btn, .btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--accent-glow), 0 2px 4px rgba(0, 0, 0, 0.06);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover { box-shadow: 0 6px 14px rgba(239, 68, 68, 0.25); transform: translateY(-1px); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

.btn:disabled,
.btn-icon:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
    transform: none;
}
.btn-primary:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    box-shadow: none;
    opacity: 1;
}
.btn-secondary:disabled {
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: var(--bg-glass);
}
.btn .spinner {
    width: 14px;
    height: 14px;
    border-color: rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-width: 2px;
}
.btn-secondary .spinner { border-color: var(--accent-soft); border-top-color: var(--accent); }

/* ─── Cards ─── */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.panel + .panel { margin-top: 14px; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.panel-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.panel-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Project cards */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.project-card:hover {
    text-decoration: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.project-thumb {
    aspect-ratio: 16 / 10;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb.plan img { object-fit: contain; background: #fff; padding: 8px; }
.project-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.project-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Stat tiles */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.stat-value {
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Segmented control (used as tabs) ─── */
.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.segmented-option {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font: 500 12.5px 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.segmented-option:hover:not(.selected):not(:disabled) { color: var(--text-primary); background: var(--bg-glass-hover); }
.segmented-option.selected {
    background: var(--bg-elevated);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.segmented-option:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── Wizard / stepper ─── */
.wizard {
    list-style: none;
    display: flex;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 22px;
}
.wizard-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    color: var(--text-muted);
    font: 500 12.5px 'Inter', system-ui, sans-serif;
    text-align: center;
}
.wizard-step + .wizard-step::before {
    content: "";
    position: absolute;
    top: 13px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}
.wizard-step.done + .wizard-step::before,
.wizard-step.active::before { background: var(--accent); }
.wizard-marker {
    position: relative;
    z-index: 1;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    transition: var(--transition);
}
.wizard-step.done   .wizard-marker { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.wizard-step.active .wizard-marker {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.wizard-step.done   { color: var(--text-secondary); }
.wizard-step.active { color: var(--accent); font-weight: 600; }

/* ─── Inputs ─── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.field-hint  { font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.field-row .field + .field { margin-top: 0; }
@media (max-width: 800px) { .field-row { grid-template-columns: minmax(0, 1fr); } }

.input,
.textarea,
select.input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font: 400 14px/1.5 'Inter', system-ui, sans-serif;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; min-height: 84px; }

/* ─── Project type chooser ─── */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    max-width: 920px;
}
.type-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.type-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.type-card:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.type-card-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
}
.type-card-title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.type-card-body { font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); }
.type-card-steps { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-muted); }
.type-card-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; font-weight: 500; font-size: 13.5px; color: var(--accent); }

/* ─── Dropzone ─── */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 32px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    color: var(--text-secondary);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.dropzone:hover,
.dropzone:focus-within {
    border-color: var(--text-secondary);
    background: var(--bg-glass-hover);
}
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    transform: scale(1.01);
}
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
/* The file input covers the whole zone at zero opacity, so the browser handles click and drop. */
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone-icon  { color: var(--text-muted); margin-bottom: 6px; }
.dropzone.dragover .dropzone-icon,
.dropzone.has-file .dropzone-icon { color: var(--accent); }
.dropzone-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.dropzone.dragover .dropzone-title { color: var(--accent); }
.dropzone-hint  { font-size: 12.5px; color: var(--text-muted); }

/* ─── Tables ─── */
.table-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}
.table thead th {
    text-align: left;
    padding: 10px 14px;
    font: 500 11px 'Inter', system-ui, sans-serif;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody td {
    padding: 10px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color 0.12s ease; }
.table tbody tr:hover { background: var(--bg-glass-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--text-muted); }

/* ─── Status tags ─── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    font-weight: 500;
    font-size: 11px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    line-height: 1.6;
    white-space: nowrap;
}
.tag.success { color: #15803d; background: rgba(34, 197, 94, 0.14); }
.tag.warn    { color: #b45309; background: rgba(245, 158, 11, 0.18); }
.tag.error   { color: #b91c1c; background: rgba(239, 68, 68, 0.16); }
.tag.info    { color: var(--accent); background: var(--accent-soft); }
.tag.neutral { color: var(--text-secondary); background: var(--bg-tertiary); }
[data-theme="dark"] .tag.success { color: #86efac; }
[data-theme="dark"] .tag.warn    { color: #fbbf24; }
[data-theme="dark"] .tag.error   { color: #fca5a5; }
.tag .tag-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.pulse .tag-dot { animation: status-pulse 2s ease-in-out infinite; }

/* ─── Banner / inline alert ─── */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border-left: 3px solid var(--accent);
    margin-bottom: 14px;
}
.banner-icon  { color: var(--accent); flex-shrink: 0; padding-top: 1px; }
.banner-body  { flex: 1; min-width: 0; }
.banner-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); margin-bottom: 2px; }
.banner-text  { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }
.banner-info    { border-left-color: var(--accent); }   .banner-info    .banner-icon { color: var(--accent); }
.banner-success { border-left-color: #22c55e; }         .banner-success .banner-icon { color: #22c55e; }
.banner-warn    { border-left-color: #f59e0b; }         .banner-warn    .banner-icon { color: #f59e0b; }
.banner-error   { border-left-color: #ef4444; }         .banner-error   .banner-icon { color: #ef4444; }

/* ─── Snackbar / toast ─── */
.snackbar-stack {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}
.snackbar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 10px 14px;
    background: var(--text-primary);
    color: var(--bg-elevated);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    animation: snackbar-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.snackbar-icon { flex-shrink: 0; display: inline-flex; }
.snackbar.success .snackbar-icon { color: #22c55e; }
.snackbar.info    .snackbar-icon { color: var(--accent); }
.snackbar.warn    .snackbar-icon { color: #f59e0b; }
.snackbar.error   .snackbar-icon { color: #ef4444; }
.snackbar-msg { flex: 1; font-weight: 500; font-size: 13px; line-height: 1.45; }
@keyframes snackbar-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Progress ─── */
.progress {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-indeterminate .progress-bar {
    width: 35%;
    animation: progress-slide 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes progress-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(286%); }
}
.spinner {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinner-rotate 0.9s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

/* Working state: the long wait while Claude reads a plan */
.working {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 48px 24px;
}
.working .progress { max-width: 360px; }
.working-title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.working-body  { font-size: 13.5px; color: var(--text-muted); max-width: 440px; }

/* ─── Empty state ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--text-secondary);
}
.empty-state-icon {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 4px;
}
.empty-state-title { font-weight: 600; font-size: 17px; color: var(--text-primary); letter-spacing: -0.01em; }
.empty-state-body {
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 380px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ─── Modals ─── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    animation: modal-backdrop-in 0.18s ease-out;
}
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    width: 460px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: modal-card-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-card-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title   { margin: 0 0 10px; font-weight: 600; font-size: 17px; line-height: 1.3; letter-spacing: -0.01em; }
.modal-body    { margin: 0 0 22px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Plan & model ─── */
.plan-frame {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}
.plan-frame img { max-width: 100%; max-height: 560px; display: block; }
.plan-frame iframe { width: 100%; height: 560px; border: none; }

.top-view {
    width: 100%;
    max-height: 560px;
    display: block;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.top-view .room      { fill: var(--accent-soft); stroke: none; }
.top-view .room-label { paint-order: stroke; stroke: var(--bg-primary); stroke-width: 0.08; stroke-linejoin: round;
                        fill: var(--text-secondary); font: 500 0.32px 'Inter', system-ui, sans-serif; text-anchor: middle; }
.top-view .room-area  { fill: var(--text-muted); font: 400 0.24px 'Inter', system-ui, sans-serif; text-anchor: middle; }
.top-view .wall      { stroke: var(--text-primary); stroke-linecap: square; }
.top-view .wall.interior { stroke: var(--text-secondary); }
.top-view .opening   { stroke-linecap: butt; }
.top-view .opening.window { stroke: #38bdf8; }
.top-view .opening.door   { stroke: #f59e0b; }
.top-view .camera .cone { fill: var(--camera-soft); stroke: var(--camera-line); stroke-width: 0.02; }
.top-view .camera .body { fill: var(--camera); stroke: var(--bg-elevated); stroke-width: 0.04; }
.top-view .camera.selected .cone { fill: var(--camera-wash); stroke: var(--camera); stroke-width: 0.04; }
.top-view .furniture rect { fill: var(--bg-elevated); stroke: var(--text-muted); stroke-width: 0.02; }
.top-view .furniture line { stroke: var(--text-secondary); stroke-width: 0.05; stroke-linecap: round; }
.top-view .furniture.rug rect { fill: var(--bg-tertiary); }

.furniture-panel { padding: 14px 20px; }
.furniture-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.furniture-status { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }

/* ─── Toggle switch (style guide §5.11) ─── */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}
.toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle:hover .toggle-track                  { border-color: var(--text-secondary); }
.toggle input:checked + .toggle-track        { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track  { box-shadow: 0 0 0 3px var(--accent-soft); }
.toggle input:disabled ~ *                   { opacity: 0.5; cursor: not-allowed; }
.toggle-label { font-size: 14px; color: var(--text-primary); }
.toggle.toggle-row { display: flex; justify-content: space-between; width: 100%; }

.assumption-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.assumption-list li {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.assumption-list li svg { color: var(--text-muted); flex-shrink: 0; margin-top: 3px; }

/* ─── 3D scene ─── */
.scene-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 14px;
    align-items: start;
}
@media (max-width: 1100px) { .scene-layout { grid-template-columns: minmax(0, 1fr); } }
.viewer {
    position: relative;
    aspect-ratio: 3 / 2;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.viewer-canvas { position: absolute; inset: 0; }
.viewer-canvas canvas { width: 100%; height: 100%; display: block; }
.viewer-hint {
    position: absolute;
    left: 12px;
    bottom: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    background: rgba(var(--bg-primary-rgb), 0.75);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    pointer-events: none;
}
.viewer-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.viewer-switch { position: absolute; top: 10px; right: 10px; }

/* ─── Landscape site ─── */
.site-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
    gap: 14px;
    align-items: start;
}
.site-layout .panel { margin-top: 0; }
.site-layout > div > .panel + .panel { margin-top: 14px; }
@media (max-width: 1100px) { .site-layout { grid-template-columns: minmax(0, 1fr); } }

.site-view {
    width: 100%;
    max-height: 640px;
    display: block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.site-view .no-image { fill: var(--bg-tertiary); }
.site-view .feature, .editor-svg .feature, .editor-svg .draft {
    fill-opacity: 0.45;
    stroke: rgba(255, 255, 255, 0.75);
    stroke-linejoin: round;
    stroke-linecap: round;
}
.site-view .feature.line, .editor-svg .feature.line, .editor-svg .draft.line { fill: none; stroke-opacity: 0.85; }
.site-view .feature.designed, .editor-svg .feature.designed { fill-opacity: 0.7; stroke: var(--bg-elevated); }
.site-view .feature.line.designed, .editor-svg .feature.line.designed { stroke-opacity: 1; }
.site-view .feature-label, .editor-svg .feature-label {
    fill: #ffffff; font-family: 'Inter', system-ui, sans-serif; font-weight: 600; text-anchor: middle; pointer-events: none;
    paint-order: stroke; stroke: rgba(0, 0, 0, 0.55); stroke-width: 0.35em; stroke-linejoin: round;
}
.site-view .camera .cone { fill: var(--camera-soft); stroke: var(--camera-line); }
.site-view .camera .body { fill: var(--camera); stroke: var(--bg-elevated); }
.site-view .camera.selected .cone { fill: var(--camera-wash); stroke: var(--camera); }
.site-view .camera-label {
    fill: #ffffff; font-family: 'Inter', system-ui, sans-serif; font-weight: 600; text-anchor: middle; pointer-events: none;
    paint-order: stroke; stroke: var(--camera-strong); stroke-width: 0.3em; stroke-linejoin: round;
}

/* Feature tints, shared by the site plan and the site editor. Lines take the tint as their stroke. */
.ft-woodland, .ft-tree_line, .ft-tree { fill: var(--cover-woodland); }
.ft-orchard  { fill: var(--cover-orchard); }
.ft-meadow   { fill: var(--cover-meadow); }
.ft-lawn     { fill: var(--cover-lawn); }
.ft-field    { fill: var(--cover-field); }
.ft-garden   { fill: var(--cover-garden); }
.ft-heath    { fill: var(--cover-heath); }
.ft-water, .ft-stream { fill: var(--cover-water); }
.ft-wetland  { fill: var(--cover-wetland); }
.ft-sand     { fill: var(--cover-sand); }
.ft-rock     { fill: var(--cover-rock); }
.ft-paved    { fill: var(--cover-paved); }
.ft-building { fill: var(--cover-building); }
.ft-mound, .ft-hollow { fill: var(--cover-relief); }
.ft-hedge    { fill: var(--cover-woodland); }
.ft-path     { fill: var(--cover-path); }
.ft-road     { fill: var(--cover-road); }
.ft-wall     { fill: var(--cover-wall); }
.ft-fence    { fill: var(--cover-fence); }
.line.ft-tree_line, .line.ft-hedge { stroke: var(--cover-woodland); }
.line.ft-stream { stroke: var(--cover-water); }
.line.ft-path { stroke: var(--cover-path); }
.line.ft-road { stroke: var(--cover-road); }
.line.ft-wall { stroke: var(--cover-wall); }
.line.ft-fence { stroke: var(--cover-fence); }
.ft-mound { stroke-dasharray: 0.6% 0.4%; }
.ft-hollow { stroke-dasharray: 0.2% 0.3%; }

/* The map a site is chosen on. */
.picker-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
    gap: 14px;
    align-items: start;
}
@media (max-width: 1100px) { .picker-layout { grid-template-columns: minmax(0, 1fr); } }
.picker-search { margin-bottom: 10px; min-height: 20px; font-size: 12.5px; color: var(--text-muted); }
/* Google's place search is a sealed component: only its box and the named parts can be styled.
   Dressed as a Proxima input (style guide §5.7). */
.picker-search gmp-place-autocomplete {
    display: block;
    width: 100%;
    color-scheme: light;
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.picker-search gmp-place-autocomplete:hover { border-color: var(--text-muted); }
.picker-search gmp-place-autocomplete:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker-search gmp-place-autocomplete::part(focus-ring) { display: none; }
.picker-search gmp-place-autocomplete::part(prediction-list) {
    margin-top: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}
.picker-search gmp-place-autocomplete::part(prediction-item) { font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px; color: var(--text-primary); }
.picker-search gmp-place-autocomplete::part(prediction-item-selected) { background: var(--accent-soft); }
.picker-search gmp-place-autocomplete::part(prediction-item-match) { color: var(--accent); font-weight: 600; }
.picker-search gmp-place-autocomplete::part(prediction-item-icon) { color: var(--text-muted); }
.picker-map {
    position: relative;
    height: 520px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.picker-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.picker-readout { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; margin-left: auto; }

.view-list { display: flex; flex-direction: column; gap: 6px; }
.view-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    font: 500 13px 'Inter', system-ui, sans-serif;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.view-item:hover { border-color: var(--accent); }
.view-item.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.view-item svg { color: var(--text-muted); flex-shrink: 0; }
.view-item.selected svg { color: var(--accent); }
.view-item .view-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Render gallery ─── */
.render-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}
.render-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.render-image {
    position: relative;
    aspect-ratio: 3 / 2;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12.5px;
    gap: 8px;
}
.render-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.render-image .render-switch {
    position: absolute;
    top: 10px;
    right: 10px;
}
/* Download sits on the photo, top-left, opposite the Render/Massing switch. */
.render-download {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.render-download:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.render-download:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.render-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.render-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.render-title { font-weight: 600; font-size: 13.5px; }
.render-prompt {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.render-prompt.expanded { -webkit-line-clamp: unset; }
.render-prompt { cursor: pointer; border-radius: 4px; transition: color 0.12s ease; }
.render-prompt:hover { color: var(--text-primary); }
.render-prompt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.render-prompt-edit { font-size: 12.5px; line-height: 1.55; min-height: 180px; }
.render-meta { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.render-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.render-error { font-size: 12px; color: #ef4444; }

.render-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.render-links span { display: inline-flex; align-items: center; gap: 5px; }
.render-links svg { flex-shrink: 0; }

/* Room looks: one row per room — its reference photo, then the agreed description. */
.look-list { display: flex; flex-direction: column; }
.look-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--border-subtle);
}
.look-row:last-child { padding-bottom: 0; }
.look-photo {
    position: relative;
    aspect-ratio: 3 / 2;
    align-self: start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    overflow: hidden;
}
.look-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.look-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.look-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.look-text { font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.look-text.empty { color: var(--text-muted); }
@media (max-width: 700px) { .look-row { grid-template-columns: minmax(0, 1fr); } .look-photo { max-width: 220px; } }

/* The picture on a card is a button that opens the lightbox. */
.render-open {
    position: absolute;
    inset: 0;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}
.render-open img { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.render-open:hover img { transform: scale(1.02); }
.render-open:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--accent); }
.render-image { overflow: hidden; }

/* ─── Lightbox ─── */
/* Colours come from the --lightbox-* tokens, which do not change with the theme. */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    background: var(--lightbox-bg);
    color: var(--lightbox-text);
    animation: modal-backdrop-in 0.18s ease-out;
    outline: none;
}
.lightbox-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    flex-shrink: 0;
}
.lightbox-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.lightbox-count { font-size: 12.5px; color: var(--lightbox-muted); font-variant-numeric: tabular-nums; }
.lightbox .btn-icon { color: var(--lightbox-muted); }
.lightbox .btn-icon:hover { color: var(--lightbox-text); background: var(--lightbox-glass); }
.lightbox .segmented { background: var(--lightbox-glass); border-color: var(--lightbox-line); }
.lightbox .segmented-option { color: var(--lightbox-muted); }
.lightbox .segmented-option:hover:not(.selected) { color: var(--lightbox-text); background: var(--lightbox-glass); }
.lightbox .segmented-option.selected { background: var(--lightbox-line); color: var(--lightbox-text); border-color: transparent; box-shadow: none; }
.lightbox-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px 24px;
}
.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: modal-card-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.lightbox-reading { position: relative; display: inline-block; line-height: 0; min-width: 0; }
.lightbox-reading .lightbox-image { max-width: calc(100vw - 160px); max-height: calc(100vh - 110px); display: block; }
.lightbox-note { line-height: 1.4; }
.lightbox-note {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--lightbox-bg);
    color: var(--lightbox-text);
    font-size: 12.5px;
    white-space: nowrap;
}
/* The photo with depth: a canvas three.js sizes to fit this box. */
.lightbox-parallax { flex: 1; align-self: stretch; min-width: 0; display: flex; align-items: center; justify-content: center; }
.parallax-canvas { border-radius: var(--radius-sm); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); display: block; }
/* Before and after: the after photo with the before photo over it, cut off at the divider. */
.compare { position: relative; display: inline-block; line-height: 0; min-width: 0; border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.compare .lightbox-image { max-width: calc(100vw - 160px); max-height: calc(100vh - 110px); box-shadow: none; border-radius: 0; display: block; }
.compare-before { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--split)) 0 0); }
.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--split);
    width: 2px;
    margin-left: -1px;
    background: var(--lightbox-text);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.compare-handle::before {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--lightbox-text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.compare-handle svg { position: relative; flex-shrink: 0; color: var(--lightbox-bg); margin: 0 -1px; }
.compare-label {
    position: absolute;
    top: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--lightbox-bg);
    color: var(--lightbox-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    pointer-events: none;
}
.compare-label.before { left: 12px; }
.compare-label.after { right: 12px; }
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.lightbox-nav {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--lightbox-line);
    background: var(--lightbox-glass);
    color: var(--lightbox-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.lightbox-nav:hover { background: var(--lightbox-line); border-color: var(--lightbox-muted); }
.lightbox-nav:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── Plan editor (full screen) ─── */
.editor-screen {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    animation: modal-backdrop-in 0.18s ease-out;
}
.editor-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.editor-bar-title { display: flex; align-items: center; gap: 12px; margin-right: 10px; min-width: 0; }
.editor-bar-sub {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-secondary.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.editor-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 8px 20px;
    line-height: 1.5;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.editor-body { flex: 1; min-height: 0; display: flex; }
.editor-reference {
    width: min(32vw, 600px);
    flex-shrink: 0;
    padding: 16px;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow: auto;
}
.editor-reference .plan-frame { min-height: 0; }
.editor-reference .plan-frame img { max-height: none; }
.editor-reference .plan-frame iframe { height: calc(100vh - 190px); }
.editor-section-title {
    margin: 20px 0 8px;
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.editor-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.editor-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.editor-surface {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-primary);
}
.editor-surface:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); }
.editor-svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
}
.editor-svg.tool-wall, .editor-svg.tool-room, .editor-svg.tool-camera { cursor: crosshair; }
.editor-svg.tool-furniture { cursor: copy; }
.editor-svg.tool-door, .editor-svg.tool-window { cursor: copy; }
.editor-svg .grid-line { stroke: var(--border); }
.editor-svg .room { fill: var(--accent-soft); cursor: pointer; transition: fill 0.12s ease; }
.editor-svg .room:hover { fill: rgba(47, 179, 131, 0.14); }
.editor-svg .room.selected { fill: rgba(47, 179, 131, 0.22); }
.editor-svg .wall { stroke: var(--text-primary); stroke-linecap: square; pointer-events: none; }
.editor-svg .wall.interior { stroke: var(--text-secondary); }
.editor-svg .wall.selected { stroke: var(--accent); }
.editor-svg .hit { stroke: transparent; cursor: pointer; }
.editor-svg .hit:hover { stroke: var(--accent-glow); }
.editor-svg .opening { stroke-linecap: butt; cursor: grab; }
.editor-svg .opening.window { stroke: #38bdf8; }
.editor-svg .opening.door { stroke: #f59e0b; }
.editor-svg .opening.selected { stroke: var(--accent); }
.editor-svg .room-label   { fill: var(--text-secondary); font-family: 'Inter', system-ui, sans-serif; font-weight: 500; text-anchor: middle; pointer-events: none; }
.editor-svg .room-area    { fill: var(--text-muted); font-family: 'Inter', system-ui, sans-serif; text-anchor: middle; pointer-events: none; }
.editor-svg .preview-label { fill: var(--accent); font-family: 'Inter', system-ui, sans-serif; font-weight: 600; text-anchor: middle; pointer-events: none; }
.editor-svg .handle { fill: var(--bg-elevated); stroke: var(--accent); stroke-width: 0.04; cursor: move; }
.editor-svg .handle:hover { fill: var(--accent); }
.editor-svg .handle.vertex { stroke: var(--camera); }
.editor-svg .furniture { cursor: grab; }
.editor-svg .furniture rect { fill: var(--bg-elevated); stroke: var(--text-muted); stroke-width: 0.02; }
.editor-svg .furniture .front { stroke: var(--text-secondary); stroke-linecap: round; }
.editor-svg .furniture.rug rect { fill: var(--bg-tertiary); stroke-dasharray: 0.08 0.06; }
.editor-svg .furniture:hover rect { stroke: var(--accent); }
.editor-svg .furniture.selected rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 0.04; }
.editor-svg .furniture.selected .front { stroke: var(--accent); }
/* Camera points. Violet, so they never read as part of the building (accent) or its openings. */
.editor-svg .camera .cone { fill: var(--camera-soft); stroke: var(--camera-line); stroke-width: 0.02; pointer-events: none; }
.editor-svg .camera.selected .cone { fill: var(--camera-wash); stroke: var(--camera); stroke-width: 0.03; }
.editor-svg .camera .body { fill: var(--camera); stroke: var(--bg-elevated); cursor: move; }
.editor-svg .camera .body:hover { fill: var(--camera-strong); }
.editor-svg .camera .lens { stroke: var(--camera); stroke-linecap: round; pointer-events: none; }
.editor-svg .camera .aim-line { stroke: var(--camera); stroke-dasharray: 0.1 0.08; pointer-events: none; }
.editor-svg .camera .handle.aim { stroke: var(--camera); cursor: crosshair; }
.editor-svg .camera .handle.aim:hover { fill: var(--camera); }
.editor-svg .camera-label {
    fill: var(--camera-strong); font-family: 'Inter', system-ui, sans-serif; font-weight: 600; text-anchor: middle; pointer-events: none;
    paint-order: stroke; stroke: var(--bg-primary); stroke-width: 0.06; stroke-linejoin: round;
}
[data-theme="dark"] .editor-svg .camera-label { fill: var(--camera); }
.editor-svg .preview { stroke: var(--accent); opacity: 0.6; stroke-linecap: square; pointer-events: none; }
.editor-svg .preview-room { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 0.03; stroke-dasharray: 0.15 0.1; pointer-events: none; }
.editor-svg .cursor { fill: var(--accent); pointer-events: none; }
/* Site editor, isometric mode: three.js owns the canvas. */
.editor-surface { position: relative; }
.editor-surface .hidden { display: none; }
.editor-iso { position: absolute; inset: 0; background: var(--bg-tertiary); }
.editor-iso canvas { touch-action: none; cursor: grab; }
.editor-iso-tools {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
/* The area picker fills the whole canvas: the map is the page, and cards float over it. */
.picker-screen { position: absolute; inset: 0; overflow: hidden; }
.picker-screen .picker-stage { position: absolute; inset: 0; }
.picker-screen .picker-map { height: 100%; border: none; border-radius: 0; }
.picker-screen .picker-3d { border-radius: 0; }
.picker-screen .picker-stage .viewer-overlay { z-index: 3; pointer-events: none; }
.picker-card {
    position: absolute;
    z-index: 5;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}
.picker-card.hidden, .picker-top .hidden { display: none; }
/* Progress of the fetch and the reading, shown over the map it is happening on. */
.picker-progress {
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(460px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.picker-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.picker-steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.picker-step-mark {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}
.picker-steps li.done .picker-step-mark { background: var(--accent); border-color: var(--accent); color: var(--bg-elevated); }
.picker-steps li.active .picker-step-mark { border-color: transparent; }
.picker-step-title { display: block; font-weight: 500; font-size: 13.5px; color: var(--text-primary); }
.picker-steps li.todo .picker-step-title { color: var(--text-muted); }
.picker-step-sub { display: block; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.picker-progress-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picker-top { top: 16px; left: 16px; width: min(420px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; }
.picker-top .breadcrumbs { margin-bottom: 0; }
.picker-top .picker-search { margin-bottom: 0; }
.picker-title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.picker-side { top: 16px; right: 16px; width: 330px; max-height: calc(100% - 120px); overflow-y: auto; }
.picker-dock {
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.picker-group { display: flex; align-items: center; gap: 4px; }
.picker-group + .picker-group { padding-left: 16px; border-left: 1px solid var(--border); }
.picker-group-label { font-weight: 500; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; }
.picker-chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    overflow: hidden;
}
.picker-chip button { height: 100%; padding: 0 8px; border: none; background: none; color: var(--text-secondary); font: 500 12.5px 'Inter', system-ui, sans-serif; cursor: pointer; display: inline-flex; align-items: center; }
.picker-chip button + button { padding: 0 7px 0 4px; color: var(--text-muted); }
.picker-chip button:hover { color: var(--accent); }
.picker-chip.selected { border-color: var(--accent); background: var(--accent-soft); }
.picker-chip.selected button:first-child { color: var(--accent); }
.picker-size { width: 84px; height: 32px; padding: 4px 8px; }
.picker-times { font-size: 13px; color: var(--text-muted); }
.picker-dock .picker-readout { margin-left: 0; }
@media (max-width: 1100px) { .picker-side { top: auto; bottom: 120px; } }
/* The landscape workspace: the same full canvas, with our own isometric view of the site under the cards. */
.workspace-stage { position: absolute; inset: 0; background: var(--bg-tertiary); }
.workspace-stage canvas { touch-action: none; }
.workspace-stage .viewer-overlay { pointer-events: none; }
.workspace-top { top: 16px; left: 16px; width: min(400px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; }
.workspace-top .breadcrumbs { margin-bottom: 0; }
.workspace-top .segmented { align-self: flex-start; }
.workspace-title-row { display: flex; align-items: center; gap: 4px; }
.workspace-title-row .picker-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-side {
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: min(400px, calc(100% - 32px));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.workspace-side .camera-preview { margin-top: 0; }
.workspace-side .field-row { margin-top: 0; }
.workspace-pair { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.workspace-side { overflow-x: hidden; }
.workspace-dock { left: 16px; transform: none; max-width: calc(100% - 448px); }
.workspace-centre {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
}
.workspace-centre .progress { width: 100%; }
.workspace-block { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.workspace-block-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workspace-block-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.workspace-features { display: flex; flex-direction: column; }
.workspace-feature { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-top: 1px solid var(--border-subtle); }
.workspace-feature:first-child { border-top: none; }
.workspace-feature-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-swatch { width: 12px; height: 12px; flex-shrink: 0; border-radius: 3px; border: 1px solid var(--border); background-color: currentColor; }
/* The swatch takes its colour from the same land-cover classes the site plan uses, which set `fill`. */
.workspace-swatch.ft-woodland, .workspace-swatch.ft-tree_line, .workspace-swatch.ft-tree, .workspace-swatch.ft-hedge { color: var(--cover-woodland); }
.workspace-swatch.ft-orchard { color: var(--cover-orchard); }
.workspace-swatch.ft-meadow { color: var(--cover-meadow); }
.workspace-swatch.ft-lawn { color: var(--cover-lawn); }
.workspace-swatch.ft-field { color: var(--cover-field); }
.workspace-swatch.ft-garden { color: var(--cover-garden); }
.workspace-swatch.ft-heath { color: var(--cover-heath); }
.workspace-swatch.ft-water, .workspace-swatch.ft-stream { color: var(--cover-water); }
.workspace-swatch.ft-wetland { color: var(--cover-wetland); }
.workspace-swatch.ft-sand { color: var(--cover-sand); }
.workspace-swatch.ft-rock { color: var(--cover-rock); }
.workspace-swatch.ft-paved { color: var(--cover-paved); }
.workspace-swatch.ft-building { color: var(--cover-building); }
.workspace-swatch.ft-mound, .workspace-swatch.ft-hollow { color: var(--cover-relief); }
.workspace-swatch.ft-path { color: var(--cover-path); }
.workspace-swatch.ft-road { color: var(--cover-road); }
.workspace-swatch.ft-wall { color: var(--cover-wall); }
.workspace-swatch.ft-fence { color: var(--cover-fence); }
.workspace-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.workspace-selected { background: var(--accent-soft); margin: 0 -16px; padding: 14px 16px; border-top: 1px solid var(--accent-glow); border-bottom: 1px solid var(--accent-glow); }
.workspace-selected .workspace-block-title { display: flex; align-items: center; gap: 8px; }
.workspace-remove:hover { color: #ef4444; border-color: #ef4444; }
.workspace-feature.selected { background: var(--accent-soft); box-shadow: -16px 0 0 var(--accent-soft), 16px 0 0 var(--accent-soft); }
.workspace-feature.removed .workspace-feature-name { text-decoration: line-through; color: var(--text-muted); cursor: default; }
.workspace-feature.removed .workspace-swatch { opacity: 0.4; }
.workspace-row-remove { width: 26px; height: 26px; opacity: 0; transition: opacity 0.12s ease; }
.workspace-feature:hover .workspace-row-remove, .workspace-row-remove:focus-visible { opacity: 1; }
.workspace-row-remove:hover { color: #ef4444; }
/* Renders as a photo album: the panel opens over the whole canvas, beside the title card. */
.album-backdrop { position: absolute; inset: 0; z-index: 4; background: var(--bg-primary); }
.workspace-side.album { left: 432px; width: auto; }
.album-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.album-head .render-actions { margin: 0; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.album-photo { margin: 0; }
.album-photo .render-image { color: var(--text-muted); flex-direction: column; }
.album-compare {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.album-compare:hover { color: var(--accent); border-color: var(--accent); }
.album-busy {
    position: absolute;
    left: 10px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}
@media (max-width: 1100px) { .workspace-side.album { left: 16px; top: 190px; height: auto; } }
.camera-name-row { display: flex; align-items: center; gap: 6px; }
.camera-name-row .input { flex: 1; min-width: 0; }
/* AI assist: a dialog with what was asked and answered, and a box for the next request. */
.assist-dialog { width: 520px; display: flex; flex-direction: column; gap: 12px; }
.assist-dialog .modal-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.assist-dialog .assist-intro { margin: 0; }
.assist-dialog .assist-log { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.assist-dialog .assist-form { flex-direction: column; align-items: stretch; }
.assist-dialog .modal-actions { align-items: center; }
.assist-undo { margin-right: auto; }
.assist-log { display: flex; flex-direction: column; gap: 6px; }
.assist-ask {
    align-self: flex-end;
    max-width: 88%;
    padding: 6px 10px;
    border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
    background: var(--accent-soft);
    color: var(--text-primary);
    font-size: 12.5px;
    line-height: 1.45;
}
.assist-reply { max-width: 94%; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); display: flex; gap: 8px; align-items: baseline; }
.assist-form { display: flex; gap: 10px; }
/* Auto design: a card that folds; the numbers are sliders. */
.design-card { gap: 0; }
.design-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
}
.design-card-head:hover .workspace-block-title { color: var(--accent); }
.design-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.design-card-title .panel-sub { display: inline-flex; align-items: center; gap: 6px; }
.design-card-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.design-rationale {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-line;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}
.slider-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; }
.slider-row .field-label { margin: 0; }
.slider-value {
    min-width: 42px;
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.slider-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-muted); }
.slider {
    grid-column: 1 / -1;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.slider:disabled { cursor: default; opacity: 0.55; }
.slider:focus-visible { outline: none; }
/* The track fills with the accent up to the value (Firefox draws that part itself). */
.slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--accent) 0 var(--fill, 0%), var(--border) var(--fill, 0%) 100%);
}
.slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--border); }
.slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.12s ease;
}
.slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.slider:hover::-webkit-slider-thumb, .slider:focus-visible::-webkit-slider-thumb { transform: scale(1.12); }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
/* A camera's prompt, read and tuned before the photo is made. */
.camera-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.camera-prompt .render-actions { margin-top: 8px; }
.picker-picked { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--camera-strong); font-weight: 500; }
.workspace-link { padding: 0; border: none; background: none; color: inherit; cursor: pointer; text-align: left; font-family: inherit; }
.workspace-link:hover { color: var(--accent); }
@media (max-width: 1100px) { .workspace-side { top: auto; height: 46%; } .workspace-dock { bottom: calc(46% + 28px); max-width: calc(100% - 32px); } }
/* The area picker's 3D view lies over the map; the map stays laid out underneath. */
.picker-stage { position: relative; }
.picker-3d { position: absolute; inset: 0; z-index: 2; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-tertiary); }
.picker-3d.hidden { display: none; }
.picker-3d gmp-map-3d { width: 100%; height: 100%; display: block; }
/* Site editor: features over the satellite image. */
.editor-svg.site-editor { background: var(--bg-tertiary); }
.editor-svg.site-editor.tool-select { cursor: grab; }
.editor-svg.site-editor.panning { cursor: grabbing; }
.editor-svg.site-editor.tool-area, .editor-svg.site-editor.tool-line, .editor-svg.site-editor.tool-tree { cursor: crosshair; }
.editor-svg .site-edge { fill: none; stroke: var(--bg-elevated); stroke-dasharray: 1% 0.6%; pointer-events: none; }
.editor-svg .feature { cursor: grab; transition: fill-opacity 0.12s ease; }
.editor-svg .feature:hover { fill-opacity: 0.6; }
.editor-svg .feature.line:hover { fill: none; }
.editor-svg .feature.selected { stroke: var(--accent) !important; stroke-width: 0.35% !important; fill-opacity: 0.75; }
.editor-svg .feature.line.selected { fill: none; fill-opacity: 1; stroke-width: inherit; }
.editor-svg .hit { fill: none; stroke: transparent; cursor: grab; }
.editor-svg .hit:hover { stroke: var(--accent-glow); }
.editor-svg .draft { pointer-events: none; fill-opacity: 0.35; stroke: var(--accent); stroke-dasharray: 0.5% 0.3%; }
.editor-svg .draft.line { stroke-opacity: 0.8; }
.editor-svg .draft-start { fill: var(--bg-elevated); stroke: var(--accent); pointer-events: none; }
.editor-svg .handle.mid { fill: var(--bg-elevated); stroke: var(--accent); cursor: copy; }
.editor-svg .handle.mid:hover { fill: var(--accent); }
.editor-svg .camera .handle.aim { stroke: var(--camera); }

.editor-properties {
    width: 340px;
    flex-shrink: 0;
    padding: 18px 20px;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow-y: auto;
}
.editor-properties .field-row { margin-top: 12px; }
.editor-properties .segmented { align-self: flex-start; }
/* Reference photos on a building: small squares in a row, the last one adds. */
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb, .photo-add {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-tertiary);
}
.photo-thumb a { display: block; width: 100%; height: 100%; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
}
.photo-remove:hover { color: #ef4444; border-color: #ef4444; }
.photo-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.photo-add:hover, .photo-add:focus-within { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.photo-add.busy { pointer-events: none; }
.photo-add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.camera-preview { margin-top: 18px; }
.camera-preview.hidden { display: none; }
.camera-preview { outline: none; }
.camera-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 30px; }
.camera-preview-head .field-label { margin: 0; white-space: nowrap; }
.camera-preview-busy { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.camera-preview-render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-preview-tag { position: absolute; top: 10px; left: 10px; }
.camera-preview-open { position: absolute; inset: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.camera-preview-open:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--accent); }
.camera-preview-frame .render-switch { position: absolute; top: 10px; right: 10px; }
/* Opened larger: the same panel over the whole window, in the lightbox's colours. */
.workspace-side:has(.camera-preview.large) { z-index: 400; }
.camera-preview.large { margin: 0; padding: 12px 20px 24px; align-items: center; }
.camera-preview.large .camera-preview-head { width: 100%; gap: 12px; margin-bottom: 12px; flex-shrink: 0; }
.camera-preview.large .camera-preview-head .field-label { color: var(--lightbox-text); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.camera-preview.large .camera-preview-busy { color: var(--lightbox-muted); }
.camera-preview-keys { order: 3; margin-top: 10px; font-size: 12px; color: var(--lightbox-muted); flex-shrink: 0; }
.camera-preview.large .camera-preview-frame {
    width: min(100%, calc((100vh - 124px) * 1.5));
    margin: auto 0;
    border-color: var(--lightbox-line);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.camera-preview-frame {
    position: relative;
    aspect-ratio: 3 / 2;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.editor-properties .field + .field { margin-top: 12px; }
.editor-delete { margin-top: 16px; }
.editor-delete:hover { color: #ef4444; border-color: #ef4444; }
.editor-checks {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.5;
}
.editor-ok { display: flex; align-items: center; gap: 8px; color: #16a34a; }
.editor-problem { display: flex; gap: 8px; color: var(--text-secondary); }
.editor-problem svg { color: #f59e0b; flex-shrink: 0; margin-top: 2px; }
.toolbar-grow { flex: 1; }

/* Number inputs: no native spinners (style guide §5.7). */
.input-number { -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
.input-number::-webkit-outer-spin-button,
.input-number::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input:disabled { color: var(--text-muted); background: var(--bg-glass); cursor: not-allowed; }

/* ─── Definition list (settings, model facts) ─── */
.facts { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 16px; font-size: 13.5px; }
.facts dt { color: var(--text-muted); }
.facts dd { color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }

/* ─── Section ─── */
.section { margin-top: 22px; }
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.section-title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); }

/* ─── Blazor chrome ─── */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 3000;
    padding: 10px 14px;
    gap: 12px;
    align-items: center;
    background: #ef4444;
    color: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
}
#blazor-error-ui a { color: #fff; font-weight: 600; text-decoration: underline; }
#blazor-error-ui .dismiss { cursor: pointer; }

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Session (app bar) ─── */
.btn-link {
    border: none;
    background: none;
    padding: 0;
    font-weight: 500; font-size: 12px; font-family: inherit;
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
}
.btn-link:hover { text-decoration: underline; }
.appbar-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font: 500 13px 'Inter', system-ui, sans-serif;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.appbar-user:hover { color: var(--text-primary); background: var(--bg-glass-hover); }

/* ─── Print and high contrast ───
   The tapestry is DECORATIVE: it carries no information, so it is the first thing to go when
   the page has to be read another way. */
@media print {
    body  { background: #fff; }
    .main { margin: 0; box-shadow: none; border-radius: 0; }
}
@media (prefers-contrast: more) {
    body { background-image: none; }
}

/* ─── Starter kit: sign-in, account, Usagers, Rôles, Configuration ─── */
/* The rules of ClientApp-StarterKit/wwwroot/app.css for the screens copied from the kit
   (Connexion, Activation, Compte, Configuration, GestionUsagers, Tiroir, DataTable…), as they are. */
.appbar-badge {
    font-weight: 500; font-size: 9.5px; font-family: inherit;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.6;
}
.appbar-badge.badge-dev { color: #b45309; background: rgba(245, 158, 11, 0.16); }
[data-theme="dark"] .appbar-badge.badge-dev { color: #fbbf24; }
.status-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500; font-size: 11px; font-family: inherit;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}
.page { display: flex; flex-direction: column; gap: 20px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.search-field { position: relative; min-width: 280px; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: inline-flex;
    pointer-events: none;
}
.input.search-input { padding-left: 36px; }
.data-table td select.input,
.entry-table tbody td select.input { padding-right: 28px; }
.table-scroll {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;              
    max-height: 640px;
}
.table thead th .th-sort,
.data-table thead th .th-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}
.table thead th .th-sort:hover,
.data-table thead th .th-sort:hover { color: var(--text-primary); }
.table thead th .th-sort:focus-visible,
.data-table thead th .th-sort:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.table thead th:not([aria-sort="none"]) .th-sort,
.data-table thead th:not([aria-sort="none"]) .th-sort { color: var(--text-primary); }
.sort-arrow {
    font-size: 10px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.sort-arrow.is-active {
    opacity: 1;
    color: var(--accent);
}
.tag.tag-success { color: #22c55e; background: rgba(34, 197, 94, 0.14); }
.tag.tag-info { color: #6b7084; background: var(--bg-tertiary); }
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
@media (max-width: 600px) {
  .search-field { min-width: 0; width: 100%; }
}
.kpi-sub { font-size: 12px; color: var(--text-muted); }
.data-scroll {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
}
.data-scroll.tall { max-height: calc(100vh - 240px); min-height: 360px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
    text-align: center;
    padding: 10px 14px;
    font-weight: 600; font-size: 11px; font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: 9px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: center;
}
.data-table td.cell-action { text-align: right; }
.data-table thead th .th-sort { justify-content: center; }
.data-table tbody tr:hover { background: var(--bg-glass-hover); }
.data-table tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-top: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.data-table .num { text-align: center; font-variant-numeric: tabular-nums; }
.data-table td.num { font-size: 15px; font-weight: 600; }
.data-table td.cell-comment {
    max-width: 380px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.data-table td .input {
    padding: 5px 8px;
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
    min-width: 0;
}
.data-table tbody td:has(.input):focus-within,
.entry-table tbody td:has(.input):focus-within {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 2px var(--accent);
}
.data-table td .input:focus,
.entry-table td .input:focus {
    box-shadow: none;
}
.data-table td.cell-comment .cell-comment-input {
    min-width: 300px;
    field-sizing: content;
    min-height: 2.4em;
    max-height: 16em;
    line-height: 1.45;
    resize: vertical;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.data-table .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }
.data-table .neg { color: #dc2626; }
[data-theme="dark"] .data-table .neg { color: #f87171; }
.data-table td.num.neg, .data-table .kpi-value.neg { color: #dc2626; }
.data-table .pos { color: #16a34a; }
[data-theme="dark"] .data-table .pos { color: #4ade80; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 2px 4px 2px 0;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.chip strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.data-table tbody tr.avenant-sub-head td {
    background: var(--bg-tertiary);
    padding-left: 32px;
    font-weight: 600; font-size: 10px; font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.data-table tbody tr.avenant-sub td { background: var(--bg-glass); }
.data-table tbody tr.avenant-sub td:first-child { padding-left: 32px; }
.data-table tbody tr.avenant-sub:hover { background: transparent; }
.detail-card + .data-scroll { margin-top: 0; }
.data-table-wrap { display: flex; flex-direction: column; gap: 12px; }
.table-filter { min-width: 0; width: 100%; max-width: 380px; }
.table-filter .search-input { padding-right: 70px; }
.table-filter-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.data-table .empty-row { text-align: center; color: var(--text-muted); padding: 22px; }
.chip-toggle {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 500; font-size: 12.5px; font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chip-toggle:hover { border-color: var(--accent); color: var(--text-primary); }
.chip-toggle.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 4px;
}
.form-grid.tight { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.span-2 { grid-column: span 2; }
.form-field label { font-weight: 500; font-size: 12px; font-family: inherit; color: var(--text-secondary); }
.form-field .req { color: #dc2626; }
[data-theme="dark"] .form-field .req { color: #f87171; }
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.form-subhead { font-weight: 600; font-size: 12px; font-family: inherit; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin: 18px 0 10px; }
.form-banner {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 14px;
}
.form-banner.success { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.form-banner.draft { background: var(--draft-soft); color: var(--draft); border: 1px solid var(--draft); }
.form-banner.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
[data-theme="dark"] .form-banner.error { color: #f87171; }
.form-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.entry-table .empty-row { text-align: center; color: var(--text-muted); padding: 20px; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-full, 999px);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600; font-size: 12px; font-family: inherit;
}
.pill-ok { background: rgba(34, 197, 94, 0.14);  color: #15803d; }
.pill-warn { background: rgba(234, 179, 8, 0.16);  color: #a16207; }
.config-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.config-nav {
    display: grid;
    gap: 18px;
    position: sticky;
    top: 76px;                      
}
.config-nav-group { display: grid; gap: 2px; }
.config-nav-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px 6px;
}
.config-nav-item {
    appearance: none;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    padding: 8px 12px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.config-nav-item:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.config-nav-item.is-active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-glass-hover);
}
.config-panel { min-width: 0; }
@media (max-width: 900px) {
  .config-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .config-nav {
        position: static;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }
  .config-nav-group { grid-auto-flow: column; grid-auto-columns: max-content; gap: 4px; align-items: center; }
  .config-nav-title { padding: 0 6px 0 0; }
  .config-nav-item { border-left: none; border-bottom: 2px solid transparent; border-radius: var(--radius-sm); white-space: nowrap; }
  .config-nav-item.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
}
.config-check { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.config-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.acces-ecran .field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.acces-ecran .text-muted { color: var(--text-muted); font-size: 12.5px; }
.acces-ecran .champ + .champ { margin-top: 12px; }
.acces-ecran .actions-ligne { display: flex; flex-wrap: wrap; gap: 6px; }
.etat-compte { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tiroir-fond {
    position: fixed; inset: 0;
    background: rgba(20, 22, 30, 0.45);
    z-index: 900;
    animation: modal-backdrop-in 0.18s ease-out;
}
.tiroir {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 100vw);
    display: flex; flex-direction: column;
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), -12px 0 40px rgba(0, 0, 0, 0.12);
    z-index: 910;
    animation: tiroir-entree 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.tiroir:focus { outline: none; }
.tiroir-tete {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.tiroir-titre { margin: 0; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); }
.tiroir-sous-titre { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.tiroir-fermer {
    border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font-size: 16px; line-height: 1;
    padding: 6px; border-radius: var(--radius-sm);
}
.tiroir-fermer:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tiroir-corps { flex: 1; overflow-y: auto; padding: 18px 24px; }
.tiroir-pied {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
}
@media (prefers-reduced-motion: reduce) {
  .tiroir, .tiroir-fond, .modal-card, .modal-backdrop { animation: none; }
}
.revelation-secret { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; scroll-margin-top: 80px; }
.revelation-secret:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.revelation-tete { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.revelation-tete .text-muted { color: var(--text-muted); font-size: 12px; }
.revelation-valeur { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.revelation-code {
    display: inline-block;
    padding: 6px 10px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    user-select: all;
    overflow-wrap: anywhere;
}
.revelation-consigne { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
a.config-nav-item { display: block; text-decoration: none; }
.data-table tbody tr.ligne-cliquable { cursor: pointer; }
.data-table tbody tr.ligne-selectionnee td { background: var(--accent-soft); }
.filtres-acces { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.lien-compte { font-size: 13.5px; font-weight: 600; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.fiche-section + .fiche-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.fiche-titre {
    margin: 0 0 10px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-muted);
}
.fiche-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; font-size: 13.5px; }
.fiche-dl dt { color: var(--text-muted); }
.fiche-dl dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.fiche-dl code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
.fiche-etat { margin-bottom: 10px; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fiche-actions a.btn-secondary { text-decoration: none; }
.fiche-historique { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.fiche-historique li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fiche-historique .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 480px) {
  .fiche-dl { grid-template-columns: 1fr; gap: 2px; }
  .fiche-dl dd { margin-bottom: 8px; }
}
.choix-sorte { display: grid; gap: 8px; }
.choix-sorte-carte {
    display: flex; flex-direction: column; gap: 4px; text-align: left;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit; font-size: 13.5px; color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choix-sorte-carte:hover, .choix-sorte-carte:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.choix-sorte-carte .text-muted { font-size: 12.5px; }
.data-table td.cellule-compte { text-align: left; white-space: normal; min-width: 180px; max-width: 320px; }
.data-table td.cellule-compte .description-compte {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
    font-size: 12.5px;
}
.data-table td.cellule-roles { white-space: normal; max-width: 240px; }
.data-table td.cellule-texte { text-align: left; white-space: normal; min-width: 280px; }
.droit .text-muted { font-size: 12px; }
.usagers-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.lien-compte { padding: 0; border: none; background: none; cursor: pointer; text-align: left; }
.lien-compte code { color: var(--accent); }
