/* ============================================================================
   EGGERS Design System — Application variant
   OCP État des Lieux Transport

   Principes non négociables :
   - border-radius: 0 partout (sauf focus ring jamais arrondi).
   - Bordures 1px #E4E4E7. Aucun box-shadow (sauf focus ring et modale).
   - Grille 24px. Espacements 24 / 12 / 6 px.
   - Typo : Arial 700 (titres), Inter (UI), JetBrains Mono (chiffres).
   - Bleu #4472C4 : action primaire / état actif / sélection.
   ========================================================================= */

/* --- Design tokens ------------------------------------------------------- */

:root {
    /* Brand / action */
    --primary: #4472c4;
    --primary-dark: #345a9e;
    --primary-tint: #d6e4f7;

    /* Status */
    --success: #66ab5b;
    --success-light: #e0f0dc;
    --error: #d95040;
    --error-light: #f8dcd9;
    --warning: #ffc000;
    --warning-light: #fff3cc;

    /* Surfaces & text */
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-alt: #f4f4f5;
    --text: #09090b;
    --text-muted: #71717a;
    --border: #e4e4e7;
    --border-strong: #a1a1aa;

    /* Typography */
    --font-brand: Arial, Helvetica, sans-serif;
    --font-ui: "Inter", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

    /* Spacing (24-grid) */
    --unit: 24px;
    --unit-half: 12px;
    --unit-quarter: 6px;

    /* Radius always zero */
    --radius: 0px;

    /* Background grid for body (dot-matrix) */
    --grid-dots: radial-gradient(#e4e4e7 1px, transparent 1px) 0 0 / 24px 24px;
}

/* --- Reset -------------------------------------------------------------- */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

main {
    flex: 1 1 auto;
    background-color: var(--bg);
    background-image: var(--grid-dots);
}

img,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    background: none;
    border: 0;
    color: inherit;
}

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

/* --- Typography roles ---------------------------------------------------- */

h1,
h2,
h3,
.brand {
    font-family: var(--font-brand);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

h1 {
    font-size: 24px;
    letter-spacing: -0.01em;
}
h2 {
    font-size: 18px;
}
h3 {
    font-size: 16px;
}

.mono,
.num,
code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.label-xs {
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.text-muted {
    color: var(--text-muted);
}

/* --- Focus ring (a11y) --------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Skip link ----------------------------------------------------------- */

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-120%);
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    z-index: 1000;
    transition: transform 0.15s ease-in-out;
}
.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    text-decoration: none;
}

/* --- Screen-reader only ------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Layout helpers ----------------------------------------------------- */

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--unit-half);
}
@media (min-width: 768px) {
    .container {
        padding: 0 var(--unit);
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--unit);
}
.stack-half {
    display: flex;
    flex-direction: column;
    gap: var(--unit-half);
}

.page {
    padding: var(--unit) 0 calc(var(--unit) * 2);
}
.page-narrow {
    max-width: 440px;
    margin: 0 auto;
    padding: var(--unit) var(--unit-half);
}
@media (min-width: 768px) {
    .page-narrow {
        padding: calc(var(--unit) * 2) var(--unit-half);
    }
}
.page-content {
    max-width: 820px;
    margin: 0 auto;
    padding: var(--unit) var(--unit-half);
}
@media (min-width: 768px) {
    .page-content {
        padding: var(--unit) var(--unit);
    }
}

