:root {
    --navy: #143f51;
    --navy-deep: #0e3040;
    --blue: #1f6685;
    --ink: #172433;
    --muted: #61707d;
    --paper: #f4f6f7;
    --surface: #ffffff;
    --line: #d6dde1;
    --line-dark: #b8c3ca;
    --success: #176b50;
    --success-bg: #e1f1e9;
    --warning: #835c12;
    --error: #a63a33;
    --error-bg: #fae8e6;
    --focus: #e4a83b;
    --shadow: 0 16px 38px rgba(23, 36, 51, .10);
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    color-scheme: light;
    font-family: var(--sans);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; }
::selection { color: #fff; background: var(--blue); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent); outline-offset: 2px; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    min-height: 78px; padding: 0 clamp(20px, 3vw, 48px);
    display: grid; grid-template-columns: minmax(275px, 1fr) auto minmax(275px, 1fr); align-items: stretch;
    color: #fff; background: var(--navy-deep); border-bottom: 1px solid rgba(255,255,255,.14);
}
.identity { align-self: center; display: inline-flex; align-items: center; width: max-content; color: inherit; text-decoration: none; }
.identity-name { font-family: var(--serif); font-size: 1.65rem; font-weight: 700; letter-spacing: .025em; }
.identity-rule { width: 1px; height: 34px; margin: 0 14px; background: rgba(255,255,255,.32); }
.identity-description { color: #d5e1e6; font-size: .68rem; line-height: 1.35; letter-spacing: .02em; }
.primary-nav { display: flex; align-items: stretch; }
.nav-item { position: relative; min-width: 128px; border: 0; color: #c8d9e0; background: transparent; font-weight: 600; font-size: .86rem; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.is-active { color: #fff; }
.nav-item.is-active::after { content: ""; position: absolute; right: 20px; bottom: 0; left: 20px; height: 3px; background: #71bdca; }
.header-actions { grid-column: 3; justify-self: end; align-self: center; display: flex; align-items: center; gap: 22px; }
.docs-link { color: #e3edf1; font-size: .82rem; font-weight: 650; text-decoration: none; text-underline-offset: 4px; }
.docs-link:hover { color: #fff; text-decoration: underline; }
.session { justify-self: end; display: flex; align-items: center; gap: 20px; font-size: .73rem; }
.session span { color: #d5e1e6; }
.session i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #77d3b1; }
.session button { padding: 8px 0; border: 0; border-bottom: 1px solid transparent; color: #fff; background: transparent; font-weight: 650; }
.session button:hover { border-color: #fff; }

main { min-height: calc(100vh - 132px); }
.login-layout { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 132px); margin: auto; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(70px, 10vw, 150px); padding: 72px 0; }
.registry-seal { width: 74px; height: 74px; display: grid; place-items: center; color: var(--navy); border: 1px solid var(--line-dark); }
.registry-seal svg { width: 42px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.login-intro h1, .page-heading h1 { font-family: var(--serif); letter-spacing: -.025em; }
.login-intro h1 { max-width: 700px; margin: 30px 0 20px; font-size: clamp(2.6rem, 5vw, 4.6rem); line-height: 1.02; font-weight: 700; }
.login-intro > p { max-width: 620px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.system-facts { margin: 42px 0 0; border-top: 1px solid var(--line-dark); }
.system-facts div { display: grid; grid-template-columns: 130px 1fr; gap: 22px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.system-facts dt { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.system-facts dd { margin: 0; font-size: .82rem; }
.login-form { padding: 38px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-form header { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.login-form h2 { margin: 0; font-family: var(--serif); font-size: 1.55rem; }
.login-form header p { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.login-form > label { display: block; margin: 18px 0 7px; font-size: .76rem; font-weight: 700; }
input, select { color: var(--ink); background: #fff; border: 1px solid var(--line-dark); }
input:hover, select:hover { border-color: #8799a4; }
input:focus, select:focus { border-color: var(--blue); outline: 3px solid rgba(31,102,133,.13); }
.login-form > input, .password-field input { width: 100%; height: 46px; padding: 0 13px; }
.password-field { position: relative; }
.password-field button { position: absolute; top: 1px; right: 1px; width: 46px; height: 44px; border: 0; color: var(--muted); background: #fff; }
.password-field svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.login-submit { width: 100%; margin-top: 24px; }
.login-submit svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.access-note { margin: 18px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; text-align: center; }

.button { min-height: 42px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.button-primary { border: 1px solid var(--navy); color: #fff; background: var(--navy); }
.button-primary:hover { background: var(--navy-deep); }
.button-primary:disabled { border-color: #b7c1c7; color: #71808a; background: #dfe4e7; }
.button-secondary { border: 1px solid var(--line-dark); color: var(--navy); background: #fff; }
.button-secondary:hover { border-color: var(--navy); background: #f7fafb; }
.message { margin: 12px 0 0; font-size: .76rem; line-height: 1.5; }
.message.error { padding: 10px 12px; color: var(--error); background: var(--error-bg); border: 1px solid #edc3bf; }

.application { width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 60px; }
.view[hidden], [hidden] { display: none !important; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(2.15rem, 4vw, 3.25rem); line-height: 1.05; }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: .82rem; }
.catalog-count { min-width: 122px; padding-left: 24px; border-left: 1px solid var(--line-dark); }
.catalog-count strong, .catalog-count span { display: block; }
.catalog-count strong { font-family: var(--serif); font-size: 1.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.catalog-count span { margin-top: 5px; color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .06em; }

.catalog-tools { margin-bottom: 20px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 13px; left: 15px; width: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { width: 100%; height: 48px; padding: 0 16px 0 48px; font-size: .86rem; }
.filter-panel { margin-top: 10px; border: 1px solid var(--line); background: #eef2f4; }
.filter-panel summary { min-height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; font-size: .76rem; font-weight: 700; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-panel summary > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.filter-panel summary svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.filter-panel summary > span:last-child { color: var(--muted); font-size: .7rem; font-weight: 500; }
.filter-grid { padding: 20px 16px; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; border-top: 1px solid var(--line); background: #fff; }
.filter-grid label { color: var(--muted); font-size: .69rem; font-weight: 700; }
.filter-grid input { width: 100%; height: 39px; margin-top: 6px; padding: 0 10px; font-size: .78rem; }
.filter-actions { padding: 0 16px 18px; display: flex; gap: 10px; background: #fff; }

.catalog-panel { background: #fff; border: 1px solid var(--line); }
.table-header { min-height: 58px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.table-header p { margin: 0; color: var(--muted); font-size: .74rem; }
.table-header label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .7rem; }
.table-header select { height: 34px; padding: 0 28px 0 9px; font-size: .72rem; }
.table-wrap { position: relative; overflow-x: auto; min-height: 320px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .72rem; }
th { padding: 12px 11px; color: #243747; background: #edf2f5; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; font-size: .67rem; line-height: 1.25; }
td { height: 51px; padding: 9px 11px; border-right: 1px solid #e3e8eb; border-bottom: 1px solid #e3e8eb; line-height: 1.35; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:hover { background: #f2f7f8; }
td:first-child { color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
td:nth-child(2) { font-weight: 700; }
th:nth-child(1) { width: 9%; } th:nth-child(2) { width: 15%; } th:nth-child(3) { width: 17%; }
th:nth-child(4) { width: 14%; } th:nth-child(5) { width: 10%; } th:nth-child(6) { width: 17%; }
th:nth-child(7) { width: 8%; } th:nth-child(8) { width: 10%; }
.table-state { position: absolute; inset: 42px 0 0; display: grid; place-items: center; padding: 40px; color: var(--muted); background: rgba(255,255,255,.94); font-size: .82rem; text-align: center; }
.pagination { min-height: 64px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pagination label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .7rem; }
.pagination select { height: 34px; padding: 0 24px 0 8px; }
.page-controls { display: flex; align-items: center; gap: 12px; }
.page-controls span { min-width: 105px; color: var(--muted); font-size: .7rem; text-align: center; }
.page-button { min-height: 34px; padding: 0 13px; border: 1px solid var(--line-dark); color: var(--navy); background: #fff; font-size: .7rem; font-weight: 700; }
.page-button:hover:not(:disabled) { border-color: var(--navy); }
.page-button:disabled { color: #9aa5ac; background: #f0f2f3; }
.import-strip { margin-top: 20px; min-height: 82px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fff; border: 1px solid var(--line); }
.import-strip strong, .import-strip span { display: block; }
.import-strip strong { font-family: var(--serif); font-size: 1rem; }
.import-strip span { margin-top: 5px; color: var(--muted); font-size: .72rem; }

.import-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); background: #fff; border: 1px solid var(--line); }
.upload-form { padding: clamp(26px, 4vw, 52px); }
.section-heading h2, .import-guidance h2, .progress-panel h2, .issues-panel h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; }
.section-heading p { margin: 7px 0 0; color: var(--muted); font-size: .75rem; }
.drop-zone { min-height: 280px; margin-top: 25px; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--navy); background: #f7f9fa; border: 1px dashed #88a3b1; cursor: pointer; text-align: center; transition: background .18s ease-out, border-color .18s ease-out; }
.drop-zone:hover, .drop-zone.is-dragging { background: #eaf3f5; border-color: var(--blue); }
.drop-zone svg { width: 48px; margin-bottom: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.drop-zone strong { font-family: var(--serif); font-size: 1.35rem; }
.drop-zone span { margin-top: 7px; color: var(--muted); font-size: .75rem; }
.selected-file { min-height: 68px; margin-top: 14px; padding: 12px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; background: #f4f7f8; border: 1px solid var(--line); }
.file-type { display: grid; place-items: center; width: 40px; height: 40px; color: #fff; background: var(--success); font-size: .65rem; font-weight: 800; }
.selected-file strong, .selected-file small { display: block; }
.selected-file strong { font-size: .76rem; }
.selected-file small { margin-top: 4px; color: var(--muted); font-size: .67rem; }
.selected-file button { border: 0; color: var(--error); background: transparent; font-size: .7rem; font-weight: 700; }
.import-button { width: 100%; margin-top: 16px; }
.import-guidance { padding: clamp(26px, 4vw, 45px); color: #eef5f7; background: var(--navy); }
.import-guidance h2 { color: #fff; }
.import-guidance dl { margin: 24px 0 0; }
.import-guidance dl div { padding: 18px 0; border-top: 1px solid rgba(255,255,255,.18); }
.import-guidance dt { color: #fff; font-size: .72rem; font-weight: 700; }
.import-guidance dd { margin: 5px 0 0; color: #c6d9df; font-size: .72rem; line-height: 1.55; }
.progress-panel, .issues-panel { margin-top: 20px; padding: 28px; background: #fff; border: 1px solid var(--line); }
.progress-panel > header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.progress-panel header p { margin: 7px 0 0; color: var(--muted); font-size: .72rem; }
.progress-panel header > div:last-child { display: flex; align-items: center; gap: 18px; }
.progress-panel header strong { font-family: var(--serif); font-size: 2.25rem; font-variant-numeric: tabular-nums; }
.status-badge { padding: 6px 9px; color: var(--navy); background: #dce9ed; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.status-badge.success { color: var(--success); background: var(--success-bg); }
.status-badge.failure { color: var(--error); background: var(--error-bg); }
.progress-track { height: 7px; margin: 25px 0; overflow: hidden; background: #dfe6e9; }
.progress-track span { display: block; width: 100%; height: 100%; background: var(--blue); transform: scaleX(0); transform-origin: left; transition: transform .35s ease-out; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics div { padding: 20px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border: 0; }
.metrics span, .metrics small { display: block; }
.metrics span { font-family: var(--serif); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.metrics small { margin-top: 5px; color: var(--muted); font-size: .68rem; }
.progress-panel > div:last-child { margin-top: 20px; }
.issues-panel header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.issues-panel header p { color: var(--muted); font-size: .7rem; }
.issue-row { display: grid; grid-template-columns: 75px 80px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .72rem; }
.severity { font-weight: 800; }
.severity.error { color: var(--error); }
.severity.warning { color: var(--warning); }

.site-footer { min-height: 54px; padding: 0 clamp(20px, 3vw, 48px); display: flex; align-items: center; justify-content: space-between; color: var(--muted); background: #fff; border-top: 1px solid var(--line); font-size: .66rem; }
.toast { position: fixed; z-index: 40; right: 22px; bottom: 22px; max-width: 390px; padding: 14px 17px; color: #fff; background: var(--navy-deep); border-radius: 6px; box-shadow: var(--shadow); font-size: .76rem; }

@media (max-width: 1050px) {
    .topbar { grid-template-columns: 1fr auto; }
    .primary-nav { order: 3; grid-column: 1 / -1; height: 48px; justify-content: center; border-top: 1px solid rgba(255,255,255,.1); }
    .header-actions { grid-column: 2; grid-row: 1; }
    .session { justify-self: auto; }
    .login-layout { grid-template-columns: 1fr 420px; gap: 55px; }
    .filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .import-layout { grid-template-columns: 1fr; }
    table { min-width: 1120px; }
}

@media (max-width: 760px) {
    .topbar { position: static; min-height: auto; grid-template-columns: 1fr; padding: 0 18px; }
    .identity { min-height: 68px; }
    .identity-description { display: none; }
    .identity-rule { display: none; }
    .session { grid-column: 1; grid-row: 2; justify-self: stretch; min-height: 42px; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.1); }
    .header-actions { grid-column: 1; grid-row: 2; justify-self: stretch; justify-content: space-between; min-height: 42px; border-top: 1px solid rgba(255,255,255,.1); }
    .session { min-height: auto; border-top: 0; }
    .primary-nav { grid-column: 1; grid-row: 3; }
    .nav-item { flex: 1; min-width: auto; }
    .login-layout { width: min(100% - 28px, 520px); grid-template-columns: 1fr; gap: 38px; padding: 45px 0; }
    .login-intro h1 { font-size: 2.65rem; }
    .system-facts { display: none; }
    .login-form { padding: 28px 22px; }
    .application { width: calc(100% - 24px); padding-top: 32px; }
    .page-heading { align-items: start; }
    .page-heading h1 { font-size: 2.2rem; }
    .catalog-count { display: none; }
    .search-row { grid-template-columns: 1fr; }
    .search-row .button { width: 100%; }
    .filter-grid { grid-template-columns: 1fr; }
    .table-header, .pagination, .import-strip { align-items: stretch; flex-direction: column; }
    .table-header { padding: 14px; }
    .table-header label { justify-content: space-between; }
    .pagination { padding: 15px; }
    .page-controls { justify-content: space-between; }
    .import-strip .button { width: 100%; }
    .upload-form, .import-guidance { padding: 24px 18px; }
    .drop-zone { min-height: 220px; }
    .progress-panel, .issues-panel { padding: 22px 17px; }
    .progress-panel > header { display: block; }
    .progress-panel header > div:last-child { margin-top: 16px; justify-content: space-between; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .metrics div:nth-child(2) { border-right: 0; }
    .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .issue-row { grid-template-columns: 62px 65px 1fr; gap: 8px; }
    .site-footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
