:root {
  color-scheme: light;
  --accent: #9f1d20;
  --accent-dark: #781518;
  --accent-soft: #f9ebeb;
  --ink: #17191c;
  --line: #d9dde2;
  --muted: #626870;
  --panel: #f6f7f8;
  --paper: #fff;
  --success: #23683f;
  --success-soft: #eaf5ee;
  --warning-soft: #fff7e6;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; }
button, input, select { font: inherit; }

.site-header, main, .site-footer { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.site-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.company-brand { min-width: 0; display: inline-flex; flex: 0 1 255px; align-items: center; }
.company-brand img { width: 100%; max-width: 255px; height: auto; display: block; }
.site-header__right { margin-left: auto; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; text-align: right; text-decoration: none; }
.brand strong, .brand small, .account-menu span, .account-menu small { display: block; }
.brand strong { font-size: 14px; }
.brand small, .account-menu small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.account-menu { display: flex; align-items: center; gap: 16px; text-align: right; }
.account-menu strong { font-size: 12px; }
.account-menu form { margin: 0; }
.text-button { padding: 4px 0; color: var(--accent); background: none; border: 0; font-size: 12px; font-weight: 700; cursor: pointer; }

main { min-height: calc(100vh - 156px); }
.flash { margin-top: 20px; padding: 12px 15px; border: 1px solid; border-radius: 7px; font-size: 13px; }
.flash--success { color: var(--success); background: var(--success-soft); border-color: #bdddc9; }
.flash--error { color: var(--accent-dark); background: var(--accent-soft); border-color: #ebc7c8; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 4vw, 48px); font-weight: 500; line-height: 1.05; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; font-size: 19px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.back-link:hover, .text-link:hover, .row-link:hover { color: var(--accent); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 54px 0 30px; }
.page-heading--compact { padding-top: 38px; }
.page-heading p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 12px; }

.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; font-size: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:focus-visible, input:focus-visible, select:focus-visible, .facility-card:focus-visible { outline: 3px solid #e4a3a5; outline-offset: 2px; }
.button--secondary { color: var(--ink); background: #fff; border-color: #bfc5cc; }
.button--secondary:hover { color: var(--accent); background: #fff; border-color: var(--accent); }
.button--full { width: 100%; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.facility-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.facility-card { min-height: 112px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 15px; padding: 20px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; }
.facility-card:hover { border-color: #aeb4bb; box-shadow: 0 12px 28px rgba(20, 24, 31, .07); }
.facility-card__mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 12px; font-weight: 800; }
.facility-card strong, .facility-card small { display: block; }
.facility-card strong { margin-bottom: 7px; font-size: 15px; }
.facility-card small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.facility-card__arrow { color: var(--muted); }

.auth-shell { min-height: 70vh; display: grid; grid-template-columns: 1.2fr 420px; align-items: center; gap: 72px; }
.auth-copy h1 { max-width: 620px; font-size: clamp(42px, 6vw, 64px); }
.auth-copy > p:not(.eyebrow) { max-width: 560px; color: var(--muted); line-height: 1.65; }
.auth-shell .form-card > .button { margin-top: 18px; }
.account-prompt { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.account-prompt a { color: var(--accent); font-weight: 700; }
.form-card { padding: 28px; }
.form-card--wide { max-width: 800px; margin-bottom: 70px; }
.form-card__heading { margin-bottom: 24px; }
.form-card__heading p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; align-content: start; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field > span { font-size: 11px; font-weight: 750; }
.field em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; min-height: 41px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #bfc5cc; border-radius: 5px; font-size: 13px; }
.field textarea { min-height: 76px; line-height: 1.5; resize: vertical; }
.field-error { color: var(--accent); font-size: 11px; }
.repeater-field { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 7px; }
.repeater-field legend { padding: 0 6px; font-size: 11px; font-weight: 750; }
.repeater-field legend em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.repeater-rows { display: grid; gap: 10px; }
.repeater-row { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 86px 14px 14px; background: var(--panel); border-radius: 6px; }
.repeater-remove { position: absolute; top: 12px; right: 12px; padding: 4px; color: var(--accent); background: transparent; border: 0; font-size: 10px; font-weight: 750; cursor: pointer; }
.repeater-add { min-height: 34px; margin-top: 10px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: var(--panel); border-radius: 6px; cursor: pointer; }
.check-field input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.check-field span, .check-field strong, .check-field small { display: block; }
.check-field strong { font-size: 12px; }
.check-field small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.source-note { margin-bottom: 24px; padding: 14px; background: var(--panel); border-left: 3px solid var(--accent); }
.source-note strong { font-size: 11px; }
.source-note p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.submission-warning, .locked-note { display: flex; gap: 10px; margin-top: 22px; padding: 12px 14px; background: var(--warning-soft); border: 1px solid #ecd9a7; border-radius: 6px; font-size: 11px; }
.submission-warning span, .locked-note span { color: var(--muted); }

.logbook-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.logbook-card { display: flex; flex-direction: column; min-height: 350px; padding: 24px; border: 1px solid var(--line); border-radius: 10px; }
.logbook-card__heading { display: flex; align-items: center; gap: 14px; }
.logbook-card__heading h2 { margin: 0; font-size: 20px; }
.logbook-card > p { min-height: 68px; margin: 24px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.logbook-card > .button { margin-top: auto; }
.record-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 7px; font-size: 12px; font-weight: 800; }
.record-icon--incident { color: #825914; background: #fff3cf; }
.record-counts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 24px; border: 1px solid var(--line); border-radius: 7px; }
.record-counts div { padding: 12px; text-align: center; }
.record-counts div + div { border-left: 1px solid var(--line); }
.record-counts dt { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.record-counts dd { margin: 4px 0 0; font-size: 18px; font-weight: 750; }
.scope-note { margin-top: 18px; padding: 16px 18px; background: var(--panel); border-radius: 8px; }
.scope-note strong { font-size: 11px; }
.scope-note p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.product-list { display: grid; gap: 8px; margin-top: 12px; }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line); }
.product-row strong, .product-row small { display: block; }
.product-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.product-row form { margin: 0; }
.volume-list { display: grid; gap: 10px; }
.volume-card { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; }
.volume-card:hover { border-color: #aeb4bb; box-shadow: 0 10px 24px rgba(20, 24, 31, .06); }
.volume-card > span:first-child, .volume-card strong, .volume-card small { display: block; }
.volume-card strong { margin: 4px 0; font-size: 14px; }
.volume-card small, .volume-card > span:first-child > span, .volume-card__status { color: var(--muted); font-size: 11px; }
.volume-card__status { display: grid; justify-items: end; gap: 7px; text-align: right; }
.section-heading { margin: 34px 0 14px; }
.section-heading h2 { margin: 0; }
.section-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.section-card { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.section-card:hover { border-color: var(--accent); }
.section-card strong, .section-card small { display: block; }
.section-card strong { margin-top: 4px; font-size: 13px; }
.section-card small, .section-card > span:last-child { color: var(--muted); font-size: 10px; }
.reference-copy { max-width: 760px; padding: 28px; }
.reference-copy h2 { margin-top: 24px; font-size: 15px; }
.reference-copy h2:first-child { margin-top: 0; }
.reference-copy p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.record-type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 900px; }
.record-type-card { min-height: 130px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; }
.record-type-card:hover { border-color: var(--accent); box-shadow: 0 12px 28px rgba(20, 24, 31, .07); }
.record-type-card strong, .record-type-card small { display: block; }
.record-type-card strong { margin-bottom: 6px; font-size: 14px; }
.record-type-card small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.operational-form { max-width: 900px; padding: 0; overflow: hidden; }
.form-section { padding: 26px 28px; border-bottom: 1px solid var(--line); }
.form-section__heading { display: grid; grid-template-columns: 26px 1fr; gap: 10px; margin-bottom: 22px; }
.form-section__heading > span { width: 24px; height: 24px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; font-size: 10px; font-weight: 800; }
.form-section__heading h2 { margin: 1px 0 4px; font-size: 15px; }
.form-section__heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-section > .check-field { margin-top: 16px; }
.form-section--plan { background: #fcfbf7; }
.operational-form > .submission-warning { margin-inline: 28px; }
.operational-form > .form-actions { margin: 22px 28px 0; padding-bottom: 24px; }
.operational-table { min-width: 900px; }
.operational-sheet > div { padding: 18px; border-bottom: 1px solid var(--line); }
.operational-sheet > div:last-child { border-bottom: 0; }
.operational-sheet span, .operational-sheet strong { display: block; }
.operational-sheet span { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.operational-sheet strong { font-size: 13px; }
.operational-sheet p { margin: 0; color: #31353a; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.operational-sheet__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 !important; }
.operational-sheet__pair > div { min-height: 90px; padding: 18px; }
.operational-sheet__pair > div + div { border-left: 1px solid var(--line); }

.filter-bar { display: grid; grid-template-columns: minmax(220px, 1.4fr) 150px 150px 150px auto; gap: 10px; align-items: end; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.filter-actions { min-height: 41px; display: flex; align-items: center; gap: 10px; }
.text-link, .row-link { color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 10px; }
.list-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.table-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: 13px 12px; border-bottom: 1px solid #e8eaed; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.status--draft { color: #735414; background: #fff3cf; }
.status--submitted { color: var(--success); background: var(--success-soft); }
.disclaimer { margin: 12px 0 50px; color: var(--muted); font-size: 10px; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
.record-sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.record-sheet > div { min-height: 104px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.record-sheet > div:nth-child(3) { border-right: 0; }
.record-sheet__wide { grid-column: 1 / -1; border-right: 0 !important; }
.record-sheet > div:last-child { border-bottom: 0; }
.record-sheet span, .record-sheet strong { display: block; }
.record-sheet span { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.record-sheet strong { font-size: 14px; }
.audit-panel { padding: 20px; }
.audit-panel h2 { font-size: 14px; }
.timeline { margin: 18px 0 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 20px; }
.timeline li > span { width: 9px; height: 9px; margin-top: 3px; background: var(--accent); border: 2px solid #f1c9ca; border-radius: 50%; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; top: 12px; bottom: 0; left: 4px; width: 1px; background: var(--line); }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-size: 11px; }
.timeline small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.locked-note { margin-bottom: 50px; }
.addenda-panel { margin-top: 28px; }
.addenda-panel > .button { margin-bottom: 14px; }
.addenda-list { display: grid; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.addenda-list li { padding: 18px; }
.addenda-list strong, .addenda-list small { display: block; }
.addenda-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.addenda-list p { margin: 12px 0 0; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }

.empty-state { padding: 64px 20px; color: var(--muted); text-align: center; }
.empty-state h2 { color: var(--ink); }
.empty-state--table { padding: 42px 20px; }
.message-page { min-height: 66vh; padding: 90px 0; }
.message-page p:not(.eyebrow) { color: var(--muted); }
.site-footer { margin-top: 52px; padding: 22px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; gap: 30px; padding: 50px 0; }
  .auth-copy { display: none; }
  .auth-shell .form-card { width: min(100%, 440px); margin-inline: auto; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--search { grid-column: 1 / -1; }
  .detail-layout { grid-template-columns: 1fr; }
  .logbook-grid { grid-template-columns: 1fr; }
  .table-shell { overflow-x: auto; }
  table { min-width: 820px; }
}

@media (max-width: 680px) {
  .site-header, main, .site-footer { width: min(100% - 28px, 1160px); }
  .site-header { gap: 12px; }
  .company-brand { flex-basis: 140px; }
  .site-header__right { gap: 10px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 10px; }
  .account-menu > span { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; padding-top: 38px; }
  .facility-grid, .form-grid, .filter-bar { grid-template-columns: 1fr; }
  .record-type-grid, .section-card-grid { grid-template-columns: 1fr; }
  .field--search, .field--wide { grid-column: auto; }
  .form-card { padding: 20px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .list-toolbar { align-items: flex-start; flex-direction: column; }
  .record-sheet { grid-template-columns: 1fr; }
  .record-sheet > div { grid-column: 1; border-right: 0; }
  .submission-warning, .locked-note { flex-direction: column; }
  .form-section { padding: 22px 18px; }
  .operational-form > .submission-warning { margin-inline: 18px; }
  .operational-form > .form-actions { margin-inline: 18px; }
  .operational-sheet__pair { grid-template-columns: 1fr; }
  .operational-sheet__pair > div + div { border-top: 1px solid var(--line); border-left: 0; }
}

@media print {
  .site-header, .site-footer, .button, .filter-bar, .list-toolbar { display: none; }
  main { width: 100%; }
}
