:root {
    color-scheme: light;
    --ink: #14294a;
    --muted: #4c6079;
    --blue: #184eac;
    --line: #d8e3f2;
    --canvas: #f4f8ff;
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }
h1, h2, h3, p, dl, ul { margin: 0; }
a { color: var(--blue); text-underline-offset: .25em; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid #2465c2; outline-offset: 3px; }
.shell { width: min(1136px, calc(100% - 36px)); margin-inline: auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner, .site-footer .shell { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar-inner { min-height: 76px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; line-height: 1.2; }
.brand img { object-fit: contain; }
.brand small, .site-footer { color: var(--muted); }
.brand small { display: block; margin-top: 4px; font-size: .77rem; }
.topbar nav { display: flex; align-items: center; gap: min(3vw, 22px); flex: none; font-size: .87rem; font-weight: 650; }
.topbar nav a, .text-button { display: inline-flex; align-items: center; min-height: 44px; }
.text-button { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--blue); cursor: pointer; }
.site-footer { background: #fff; border-top: 1px solid var(--line); font-size: .83rem; }
.site-footer .shell { padding-block: 24px; }

.public-main { padding-block: clamp(38px, 8.5vw, 112px) clamp(60px, 10vw, 130px); }
.verification-grid { display: grid; gap: 32px; align-items: center; }
.intro { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: .79rem; font-weight: 750; color: var(--blue); letter-spacing: .06em; text-transform: uppercase; }
.eyebrow span { display: inline-block; width: 16px; height: 2px; background: currentColor; }
.intro h1 {
    margin-top: 14px;
    font: 500 clamp(2.75rem, 6.5vw, 5.45rem)/.99 Georgia, serif;
    letter-spacing: -.055em;
}
.intro h1 em { color: var(--blue); font-weight: inherit; }
.lead { max-width: 33ch; margin-block: 19px 26px; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.13rem); }
.verify-card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: clamp(16px, 3.2vw, 28px); }
.verify-card { max-width: 490px; box-shadow: 0 10px 24px #173f7f0c; }
.verify-card p { color: var(--muted); font-size: .91rem; margin-block: 4px 14px; }
.verify-guide { margin-top: clamp(28px, 5vw, 56px); }
.verify-guide h2 { font-size: clamp(1.25rem, 2.5vw, 1.6rem); }
.verify-guide p { margin-top: 6px; color: var(--muted); }
.verify-guide ol { display: grid; gap: 12px; padding: 0; margin-block: 18px; list-style-position: inside; }
.verify-guide li { padding: 14px; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; }
.verify-guide li::marker { color: var(--blue); font-weight: 750; }
.verify-guide li p, .verify-guide > p:last-child { font-size: .93rem; }
.verify-guide > p:last-child { border-top: 1px solid var(--line); padding-top: 14px; }
@media (min-width: 54rem) { .verify-guide ol { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
label { display: grid; gap: 6px; min-width: 0; font-weight: 650; font-size: .92rem; }
input, textarea, select { width: 100%; min-width: 0; min-height: 46px; padding: 9px 12px; color: var(--ink); background: #fff; border: 1px solid #758ba9; border-radius: 8px; }
textarea { resize: vertical; }
.code-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.code-entry input { font: 700 1.2rem/1.4 ui-monospace, monospace; letter-spacing: .21em; text-transform: uppercase; }
.code-entry input::placeholder { color: #536985; opacity: 1; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; max-width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; font-weight: 700; font-size: .92rem; text-decoration: none; cursor: pointer; }
.primary { background: var(--blue); color: #fff; }
.primary:hover { background: #123d87; }
.secondary { background: #eef4ff; border-color: #758ba9; color: #153e85; }
.secondary:hover { background: #dfeaff; }
.danger { background: #fff0f0; border-color: #ad626a; color: #8c2937; }
.danger:hover { background: #ffe2e5; }

.visual { display: none; }
@media (min-width: 42rem) {
    .verification-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .visual {
        display: grid;
        place-items: center;
        min-height: clamp(330px, 39vw, 470px);
        position: relative;
        overflow: hidden;
        border-radius: 24px;
        background: #e0ecff;
        border: 1px solid #d1e0f8;
        isolation: isolate;
    }
    .visual-lines, .visual-lines::before, .visual-lines::after { position: absolute; border: 1px solid #adc6ed; transform: rotate(-16deg); border-radius: 42px; }
    .visual-lines { inset: 10% -13% 8% -8%; z-index: -1; background: #ccdef754; }
    .visual-lines::before, .visual-lines::after { content: ""; inset: 15px; transform: none; }
    .visual-lines::after { inset: 30px; }
    .paper { width: 76%; max-width: 410px; background: #fff; border-radius: 8px; padding: 12px; transform: rotate(-7deg); box-shadow: 0 17px 34px #133d7c36; }
    .paper-frame { aspect-ratio: 1.47; border: 1px solid #4777c4; outline: 1px solid #adc6ed; outline-offset: -5px; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; padding: 16px 5px; }
    .paper-frame img { object-fit: contain; margin-bottom: 5px; }
    .paper-kicker { font-size: clamp(.4rem, .85vw, .63rem); font-weight: 750; letter-spacing: .12em; color: #214b8c; }
    .paper-title { font: 500 clamp(1.2rem, 3.2vw, 2.65rem)/1.2 Georgia, serif; color: #19458a; }
    .paper-subtitle { font-size: clamp(.45rem, 1.1vw, .73rem); color: var(--muted); }
    .paper-rules { display: grid; gap: 6px; width: 45%; margin-top: 12px; }
    .paper-rules i { display: block; height: 1px; background: #cedcf0; }
    .paper-rules i:last-child { width: 65%; justify-self: center; }
    .seal { position: absolute; bottom: -13%; right: 8%; display: grid; place-items: center; width: clamp(37px, 6vw, 70px); aspect-ratio: 1; background: var(--blue); border: 4px double #dbe8ff; color: #fff; border-radius: 50%; font-size: clamp(1rem, 3.2vw, 2rem); }
}
@media (min-width: 62rem) { .verification-grid { gap: 68px; } }

.result { margin-top: 32px; }
.result h2, .preview h2 { font: 500 clamp(1.7rem, 4vw, 2.9rem)/1.12 Georgia, serif; margin-block: 10px; overflow-wrap: anywhere; }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; color: var(--muted); overflow-wrap: anywhere; }
.status { display: inline-block; border-radius: 6px; background: #e8f0ff; color: #23467e; padding: 3px 8px; font-size: .82rem; font-weight: 700; }
.status.valid { color: #205e42; background: #e7f5ec; }
.status.revoked { color: #8c2937; background: #ffe9eb; }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 12px; margin-block: 20px; }
.details div { padding: 12px; border-radius: 8px; background: #f1f6fe; min-width: 0; }
.details dt { color: var(--muted); font-size: .84rem; }
.details dd { margin: 4px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.details .score-total { background: #e8f0ff; outline: 1px solid #758ba9; outline-offset: -1px; }
.score-total dd { font-size: 1.3rem; color: #153e85; }
.score-guide { margin-top: 20px; }
.score-guide table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.score-guide th, .score-guide td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.score-guide .score-match { background: #e8f0ff; font-weight: 700; color: #153e85; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.score-guide p { margin-top: 10px; font-size: .87rem; color: var(--muted); }
.notice { padding: 12px 15px; background: #e8f0ff; border-radius: 8px; color: #1b437f; }
.notice.error, .verify-card .notice.error { background: #ffeded; color: #8c2937; }
.verify-card .notice { margin-block: 12px 0; }

.admin-main { padding-block: clamp(27px, 5vw, 60px) 64px; }
.narrow { max-width: 480px; }
.admin-main h1 { font: 500 clamp(2rem, 5vw, 3.2rem)/1.12 Georgia, serif; margin-block: 8px 12px; overflow-wrap: anywhere; }
.admin-main h2 { font-size: 1.2rem; }
.page-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.admin-main > .notice { margin-bottom: 14px; }
.form-stack, .form-grid, .filters, .editor-side, .editor-grid { display: grid; gap: 14px; align-items: start; }
.form-stack { justify-items: start; }
.form-stack label { width: 100%; }
.participant-form { width: min(100%, 620px); }
.participant-form > p, .participants-panel > p { font-size: .9rem; color: var(--muted); }
.participants-panel { margin-top: 18px; }
.form-grid { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); }
.filters { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); align-items: end; }
.full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; min-height: initial; accent-color: var(--blue); }
.certificate-table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; }
.certificate-table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
.certificate-table :is(th, td) { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.certificate-table thead { background: #eef4ff; font-size: .88rem; }
.certificate-table tbody tr:last-child > * { border-bottom: 0; }
.certificate-table tbody td { overflow-wrap: anywhere; }
.certificate-table tbody th { min-width: 118px; overflow-wrap: anywhere; }
.certificate-table code { color: #153e85; font-size: 1rem; font-weight: 700; letter-spacing: .09em; }
.certificate-table .list-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 178px; }
.certificate-table .list-actions .button { padding-inline: 9px; white-space: nowrap; }
.history { list-style: none; padding: 0; margin-top: 16px; }
.pagination a, .back-link { display: inline-flex; align-items: center; min-height: 44px; }
.list-actions, .pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pagination { justify-content: center; margin-top: 10px; }
.certificate-table small, .history small, .code-notice small { display: block; color: var(--muted); }
.history li + li { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.history p { margin-top: 4px; overflow-wrap: anywhere; }
.preview { grid-column: 1 / -1; }
summary { cursor: pointer; font-weight: 700; min-height: 30px; }
.code-notice { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.code-notice strong { font: 700 1.4rem ui-monospace, monospace; letter-spacing: .13em; padding-left: 6px; }
@media (min-width: 55rem) { .editor-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); } }
@media (max-width: 24rem) {
    .topbar-inner { padding-block: 8px; flex-wrap: wrap; }
    .brand { font-size: .92rem; }
    .brand img { width: 38px; }
    .code-entry { grid-template-columns: 1fr; }
    .site-footer .shell { flex-direction: column; align-items: flex-start; gap: 3px; }
}
