:root {
    --background: #f4f6f9;
    --surface: #ffffff;
    --text: #1b2430;
    --muted: #667085;
    --border: #dfe3e8;
    --primary: #234a91;
    --primary-dark: #17366d;
    --success: #18794e;
    --success-bg: #e8f7ef;
    --danger: #b42318;
    --danger-bg: #fdecea;
    --warning-bg: #fff6df;
    --shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    background: #111827;
    color: #ffffff;
    border-bottom: 4px solid var(--primary);
}

.topbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
}

.subtitle {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

main.container {
    padding-top: 28px;
    padding-bottom: 40px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 20px;
}

h1, h2 {
    margin: 0;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-card strong {
    font-size: 1.8rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

label span {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd5dc;
    border-radius: 7px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.member-picker [data-member-select] {
    margin-top: 7px;
}

.member-picker [data-member-count] {
    display: block;
    min-height: 1em;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.74rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(35, 74, 145, 0.16);
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    padding: 9px 13px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    background: #f8fafc;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

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

.button-secondary {
    background: #f8fafc;
}

.button-small {
    padding: 7px 10px;
    font-size: 0.88rem;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    gap: 10px;
    margin-bottom: 16px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.actions-column {
    width: 220px;
}

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

.actions form {
    margin: 0;
}

.role-badge {
    display: inline-block;
    min-width: 38px;
    text-align: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
}

.status {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.status-active {
    background: var(--success-bg);
    color: var(--success);
}

.status-inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.row-inactive {
    opacity: 0.62;
}

.muted {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: #b7e4c7;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #f5c2c0;
}

.alert-info {
    background: #edf5ff;
    color: #234f82;
    border-color: #bad2ec;
}

.footer {
    padding: 24px 0 36px;
    color: var(--muted);
    text-align: center;
    font-size: 0.88rem;
}

@media (max-width: 760px) {
    .stats-grid,
    .form-grid,
    .filters {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    .actions {
        min-width: 210px;
    }
}

.train-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.train-criteria-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.train-criterion {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.train-criterion .checkbox-field {
    font-weight: 700;
}

.train-criterion label span {
    font-size: 0.85rem;
}

.train-ranking-table th:first-child,
.train-ranking-table td:first-child {
    width: 54px;
    text-align: center;
}

.train-rank {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

.train-score-missing {
    color: var(--muted);
}

.train-rule-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.train-rule-chip {
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.82rem;
    font-weight: 700;
}

.train-settings-actions {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .train-criteria-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .train-settings-grid,
    .train-criteria-grid {
        grid-template-columns: 1fr;
    }
}


.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.info-box {
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid #cbd8ee;
    border-radius: 8px;
    background: #f2f6fc;
}

.info-box p {
    margin: 7px 0 0;
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #e8edf5;
}

label small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.import-table select {
    min-width: 140px;
}

.validation {
    margin-bottom: 4px;
    font-size: 0.86rem;
    font-weight: 700;
}

.validation-ok {
    color: var(--success);
}

.validation-warning {
    color: #8a5a00;
}

.validation-error {
    color: var(--danger);
}

.row-error {
    background: var(--danger-bg);
}

.import-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.cancel-import-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}


.brand-link {
    color: inherit;
    text-decoration: none;
}

.nav-link {
    padding: 9px 12px;
    border-radius: 7px;
}

.nav-link:hover,
.nav-link-active {
    background: rgba(255, 255, 255, 0.14);
}


.alias-panel .panel-header p {
    margin: 6px 0 0;
}

.alias-counter {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    white-space: nowrap;
}

.alias-add-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.alias-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.alias-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px 7px 12px;
    border: 1px solid #cfd8ea;
    border-radius: 999px;
    background: #f6f8fc;
}

.alias-chip form {
    margin: 0;
}

.alias-delete {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: #e8edf5;
    color: #475467;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.alias-delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.empty-aliases {
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.member-aliases {
    margin-top: 4px;
    color: #475467;
    font-size: 0.85rem;
}

@media (max-width: 760px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .topbar nav {
        gap: 6px;
    }

    .nav-link {
        padding: 7px 9px;
    }

    .alias-add-form {
        grid-template-columns: 1fr;
    }
}


.button-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
}

.button-danger:hover {
    background: #8f1b13;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-field input {
    width: auto;
}

.checkbox-field span {
    margin: 0;
}

.editable-alias-list {
    display: grid;
    gap: 10px;
}

.editable-alias-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.editable-alias-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.danger-zone {
    border-color: #f2b8b5;
    background: #fff8f7;
}

.delete-member-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

@media (max-width: 760px) {
    .editable-alias-row,
    .editable-alias-form,
    .delete-member-form {
        grid-template-columns: 1fr;
    }
}


.row-suggestion {
    background: var(--warning-bg);
}

.row-suggestion select {
    min-width: 260px;
}


.decision-stack {
    display: grid;
    gap: 9px;
    min-width: 280px;
}

.manual-target-label span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.manual-target-select {
    min-width: 280px;
}


.is-hidden {
    display: none !important;
}


.alert-warning {
    background: var(--warning-bg);
    color: #7a5200;
    border-color: #eed28a;
}

.ocr-upload-form {
    display: grid;
    gap: 18px;
}

.ocr-scope {
    margin-top: 18px;
    margin-bottom: 0;
}

.ocr-images-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.ocr-image-frame {
    overflow: auto;
    max-height: 680px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #eef1f5;
    text-align: center;
}

.ocr-image-frame img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.ocr-results-table input {
    min-width: 100px;
}

.ocr-results-table td:nth-child(3) input {
    min-width: 210px;
}

.confidence-list,
.ocr-raw {
    display: grid;
    gap: 3px;
    min-width: 150px;
    font-size: 0.82rem;
}

.ocr-raw {
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
}

.ocr-engine,
.ocr-dimensions {
    font-size: 1.05rem !important;
}

@media (max-width: 900px) {
    .ocr-images-grid,
    .ocr-upload-form {
        grid-template-columns: 1fr;
    }
}


.ocr-input-methods {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(300px, 1fr);
    align-items: stretch;
    gap: 18px;
}

.ocr-method-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 700;
}

.ocr-method-separator span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
}

.ocr-paste-zone {
    display: flex;
    min-height: 148px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 18px;
    border: 2px dashed #9cabc0;
    border-radius: 10px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition:
        border-color 120ms ease,
        background 120ms ease,
        box-shadow 120ms ease;
}

.ocr-paste-zone:hover,
.ocr-paste-zone:focus,
.ocr-paste-zone.is-dragging {
    border-color: var(--primary);
    background: #eef4ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(35, 74, 145, 0.13);
}

.ocr-paste-zone.has-image {
    border-style: solid;
    border-color: var(--success);
    background: var(--success-bg);
}

.ocr-paste-zone.has-error {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.ocr-paste-zone kbd {
    display: inline-block;
    min-width: 27px;
    padding: 2px 6px;
    border: 1px solid #aab3bf;
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 700;
}

.ocr-paste-preview {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 7px;
    padding: 8px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.76);
    text-align: left;
}

.ocr-paste-preview img {
    width: 58px;
    height: 58px;
    border-radius: 5px;
    object-fit: cover;
}

.ocr-paste-preview span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 700;
}

.ocr-upload-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.ocr-selection-status {
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .ocr-input-methods {
        grid-template-columns: 1fr;
    }

    .ocr-method-separator {
        min-height: 20px;
    }

    .ocr-upload-actions {
        align-items: stretch;
        flex-direction: column;
    }
}


.ocr-row-partial {
    background: #fff8df;
}

.ocr-partial-badge {
    display: block;
    width: fit-content;
    margin-top: 6px;
    padding: 3px 7px;
    border: 1px solid #ddb94e;
    border-radius: 999px;
    background: #fff1b8;
    color: #705200;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}


.ocr-import-form {
    display: grid;
    gap: 18px;
}

.ocr-import-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 16px;
}

.ocr-import-actions label {
    min-width: 190px;
}

@media (max-width: 760px) {
    .ocr-import-actions {
        align-items: stretch;
        flex-direction: column;
    }
}


.ocr-batch-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}

.ocr-batch-preview-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.ocr-batch-preview-card img {
    width: 72px;
    height: 72px;
    border-radius: 6px;
    object-fit: cover;
}

.ocr-batch-preview-card > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.ocr-batch-preview-card strong,
.ocr-batch-preview-card span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.button-small {
    width: fit-content;
    padding: 5px 9px;
    font-size: 0.78rem;
}

.ocr-capture-list {
    display: grid;
    gap: 8px;
}

.ocr-capture-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.ocr-capture-item > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ocr-batch-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.ocr-batch-table-form {
    display: grid;
    gap: 18px;
}

.ocr-batch-table input[type="text"] {
    min-width: 150px;
}

.ocr-batch-table td:nth-child(3) input {
    min-width: 125px;
}

.ocr-source-list {
    display: grid;
    gap: 3px;
    max-width: 220px;
    color: var(--muted);
    font-size: 0.8rem;
}

.warning-text {
    display: block;
    margin-top: 5px;
    color: #7a5200;
}

.ocr-batch-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.ocr-batch-actions label {
    min-width: 180px;
}

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

@media (max-width: 1150px) {
    .ocr-batch-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ocr-capture-item,
    .ocr-capture-item > div,
    .ocr-batch-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ocr-batch-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    border-color: #8cc9a5;
    background: var(--success-bg);
    color: #1f6b3c;
}

.badge-warning {
    border-color: #e0bd63;
    background: var(--warning-bg);
    color: #7a5200;
}

.badge-danger {
    border-color: #e1a1a1;
    background: var(--danger-bg);
    color: var(--danger);
}


.ocr-capture-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
}

.ocr-capture-card .ocr-capture-item {
    border: 0;
    border-radius: 0;
}

.ocr-debug-panel {
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.ocr-debug-panel summary {
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 700;
}

.ocr-debug-panel[open] summary {
    border-bottom: 1px solid var(--border);
}

.ocr-debug-warnings {
    display: grid;
    gap: 8px;
    padding: 14px 14px 0;
}

.ocr-debug-images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 16px;
}

.ocr-debug-images figure {
    margin: 0;
}

.ocr-debug-images figcaption {
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 700;
}

.ocr-debug-images img {
    display: block;
    width: 100%;
    max-height: 720px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    object-fit: contain;
}

.ocr-debug-table {
    width: 100%;
}

.ocr-debug-panel .table-wrapper {
    margin: 0 16px 16px;
}

.ocr-source-list a {
    color: var(--primary);
    text-decoration: none;
}

.ocr-source-list a:hover {
    text-decoration: underline;
}

@media (max-width: 850px) {
    .ocr-debug-images {
        grid-template-columns: 1fr;
    }
}


.ocr-analysis-progress {
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.ocr-progress-track {
    overflow: hidden;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #dce3ea;
}

.ocr-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 180ms ease;
}

.ocr-paste-zone[aria-disabled="true"] {
    opacity: 0.65;
    pointer-events: none;
}


body.is-ocr-processing {
    overflow: hidden;
}

.ocr-processing-dialog {
    width: min(640px, calc(100vw - 32px));
    max-width: 640px;
    padding: 0;
    border: 0;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

.ocr-processing-dialog::backdrop {
    background: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(3px);
}

.ocr-processing-dialog-content {
    display: grid;
    gap: 22px;
    padding: 28px;
}

.ocr-processing-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ocr-processing-dialog h2 {
    margin: 0 0 6px;
}

.ocr-processing-dialog p {
    margin: 0;
}

.ocr-processing-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbe3ea;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ocr-processing-spin 900ms linear infinite;
}

.ocr-processing-progress {
    display: grid;
    gap: 10px;
}

.ocr-processing-status {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
}

.ocr-processing-status span {
    color: var(--muted);
    text-align: right;
}

.ocr-processing-files {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.ocr-processing-files span {
    color: var(--muted);
    font-size: 0.82rem;
}

.ocr-processing-files strong {
    overflow-wrap: anywhere;
}

.ocr-processing-warning {
    padding: 10px 12px;
    border: 1px solid #8cc9a5;
    border-radius: 8px;
    background: var(--success-bg);
    color: #1f6b3c;
    font-weight: 700;
}

@keyframes ocr-processing-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 620px) {
    .ocr-processing-dialog-content {
        padding: 22px;
    }

    .ocr-processing-status {
        display: grid;
        gap: 4px;
    }

    .ocr-processing-status span {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ocr-processing-spinner {
        animation: none;
    }
}


body.is-import-processing {
    overflow: hidden;
}

.import-processing-dialog {
    width: min(680px, calc(100vw - 32px));
    max-width: 680px;
    padding: 0;
    border: 0;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

.import-processing-dialog::backdrop {
    background: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(3px);
}

.import-processing-dialog-content {
    display: grid;
    gap: 22px;
    padding: 28px;
}

.import-processing-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.import-processing-dialog h2 {
    margin: 0 0 6px;
}

.import-processing-dialog p {
    margin: 0;
}

.import-processing-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbe3ea;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: import-processing-spin 900ms linear infinite;
}

.import-processing-progress {
    display: grid;
    gap: 10px;
}

.import-progress-track {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 13px;
    border-radius: 999px;
    background: #dce3ea;
}

.import-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 180ms ease;
}

.import-progress-track.is-indeterminate .import-progress-bar {
    position: absolute;
    width: 38%;
    animation: import-progress-indeterminate 1.15s ease-in-out infinite;
}

.import-processing-status {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
}

.import-processing-status span {
    color: var(--muted);
    text-align: right;
}

.import-processing-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.import-processing-summary > div {
    display: grid;
    gap: 4px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.import-processing-summary span {
    color: var(--muted);
    font-size: 0.78rem;
}

.import-processing-summary strong {
    font-size: 1.25rem;
}

.import-processing-result {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.import-processing-result-success {
    border-color: #8cc9a5;
    background: var(--success-bg);
    color: #1f6b3c;
}

.import-processing-result-error {
    border-color: #e1a1a1;
    background: var(--danger-bg);
    color: var(--danger);
}

@keyframes import-processing-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes import-progress-indeterminate {
    0% {
        left: -42%;
    }

    55% {
        left: 50%;
    }

    100% {
        left: 105%;
    }
}

@media (max-width: 700px) {
    .import-processing-dialog-content {
        padding: 22px;
    }

    .import-processing-status {
        display: grid;
        gap: 4px;
    }

    .import-processing-status span {
        text-align: left;
    }

    .import-processing-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .import-processing-spinner,
    .import-progress-track.is-indeterminate .import-progress-bar {
        animation: none;
    }
}


.ocr-role-select {
    min-width: 112px;
    font-weight: 700;
}

.ocr-batch-table td:nth-child(2) {
    min-width: 145px;
}


.lab-engine-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.lab-engine-status {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.lab-engine-status span {
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.lab-engine-status.is-online span {
    background: var(--success-bg);
    color: #1f6b3c;
}

.lab-engine-status.is-offline span {
    background: var(--danger-bg);
    color: var(--danger);
}

.ocr-lab-form {
    display: grid;
    gap: 18px;
}

.lab-image-preview {
    display: grid;
    grid-template-columns: minmax(160px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.lab-image-preview img {
    width: 100%;
    max-height: 240px;
    border-radius: 7px;
    object-fit: contain;
    background: #ffffff;
}

.lab-image-preview > div {
    display: grid;
    gap: 5px;
}

.lab-options {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.lab-options legend {
    padding: 0 7px;
    font-weight: 700;
}

.lab-options small {
    flex-basis: 100%;
    color: var(--muted);
}

.ocr-lab-results {
    display: grid;
    gap: 18px;
}

.ocr-lab-result-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.ocr-lab-result-card > .panel-header {
    padding: 16px;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.lab-warning-list {
    display: grid;
    gap: 8px;
    padding: 14px 14px 0;
}

.lab-annotated-image {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 16px;
}

.lab-annotated-image figcaption {
    font-weight: 700;
}

.lab-annotated-image img {
    display: block;
    width: 100%;
    max-height: 720px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.lab-result-table {
    width: 100%;
}

.lab-result-table td {
    vertical-align: top;
}

.lab-result-table td > strong,
.lab-result-table td > small,
.lab-result-table td > code {
    display: block;
    margin-bottom: 4px;
}

.lab-result-table code {
    max-width: 220px;
    overflow-wrap: anywhere;
    color: var(--muted);
    white-space: normal;
}

.lab-variants-cell {
    min-width: 245px;
}

.lab-variant {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 2px 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.lab-variant:last-child {
    border-bottom: 0;
}

.lab-variant small {
    grid-column: 2;
    color: var(--muted);
}

@media (max-width: 900px) {
    .lab-engine-status-grid {
        grid-template-columns: 1fr;
    }

    .lab-image-preview {
        grid-template-columns: 1fr;
    }
}


.ocr-engine-options {
    display: grid;
    grid-template-columns: minmax(260px, 520px);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.ocr-engine-options label {
    display: grid;
    gap: 7px;
}

.ocr-engine-options small {
    color: var(--muted);
}

.ocr-source-list {
    display: grid;
    gap: 7px;
    min-width: 185px;
}

.ocr-source-open {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8fafc;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.ocr-source-open:hover,
.ocr-source-open:focus-visible {
    border-color: var(--primary);
    background: #eef4ff;
}

.ocr-source-open span {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.ocr-source-open small {
    color: var(--primary);
}

.ocr-source-dialog {
    width: min(1180px, calc(100vw - 30px));
    max-width: 1180px;
    max-height: calc(100vh - 30px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgb(15 23 42 / 28%);
}

.ocr-source-dialog::backdrop {
    background: rgb(15 23 42 / 72%);
}

.ocr-source-dialog-content {
    display: grid;
    gap: 18px;
    max-height: calc(100vh - 30px);
    padding: 20px;
    overflow: auto;
}

.ocr-source-dialog-header {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
}

.ocr-source-dialog-header h2,
.ocr-source-dialog-header p {
    margin: 0;
}

.ocr-source-dialog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
    gap: 18px;
    align-items: start;
}

.ocr-source-image-panel,
.ocr-source-correction-panel {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}

.ocr-source-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.ocr-source-toolbar > div {
    display: flex;
    gap: 6px;
}

.ocr-source-crop-viewport {
    min-height: 150px;
    max-height: 430px;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(45deg, #eef1f5 25%, transparent 25%),
        linear-gradient(-45deg, #eef1f5 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef1f5 75%),
        linear-gradient(-45deg, transparent 75%, #eef1f5 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.ocr-source-crop {
    display: block;
    max-width: none;
    height: auto;
    background: #ffffff;
}

.ocr-source-full-details img {
    display: block;
    width: 100%;
    max-height: 520px;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.ocr-source-correction-panel label {
    display: grid;
    gap: 6px;
}

.ocr-source-correction-panel h3,
.ocr-source-correction-panel p {
    margin: 0;
}

.ocr-source-applied-status {
    min-height: 1.4em;
    color: #1f6b3c;
    font-weight: 700;
}

.row-manually-reviewed {
    box-shadow: inset 4px 0 0 #2e8b57;
}

@media (max-width: 860px) {
    .ocr-source-dialog-layout {
        grid-template-columns: 1fr;
    }

    .ocr-source-crop-viewport {
        max-height: 330px;
    }
}


.error-text {
    display: block;
    margin-top: 5px;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 700;
}


.vs-import-form {
    display: grid;
    gap: 18px;
}

.vs-import-form label {
    display: grid;
    gap: 7px;
}

.vs-import-form textarea {
    min-height: 150px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.vs-stats-grid {
    margin-bottom: 18px;
}

.vs-preview-table {
    min-width: 1120px;
}

.vs-preview-table input[type="text"],
.vs-preview-table input[type="date"],
.vs-preview-table select {
    width: 100%;
    min-width: 145px;
}

.vs-preview-table td {
    vertical-align: top;
}

.vs-association-fields {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.vs-member-select {
    min-width: 230px !important;
}

.success-text {
    display: block;
    margin-top: 5px;
    color: #1f6b3c;
    font-size: 0.82rem;
    font-weight: 700;
}


.vs-ocr-upload-form {
    display: grid;
    gap: 18px;
}

.vs-ocr-drop-zone {
    display: grid;
    gap: 7px;
    padding: 26px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: #f8fafc;
    text-align: center;
}

.vs-ocr-drop-zone:focus,
.vs-ocr-drop-zone:hover {
    border-color: var(--primary);
}

.vs-ocr-drop-zone input[type="file"] {
    margin: 8px auto 0;
}

.vs-ocr-captures {
    display: grid;
    gap: 12px;
}

.vs-ocr-captures details {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.vs-ocr-debug-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.vs-ocr-debug-grid figure {
    display: grid;
    gap: 7px;
    margin: 0;
}

.vs-ocr-debug-grid img {
    width: 100%;
    max-height: 720px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.vs-ocr-results-table {
    min-width: 1120px;
}

.vs-ocr-results-table input[type="text"],
.vs-ocr-results-table input[type="date"] {
    width: 100%;
    min-width: 150px;
}

.vs-ocr-open-source {
    max-width: 220px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8fafc;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.vs-ocr-open-source:hover {
    border-color: var(--primary);
    background: #eef4ff;
}

.page-heading-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 800px) {
    .vs-ocr-debug-grid {
        grid-template-columns: 1fr;
    }
}


/* Navigation et accueil BDUN v0.19.0 */

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.brand-logo {
    width: 64px;
    height: 64px;
    border: 2px solid #d6a938;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
}

.brand-copy,
.brand-copy span {
    display: block;
}

.topbar nav {
    position: relative;
    justify-content: flex-end;
}

.nav-link-disabled {
    color: #94a3b8;
    cursor: default;
}

.nav-link-disabled small {
    display: inline-block;
    margin-left: 5px;
    color: #d6a938;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-menu {
    position: relative;
}

.nav-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.nav-menu summary::-webkit-details-marker {
    display: none;
}

.nav-menu summary::after {
    content: "▾";
    display: inline-block;
    margin-left: 7px;
    color: #d6a938;
    transition: transform 140ms ease;
}

.nav-menu[open] summary::after {
    transform: rotate(180deg);
}

.nav-menu-panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 12px);
    right: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(175px, 1fr));
    gap: 8px;
    width: min(920px, calc(100vw - 32px));
    padding: 16px;
    border: 1px solid #344156;
    border-top: 3px solid #d6a938;
    border-radius: 10px;
    background: #111827;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.nav-menu-group {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    border-radius: 8px;
    background: #172033;
}

.nav-menu-group:nth-child(1) {
    border-top: 3px solid #2d72d9;
}

.nav-menu-group:nth-child(2) {
    border-top: 3px solid #29935d;
}

.nav-menu-group:nth-child(3) {
    border-top: 3px solid #d9aa2d;
}

.nav-menu-group-technical {
    border-top: 3px solid #c43d3d;
}

.nav-menu-group h2 {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-menu-group a {
    display: block;
    padding: 8px 9px;
    border-radius: 6px;
    color: #dbe4f0;
    font-size: 0.88rem;
    text-decoration: none;
}

.nav-menu-group a:hover,
.nav-menu-group a:focus,
.nav-menu-group .nav-menu-current {
    background: #24344f;
    color: #ffffff;
    outline: none;
}

.nav-menu-group .nav-menu-current {
    box-shadow: inset 3px 0 #d6a938;
    font-weight: 700;
}

.home-hero {
    position: relative;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    align-items: center;
    gap: 34px;
    overflow: hidden;
    margin-bottom: 22px;
    padding: 34px;
    border: 1px solid #273b61;
    border-radius: 16px;
    background:
        radial-gradient(circle at 15% 50%, rgba(34, 128, 88, 0.32), transparent 32%),
        linear-gradient(125deg, #0c1b36 0%, #173e78 64%, #7c2026 130%);
    color: #ffffff;
    box-shadow: var(--shadow);
}

.home-hero::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 42%;
    height: 4px;
    background: linear-gradient(90deg, transparent, #d6a938);
}

.home-hero img {
    position: relative;
    z-index: 1;
    display: block;
    width: min(220px, 100%);
    height: auto;
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

.home-hero > div {
    position: relative;
    z-index: 1;
}

.home-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: #e8c55e;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-hero h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.05;
}

.home-hero p {
    max-width: 680px;
    margin: 14px 0 22px;
    color: #dce6f4;
    font-size: 1.05rem;
}

.home-hero .button-primary {
    border-color: #d6a938;
    background: #d6a938;
    color: #172033;
}

.home-hero .button-primary:hover {
    background: #ebca65;
}

.home-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.home-action-card {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 160px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text);
    text-decoration: none;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease;
}

.home-action-card:hover {
    transform: translateY(-2px);
    border-color: #9fb4d5;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.1);
}

.home-action-number {
    color: #b78c22;
    font-size: 0.78rem;
    font-weight: 700;
}

.home-action-card strong {
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.home-action-card > span:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

.anchor-target {
    scroll-margin-top: 24px;
}

@media (max-width: 980px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .topbar nav {
        width: 100%;
        justify-content: flex-start;
    }

    .nav-menu-panel {
        right: auto;
        left: 0;
        grid-template-columns: repeat(2, minmax(190px, 1fr));
        width: min(720px, calc(100vw - 32px));
    }

    .home-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .brand-logo {
        width: 54px;
        height: 54px;
    }

    .topbar nav {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .nav-link {
        width: 100%;
    }

    .nav-menu-panel {
        position: static;
        grid-template-columns: 1fr;
        width: 100%;
        margin-top: 8px;
        box-shadow: none;
    }

    .home-hero {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 24px;
        text-align: center;
    }

    .home-hero img {
        width: 170px;
        margin: 0 auto;
    }

    .home-hero p {
        margin-right: auto;
        margin-left: auto;
    }

    .home-actions-grid {
        grid-template-columns: 1fr;
    }
}


/* Bibliothèque des guides v0.20.1 */

.button-ghost {
    border-color: rgba(255, 255, 255, 0.54);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.button-ghost:hover {
    background: rgba(255, 255, 255, 0.16);
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.guides-heading {
    padding: 22px 24px;
    border-radius: 14px;
    background: linear-gradient(120deg, #0c1b36, #173e78);
    color: #ffffff;
}

.guides-heading p {
    color: #dce6f4;
}

.guide-tone-blue {
    --guide-accent: #2d72d9;
    --guide-accent-soft: #eaf2ff;
    --guide-accent-dark: #174d9b;
}

.guide-tone-red {
    --guide-accent: #c43d3d;
    --guide-accent-soft: #fff0ef;
    --guide-accent-dark: #8f2424;
}

.guide-tone-green {
    --guide-accent: #29935d;
    --guide-accent-soft: #eaf8f0;
    --guide-accent-dark: #17673f;
}

.guide-tone-gold {
    --guide-accent: #c69424;
    --guide-accent-soft: #fff7df;
    --guide-accent-dark: #7f5d11;
}

.guide-category-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.guide-category-card {
    display: grid;
    gap: 3px;
    min-height: 78px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--guide-accent, #667085);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
}

.guide-category-card:hover,
.guide-category-selected {
    border-color: var(--guide-accent, var(--primary));
    background: var(--guide-accent-soft, #eef2ff);
}

.guide-category-card strong {
    color: var(--guide-accent-dark, var(--primary-dark));
    font-size: 0.92rem;
}

.guide-category-card span {
    color: var(--muted);
    font-size: 0.78rem;
}

.guide-category-all {
    --guide-accent: #d6a938;
    --guide-accent-soft: #fff8e5;
    --guide-accent-dark: #75580f;
}

.guide-library-panel {
    padding-top: 18px;
}

.guide-search-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 22px;
}

.guide-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.guide-card {
    display: grid;
    grid-template-rows: 190px 1fr;
    overflow: hidden;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.07);
}

.guide-card-visual {
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 25%, var(--guide-accent), transparent 48%),
        linear-gradient(145deg, #0d1930, var(--guide-accent-dark));
    color: #ffffff;
    text-decoration: none;
}

.guide-card-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-card-visual > span {
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(9, 18, 35, 0.52);
    font-size: 1.05rem;
    font-weight: 700;
}

.guide-card-body {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 17px;
}

.guide-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.guide-category-pill,
.guide-featured {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.73rem;
    font-weight: 700;
}

.guide-featured {
    background: #fff3c4;
    color: #75580f;
}

.guide-card h2 {
    font-size: 1.08rem;
    line-height: 1.28;
}

.guide-card h2 a {
    color: var(--text);
    text-decoration: none;
}

.guide-card h2 a:hover {
    color: var(--primary);
}

.guide-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.guide-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
}

.guide-card-footer span {
    color: var(--muted);
}

.guide-card-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.home-featured-guides .panel-header {
    align-items: flex-end;
}

.guide-card-grid-featured {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.guide-card-grid-featured .guide-card {
    grid-template-rows: 150px 1fr;
}

.guide-card-grid-featured .guide-card-body {
    padding: 15px;
}

.guide-card-grid-featured .guide-card-body h2 {
    font-size: 1rem;
}

.guide-card-grid-featured .guide-card-body p {
    font-size: 0.84rem;
}

.guide-detail {
    max-width: 940px;
    margin: 0 auto;
}

.guide-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.88rem;
}

.guide-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.guide-detail-header {
    padding: 32px;
    border-top: 5px solid var(--guide-accent);
    border-radius: 14px;
    background:
        radial-gradient(circle at 90% 10%, var(--guide-accent), transparent 34%),
        linear-gradient(125deg, #0c1b36, var(--guide-accent-dark));
    color: #ffffff;
    box-shadow: var(--shadow);
}

.guide-detail-header h1 {
    margin-top: 14px;
    font-size: clamp(1.9rem, 5vw, 3rem);
    line-height: 1.12;
}

.guide-detail-header p {
    max-width: 760px;
    margin: 14px 0;
    color: #e4ebf4;
    font-size: 1.05rem;
}

.guide-detail-date {
    color: #c8d3e2;
    font-size: 0.82rem;
}

.guide-detail-image {
    margin: 20px 0;
    text-align: center;
}

.guide-detail-image img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 1100px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.guide-content {
    font-size: 1rem;
}

.guide-content p {
    margin: 0 0 1.15em;
}

.guide-content p:last-child {
    margin-bottom: 0;
}

.guide-source a {
    color: var(--primary);
    font-weight: 700;
}

.guide-detail-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 18px;
}

.guide-admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 0.8fr);
    align-items: start;
    gap: 20px;
}

.guide-admin-current-image {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.guide-admin-current-image img {
    width: 140px;
    height: 100px;
    border-radius: 7px;
    object-fit: cover;
}

.guide-admin-options {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.guide-admin-ideas {
    position: sticky;
    top: 20px;
}

.guide-admin-ideas > p {
    margin-bottom: 14px;
}

.guide-admin-ideas ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
    color: #475467;
    font-size: 0.88rem;
}

.guide-admin-sources {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.guide-admin-sources a {
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

/* Tableau de bord R4/R5 v0.21.0 */

.dashboard-heading {
    padding: 22px 24px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 86% 30%, rgba(214, 169, 56, 0.2), transparent 28%),
        linear-gradient(120deg, #0c1b36, #173e78);
    color: #ffffff;
}

.dashboard-heading p {
    color: #dce6f4;
}

.dashboard-settings-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.dashboard-kpi {
    position: relative;
    display: grid;
    gap: 7px;
    overflow: hidden;
    min-height: 150px;
    padding: 20px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--kpi-accent);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.dashboard-kpi::after {
    content: "";
    position: absolute;
    top: -45px;
    right: -45px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--kpi-glow);
}

.dashboard-kpi > * {
    position: relative;
    z-index: 1;
}

.dashboard-kpi > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-kpi strong {
    align-self: center;
    color: var(--primary-dark);
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1;
}

.dashboard-kpi small {
    color: var(--muted);
    font-size: 0.78rem;
}

.dashboard-kpi-blue {
    --kpi-accent: #2d72d9;
    --kpi-glow: rgba(45, 114, 217, 0.12);
}

.dashboard-kpi-gold {
    --kpi-accent: #d6a938;
    --kpi-glow: rgba(214, 169, 56, 0.15);
}

.dashboard-kpi-green {
    --kpi-accent: #29935d;
    --kpi-glow: rgba(41, 147, 93, 0.13);
}

.dashboard-kpi-red {
    --kpi-accent: #c43d3d;
    --kpi-glow: rgba(196, 61, 61, 0.12);
}

.dashboard-two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-two-columns > .panel {
    min-width: 0;
    margin-bottom: 0;
}

.dashboard-ranking-list {
    display: grid;
}

.dashboard-ranking-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) minmax(90px, auto);
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 9px 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.dashboard-ranking-row:last-child {
    border-bottom: 0;
}

a.dashboard-ranking-row:hover {
    border-radius: 7px;
    background: #f5f8fc;
}

.dashboard-rank {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: #eaf0f8;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.dashboard-member {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dashboard-member strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-member small,
.dashboard-value small {
    color: var(--muted);
    font-size: 0.72rem;
}

.dashboard-value {
    display: grid;
    gap: 2px;
    color: var(--primary-dark);
    font-weight: 800;
    text-align: right;
}

.alliance-dashboard-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.alliance-member-search {
    width: min(100%, 360px);
}

.alliance-member-search input {
    margin-top: 6px;
}

.alliance-members-table {
    min-width: 640px;
}

.alliance-members-table td:nth-child(3) {
    color: var(--primary-dark);
    font-weight: 800;
    text-align: right;
}

.alliance-members-table th:nth-child(3) {
    text-align: right;
}

.alliance-train-history {
    min-width: 680px;
}

.alliance-dashboard-note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.82rem;
}

.dashboard-value-positive {
    color: #237849;
}

.dashboard-status-dot {
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border-radius: 50%;
}

.dashboard-status-warning {
    background: #d6a938;
    box-shadow: 0 0 0 5px rgba(214, 169, 56, 0.14);
}

.dashboard-criteria {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
}

.dashboard-criteria span,
.dashboard-count-badge {
    padding: 5px 9px;
    border-radius: 999px;
    background: #eaf0f8;
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-missing-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-missing-list a {
    display: grid;
    gap: 3px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    text-decoration: none;
}

.dashboard-missing-list a:hover {
    border-color: #9fb4d5;
}

.dashboard-missing-list span {
    color: var(--muted);
    font-size: 0.75rem;
}

/* Réinitialisation des données v0.22.0 */

.reset-heading {
    padding: 22px 24px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 85% 20%, rgba(196, 61, 61, 0.24), transparent 30%),
        linear-gradient(120deg, #0c1b36, #54232b);
    color: #ffffff;
}

.reset-heading p {
    color: #e8edf5;
}

.reset-warning {
    border: 1px solid #efb0b0;
    border-left: 5px solid #c43d3d;
    background: #fff7f7;
}

.reset-warning h2 {
    color: #8f2727;
}

.reset-warning p {
    margin: 8px 0 0;
    color: #694242;
}

.reset-option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 20px;
}

.reset-option {
    --reset-accent: #2d72d9;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    min-height: 125px;
    padding: 17px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--reset-accent);
    border-radius: 11px;
    background: #ffffff;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.reset-option:hover {
    transform: translateY(-1px);
    border-color: var(--reset-accent);
}

.reset-option:has(input:checked) {
    border-color: var(--reset-accent);
    background: #f5f8fc;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--reset-accent) 18%, transparent);
}

.reset-option > input {
    width: 19px;
    height: 19px;
    margin-top: 1px;
    accent-color: var(--reset-accent);
}

.reset-option-blue {
    --reset-accent: #2d72d9;
}

.reset-option-green {
    --reset-accent: #29935d;
}

.reset-option-gold {
    --reset-accent: #d6a938;
}

.reset-option-red {
    --reset-accent: #c43d3d;
}

.reset-option-danger {
    background: #fffafa;
}

.reset-option-content {
    display: grid;
    gap: 9px;
}

.reset-option-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}

.reset-option-title strong {
    color: var(--primary-dark);
}

.reset-option-title > span {
    padding: 3px 7px;
    border-radius: 999px;
    background: #edf1f6;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.reset-option-content small {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.reset-confirmation {
    max-width: 900px;
    margin-right: auto;
    margin-left: auto;
}

.reset-confirmation > .checkbox-field {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.reset-confirmation-text {
    display: grid;
    gap: 7px;
    max-width: 420px;
    margin-top: 17px;
}

.reset-selection-summary {
    margin-top: 17px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f1f4f8;
    color: #475467;
    font-size: 0.84rem;
}

.reset-submit {
    border-color: #a52f2f;
    background: #b83232;
    color: #ffffff;
}

.reset-submit:hover:not(:disabled) {
    background: #962727;
}

.reset-submit:disabled {
    border-color: #c8ced8;
    background: #d9dee6;
    color: #7e8795;
    cursor: not-allowed;
}

/* Authentification et comptes v0.23.0 */

.nav-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px 5px 12px;
    border: 1px solid #41516a;
    border-radius: 999px;
    background: #172033;
}

.nav-account > span {
    display: grid;
    line-height: 1.15;
}

.nav-account strong {
    max-width: 140px;
    overflow: hidden;
    color: #ffffff;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-account small {
    color: #aebbd0;
    font-size: 0.65rem;
}

.nav-account form {
    margin: 0;
}

.nav-account-security {
    color: #c7d5ea;
    font-size: 0.72rem;
    text-decoration: none;
}

.nav-account-security:hover {
    color: #ffffff;
    text-decoration: underline;
}

.nav-logout {
    padding: 7px 10px;
    border: 0;
    border-radius: 999px;
    background: #28364d;
    color: #e8edf5;
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

.nav-logout:hover {
    background: #374966;
    color: #ffffff;
}

.auth-page,
.auth-standalone {
    display: grid;
    min-height: min(680px, calc(100vh - 190px));
    place-items: center;
    padding: 28px 0;
}

.auth-card {
    width: min(720px, 100%);
    margin: 0;
    padding: clamp(24px, 5vw, 40px);
    border-top: 5px solid #d6a938;
}

.auth-card-compact {
    width: min(520px, 100%);
}

.auth-card h1 {
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: clamp(1.7rem, 4vw, 2.35rem);
}

.auth-card > p {
    margin-bottom: 22px;
    color: var(--muted);
}

.auth-form {
    margin-top: 22px;
}

.auth-help {
    margin: 20px 0 0 !important;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
}

.auth-request-button {
    justify-content: center;
    width: 100%;
    margin-top: 12px;
}

.auth-invited-member {
    display: grid;
    gap: 3px;
    margin: 16px 0;
    padding: 15px;
    border: 1px solid #b9c9df;
    border-radius: 9px;
    background: #f2f6fb;
}

.auth-invited-member strong {
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.auth-invited-member span {
    color: var(--muted);
    font-size: 0.82rem;
}

.home-member-welcome {
    text-align: center;
}

.home-member-welcome p {
    margin: 9px 0 18px;
    color: var(--muted);
}

.invitation-result {
    border: 1px solid #92c9aa;
    border-left: 5px solid #29935d;
    background: #f4fbf7;
}

.invitation-result p {
    margin: 8px 0 14px;
    color: #456354;
}

.invitation-result .invitation-mail-status {
    margin: 0 0 14px;
    padding: 9px 11px;
    border-radius: 7px;
    font-weight: 700;
}

.invitation-mail-status-success {
    background: #dff3e7;
    color: #1d7045 !important;
}

.invitation-mail-status-error {
    background: var(--danger-bg);
    color: var(--danger) !important;
}

.invitation-mail-notice {
    margin-bottom: 20px;
}

.invitation-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.invitation-copy-row input {
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.78rem;
}

.account-admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.account-admin-grid > .panel {
    min-width: 0;
}

.invitation-list {
    display: grid;
}

.invitation-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
}

.invitation-list > div:last-child {
    border-bottom: 0;
}

.invitation-list > div > span {
    display: grid;
    gap: 3px;
}

.invitation-list small {
    color: var(--muted);
    font-size: 0.74rem;
}

.invitation-requests-panel {
    margin-bottom: 20px;
}

.invitation-request-list {
    display: grid;
}

.invitation-request-row {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(170px, auto) auto;
    align-items: center;
    gap: 18px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}

.invitation-request-row:last-child {
    border-bottom: 0;
}

.invitation-request-identity {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.invitation-request-identity span {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
}

.invitation-request-identity small {
    color: var(--muted);
    font-size: 0.74rem;
}

.invitation-request-actions,
.request-generate-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.request-generate-form select {
    min-width: 120px;
}

.account-table {
    min-width: 980px;
}

.account-role-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.account-member-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
}

.account-member-form [data-member-search],
.account-member-form [data-member-count] {
    grid-column: 1 / -1;
}

.account-member-form [data-member-select] {
    grid-column: 1;
    margin-top: 0;
}

.account-member-form .button {
    grid-column: 2;
}

.account-member-form select {
    min-width: 180px;
}

.account-role-form select {
    min-width: 130px;
}

.status-pending {
    background: #fff3cd;
    color: #7b5900;
}

.status-disabled {
    background: #fde7e7;
    color: #8c2929;
}

@media (max-width: 1050px) {
    .guide-category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .guide-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reset-option-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .guide-admin-layout {
        grid-template-columns: 1fr;
    }

    .guide-admin-ideas {
        position: static;
    }

    .dashboard-settings-form,
    .dashboard-two-columns,
    .account-admin-grid {
        grid-template-columns: 1fr;
    }

    .invitation-request-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .invitation-request-actions,
    .request-generate-form {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 680px) {
    .home-hero-actions,
    .guide-detail-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .guide-category-grid,
    .guide-card-grid,
    .guide-search-form {
        grid-template-columns: 1fr;
    }

    .home-featured-guides .panel-header {
        align-items: stretch;
    }

    .guide-card {
        grid-template-rows: 170px 1fr;
    }

    .guide-detail-header {
        padding: 24px;
    }

    .guide-admin-current-image {
        grid-template-columns: 1fr;
    }

    .dashboard-kpi-grid,
    .dashboard-missing-list,
    .reset-option-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-ranking-row {
        grid-template-columns: 32px minmax(0, 1fr) minmax(76px, auto);
    }

    .alliance-dashboard-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .alliance-member-search {
        width: 100%;
    }

    .nav-account {
        justify-content: space-between;
        border-radius: 8px;
    }

    .invitation-copy-row {
        grid-template-columns: 1fr;
    }
}
