:root {
    --ink: #183248;
    --muted: #617384;
    --paper: #ffffff;
    --background: #f3f6f8;
    --line: #dce5eb;
    --blue: #176b87;
    --blue-dark: #105269;
    --blue-soft: #e8f4f7;
    --red: #a73232;
    --red-soft: #fbecec;
    --orange: #956017;
    --orange-soft: #fff3dc;
    --violet: #6650a4;
    --violet-soft: #f0ecfa;
    --green: #287256;
    --green-soft: #e8f5ee;
    --shadow: 0 8px 28px rgba(24, 50, 72, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--background);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}
.container { width: min(1480px, calc(100% - 40px)); margin: 0 auto; }
.site-header {
    color: #fff;
    background: linear-gradient(125deg, #123c55, #176b87 65%, #2c8795);
    padding: 34px 0 30px;
    box-shadow: 0 5px 18px rgba(14, 58, 80, .18);
}
.header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; line-height: 1.1; }
h2 { margin-bottom: 8px; font-size: 23px; letter-spacing: -.015em; }
h3 { margin: 0; font-size: 19px; }
.subtitle { margin: 0; color: rgba(255, 255, 255, .84); }
.eyebrow, .step-label { margin: 0 0 5px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow { color: #b9e8ef; }
.step-label { color: var(--blue); }
.version { white-space: nowrap; padding: 7px 11px; border: 1px solid rgba(255,255,255,.32); border-radius: 999px; background: rgba(255,255,255,.09); font-size: 13px; }
main { padding: 28px 0 44px; }
.panel, .notice {
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: var(--shadow);
}
.panel { padding: 24px; }
.notice { padding: 20px 22px; }
.notice p:last-child { margin-bottom: 0; }
.notice.danger { border-left: 5px solid var(--red); background: var(--red-soft); }
.notice.warning { border-left: 5px solid var(--orange); background: var(--orange-soft); }
.notice.success { border-left: 5px solid var(--green); background: var(--green-soft); }
.notice.info { border-left: 5px solid var(--blue); background: var(--blue-soft); }
.information-field-list { margin: 10px 0 0; padding-left: 22px; }
.information-field-list li + li { margin-top: 4px; }
.panel-heading, .results-toolbar, .result-status { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.privacy { max-width: 610px; color: var(--muted); font-size: 13px; }
.upload-form { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px 22px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .filters label { font-weight: 650; }
.field small { color: var(--muted); }
input[type="text"], input[type="search"], input[type="file"], select {
    width: 100%; min-height: 43px; border: 1px solid #bfcdd7; border-radius: 8px; background: #fff; color: var(--ink); padding: 9px 11px; font: inherit;
}
input[type="file"] { padding: 8px; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid rgba(23, 107, 135, .22); outline-offset: 2px; }
.checkbox-field { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--blue); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; }
.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; cursor: pointer; text-decoration: none; font: 650 14px/1.2 inherit;
}
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--blue); background: #fff; color: var(--blue-dark); }
.button.quiet { border-color: #bccbd4; background: transparent; color: var(--muted); }
.result-status { align-items: center; }
.result-status h2 { margin-bottom: 5px; }
.result-status p { margin-bottom: 0; }
.result-status .establishment-name { margin-top: 7px; }
.finess-status, .finess-source { color: var(--muted); font-size: 13px; }
.finess-source a { color: var(--blue-dark); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 14px; margin: 0 0 22px; }
.summary-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.summary-card span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.summary-card strong, .summary-count-button { font-size: 28px; line-height: 1; }
.summary-count-button { min-width: 42px; margin: -5px -7px -7px; border: 2px solid transparent; border-radius: 9px; padding: 5px 7px 7px; color: var(--ink); background: transparent; cursor: pointer; font-family: inherit; font-weight: 700; text-align: left; }
.summary-count-button:hover { background: var(--blue-soft); }
.summary-count-button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 2px #fff inset; }
.summary-card.critical strong, .summary-card.error strong, .summary-card.critical .summary-count-button, .summary-card.error .summary-count-button { color: var(--red); }
.summary-card.warning-card strong, .summary-card.warning-card .summary-count-button { color: var(--orange); }
.summary-card.atypy strong, .summary-card.atypy .summary-count-button { color: var(--violet); }
.ium-summary-grid { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; margin: 18px 0; }
.ium-summary-grid div { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafb; }
.ium-summary-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.ium-summary-grid strong { font-size: 21px; }
.ium-records { margin: 18px 0; }
.ium-records summary { margin-bottom: 12px; cursor: pointer; font-weight: 700; }
.autum-scope { margin-top: 18px; }
.filters { display: grid; grid-template-columns: auto 160px auto 260px auto; align-items: center; gap: 8px; }
.filter-reset { white-space: nowrap; }
.type-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 26px; }
.type-nav a { color: var(--blue-dark); background: var(--blue-soft); border-radius: 999px; padding: 7px 10px; text-decoration: none; font-size: 13px; font-weight: 600; }
.type-nav span { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: #fff; }
.grid-help { margin: -10px 0 20px; color: var(--muted); font-size: 13px; }
.anomaly-group { scroll-margin-top: 16px; margin-top: 28px; }
.anomaly-group:first-of-type { margin-top: 0; }
.group-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 10px; }
.count, .no-result { color: var(--muted); font-size: 13px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; padding: 10px 11px; color: #fff; background: #24556c; text-align: left; white-space: nowrap; }
td { padding: 10px 11px; border-top: 1px solid #e6edf1; vertical-align: top; }
tbody tr:nth-child(even) { background: #f8fafb; }
tbody tr:hover { background: #edf6f8; }
tr[hidden] { display: none; }
[data-anomaly][data-rhs-available="1"] { cursor: pointer; }
[data-anomaly][data-rhs-available="1"]:focus { outline: 3px solid rgba(23, 107, 135, .34); outline-offset: -3px; }
[data-anomaly][data-rhs-available="1"] td:first-child::after { content: "Voir le RHS"; display: block; margin-top: 5px; color: var(--blue-dark); font-size: 10px; font-weight: 700; white-space: nowrap; }
.anomaly-row-selected { background: #dceff3 !important; box-shadow: inset 4px 0 0 var(--blue); }
.rhs-detail-row, .rhs-detail-row:hover { background: #f5fafb !important; }
.rhs-detail-row > td { padding: 0; border-top: 2px solid var(--blue); }
.rhs-detail { padding: 18px; }
.rhs-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.rhs-detail h4 { margin: 0 0 4px; font-size: 16px; }
.rhs-detail-context, .rhs-highlight-legend, .rhs-highlight-unmatched, .rhs-grid-limit { margin: 0; color: var(--muted); font-size: 12px; }
.rhs-highlight-legend { margin-top: 10px; color: #7f1d1d; font-weight: 700; }
.rhs-highlight-unmatched, .rhs-grid-limit { margin-top: 10px; color: var(--orange); }
.rhs-detail-close { flex: 0 0 auto; }
.rhs-fields-scroll { max-height: 620px; margin-top: 13px; overflow: auto; border: 1px solid #cbd8df; border-radius: 8px; background: #fff; }
.rhs-fields-table { table-layout: fixed; font-size: 13px; }
.rhs-fields-table thead th { top: 0; z-index: 4; }
.rhs-fields-table thead th:first-child { width: 54%; }
.rhs-fields-table thead th:nth-child(2) { width: 46%; }
.rhs-fields-table tbody tr:nth-child(even), .rhs-fields-table tbody tr:hover { background: #fff; }
.rhs-field-group th { position: sticky; top: 39px; z-index: 3; padding: 8px 11px; border-top: 1px solid #bdd1da; color: var(--blue-dark); background: var(--blue-soft); font-size: 12px; letter-spacing: .02em; white-space: normal; }
.rhs-field-row > th { position: static; z-index: auto; padding: 9px 11px; border-top: 1px solid #e6edf1; color: var(--ink); background: #f8fafb; text-align: left; white-space: normal; }
.rhs-field-row > td { background: #fff; }
.rhs-field-name { display: block; font-weight: 700; }
.rhs-field-position { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.rhs-field-value { overflow-wrap: anywhere; font-family: "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; }
.rhs-field-error > th, .rhs-field-error > td { color: #7f1d1d; background: #ffe0d6; box-shadow: inset 0 2px 0 #a82727, inset 0 -2px 0 #a82727; }
.rhs-field-error > th { box-shadow: inset 4px 0 0 #a82727, inset 0 2px 0 #a82727, inset 0 -2px 0 #a82727; }
.rhs-field-error .rhs-field-position { color: #8b2c24; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.value-cell { max-width: 170px; overflow-wrap: anywhere; }
.severity { display: inline-block; border-radius: 999px; padding: 3px 7px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.severity-bloquante, .severity-erreur { color: #7f1d1d; background: #fee2e2; }
.severity-avertissement { color: #7a4b0f; background: #ffedc2; }
.severity-atypie { color: #53408c; background: var(--violet-soft); }
.file-source { display: inline-block; border-radius: 999px; padding: 3px 7px; color: var(--blue-dark); background: var(--blue-soft); font-size: 11px; font-weight: 750; }
.file-source-ium { color: #53408c; background: var(--violet-soft); }
.reference-status { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 750; }
.reference-loaded { color: #1f654a; background: var(--green-soft); }
.reference-missing, .reference-unreadable, .reference-empty, .reference-unsupported, .reference-invalid { color: #7a4b0f; background: var(--orange-soft); }
.limits-panel ul { margin-bottom: 0; padding-left: 21px; }
.limits-panel li + li { margin-top: 7px; }
.specification-panel summary { cursor: pointer; font-size: 17px; font-weight: 700; }
.specification-table { margin-top: 18px; max-height: 560px; }
.formula { margin: 14px 0 0; font-family: "Cascadia Mono", Consolas, monospace; color: var(--blue-dark); }
.empty-state { padding: 22px; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.empty-state p { margin: 0; }
.site-footer { padding: 20px 0 30px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0; }
.back-to-top { position: fixed; right: 22px; bottom: 22px; z-index: 20; min-height: 44px; border: 1px solid var(--blue-dark); border-radius: 999px; padding: 9px 16px; color: #fff; background: var(--blue-dark); box-shadow: 0 7px 22px rgba(24, 50, 72, .24); cursor: pointer; font: 700 13px/1.2 inherit; }
.back-to-top:hover { background: var(--blue); }
.back-to-top[hidden] { display: none; }

@media (max-width: 1050px) {
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
    .ium-summary-grid { grid-template-columns: repeat(3, 1fr); }
    .panel-heading, .results-toolbar, .result-status { display: block; }
    .privacy { max-width: none; }
    .result-actions { justify-content: flex-start; margin-top: 16px; }
    .filters { grid-template-columns: auto 1fr; margin-top: 16px; }
    .filter-reset { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 720px) {
    .container { width: min(100% - 24px, 1480px); }
    .header-row { display: block; }
    .version { display: inline-block; margin-top: 16px; }
    .upload-form { grid-template-columns: 1fr; }
    .form-actions { justify-content: stretch; }
    .form-actions .button { width: 100%; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .ium-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .panel { padding: 18px; }
    .rhs-detail-header { display: block; }
    .rhs-detail-close { margin-top: 12px; }
}
@media print {
    body { background: #fff; font-size: 10pt; }
    .site-header { background: #fff; color: #000; padding: 12px 0; box-shadow: none; }
    .eyebrow, .subtitle, .version, .upload-panel, .result-actions, .filters, .type-nav, .specification-panel, .site-footer, .back-to-top { display: none; }
    .panel, .notice, .summary-card { box-shadow: none; break-inside: avoid; }
    .table-wrap { overflow: visible; }
    th { position: static; color: #000; background: #e5e7eb; }
}