/* --- Card / surface ----------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: var(--unit);
}
.card + .card {
    margin-top: var(--unit-half);
}
.card-flat {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: var(--unit-half);
}

/* --- Buttons ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease,
        color 0.12s ease;
    white-space: nowrap;
}
.btn:hover {
    text-decoration: none;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-secondary:hover {
    background: var(--surface-alt);
    border-color: var(--text);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--primary);
    min-height: 36px;
    padding: 6px 10px;
}
.btn-ghost:hover {
    background: var(--primary-tint);
}

.btn-danger {
    background: var(--surface);
    border-color: var(--error);
    color: var(--error);
}
.btn-danger:hover {
    background: var(--error-light);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

/* --- Form elements ------------------------------------------------------ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--unit-half);
}

label,
.label {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.label-required::after {
    content: " *";
    color: var(--error);
}

.help-text {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-muted);
}

.input,
.select,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    transition: border-color 0.12s ease;
}
textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

input[type="number"],
input[type="date"],
input[type="tel"],
.input-mono {
    font-family: var(--font-mono);
    font-size: 15px;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--error);
}

.field-error {
    display: block;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--error);
    margin-top: 4px;
}

/* OTP digits */
.input-otp {
    font-family: var(--font-mono);
    font-size: 32px;
    letter-spacing: 0.15em;
    text-align: center;
    padding: 14px 10px;
}

fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}
legend {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    padding: 0;
}

/* Radio / checkbox cards */
.choice-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}
.choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--text);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choice:hover {
    border-color: var(--text);
}
.choice input[type="radio"],
.choice input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
}
.choice:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
}
.choice:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Scale input (1..N buttons) */
.scale {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid var(--border-strong);
}
.scale-btn {
    flex: 1 1 40px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border-right: 1px solid var(--border-strong);
    cursor: pointer;
}
.scale-btn:last-child {
    border-right: 0;
}
.scale-btn[aria-pressed="true"],
.scale-btn.is-active {
    background: var(--primary);
    color: #fff;
}
.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* File upload drop zone */
.dropzone {
    border: 1px dashed var(--border-strong);
    background: var(--surface-alt);
    padding: var(--unit);
    text-align: center;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-muted);
}
.dropzone input[type="file"] {
    min-height: auto;
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 14px;
}

/* --- Badges ------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    line-height: 1.4;
}
.badge-ok {
    border-color: var(--success);
    color: var(--success);
}
.badge-err {
    border-color: var(--error);
    color: var(--error);
}
.badge-warn {
    border-color: var(--warning);
    color: #8a6d00;
}
.badge-info {
    border-color: var(--primary);
    color: var(--primary);
}
.badge-solid-warn {
    background: var(--warning);
    border-color: var(--warning);
    color: #1a1300;
}

/* --- Status dot --------------------------------------------------------- */

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 0;
    background: var(--text-muted);
    vertical-align: middle;
    flex-shrink: 0;
}
.dot-ok {
    background: var(--success);
}
.dot-err {
    background: var(--error);
}
.dot-warn {
    background: var(--warning);
}
.dot-primary {
    background: var(--primary);
}
.dot-pulse {
    animation: dot-pulse 1.4s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}

/* --- Messages / flash --------------------------------------------------- */

.messages {
    margin-top: var(--unit-half);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--unit-half);
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    background: var(--surface);
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text);
}
.alert-success {
    border-color: var(--success);
    background: var(--success-light);
    color: #1f4b19;
}
.alert-error {
    border-color: var(--error);
    background: var(--error-light);
    color: #6b1e16;
}
.alert-warning {
    border-color: var(--warning);
    background: var(--warning-light);
    color: #6a4f00;
}
.alert-info {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-dark);
}
.alert__body {
    flex: 1;
}
.alert__close {
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ui);
    font-size: 18px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    opacity: 0.7;
}
.alert__close:hover {
    opacity: 1;
}

/* --- Navbar ------------------------------------------------------------- */

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 var(--unit-half);
    max-width: 1280px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .navbar__inner {
        padding: 0 var(--unit);
        min-height: 64px;
    }
}
.navbar__brand {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.02em;
    color: var(--text);
    text-transform: uppercase;
}
.navbar__brand:hover {
    text-decoration: none;
}
.navbar__brand .brand-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-left: 8px;
}
.nav-list {
    list-style: none;
    display: none;
    align-items: center;
    gap: var(--unit);
}
@media (min-width: 768px) {
    .nav-list {
        display: flex;
    }
}
.nav-list a {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}
.nav-list a:hover {
    color: var(--text);
    text-decoration: none;
}
.nav-list a.is-active,
.nav-list a[aria-current="page"] {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: var(--primary);
}
.nav-user {
    display: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}
