:root {
  color-scheme: light;
  --navy: #173a5e;
  --blue: #24679b;
  --blue-2: #2f7db6;
  --pale: #eef5fa;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #5d6b78;
  --line: #cbd8e3;
  --green: #17825c;
  --red: #c33b34;
  --amber: #cf7b13;
  --gray: #65717c;
  --shadow: 0 5px 18px rgba(23, 58, 94, 0.09);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #edf2f6;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

:focus-visible {
  outline: 3px solid #f4b942;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 6px;
  z-index: 50;
  background: #fff;
  color: var(--navy);
  padding: 8px 12px;
  border-radius: 4px;
}
.skip-link:focus { left: 8px; }

.site-header {
  padding: 24px clamp(18px, 4vw, 54px) 20px;
}
.site-header .eyebrow { margin: 0 0 7px; }
.site-header h1 {
  max-width: 900px;
  margin: 0 0 8px;
  color: var(--navy);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.15;
}
.site-header .brand-block > p:last-child { margin: 0; }
.version-card { margin-top: 10px; }

.cover {
  background: linear-gradient(120deg, var(--navy), #2d78ac);
  color: white;
  padding: 28px clamp(18px, 4vw, 54px) 24px;
}

.cover h1 {
  max-width: 1180px;
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.cover .subtitle { margin: 0; font-size: 16px; opacity: 0.96; }
.cover .revision { margin: 9px 0 0; font-size: 12px; opacity: 0.83; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px clamp(12px, 3vw, 34px);
  background: #102f4b;
  box-shadow: var(--shadow);
}

.toolbar button, .toolbar .file-button {
  border: 0;
  border-radius: 5px;
  padding: 8px 11px;
  color: #fff;
  background: #266ea3;
  font-weight: 700;
  white-space: nowrap;
}
.toolbar button:hover, .toolbar .file-button:hover { filter: brightness(1.1); }
.toolbar .positive { background: var(--green); }
.toolbar .warning { background: var(--amber); }
.toolbar .danger { background: var(--red); }
.toolbar .secondary { background: #56687a; }
.toolbar .file-button input { display: none; }
.toolbar .save-status { margin-left: auto; color: #dcebf7; font-size: 12px; }

main {
  width: min(1480px, calc(100% - 24px));
  margin: 16px auto 54px;
}

.panel {
  background: var(--panel);
  border: 1px solid #dce5ec;
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin: 0 0 14px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 13px;
  padding-left: 10px;
  border-left: 4px solid var(--blue-2);
  color: var(--navy);
  font-size: 18px;
}

.notice {
  border-left: 4px solid var(--blue-2);
  background: #f4f9fd;
  padding: 12px 14px;
  color: #34495a;
}
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 11px 13px;
}
.grid .wide { grid-column: span 2; }

.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label, .field-label {
  color: #536574;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

input[type="text"], input[type="date"], input[type="email"], select, textarea {
  width: 100%;
  border: 1px solid #adbfcc;
  border-radius: 5px;
  background: #fffef4;
  color: var(--ink);
  padding: 8px 9px;
}
textarea { min-height: 62px; resize: vertical; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 8px 12px;
}
.module-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #f9fbfd;
}
.module-option input { width: 18px; height: 18px; }
.module-actions { display: flex; gap: 8px; margin-top: 12px; }
.small-button {
  border: 1px solid #9eb3c3;
  border-radius: 5px;
  padding: 6px 9px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 8px;
}
.stat {
  border-radius: 7px;
  padding: 10px;
  background: var(--pale);
  text-align: center;
}
.stat strong { display: block; font-size: 22px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.progress-track { height: 9px; background: #dde7ee; border-radius: 99px; overflow: hidden; margin-top: 11px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #62b68e); transition: width .2s ease; }

.library-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(180px, .8fr) auto;
  gap: 10px;
  align-items: end;
}
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.button-row button {
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  background: #435f78;
  color: #fff;
  font-weight: 700;
}
.button-row .danger { background: var(--red); }
.library-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.section {
  margin-bottom: 12px;
  border: 1px solid #cbd8e3;
  border-radius: 9px;
  overflow: clip;
  background: #fff;
  box-shadow: 0 2px 9px rgba(23, 58, 94, 0.06);
}
.section-header {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 13px 16px;
  background: #dfeef8;
  color: var(--navy);
  text-align: left;
}
.section-header h2 { margin: 0; font-size: 17px; }
.section-header p { margin: 3px 0 0; color: #4e6578; font-size: 12px; font-weight: 400; }
.section-header .chevron { font-size: 18px; transition: transform .15s ease; }
.section-header[aria-expanded="false"] .chevron { transform: rotate(-90deg); }
.section-body { padding: 0; }
.section-body[hidden] { display: none; }
.source-strip {
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  background: #f7fafc;
  color: #5a6c7b;
  font-size: 12px;
}

.check-table-wrap { overflow-x: auto; }
.check-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.check-table col.code { width: 72px; }
.check-table col.req { width: 31%; }
.check-table col.evidence { width: 21%; }
.check-table col.ref { width: 15%; }
.check-table col.status { width: 125px; }
.check-table col.notes { width: auto; }
.check-table th {
  position: static;
  padding: 9px 8px;
  border: 1px solid #b9c9d6;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  text-align: left;
}
.check-table td {
  vertical-align: top;
  padding: 9px 8px;
  border: 1px solid #d5e0e8;
  background: #fff;
}
.check-table tbody tr:nth-child(even) td { background: #f8fafc; }
.check-table .item-code { color: #456078; font-weight: 700; }
.check-table .requirement { font-weight: 600; }
.check-table .evidence, .check-table .reference { color: #4f6170; font-size: 12px; }
.check-table .module-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.module-tag { border-radius: 99px; padding: 2px 6px; background: #e8f1f7; color: #315d7b; font-size: 10px; }
.status-select { font-weight: 700; background: #fff; }
.status-select[data-status="C"] { color: var(--green); border-color: var(--green); }
.status-select[data-status="NC"] { color: var(--red); border-color: var(--red); }
.status-select[data-status="NA"] { color: var(--gray); border-color: var(--gray); }
.status-select[data-status="DP"] { color: var(--amber); border-color: var(--amber); }
.row-notes textarea { min-height: 54px; background: #fff; }
.action-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.action-fields .full { grid-column: 1 / -1; }
.action-fields input { padding: 6px; background: #fff; }
.action-fields[hidden] { display: none; }

.editable-active [data-editable="true"] {
  outline: 2px dashed #e0a21d;
  outline-offset: 2px;
  background: #fffbea;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.summary-grid textarea { min-height: 100px; }

.footer {
  background: #dce6ed;
  color: #526270;
  padding: 18px;
  text-align: center;
  font-size: 12px;
}
.footer a { color: var(--navy); }

.no-results {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .module-grid { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .library-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 13px; }
  .site-header { padding: 18px 14px 16px; }
  .toolbar { position: static; }
  .toolbar .save-status { width: 100%; margin-left: 0; }
  main {
    width: min(calc(100% - 24px), 1480px);
    margin-top: 12px;
  }
  .panel { padding: 13px; }
  .grid, .module-grid, .library-row, .summary-grid { grid-template-columns: 1fr; }
  .grid .wide { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .check-table-wrap {
    margin: 0 7px 7px;
    border: 1px solid #d5e0e8;
    border-radius: 6px;
  }
  .check-table { min-width: 980px; }
}

@media print {
  body { background: #fff; font-size: 9pt; }
  .skip-link, .toolbar, .module-actions, .library-panel, .footer, .screen-only { display: none !important; }
  main { width: 100%; margin: 0; }
  .cover { padding: 14mm 12mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .panel, .section { box-shadow: none; break-inside: avoid-page; }
  .section-body[hidden] { display: block !important; }
  .section-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .check-table th { position: static; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .check-table td, .check-table th { padding: 5px; }
  input, select, textarea { border: 0; background: transparent !important; padding: 0; }
  textarea { min-height: 32px; }
  .action-fields[hidden] { display: grid !important; }
}
