:root {
  --bg: #e7edf5;
  --bg-deep: #dbe4ef;
  --card: #ffffff;
  --card-alt: #f5f8fc;
  --text: #16253b;
  --muted: #5c6d86;
  --line: #c8d4e3;
  --line-strong: #aebed2;
  --cap-blue-900: #0f2747;
  --cap-blue-700: #1b4f91;
  --cap-blue-500: #3f6fa7;
  --cap-red: #bf3d31;
  --cap-red-soft: #fce5e2;
  --cap-gold: #b8872f;
  --cap-gold-soft: #f8efd7;
  --cap-green: #1e6b43;
  --cap-green-soft: #e1f4e8;
  --cap-silver: #d8e0ea;
  --cap-silver-deep: #93a7bf;
  --shadow: 0 18px 38px rgba(15, 39, 71, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

header {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 38%),
    linear-gradient(135deg, var(--cap-blue-900) 0%, #163a68 52%, var(--cap-blue-700) 100%);
  color: #fff;
  padding: 34px 32px 76px;
  border-bottom: 5px solid var(--cap-red);
}

header::after {
  content: "";
  position: absolute;
  inset: auto -6% -54px auto;
  width: min(420px, 48vw);
  height: 180px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(216, 224, 234, 0.24), rgba(216, 224, 234, 0));
  transform: rotate(-11deg);
  border-radius: 28px;
}

header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  letter-spacing: 0.01em;
}

.header-title-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  font-weight: 800;
}

header p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 920px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.55;
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 32px 40px;
}

.upload-page {
  max-width: 980px;
}

.upload-gate,
.dashboard-topbar {
  margin-top: 24px;
}

.upload-gate {
  display: grid;
  place-items: start center;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.upload-card,
.card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(174, 190, 210, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.upload-card {
  padding: 20px;
  border-top: 5px solid var(--cap-blue-700);
}

.upload-panel {
  width: min(100%, 760px);
  padding: 28px;
}

.upload-panel h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.upload-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.card {
  padding: 20px;
}

.upload-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(174, 190, 210, 0.7);
}

.upload-panel-footer .note {
  margin: 0;
}

.changelog-page {
  max-width: 980px;
}

.changelog-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(174, 190, 210, 0.84);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.changelog-topbar strong {
  font-size: 1.15rem;
  color: var(--cap-blue-900);
}

.changelog-entries {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.changelog-entry {
  border-left: 5px solid var(--cap-blue-700);
}

.changelog-entry-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.changelog-entry-heading h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--cap-blue-900);
}

.changelog-entry-heading .note {
  margin: 0;
  font-size: 0.85rem;
}

.changelog-list {
  margin: 14px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.changelog-list li {
  margin-bottom: 6px;
}

.changelog-list li:last-child {
  margin-bottom: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--cap-red);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--cap-blue-900);
}

.upload-card small,
.note {
  color: var(--muted);
  line-height: 1.5;
}

.upload-card code,
.note code {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--cap-blue-900);
}

.status-banner {
  margin: 16px 0 0;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 600;
}

.status-banner.info {
  background: #edf4ff;
  border-color: #c2d7f0;
  color: #20446f;
}

.status-banner.success {
  background: var(--cap-green-soft);
  border-color: #a7d6ba;
  color: var(--cap-green);
}

.status-banner.error {
  background: var(--cap-red-soft);
  border-color: #efb8b0;
  color: #8f2920;
}

input[type="file"],
input[type="search"],
input[type="text"],
input[type="number"],
select,
textarea,
.action-chip,
.primary-button,
.secondary-button {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input[type="file"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus,
.tab:focus,
.action-chip:focus,
.primary-button:focus,
.secondary-button:focus {
  outline: none;
  border-color: var(--cap-blue-700);
  box-shadow: 0 0 0 4px rgba(27, 79, 145, 0.14);
}

input[type="file"].visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.file-drop-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 132px;
  padding: 20px;
  border: 2px dashed var(--line-strong);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(239, 245, 252, 0.96)),
    #fff;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.file-drop-zone.drag-over {
  border-color: var(--cap-blue-700);
  background: #edf4ff;
  box-shadow: 0 0 0 4px rgba(27, 79, 145, 0.12);
}

.file-drop-zone strong {
  display: block;
  margin-bottom: 6px;
  color: var(--cap-blue-900);
  font-size: 1.05rem;
}

.file-drop-zone span {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.primary-button,
.secondary-button {
  width: auto;
  min-width: 130px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cap-blue-900), var(--cap-blue-700));
  color: #fff;
}

.secondary-button {
  border-color: rgba(174, 190, 210, 0.9);
  background: #fff;
  color: var(--cap-blue-900);
}