@media (min-width: 768px) {
    .nav-user {
        display: inline;
    }
}
.navbar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    background: var(--surface);
}
@media (min-width: 768px) {
    .navbar__toggle {
        display: none;
    }
}
.navbar__toggle svg {
    width: 20px;
    height: 20px;
    stroke: var(--text);
}

/* Mobile menu drawer */
.mobile-menu {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
    overflow-y: auto;
    padding: var(--unit-half);
}
.mobile-menu[data-open="true"] {
    display: block;
}
.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
}
.mobile-menu li + li {
    border-top: 1px solid var(--border);
}
.mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 0;
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--text);
}
.mobile-menu a.is-active,
.mobile-menu a[aria-current="page"] {
    color: var(--primary);
    font-weight: 600;
}
@media (min-width: 768px) {
    .mobile-menu {
        display: none !important;
    }
}

/* --- Footer ------------------------------------------------------------- */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: auto;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-muted);
}
.site-footer__inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: space-between;
    align-items: flex-start;
    min-height: 56px;
    padding: var(--unit-half);
    max-width: 1280px;
    margin: 0 auto;
}
@media (min-width: 640px) {
    .site-footer__inner {
        flex-direction: row;
        align-items: center;
        padding: var(--unit-half) var(--unit);
    }
}
.site-footer a {
    color: var(--text-muted);
}
.site-footer a:hover {
    color: var(--text);
}

/* --- Tables ------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    background: var(--surface);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 14px;
}
.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.table th {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-alt);
}
.table tbody tr {
    min-height: 48px;
}
.table tbody tr:hover {
    background: var(--bg);
}
.table td.num,
.table th.num {
    font-family: var(--font-mono);
    text-align: right;
}

/* Stacked cards on mobile for wide tables */
@media (max-width: 767px) {
    .table-responsive .table,
    .table-responsive .table tbody,
    .table-responsive .table tr,
    .table-responsive .table td {
        display: block;
        width: 100%;
    }
    .table-responsive .table thead {
        display: none;
    }
    .table-responsive .table tr {
        border: 1px solid var(--border);
        padding: var(--unit-half);
        margin-bottom: var(--unit-half);
        background: var(--surface);
    }
    .table-responsive .table td {
        border-bottom: 0;
        padding: 4px 0;
        display: flex;
        justify-content: space-between;
        gap: var(--unit-half);
    }
    .table-responsive .table td::before {
        content: attr(data-label);
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        flex-shrink: 0;
    }
}

/* --- Metric block ------------------------------------------------------- */

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: var(--unit-half) var(--unit);
    min-width: 160px;
}
.metric__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.metric__value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
}
.metric__delta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}
.metric__delta-up {
    color: var(--success);
}
.metric__delta-down {
    color: var(--error);
}

/* --- Progress bar ------------------------------------------------------- */

.progress {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--surface-alt);
    overflow: hidden;
}
.progress__fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s ease;
}
.progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* --- Stepper (desktop sidebar) ----------------------------------------- */

.stepper {
    display: none;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 80px;
}
@media (min-width: 1024px) {
    .stepper {
        display: flex;
    }
}
.stepper__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid var(--border);
}
.stepper__item.is-current {
    color: var(--text);
    font-weight: 600;
    border-left-color: var(--primary);
}
.stepper__item.is-complete {
    color: var(--text);
    border-left-color: var(--success);
}

/* --- Questionnaire-specific -------------------------------------------- */

