:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5b667a;
  --line: #273248;
  --navy: #10213b;
  --blue: #1859a9;
  --paper: #fff;
  --warning-bg: #fff8e6;
  --warning-line: #d99000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #eef2f7;
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  background: var(--navy);
  color: white;
}

h1, h2, h3, p { margin-top: 0; }
.app-header h1 { margin-bottom: .25rem; font-size: clamp(1.5rem, 3vw, 2.25rem); }
.eyebrow { margin-bottom: .25rem; color: #b9d7ff; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.subtitle { margin-bottom: 0; color: #d5e4f8; }
.mode-badge { align-self: flex-start; border: 1px solid #8eb8ef; border-radius: 999px; padding: .35rem .7rem; white-space: nowrap; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 1.25rem; }
.controls, .warnings { margin-bottom: 1rem; padding: 1rem; border-radius: .6rem; background: white; box-shadow: 0 2px 14px rgb(16 33 59 / 8%); }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 1rem; }
label { display: grid; gap: .35rem; font-weight: 700; }
input, select, button { min-height: 44px; border-radius: .4rem; font: inherit; }
input, select { width: 100%; border: 1px solid #aeb7c5; padding: .55rem .65rem; background: white; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
button { border: 1px solid var(--blue); padding: .55rem 1rem; background: white; color: var(--blue); font-weight: 700; cursor: pointer; }
button.primary { background: var(--blue); color: white; }
button:disabled { cursor: not-allowed; opacity: .55; }
.status { margin: .75rem 0 0; color: var(--muted); }

.warnings { border-left: 5px solid var(--warning-line); background: var(--warning-bg); }
.warnings ul { margin-bottom: 0; }
.paper { padding: clamp(.7rem, 2vw, 1.5rem); background: var(--paper); box-shadow: 0 4px 24px rgb(16 33 59 / 12%); }
.paper-header h2 { margin-bottom: 1rem; text-align: center; font-family: Georgia, serif; letter-spacing: .03em; }
.identity-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; border: 2px solid var(--line); }
.identity-grid div { padding: .5rem; border-right: 1px solid var(--line); }
.identity-grid div:last-child { border-right: 0; }
.identity-grid dt { font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.identity-grid dd { margin: .15rem 0 0; min-height: 1.5em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1050px; border-collapse: collapse; table-layout: fixed; }
th, td { border: 1px solid var(--line); padding: .45rem .3rem; text-align: center; vertical-align: middle; }
thead th { background: #e7edf5; font-size: .82rem; }
.row-label { width: 34%; text-align: left; }
tbody th { text-align: left; font-weight: 650; }
td.blank-source { background: repeating-linear-gradient(135deg, #fafafa, #fafafa 7px, #f1f1f1 7px, #f1f1f1 14px); }
td.has-source a { color: #0d4f99; font-weight: 750; }
.source-notice { margin: .75rem 0; padding: .65rem; border: 1px solid #d8ab3c; background: #fff9e9; font-size: .9rem; }
.source-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.source-links a { border: 1px solid #9db1ca; border-radius: .3rem; padding: .3rem .5rem; color: #0d4f99; text-decoration: none; }
.certification-preview { margin-top: 2rem; }
.signature-lines { display: grid; grid-template-columns: 3fr 1fr; gap: 2rem; margin-top: 2.5rem; }
.signature-lines span { border-top: 1px solid var(--ink); padding-top: .25rem; }

@media (max-width: 760px) {
  .app-header { display: block; }
  .mode-badge { display: inline-block; margin-top: .75rem; }
  .filter-grid { grid-template-columns: 1fr; }
  main { padding: .65rem; }
}

@page { size: landscape; margin: .35in; }
@media print {
  body { background: white; font-size: 10pt; }
  .no-print, .app-header { display: none !important; }
  main { width: 100%; padding: 0; }
  .paper { padding: 0; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
  th, td { padding: .24rem .18rem; }
  .source-notice { font-size: 8pt; }
}
