:root {
    --bg: #f6f8fc;
    --panel: #ffffff;
    --text: #111827;
    --muted: #5f6b7a;
    --line: #d8e0eb;
    --blue: #235FF8;
    --blue-dark: #153ea7;
    --green: #3f8f29;
    --orange: #e96a00;
    --red: #bf1f1f;
    --purple: #7348c9;
    --shadow: 0 18px 40px rgba(25, 42, 70, .08);
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

.validator-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0 44px;
}

.validator-topbar {
    background: linear-gradient(135deg, #081a36, #102b54);
    color: #fff;
    border-radius: 0 0 var(--radius) var(--radius);
    margin: -22px calc((100vw - min(1180px, calc(100vw - 40px))) / -2) 28px;
    padding: 18px max(24px, calc((100vw - min(1180px, calc(100vw - 40px))) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: var(--shadow);
}

.brand-link,
.ghost-button,
.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
}

.brand-link {
    color: #fff;
    font-size: 1.25rem;
}

.brand-icon {
    font-size: 2rem;
}

.ghost-button {
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    padding: 10px 14px;
    background: rgba(255,255,255,.05);
}

.intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.upload-panel,
.context-panel,
.result-hero,
.summary-strip,
.issues-card,
.tips-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.upload-panel {
    padding: 26px;
    display: grid;
    gap: 14px;
}

.panel-icon,
.result-icon-wrap,
.tips-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eaf1ff;
    color: var(--blue);
}

.panel-icon .material-symbols-outlined,
.result-icon-wrap .material-symbols-outlined,
.tips-icon .material-symbols-outlined {
    font-size: 38px;
}


.upload-panel-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.upload-panel-heading > div:last-child {
    display: grid;
    gap: 6px;
}

.upload-panel h1,
.context-panel h2,
.result-hero h2,
.issues-card h2,
.tips-card h2,
.example-dialog h2 {
    margin: 0;
    line-height: 1.15;
}

.upload-panel p,
.context-panel p,
.result-hero p,
.issues-card p,
.tips-card p,
.example-dialog p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.upload-panel label {
    font-weight: 800;
    margin-top: 4px;
}

.upload-panel input[type="file"] {
    width: 100%;
    border: 1px dashed #b8c5d6;
    border-radius: 12px;
    padding: 14px;
    background: #fbfdff;
}

.primary-button {
    border: none;
    background: var(--blue);
    color: #fff;
    padding: 12px 18px;
    min-height: 46px;
    cursor: pointer;
    font-size: 1rem;
}

.primary-button:hover,
.primary-button:focus-visible {
    background: var(--blue-dark);
}

.secondary-button {
    border: 1px solid #b8c5d6;
    background: #fff;
    color: #16243a;
    padding: 11px 16px;
    min-height: 44px;
    cursor: pointer;
    font-size: .98rem;
}

.context-panel {
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #fff, #f1f6ff);
}

.eyebrow {
    color: var(--blue) !important;
    font-size: .8rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 800;
}

.small-note,
.muted {
    color: var(--muted);
    font-size: .92rem;
}

.processing-text {
    display: none;
    font-size: .94rem;
    color: var(--muted);
}

.upload-panel.is-processing .processing-text {
    display: block;
}

.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding: 16px 18px;
    border-radius: 14px;
    font-weight: 700;
}

.alert-error {
    background: #fff1f1;
    color: #8f1515;
    border: 1px solid #f3bbbb;
}

.result-hero {
    margin: 26px 0 22px;
    padding: 28px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
}

.result-ready .result-icon-wrap {
    background: #edf8e9;
    color: var(--green);
}

.result-needs_review .result-icon-wrap {
    background: #fff2df;
    color: var(--orange);
}

.result-copy {
    display: grid;
    gap: 8px;
}

.result-copy h2 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.result-ready h2 {
    color: var(--green);
}

.result-needs_review h2 {
    color: var(--orange);
}

.document-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2c3b50 !important;
    font-weight: 700;
}

