:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #1f2528;
  --muted: #5f6b70;
  --line: #d8dee0;
  --paper: #ffffff;
  --surface: #f3f6f5;
  --teal: #1d4f4a;
  --teal-hover: #143d39;
  --teal-soft: #e1efec;
  --gold: #d49b2a;
  --warn: #8a5200;
  --warn-bg: #fff5dd;
  --shadow: 0 14px 36px rgba(31, 37, 40, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
.file-drop {
  border-radius: 6px;
}

button,
.print-link {
  min-height: 42px;
  border: 0;
  padding: 0 16px;
  font-weight: 750;
  cursor: pointer;
}

button:disabled,
.print-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(29, 79, 74, 0.25);
  outline-offset: 2px;
}

select,
.search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfc9cc;
  padding: 0 12px;
  color: var(--ink);
  background: var(--paper);
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 750;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.65rem;
  line-height: 1.15;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 16px clamp(18px, 4vw, 48px);
  color: #ffffff;
  background: var(--teal);
  border-bottom: 5px solid var(--gold);
}

.eyebrow {
  margin-bottom: 3px;
  color: #dcebe8;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.roster-status {
  max-width: min(48vw, 620px);
  overflow: hidden;
  color: #e9f3f1;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 820px);
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.setup-panel,
.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.setup-panel {
  position: sticky;
  top: 20px;
}

.setup-section,
.search-panel,
.card-panel,
.review-panel {
  border: 1px solid rgba(31, 37, 40, 0.1);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.setup-section {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.section-heading p,
.detail-copy {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.step-number {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--teal);
  font-size: 0.85rem;
  font-weight: 850;
}

.file-drop {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1.5px dashed #91aaa5;
  background: #f8fbfa;
  cursor: pointer;
}

.file-drop input {
  width: 100%;
  color: var(--muted);
}

.file-title {
  font-weight: 800;
}

.file-detail {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.primary-button {
  color: #ffffff;
  background: var(--teal);
}

.print-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-hover);
}

.secondary-button {
  color: var(--teal);
  background: var(--teal-soft);
}

.text-button {
  padding-inline: 8px;
  color: var(--muted);
  background: transparent;
}

.mapping-section summary {
  color: var(--teal);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.field-grid,
.settings-section {
  display: grid;
  gap: 12px;
}

.search-panel,
.card-panel {
  padding: clamp(18px, 3vw, 28px);
}

.search-panel {
  display: grid;
  gap: 14px;
}

.search-label {
  margin-top: 6px;
}

.search-input {
  min-height: 56px;
  padding-inline: 16px;
  border-width: 2px;
  border-color: #829b97;
  font-size: 1.08rem;
}

.search-input:disabled {
  background: #eef1f0;
}

.search-summary {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.search-results {
  display: grid;
  gap: 8px;
}

.student-result {
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) minmax(135px, 1fr) minmax(110px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  text-align: left;
}

.student-result:hover,
.student-result.selected {
  border-color: #73958e;
  background: #f2f8f6;
}

.student-result.selected {
  box-shadow: inset 4px 0 0 var(--teal);
}

.result-name {
  font-weight: 850;
}

.result-detail,
.result-id {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-action {
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 800;
}

.no-results {
  padding: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.card-panel {
  display: grid;
  gap: 22px;
}

.card-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.print-area {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  background: #edf1f0;
}

.card-sheet {
  width: min(100%, 5in);
}

.empty-state {
  display: grid;
  min-height: 2.65in;
  place-items: center;
  border: 1px dashed #aeb9bc;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-weight: 700;
  text-align: center;
}

.credential-card {
  display: grid;
  gap: 10px;
  min-height: 2.65in;
  padding: 18px;
  border: 1.3px solid #273033;
  border-left: 6px solid var(--teal);
  border-radius: 6px;
  background: var(--paper);
  break-inside: avoid;
  page-break-inside: avoid;
}

.card-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
}

.card-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.15rem;
  line-height: 1.2;
}

.card-mark {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.credential-row {
  display: grid;
  grid-template-columns: 1.3in minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  min-height: 24px;
  border-bottom: 1px solid #e5e9ea;
}

.credential-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.credential-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.3;
}

.review-panel {
  padding: 16px 18px;
  border-color: #e5c87f;
  color: var(--warn);
  background: var(--warn-bg);
  box-shadow: none;
}

.review-panel p {
  margin-top: 5px;
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .setup-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .roster-status {
    max-width: 100%;
    text-align: left;
  }

  .student-result {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .result-detail,
  .result-id {
    grid-column: 1 / -1;
  }

  .result-action {
    grid-column: 2;
    grid-row: 1;
  }

  .card-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .print-area {
    min-height: 280px;
    padding: 12px;
  }
}

@media (max-width: 440px) {
  .file-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .credential-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-bottom: 4px;
  }
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.45in;
  }

  :root {
    --ink: #111111;
    --muted: #424242;
    --teal: #111111;
    --gold: #111111;
  }

  body {
    background: #ffffff;
  }

  .app-header,
  .setup-panel,
  .search-panel,
  .card-panel-heading,
  .review-panel {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .card-panel,
  .print-area {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .card-sheet {
    width: 5in;
    margin: 0;
  }

  .credential-card {
    min-height: 2.65in;
    box-shadow: none;
  }

  .credential-value {
    font-size: 9pt;
  }
}