.danger-button {
  border-color: #dcb4af;
  color: #8f2e23;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(174, 190, 210, 0.84);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.dashboard-topbar strong {
  display: block;
  color: var(--cap-blue-900);
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.tab {
  border: 1px solid rgba(174, 190, 210, 0.9);
  background: rgba(255, 255, 255, 0.92);
  color: var(--cap-blue-900);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tab:hover,
.action-chip:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: linear-gradient(135deg, var(--cap-blue-900), var(--cap-blue-700));
  color: #fff;
  border-color: transparent;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(174, 190, 210, 0.84);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.98)),
    #fff;
  box-shadow: 0 12px 26px rgba(15, 39, 71, 0.08);
}

.stalled-blockers {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.stalled-blockers:empty {
  display: none;
}

.summary-card {
  padding: 14px 16px;
  border: 1px solid rgba(174, 190, 210, 0.84);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
}

.summary-card .action-chip {
  width: 100%;
  margin-top: 12px;
}

.stat .num {
  font-size: 2.05rem;
  font-weight: 800;
  line-height: 1;
  color: var(--cap-blue-900);
}

.summary-num {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  color: var(--cap-blue-900);
}

.stat .label {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.print-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.print-report {
  display: none;
}

#milestonesView > .paired-section + .paired-section,
#milestonesView > .paired-section + .card {
  margin-top: 18px;
}

#printReportsView > .card + .card {
  margin-top: 18px;
}

.paired-section {
  --paired-card-height: 680px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: stretch;
}

.paired-section > .card {
  display: flex;
  flex-direction: column;
  height: var(--paired-card-height);
  min-width: 0;
  min-height: 0;
}

.paired-section .table-wrap {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.section-sort select {
  width: auto;
  min-width: 132px;
  padding: 8px 10px;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  color: var(--cap-blue-900);
}

.card-heading h2 {
  margin-bottom: 8px;
}

h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.controls {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr;
  gap: 12px;
  margin-bottom: 14px;
}

.attendance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.attendance-entry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.attendance-entry-label {
  display: grid;
  gap: 8px;
  color: var(--cap-blue-900);
  font-weight: 800;
}

.attendance-targets,
.attendance-actions,
.attendance-export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attendance-targets {
  margin-top: 14px;
}

.attendance-targets label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--cap-blue-900);
  font-size: 0.88rem;
  font-weight: 800;
}

.attendance-targets input {
  width: auto;
  accent-color: var(--cap-blue-700);
}

.attendance-actions {
  margin-top: 14px;
}

.attendance-export-buttons {
  margin-bottom: 12px;
}

.attendance-export-output {
  min-height: 118px;
  resize: vertical;
  line-height: 1.5;
}

.attendance-lists-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.attendance-list-panel {
  min-height: 220px;
}

.attendance-number-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attendance-number {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #d7e1ec;
  border-radius: 999px;
  background: #f3f7fb;
  color: var(--cap-blue-900);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  font-weight: 800;
}

.print-report-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) minmax(180px, 0.7fr);
  gap: 12px;
  margin-bottom: 14px;
}

.print-report-controls label {
  display: grid;
  gap: 8px;
  color: var(--cap-blue-900);
  font-weight: 800;
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.inline-input span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.promotion-picker {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-alt);
}

.promotion-picker-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.promotion-picker-heading > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.promotion-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.promotion-picker-grid label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.promotion-picker-grid input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--cap-blue-700);
}

.print-report-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #d7e1ec;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  color: var(--cap-blue-900);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

tbody tr:nth-child(even) td {
  background: rgba(245, 248, 252, 0.65);
}

tr:hover td {
  background: rgba(228, 238, 249, 0.8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.cell-detail {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.overdue {
  background: var(--cap-red-soft);
  color: #972e24;
}

.soon {
  background: var(--cap-gold-soft);
  color: #8d6418;
}

.ready {
  background: var(--cap-green-soft);
  color: var(--cap-green);
}

.complete {
  background: var(--cap-green);
  color: #fff;
}

.notready,
.future {
  background: #edf2f8;
  color: #4d6078;
}

.progress {
  width: 124px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  background: #dbe4ef;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cap-blue-700), #5b83b7);
}

.missing-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #d7e1ec;
  background: #f3f7fb;
  color: #3d4f67;
  font-size: 0.76rem;
}

.pill-incomplete {
  border-color: #efb8b0;
  background: var(--cap-red-soft);
  color: #972e24;
}

.pill-complete {
  border-color: #a7d6ba;
  background: var(--cap-green-soft);
  color: var(--cap-green);
}

.action-chip {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 12px;
}

.action-chip:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.achievement-name {
  color: var(--cap-blue-900);
}

.achievement-rank {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.cadet-actions {
  margin-top: 10px;
}

.action-chip.exclude {
  border-color: #dcb4af;
  background: #fff5f3;
  color: #8f2e23;
}

.action-chip.include {
  border-color: #a7d6ba;
  background: #effaf3;
  color: var(--cap-green);
}

.excluded-list {
  display: grid;
  gap: 10px;
}

.paired-section .excluded-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.excluded-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
}

.excluded-meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--cap-blue-900);
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  /* Hiding always wins over a component's own display rule. */
  display: none !important;
}