.result-actions {
    display: grid;
    gap: 10px;
    min-width: 230px;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.summary-strip article {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    padding: 22px;
    border-right: 1px solid var(--line);
}

.summary-strip article:last-child {
    border-right: none;
}

.summary-icon {
    grid-row: span 2;
    color: var(--blue);
    font-size: 32px;
}

.summary-icon.success { color: var(--green); }
.summary-icon.caution { color: var(--orange); }
.summary-icon.danger { color: var(--red); }
.summary-icon.image { color: var(--purple); }

.summary-strip strong {
    font-size: 1.8rem;
    line-height: 1;
}

.summary-strip span:last-child {
    color: var(--muted);
    font-weight: 700;
}

.issues-card {
    margin-bottom: 24px;
    overflow: visible;
}

.issues-header {
    padding: 24px 28px 18px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
}

.issues-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.issues-header h2 span {
    font-size: .9rem;
    background: #eaf1ff;
    color: var(--blue);
    padding: 4px 8px;
    border-radius: 8px;
}

.label-help {
    position: relative;
    color: var(--blue);
    font-weight: 800;
}

.label-help summary {
    cursor: pointer;
    list-style: none;
}

.label-help summary::-webkit-details-marker {
    display: none;
}

.label-help-panel {
    position: absolute;
    z-index: 5;
    right: 0;
    top: calc(100% + 10px);
    width: min(360px, calc(100vw - 40px));
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.label-help-panel p + p {
    margin-top: 10px;
}

.issues-table-wrap {
    overflow-x: auto;
}

.issues-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.issues-table th,
.issues-table td {
    text-align: left;
    vertical-align: top;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    line-height: 1.45;
}

.issues-table th {
    background: #fbfcfe;
    font-size: .9rem;
    color: #26364d;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 800;
    font-size: .86rem;
    white-space: nowrap;
}

.status-pill.must_fix {
    background: #fff0f0;
    color: var(--red);
    border: 1px solid #f4baba;
}

.status-pill.please_review {
    background: #fff5e8;
    color: #b75500;
    border: 1px solid #ffd0a0;
}

.status-pill.helpful_note {
    background: #f1eaff;
    color: var(--purple);
    border: 1px solid #d8c8ff;
}

.preview-box {
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    padding: 10px;
    color: #243247;
    max-width: 240px;
}

.issues-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 14px 22px 18px;
    font-size: .94rem;
}

.tips-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 22px;
    padding: 26px;
    background: linear-gradient(135deg, #fff, #eef5ff);
}

.tips-content {
    min-width: 0;
}

.tips-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.tips-example-button {
    flex: 0 0 auto;
}

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

.tips-grid ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    color: #243247;
}

.tips-grid li {
    margin: 0 0 10px;
    padding-left: 28px;
    position: relative;
}

.tips-grid li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--green);
    font-weight: 900;
}

.example-modal[hidden] {
    display: none;
}

.example-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
}

.example-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 21, 42, .56);
}

.example-dialog {
    position: relative;
    width: min(640px, 100%);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
    padding: 28px;
    display: grid;
    gap: 12px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.word-example {
    background: #fbfcff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 22px;
    font-family: Georgia, "Times New Roman", serif;
    color: #111827;
}

.word-example p {
    color: #111827;
    margin-bottom: 10px;
}

.word-example ol {
    margin: 0;
    padding-left: 42px;
}

.word-example li {
    padding-left: 8px;
    margin-bottom: 6px;
}

@media (max-width: 820px) {
    .validator-shell {
        width: min(100% - 24px, 1180px);
    }

    .validator-topbar {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 18px;
        padding-right: 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .intro-grid,
    .result-hero,
    .tips-card,
    .tips-grid {
        grid-template-columns: 1fr;
    }

    .upload-panel-heading {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .tips-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-actions {
        min-width: 0;
        width: 100%;
    }

    .issues-header {
        flex-direction: column;
    }

    .label-help-panel {
        left: 0;
        right: auto;
    }
}


/* Validator 1.2.6 refinements */
.brand-icon {
    font-size: 1.85rem;
}


/* Label key uses the same visual status colors as the report table. */
.label-help-panel p {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    color: var(--text);
    font-weight: 400;
}

.label-help-panel .status-pill {
    font-weight: 800;
}
