:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #272822;
  background: #f6f5f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #64675e;
  --border: #e2e2d9;
  --accent: #946010;
  --accent-bg: #f5ebd9;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, input[type="file"] { max-width: 100%; }
button:focus-visible, input:focus-visible { outline: 3px solid #946010; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px max(32px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--border); background: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.brand-context { margin-top: 4px; color: var(--muted); font-size: 12px; }
.environment-label { color: var(--muted); font-size: 12px; }
.main-content { width: min(1120px, calc(100% - 64px)); margin: 48px auto 56px; flex: 1; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 32px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.6px; }
h1 { margin-top: 9px; font-size: clamp(30px, 4vw, 40px); letter-spacing: -1.5px; font-weight: 620; }
.page-description { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.preview-badge, .validated-badge { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: 20px; }
.preview-badge { color: #71501a; background: var(--accent-bg); border: 1px solid #e6d8bb; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #946010; }
.intake-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); gap: 24px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 26px; }
.panel-heading, .heading-with-index { display: flex; align-items: center; gap: 12px; }
.panel-heading { margin-bottom: 24px; }
.panel-heading h2, .panel h3 { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.section-index { color: var(--accent); background: #faf5eb; border: 1px solid #ede3cf; padding: 5px 7px; border-radius: 5px; font-size: 10px; font-weight: 650; }
.input-label { display: block; font-size: 13px; font-weight: 650; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.65; margin-top: 6px; overflow-wrap: anywhere; }
.file-input { display: block; width: 100%; margin-top: 16px; padding: 9px; border: 1px solid #d7d9ce; background: #fbfcf9; border-radius: 7px; color: #53564d; font-size: 12px; cursor: pointer; }
.file-input::file-selector-button { border: 1px solid #d9dccf; background: #fff; color: #33372d; padding: 8px 11px; border-radius: 4px; margin-right: 10px; cursor: pointer; font: inherit; font-weight: 600; }
.file-input:disabled { cursor: wait; opacity: .65; }
.file-summary { min-height: 72px; display: flex; align-items: center; }
.file-hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.selected-file { display: flex; align-items: center; gap: 10px; padding: 13px 0; min-width: 0; }
.selected-file > div { min-width: 0; }
.file-type { color: #735624; background: #f6f0e4; font-size: 9px; font-weight: 700; padding: 10px 6px; border-radius: 4px; }
.file-name { display: block; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.file-size { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.upload-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; border-top: 1px solid #eeefe9; padding-top: 18px; }
.primary-button { border: 1px solid #80540e; border-radius: 6px; padding: 11px 17px; color: #fff; background: #946010; font-size: 12px; font-weight: 650; cursor: pointer; transition: background .15s; }
.primary-button:hover:not(:disabled) { background: #7e500b; }
.primary-button:disabled { color: #797d71; background: #e9ebe3; border-color: #e0e3d8; cursor: not-allowed; }
.action-hint { color: var(--muted); font-size: 11px; }
.context-panel { padding: 27px 28px; border: 1px solid #e4e4d9; border-radius: 12px; background: #eeefe7; }
.context-title { font-size: 13px; font-weight: 650; }
.review-steps { list-style: none; padding: 0; margin: 24px 0 21px; display: grid; gap: 19px; }
.review-steps li { display: flex; gap: 13px; }
.step-number { flex-shrink: 0; width: 24px; font: 11px/1.8 "SFMono-Regular", Consolas, monospace; color: #717665; }
.review-steps strong { font-size: 12px; font-weight: 600; }
.review-steps p { margin-top: 3px; color: #666b5c; font-size: 12px; line-height: 1.55; }
.scope-note { color: #5b614f; font-size: 11px; line-height: 1.65; padding-top: 15px; border-top: 1px solid #dce0d0; }
.status-announcement { color: #57614a; font-size: 12px; min-height: 38px; padding: 12px 2px 8px; }
.empty-preview { display: flex; align-items: center; justify-content: center; gap: 17px; padding: 44px 24px; border: 1px dashed #d5d8cc; border-radius: 12px; background: rgba(255, 255, 255, .35); }
.empty-preview-mark { color: #a3a895; font-size: 32px; }
.empty-preview h2 { font-size: 14px; font-weight: 550; color: #595f50; }
.empty-preview p { margin-top: 7px; font-size: 12px; color: #747b69; line-height: 1.6; }
.error-panel { border: 1px solid #edc5bd; border-left: 3px solid #ae4b38; background: #fff8f6; border-radius: 8px; padding: 19px 22px; margin-bottom: 24px; }
.error-panel h2 { color: #8b3427; font-size: 14px; }
.error-panel p { font-size: 12px; line-height: 1.7; margin-top: 7px; color: #773e33; overflow-wrap: anywhere; }
.error-panel .error-code { font-size: 10px; color: #965f54; }
.preview-section { display: grid; gap: 18px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 3px; }
.preview-heading h2 { margin-top: 8px; font-size: 24px; letter-spacing: -.6px; font-weight: 600; }
.validated-badge { color: #3f603a; background: #e9f0e4; border: 1px solid #d1e0c9; }
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.metadata-list { margin: 20px 0 0; }
.metadata-list > div { display: grid; grid-template-columns: minmax(100px, .75fr) minmax(0, 1.25fr); gap: 18px; border-top: 1px solid #eeefe9; padding: 12px 0; }
.metadata-list > div:last-child { padding-bottom: 0; }
dt { font-size: 12px; color: var(--muted); }
dd { margin: 0; font-size: 12px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.metadata-panel .file-hint { margin-top: 16px; }
.validity-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.validity-panel h3 { font-size: 13px; }
.validity-value { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.validity-value strong { font-size: 24px; font-weight: 600; letter-spacing: -.7px; }
.validity-value span { color: var(--muted); font-size: 12px; }
.warning-panel { padding: 19px 24px; border: 1px solid #e7d4aa; border-radius: 8px; background: #fff8e9; }
.warning-panel h3 { color: #7c5b1d; font-size: 13px; }
.warning-panel ul { margin: 10px 0 0; padding-left: 18px; color: #735b2b; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.evidence-panel .panel-heading, .archive-panel .panel-heading { margin-bottom: 10px; }
.evidence-list { margin: 20px 0 0; display: grid; gap: 16px; }
.evidence-list dt { margin-bottom: 5px; }
.evidence-list code { color: #4c5344; font-size: 11px; }
.archive-heading { justify-content: space-between; }
.count-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.archive-table-wrap { margin-top: 22px; overflow-x: auto; }
.archive-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.archive-table th { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding: 0 12px 10px 0; border-bottom: 1px solid #dfe3d7; }
.archive-table th:first-child { width: 29%; }
.archive-table th:nth-child(2) { width: 12%; }
.archive-table th:last-child { width: 59%; }
.archive-table td { padding: 14px 16px 14px 0; border-bottom: 1px solid #eceee6; vertical-align: top; line-height: 1.7; }
.archive-table tr:last-child td { border-bottom: 0; padding-bottom: 0; }
.archive-name { font-size: 12px; overflow-wrap: anywhere; }
.archive-entry-role { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.archive-size { font-size: 11px; color: var(--muted); white-space: nowrap; }
.archive-hash { font-size: 10px; color: #606955; overflow-wrap: anywhere; }
.app-footer { display: flex; justify-content: space-between; gap: 18px; max-width: 1120px; width: calc(100% - 64px); padding: 20px 0 26px; margin: 0 auto; border-top: 1px solid var(--border); color: #7b8071; font-size: 10px; line-height: 1.6; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
noscript { display: block; margin: 32px; font-family: sans-serif; }

@media (max-width: 760px) {
  .app-header { padding: 20px 24px; }
  .main-content { width: calc(100% - 48px); margin-top: 32px; }
  .intake-grid { grid-template-columns: 1fr; gap: 16px; }
  .context-panel { padding: 24px; }
  .review-steps { gap: 14px; }
  .page-heading { align-items: flex-start; }
  .preview-badge { margin-top: 27px; font-size: 10px; padding: 7px 9px; }
  .metadata-grid { grid-template-columns: 1fr; gap: 16px; }
  .panel { padding: 22px; }
  .preview-heading { align-items: flex-start; }
  .preview-heading h2 { font-size: 21px; }
  .validated-badge { font-size: 10px; padding: 7px 9px; }
  .archive-table th:first-child { width: 29%; }
  .archive-table th:nth-child(2) { width: 17%; }
  .archive-table th:last-child { width: 54%; }
  .archive-table td { padding-right: 10px; }
  .archive-hash { font-size: 9px; }
  .app-footer { width: calc(100% - 48px); flex-direction: column; gap: 4px; }
}

@media (max-width: 420px) {
  .app-header { padding: 17px 18px; gap: 12px; align-items: flex-start; }
  .brand { gap: 9px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-name { font-size: 13px; }
  .brand-context { font-size: 11px; }
  .environment-label { max-width: 70px; text-align: right; line-height: 1.5; font-size: 10px; }
  .main-content { width: calc(100% - 32px); }
  .page-heading { gap: 10px; }
  .page-description { font-size: 13px; }
  .preview-badge { gap: 5px; }
  .panel, .context-panel { padding: 19px; }
  .preview-heading { flex-direction: column; gap: 12px; }
  .metadata-list > div { grid-template-columns: minmax(85px, .8fr) minmax(0, 1.2fr); gap: 12px; }
  .validity-panel { align-items: flex-start; flex-direction: column; gap: 12px; }
  .empty-preview { padding: 30px 20px; gap: 12px; }
  .empty-preview h2 { font-size: 13px; line-height: 1.5; }
  .app-footer { width: calc(100% - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Staff workflow; the original preview styles remain available to the standalone review server. */
a { color: var(--accent); }
a:focus-visible, select:focus-visible { outline: 3px solid #946010; outline-offset: 4px; }
.header-actions, .session-chip { display: flex; align-items: center; gap: 20px; }
.session-chip { font-size: 12px; gap: 13px; border-left: 1px solid var(--border); padding-left: 20px; }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 5px 0; font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }
.text-button:hover { text-decoration: underline; }
.text-button:disabled { color: #85877d; cursor: wait; }
.text-link { font-size: 12px; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; padding: 9px 13px; border: 1px solid #d7dacf; border-radius: 6px; background: #fff; color: #454c3c; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.6; }
.secondary-button:hover:not(:disabled) { background: #f4f5ef; }
.secondary-button:disabled { color: #868b7e; cursor: wait; }
.login-layout { display: grid; grid-template-columns: 1fr minmax(280px, 400px); align-items: start; gap: 90px; margin: 60px auto; max-width: 970px; }
.login-intro h1 { max-width: 440px; font-size: 44px; line-height: 1.16; }
.login-intro > .field-help { margin-top: 24px; max-width: 390px; }
.login-panel { padding: 32px; }
.login-panel h2, .user-form h2, .admin-layout h2, .job-panel h2, .panel > .split-heading > h2 { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.login-panel form { margin-top: 24px; }
.login-panel .error-panel { margin: 20px 0 0; padding: 14px; }
.login-panel .error-panel h2 { font-size: 12px; }
.login-button { width: 100%; margin-top: 6px; }
.form-field { margin: 17px 0; min-width: 0; }
.text-input { display: block; width: 100%; font: inherit; font-size: 13px; color: #30342b; padding: 11px 12px; margin-top: 7px; border: 1px solid #ced3c4; border-radius: 6px; background: #fff; min-height: 40px; }
.text-input::placeholder { color: #878d7d; font-size: 12px; }
.staff-nav { display: flex; flex-wrap: wrap; gap: 24px; border-bottom: 1px solid var(--border); margin: -20px 0 34px; }
.nav-button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: #686f5e; font: inherit; font-size: 13px; padding: 14px 2px 17px; cursor: pointer; }
.nav-button:hover { color: var(--accent); }
.nav-button.active { color: #805616; border-bottom-color: #a6782b; font-weight: 650; }
.notice-panel { padding: 14px 18px; border: 1px solid #d1deca; border-radius: 8px; color: #435b3a; background: #edf4e8; font-size: 12px; line-height: 1.65; margin-bottom: 22px; overflow-wrap: anywhere; }
.split-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ca-status { margin: 21px 0 9px; font-size: 14px; font-weight: 650; }
.ca-status.ready { color: #42633a; }
.ca-status.unavailable { color: #875a20; }
.ca-panel .evidence-list { gap: 12px; margin: 16px 0; }
.ca-panel .evidence-list dd { font-size: 11px; }
.staff-empty { margin-top: 28px; }
.staff-review { margin-top: 38px; }
.record-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.state-badge { display: inline-block; white-space: normal; color: #666c5a; background: #eef0e7; padding: 6px 9px; border-radius: 4px; font-size: 10px; font-weight: 650; line-height: 1.5; letter-spacing: .15px; }
.state-valid, .state-succeeded { color: #3c6033; background: #e9f1e4; }
.state-invalid, .state-result_unknown { color: #8f402b; background: #f9e7df; }
.state-signing { color: #825a17; background: #fbefd3; }
.compact-grid { margin-top: 14px; }
.compact-grid .metadata-list, .compact-grid .evidence-list { margin-top: 0; }
.sidecar-section { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--border); }
.sidecar-section h4 { font-size: 12px; color: #655c46; margin: 0; }
.sidecar-section .warning-panel { margin-top: 18px; }
.confirmation-panel { border-color: #d2bf97; background: #fffefa; }
.confirmation-panel .warning-panel { margin: 18px 0; }
.confirmation-check { display: flex; gap: 11px; align-items: flex-start; font-size: 12px; line-height: 1.8; margin: 20px 0; cursor: pointer; }
.confirmation-check input, .role-option input { width: 16px; height: 16px; accent-color: #946010; margin: 3px 0 0; flex: 0 0 16px; }
.job-panel { margin-top: 24px; }
.job-panel > .warning-panel { margin-top: 18px; }
.job-succeeded { border-color: #c7d8bd; }
.job-result_unknown { border-color: #dbb395; }
.job-panel > .secondary-button { margin-top: 22px; }
.download-button { display: inline-block; text-decoration: none; margin-top: 22px; margin-right: 12px; }
.filter-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .55fr) auto; align-items: end; gap: 16px; }
.filter-form .form-field { margin: 0; }
.filter-form > button { margin-bottom: 1px; min-height: 40px; }
.data-table-wrap { margin-top: 24px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table th { color: #727963; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 650; padding: 0 14px 12px 0; border-bottom: 1px solid #dce0d3; }
.data-table td { padding: 15px 16px 15px 0; border-bottom: 1px solid #ecefe4; vertical-align: top; line-height: 1.65; max-width: 270px; overflow-wrap: anywhere; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td strong { font-weight: 600; }
.cell-secondary { display: block; color: #747b68; font-size: 11px; line-height: 1.65; margin-top: 3px; }
.hash-cell { min-width: 170px; font-size: 10px; overflow-wrap: anywhere; }
.table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 90px; }
.empty-message { color: var(--muted); font-size: 13px; padding: 28px 0 12px; line-height: 1.65; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.role-fields { border: 1px solid #e1e5d9; border-radius: 8px; padding: 12px 14px 15px; margin: 22px 0; }
.role-fields legend { font-size: 12px; font-weight: 600; color: #4f5743; padding: 0 5px; }
.role-option { display: flex; align-items: flex-start; gap: 10px; margin: 9px 0 14px; cursor: pointer; }
.role-option strong { font-size: 11px; font-weight: 650; }
.role-option .cell-secondary { margin-top: 0; font-size: 10px; }
.user-form > form > .primary-button { margin-top: 15px; }

@media (max-width: 920px) {
  .login-layout { gap: 40px; }
  .login-intro h1 { font-size: 37px; }
  .admin-layout { grid-template-columns: 1fr; }
  .user-form { max-width: 600px; }
}

@media (max-width: 760px) {
  .header-actions { gap: 10px; align-items: flex-end; flex-direction: column; }
  .session-chip { border: 0; padding: 0; gap: 10px; font-size: 11px; }
  .login-layout { grid-template-columns: 1fr; gap: 28px; margin: 16px auto 35px; max-width: 470px; }
  .login-intro h1 { font-size: 34px; }
  .login-intro > .field-help { margin-top: 15px; }
  .login-panel { padding: 26px; }
  .staff-nav { margin-top: -12px; gap: 18px; }
  .nav-button { font-size: 12px; padding-bottom: 14px; }
  .filter-form { grid-template-columns: minmax(0, 1fr) minmax(140px, .65fr); }
  .filter-form > button { grid-column: 1 / -1; justify-self: start; }
  .data-table { min-width: 540px; }
  .compact-grid { gap: 24px; }
  .staff-review .preview-heading h2 { overflow-wrap: anywhere; }
}

@media (max-width: 420px) {
  .session-chip > span { display: none; }
  .staff-nav { gap: 14px; }
  .nav-button { font-size: 11px; }
  .filter-form { grid-template-columns: 1fr; }
  .filter-form > button { grid-column: auto; }
  .split-heading { align-items: flex-start; }
  .job-panel .split-heading { flex-direction: column; gap: 10px; }
}

/* V004: certificate status */
.state-expiring { background: #fff3cd; color: #7a5600; }
.state-expired { background: #f8d7da; color: #842029; }
.state-superseded { background: #e2e3e5; color: #41464b; }
.state-succeeded { background: #d1e7dd; color: #0f5132; }
.delete-account { margin-top: 24px; }
.delete-account .field-help { margin: 8px 0 12px; }
.danger-button { color: #a3271f; border-color: #e4b3ae; }
.danger-button:disabled { color: inherit; border-color: inherit; opacity: .55; }