.site-footer {
  padding: 0 32px 28px;
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0.3rem 0;
}

.site-footer a {
  color: var(--cap-blue-700);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .section-grid,
  .controls,
  .paired-section,
  .attendance-layout,
  .attendance-lists-grid,
  .print-report-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  header {
    padding: 28px 20px 68px;
  }

  main {
    padding: 0 18px 28px;
  }

  .site-footer {
    padding: 0 18px 22px;
  }

  .card-heading,
  .dashboard-topbar,
  .file-drop-zone,
  .excluded-item,
  .upload-panel-footer,
  .changelog-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-panel {
    padding: 22px;
  }

  .section-tools {
    justify-content: flex-start;
  }

  .attendance-entry-form {
    grid-template-columns: 1fr;
  }
}

@media print {
  header,
  .upload-page,
  .changelog-page,
  .upload-grid,
  .dashboard-topbar,
  .status-banner,
  .tabs,
  .controls,
  .action-chip {
    display: none;
  }

  main {
    padding: 0;
  }

  .card,
  .stat {
    box-shadow: none;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }

  body.printing-report {
    background: #fff;
  }

  body.printing-report header,
  body.printing-report main,
  body.printing-report .site-footer {
    display: none !important;
  }

  body.printing-report .print-report:not(:empty) {
    display: block;
    padding: 0;
  }

  .print-report,
  .print-report * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .print-report-header {
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #111;
  }

  .print-report-header h1 {
    margin: 0 0 6px;
    color: #111;
    font-size: 20pt;
  }

  .print-report-header p {
    margin: 0;
    color: #333;
    font-size: 10pt;
  }

  .print-section {
    margin-bottom: 18px;
    break-before: page;
    page-break-before: always;
  }

  .print-report-header + .print-section {
    break-before: auto;
    page-break-before: auto;
  }

  .print-section h2 {
    margin: 0 0 7px;
    color: #111;
    font-size: 14pt;
    break-after: avoid;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }

  .print-table th,
  .print-table td {
    padding: 6px 8px;
    border: 1px solid #777;
    color: #111;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    background: #e8e8e8;
    font-weight: 800;
  }

  .print-table tbody tr:nth-child(even) td {
    background: #e5e5e5;
  }

  .print-name-columns th,
  .print-name-columns td {
    width: 33.333%;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-table tr {
    break-inside: avoid;
  }

  .print-empty {
    color: #555;
    font-style: italic;
  }

  .certificate-page {
    break-before: page;
    page-break-before: always;
    page: certificate;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  /* One deliberately empty sheet leads the run; the first certificate breaks past it. */
  .certificate-blank-page {
    page: certificate;
    display: block;
    box-sizing: border-box;
    height: 100vh;
    margin: 0;
    padding: 0;
  }

  /* No cover header precedes the first certificate, so it must not force a blank leading sheet. */
  .certificate-page:first-child {
    break-before: auto;
    page-break-before: auto;
  }
}

/* Promotion certificates copy the slide deck: a 10in x 5.625in sheet with every element
   placed at the deck's coordinates by inline styles. */
.certificate-sheet {
  position: relative;
  width: 10in;
  height: 5.625in;
  overflow: hidden;
  background: #fff;
  color: #001689;
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
}

.cert-art {
  position: absolute;
  display: block;
}

.cert-art-cropped {
  overflow: hidden;
}

.cert-art-cropped img {
  position: absolute;
  max-width: none;
}

.cert-text {
  position: absolute;
  box-sizing: border-box;
  padding: 0.1in;
  text-align: center;
}

.cert-text p {
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.cert-large {
  font-size: 26pt;
}

.cert-small {
  font-size: 12pt;
}

/* The deck keeps the date at one height whether this sentence takes one line or two. */
.cert-text .cert-requirements {
  min-height: 2.4em;
  white-space: normal;
}

/* The rule under the name sits just clear of its descenders, where the deck draws it. */
.cert-text .cert-name {
  /* A long name shrinks, but its line keeps the full-size height so nothing below moves. */
  line-height: 31.2pt;
  padding-bottom: 0.05in;
  border-bottom: 0.75pt solid #595959;
}

@page certificate {
  size: landscape;
  margin: 0;
}
