:root {
  --ink: #1e1c1b;
  --ink-soft: #55504c;
  --paper: #f4f0e9;
  --paper-deep: #eae3d9;
  --card: #fffdfa;
  --line: #ded5ca;
  --red: #d70b2f;
  --red-dark: #ab0826;
  --green: #08785c;
  --green-soft: #e4f4ee;
  --amber: #926219;
  --amber-soft: #fbf0dc;
  --shadow: 0 24px 70px rgba(34, 29, 25, 0.08);
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
  min-height: 100px;
  padding: 14px max(24px, calc((100% - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #211f1e;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}
.brand-link img { width: 146px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-label { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }

.hero { min-height: 450px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 56px; padding-block: 74px 60px; }
.eyebrow { margin: 0 0 12px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: 0.17em; text-transform: uppercase; }
.eyebrow-light { color: #ff6e88; }
.hero h1, .section-heading h2, .security-band h2, .login-brand h1, .login-panel h2, .dialog-heading h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}
.hero h1 { margin: 0; max-width: 900px; font-size: clamp(50px, 6.6vw, 86px); line-height: 0.96; letter-spacing: -0.045em; }
.hero h1 em { font-weight: 400; }
.hero-copy { max-width: 710px; margin: 28px 0 0; color: var(--ink-soft); font-size: 17px; line-height: 1.75; }
.hero-stamp { width: 150px; height: 150px; display: grid; place-content: center; text-align: center; border: 1px solid #c9bdb0; border-radius: 50%; transform: rotate(5deg); }
.hero-stamp span { font-family: Georgia, serif; font-size: 53px; line-height: 0.9; letter-spacing: -0.12em; }
.hero-stamp small { margin-top: 12px; font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--line); box-shadow: var(--shadow); }
.summary-card { min-height: 140px; padding: 28px 30px; background: var(--card); }
.summary-card span { font-family: Georgia, serif; font-size: 50px; line-height: 1; }
.summary-card p { margin: 13px 0 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.section-block { padding-block: 100px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 50px; margin-bottom: 38px; }
.section-heading h2, .security-band h2 { margin: 0; font-size: clamp(40px, 5vw, 58px); line-height: 1; letter-spacing: -0.035em; }
.section-heading > p, .archive-heading > div > p:last-child { max-width: 530px; margin: 0; color: var(--ink-soft); line-height: 1.7; }
.archive-heading > div > p:last-child { margin-top: 16px; }

.systems-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.system-card { display: flex; flex-direction: column; min-height: 390px; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 14px 42px rgba(34, 29, 25, 0.04); }
.system-card-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.category-pill, .status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.category-pill { background: #eee8df; color: #554c45; }
.link-count { color: #7c736c; font-size: 11px; }
.system-card h3 { margin: 25px 0 10px; font-family: Georgia, serif; font-size: 30px; font-weight: 400; letter-spacing: -0.02em; }
.system-summary { margin: 0 0 24px; color: var(--ink-soft); line-height: 1.65; }
.system-links { display: grid; gap: 8px; }
.system-link { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 16px; padding: 13px 44px 13px 14px; border: 1px solid #e5ddd4; border-radius: 12px; text-decoration: none; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.system-link:hover { transform: translateY(-1px); border-color: #c8b9aa; background: #faf6f0; }
.system-link span { font-size: 13px; font-weight: 750; }
.system-link small { grid-column: 1; color: #776e67; font-size: 11px; }
.system-link b { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--red); font-weight: 600; }
.access-note { margin: auto 0 0; padding-top: 22px; color: #7a716a; font-size: 11px; line-height: 1.55; }

.security-band { background: #211f1e; color: #fff; }
.security-band-inner { min-height: 300px; display: grid; grid-template-columns: 80px minmax(0, 820px); align-content: center; gap: 34px; }
.security-icon { width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 50%; color: #ff6e88; font-size: 28px; }
.security-band h2 { font-size: clamp(36px, 5vw, 56px); }
.security-band p:last-child { margin: 18px 0 0; color: #c9c1bb; font-size: 16px; line-height: 1.7; }

.archive-section { padding-bottom: 120px; }
.archive-heading { align-items: center; }
.archive-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 230px auto; gap: 12px; align-items: center; padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 253, 250, 0.7); }
input, select, textarea { width: 100%; border: 1px solid #d8cec3; border-radius: 10px; background: #fffdfa; color: var(--ink); outline: none; }
input, select { height: 46px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(215, 11, 47, 0.09); }
.check-field { min-height: 46px; display: inline-flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.check-field input { width: 17px; height: 17px; accent-color: var(--red); }
.archive-list { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.archive-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) 180px auto; gap: 20px; align-items: center; padding: 21px 22px; border-bottom: 1px solid #ebe4dc; }
.archive-row:last-child { border-bottom: 0; }
.archive-missing { opacity: .63; }
.archive-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid #d8cec3; border-radius: 14px; color: var(--red); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.archive-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: #756d66; font-size: 10px; }
.status-current { background: var(--green-soft); color: var(--green); }
.status-reference { background: var(--amber-soft); color: var(--amber); }
.status-historical { background: #eee9e3; color: #6b625b; }
.archive-details h3 { margin: 8px 0 5px; overflow-wrap: anywhere; font-size: 14px; }
.archive-details p { margin: 0; color: #756d66; font-size: 11px; line-height: 1.5; }
.archive-file-meta { display: grid; gap: 6px; color: #756d66; font-size: 11px; }
.archive-help { margin-top: 18px; padding: 20px 22px; border-left: 3px solid var(--red); background: #ebe5dc; }
.archive-help strong { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.archive-help p { margin: 7px 0 0; color: #645d57; font-size: 12px; line-height: 1.6; }
.archive-help code { padding: 2px 5px; border-radius: 4px; background: rgba(255, 255, 255, .7); }

.primary-button, .outline-button, .icon-button, .text-button { border: 0; cursor: pointer; font-weight: 750; }
.primary-button { min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--red); color: #fff; box-shadow: 0 12px 28px rgba(215, 11, 47, .18); }
.primary-button:hover { background: var(--red-dark); }
.outline-button { min-height: 40px; padding: 0 15px; border: 1px solid #d8cec3; border-radius: 999px; background: transparent; color: var(--ink); text-decoration: none; }
.outline-button:hover { border-color: #bcae9f; background: rgba(255,255,255,.45); }
.outline-button-dark { border-color: rgba(255,255,255,.25); color: #fff; }
.outline-button-dark:hover { border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.06); }
button:disabled { cursor: not-allowed; opacity: .55; }
.archive-download { justify-self: end; display: inline-flex; align-items: center; justify-content: center; }
.full-button { width: 100%; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 24px; font-weight: 400; }
.text-button { padding: 5px; background: transparent; color: var(--red); font-size: 12px; }

.notice, .form-message { border: 1px solid #efb5bf; border-radius: 10px; background: #fff0f3; color: #9c1831; }
.notice { padding: 13px 15px; margin-bottom: 14px; }
.form-message { padding: 10px 12px; margin: 0; font-size: 12px; }
.loading-card { grid-column: 1 / -1; padding: 44px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: #756d66; text-align: center; }

.site-footer { padding: 30px 0; background: #211f1e; color: #bfb7b1; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer-inner img { width: 122px; }
.footer-inner p { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.upload-dialog { width: min(650px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; background: var(--card); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.upload-dialog::backdrop { background: rgba(18, 16, 15, .72); backdrop-filter: blur(4px); }
.upload-dialog form { display: grid; gap: 18px; padding: 30px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.dialog-heading h2 { margin: 0; font-size: 40px; }
.upload-dialog label { display: grid; gap: 7px; font-size: 11px; font-weight: 750; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-drop { padding: 16px; border: 1px dashed #cdbfb1; border-radius: 12px; background: #f8f4ee; }
.file-drop input { height: auto; padding: 0; border: 0; background: transparent; }
.file-drop span { color: #756d66; font-size: 10px; font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(430px, calc(100% - 48px)); padding: 15px 18px; border-radius: 12px; background: #211f1e; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.2); font-size: 12px; }

.login-page { min-height: 100vh; background: #211f1e; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.login-brand { min-height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(36px, 5vw, 72px); color: #fff; background: radial-gradient(circle at 15% 15%, rgba(215,11,47,.16), transparent 34%), #211f1e; }
.login-logo { width: 176px; }
.login-brand h1 { max-width: 760px; margin: 0; font-size: clamp(52px, 7vw, 92px); line-height: .94; letter-spacing: -.045em; }
.login-intro { max-width: 620px; margin: 28px 0 0; color: #cbc3bd; font-size: 16px; line-height: 1.75; }
.login-security { margin: 0; color: #aaa19a; font-size: 11px; letter-spacing: .05em; }
.login-security span { margin-right: 8px; color: #36b28e; }
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.login-panel-inner { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.login-mark { width: 62px; margin-bottom: 28px; }
.login-panel h2 { margin: 0; font-size: 46px; letter-spacing: -.035em; }
.muted { color: var(--ink-soft); line-height: 1.6; }
.login-form { display: grid; gap: 13px; margin-top: 28px; }
.login-form > label { font-size: 11px; font-weight: 750; }
.password-field { position: relative; }
.password-field input { padding-right: 63px; }
.password-field .text-button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.login-footnote { margin: 24px 0 0; color: #80776f; font-size: 10px; line-height: 1.6; text-align: center; }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .systems-grid { grid-template-columns: 1fr; }
  .archive-toolbar { grid-template-columns: 1fr 220px; }
  .check-field { grid-column: 1 / -1; }
  .archive-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .archive-file-meta { grid-column: 2; grid-row: 2; grid-template-columns: auto auto; justify-content: start; }
  .archive-download { grid-column: 3; grid-row: 1 / span 2; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 440px; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 28px, 1240px); }
  .site-header { min-height: 82px; padding-inline: 14px; }
  .brand-link img { width: 122px; }
  .header-label { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding-block: 58px; }
  .hero h1 { font-size: clamp(46px, 14vw, 66px); }
  .hero-stamp { display: none; }
  .summary-card { min-height: 118px; padding: 22px 18px; }
  .summary-card span { font-size: 40px; }
  .summary-card p { font-size: 9px; }
  .section-block { padding-block: 70px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 20px; }
  .section-heading h2 { font-size: 43px; }
  .system-card { padding: 22px; }
  .security-band-inner { min-height: 340px; grid-template-columns: 1fr; gap: 22px; }
  .security-icon { width: 58px; height: 58px; }
  .archive-heading .primary-button { width: 100%; }
  .archive-toolbar { grid-template-columns: 1fr; }
  .check-field { grid-column: auto; }
  .archive-row { grid-template-columns: 48px minmax(0, 1fr); gap: 13px; padding: 18px 14px; }
  .archive-icon { width: 46px; height: 46px; }
  .archive-file-meta { grid-column: 2; grid-row: auto; }
  .archive-download { grid-column: 2; grid-row: auto; justify-self: start; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .upload-dialog form { padding: 22px; }
  .login-brand { min-height: 390px; padding: 30px 22px; }
  .login-brand h1 { font-size: 51px; }
  .login-logo { width: 145px; }
  .login-intro { font-size: 14px; }
  .login-panel { padding: 22px 14px 50px; }
  .login-panel-inner { padding: 27px 22px; }
}

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