:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #5d6b7c;
    --paper: #f3efe6;
    --card: #fffdf9;
    --line: #e4dccf;
    --navy: #142033;
    --gold: #c8922a;
    --green: #0f7a45;
    --red: #a12626;
    --sans: "Segoe UI", Candara, "Trebuchet MS", sans-serif;
    --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.02rem;
    line-height: 1.5;
    background-color: var(--paper);
    background-image:
        linear-gradient(180deg, rgba(20, 32, 51, 0.05), transparent 240px),
        radial-gradient(circle at 1px 1px, rgba(20, 32, 51, 0.08) 1px, transparent 0);
    background-size: auto, 22px 22px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
.verdict,
.panel,
.banner {
    scroll-margin-top: 5.5rem;
}

h1 {
    margin-bottom: 0.35rem;
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

h2 {
    margin-bottom: 0.3rem;
    font-size: 1.15rem;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

.skip {
    position: absolute;
    left: 0.6rem;
    top: -3rem;
    z-index: 20;
    padding: 0.4rem 0.7rem;
    background: #fff;
    color: var(--navy);
}

.skip:focus {
    top: 0.6rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--navy);
    color: #f6f1e7;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    background: #d7a441;
    color: var(--navy);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text small {
    color: #d9deea;
    font-size: 0.78rem;
}

.site-nav {
    display: flex;
    gap: 0.45rem;
}

.nav-link {
    border: 1px solid rgba(246, 241, 231, 0.35);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    color: inherit;
    text-decoration: none;
    font-size: 0.92rem;
}

.nav-link:hover {
    background: #d7a441;
    border-color: #d7a441;
    color: var(--navy);
}

.shell {
    width: min(1080px, calc(100% - 2rem));
    margin: 1.35rem auto 2rem;
}

.shell-narrow {
    width: min(540px, calc(100% - 2rem));
}

.footer-inner {
    margin-top: 0;
    margin-bottom: 0;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 0.2rem 0 1.4rem;
    font-size: 0.92rem;
}

.eyebrow {
    margin-bottom: 0.2rem;
    color: #9a6d12;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lede,
.muted,
.hint {
    color: var(--muted);
}

.hint {
    margin-bottom: 0;
    font-size: 0.92rem;
}

.panel {
    margin-top: 0.95rem;
    padding: 1rem 1rem 1.15rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(20, 32, 51, 0.05);
}

.panel-head {
    margin-bottom: 0.75rem;
}

.panel-head p:last-child {
    margin-bottom: 0;
}

.split {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.verdict {
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    padding: 1.4rem 1rem 1.25rem;
    text-align: center;
    border: 2px dashed currentColor;
    border-radius: 18px;
    background: var(--card);
}

.verdict-kicker {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.15rem 0 0.2rem;
    padding: 0.1rem 0.75rem 0.2rem;
    border: 5px solid currentColor;
    border-radius: 10px;
    font-size: clamp(2.6rem, 10vw, 4.4rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1;
    text-indent: 0.12em;
    text-transform: uppercase;
    transform: rotate(-6deg);
}

.verdict-valid {
    color: var(--green);
    background: #f3faf6;
}

.verdict-invalid,
.verdict-duplicate {
    color: var(--red);
    background: #fff6f5;
}

.verdict-duplicate .stamp {
    font-size: clamp(1.55rem, 6.5vw, 2.6rem);
    letter-spacing: 0.06em;
}

.verdict .tracking,
.verdict-copy {
    color: var(--ink);
    transform: none;
}

.tracking {
    margin: 0.35rem 0 0;
    font-family: var(--mono);
    font-size: 1.05rem;
    letter-spacing: 0;
    word-break: break-all;
}

.verdict-copy {
    max-width: 34rem;
    margin-bottom: 0.45rem;
}

.badge-icon::before {
    font-size: 0.72em;
    letter-spacing: 0;
}

.verdict-valid .badge-icon::before {
    content: "✓";
}

.verdict-invalid .badge-icon::before {
    content: "✕";
}

.verdict-duplicate .badge-icon::before {
    content: "!";
}

.reader {
    width: 100%;
    overflow: hidden;
    background: #101826;
    border-radius: 16px;
    color: #d5dce8;
}

.reader-placeholder {
    display: grid;
    min-height: 250px;
    margin: 0;
    place-items: center;
    padding: 1rem;
    text-align: center;
}

.btn-row,
.inline-form,
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.btn-row,
.inline-form {
    margin-top: 0.8rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.btn-primary {
    background: var(--navy);
    color: #f7f3ea;
}

.btn-primary:hover {
    background: #24384f;
}

.btn-ghost {
    background: transparent;
    border-color: #cfc6b8;
    color: var(--navy);
}

.btn-ghost:hover {
    background: #f6f1e7;
}

.btn-danger {
    background: transparent;
    border-color: #e4b4b4;
    color: var(--red);
}

.btn-danger:hover {
    background: var(--red);
    color: #fff;
}

.btn-small {
    min-height: 36px;
    padding: 0.25rem 0.65rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

.file-btn {
    position: relative;
    overflow: hidden;
}

.file-btn input {
    position: absolute;
    inset: 0;
    cursor: pointer;
    opacity: 0;
}

.file-reader {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

label {
    display: block;
    margin: 0.85rem 0 0.35rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
textarea {
    width: 100%;
    padding: 0.75rem 0.8rem;
    border: 1px solid #d9d0c2;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

textarea {
    min-height: 180px;
    resize: vertical;
    font-family: var(--mono);
}

#tracking,
.mono {
    font-family: var(--mono);
}

.inline-form input,
.search-form input {
    flex: 1 1 180px;
    min-width: 0;
    width: auto;
}

.banner {
    margin: 0.9rem 0 0;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
}

.banner-ok {
    background: #e8f6ee;
    color: #0f5c34;
}

.banner-error {
    background: #fdecec;
    color: #8d1f1f;
}

.form-error {
    margin: 0.85rem 0 0;
    color: var(--red);
    font-weight: 700;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

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

th,
td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #eee6da;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #faf7f2;
    color: #5c6a7a;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.actions {
    width: 1%;
    white-space: nowrap;
}

.actions form,
.clear-form {
    margin: 0;
}

.clear-form {
    margin-top: 0.9rem;
}

.empty {
    padding: 1.2rem 0.2rem 0.4rem;
    color: var(--muted);
}

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

:focus-visible {
    outline: 3px solid #d7a441;
    outline-offset: 2px;
}

@media (min-width: 860px) {
    .admin-grid {
        grid-template-columns: 1.25fr 0.75fr;
        gap: 0.95rem;
    }

    .admin-grid .panel {
        margin-top: 0.95rem;
    }
}

@media (max-width: 560px) {
    .inline-form,
    .search-form,
    .btn-row {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form .btn,
    .search-form .btn,
    .btn-row .btn,
    .inline-form input,
    .search-form input {
        width: 100%;
    }
}

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