.banner-test {
    background: var(--warning);
    color: #1a1300;
    padding: var(--unit-half) var(--unit);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.banner-test__label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.banner-test__body {
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
}

.module {
    border-top: 1px solid var(--border);
    padding: var(--unit) 0;
}
.module:first-of-type {
    border-top: 0;
}
.module__title {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 6px;
}
.module__description {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: var(--unit);
}

.question {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: var(--unit);
}
.question + .question {
    border-top: 1px solid var(--border);
    padding-top: var(--unit);
}
.question__label {
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.question__required {
    color: var(--error);
    margin-left: 2px;
}
.question__help {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.question[hidden],
.question[aria-hidden="true"] {
    display: none !important;
}

/* Action bar (sticky bottom on mobile) */
.action-bar {
    display: flex;
    flex-direction: column;
    gap: var(--unit-half);
    padding: var(--unit-half);
    background: var(--surface);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 20;
}
.action-bar .btn {
    width: 100%;
    min-height: 48px;
}
@media (min-width: 768px) {
    .action-bar {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: var(--unit-half);
        padding: var(--unit-half) 0;
        position: static;
        border-top: 1px solid var(--border);
        margin-top: var(--unit);
    }
    .action-bar .btn {
        width: auto;
    }
}

.autosave {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
@media (min-width: 768px) {
    .autosave {
        margin-right: auto;
    }
}

/* --- Success / confirmation surface ----------------------------------- */

.icon-square {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: var(--font-ui);
    font-size: 24px;
    line-height: 1;
}
.icon-square-ok {
    border-color: var(--success);
    color: var(--success);
}
.icon-square-err {
    border-color: var(--error);
    color: var(--error);
}
.icon-square-warn {
    border-color: var(--warning);
    color: #8a6d00;
}

/* --- Errors pages ------------------------------------------------------ */

.error-page {
    max-width: 560px;
    margin: 0 auto;
    padding: calc(var(--unit) * 2) var(--unit-half);
    text-align: center;
}
.error-page__code {
    font-family: var(--font-mono);
    font-size: 64px;
    line-height: 1;
    color: var(--text-muted);
    margin-bottom: var(--unit);
}
.error-page__title {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 20px;
    margin-bottom: var(--unit-half);
}
.error-page__message {
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: var(--unit);
}

/* --- Utility helpers (limited) ---------------------------------------- */

.mt-0 { margin-top: 0 !important; }
.mt-q { margin-top: var(--unit-quarter); }
.mt-h { margin-top: var(--unit-half); }
.mt-u { margin-top: var(--unit); }
.mt-2u { margin-top: calc(var(--unit) * 2); }

.mb-q { margin-bottom: var(--unit-quarter); }
.mb-h { margin-bottom: var(--unit-half); }
.mb-u { margin-bottom: var(--unit); }

.p-u { padding: var(--unit); }
.p-h { padding: var(--unit-half); }

.row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--unit-half);
}
.row-between {
    display: flex;
    flex-wrap: wrap;
    gap: var(--unit-half);
    justify-content: space-between;
    align-items: center;
}

.grid-auto {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--unit-half);
}
@media (min-width: 768px) {
    .grid-auto-md-2 {
        grid-template-columns: 1fr 1fr;
    }
    .grid-auto-md-3 {
        grid-template-columns: 1fr 1fr auto;
    }
}

.hidden {
    display: none !important;
}
@media (max-width: 767px) {
    .hidden-mobile {
        display: none !important;
    }
}
@media (min-width: 768px) {
    .hidden-desktop {
        display: none !important;
    }
}

.sticky-actions-spacer {
    height: 80px;
}
@media (min-width: 768px) {
    .sticky-actions-spacer {
        display: none;
    }
}

/* --- Layout primitives for fill page ---------------------------------- */

.fill-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--unit);
}
@media (min-width: 1024px) {
    .fill-layout {
        grid-template-columns: 220px 1fr;
        align-items: start;
    }
}

/* --- Reduced motion --------------------------------------------------- */

@media (prefers-reduced-motion: reduce),
.no-motion * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
