:root {
  color-scheme: light;
  --ink: #17232b;
  --subtle: #495b65;
  --canvas: #f4f7f8;
  --paper: #fff;
  --line: #c4cfd4;
  --brand: #075c60;
  --brand-dark: #06494c;
  --brand-pale: #e8f3f2;
  --danger: #992e21;
  --danger-pale: #fff2ef;
  --focus: #1b6fc5;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: var(--brand); text-underline-offset: .17em; }
a:hover { color: var(--brand-dark); }
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
p { margin: 0 0 .8rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.022em; margin: 0 0 .6rem; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); font-weight: 720; }
h2 { font-size: 1.24rem; }
h3 { font-size: 1.06rem; }
img { max-width: 100%; height: auto; }
input, textarea, select, button { font: inherit; }
input[type="checkbox"], input[type="radio"] {
  width: 1.17rem;
  height: 1.17rem;
  margin: 0;
  accent-color: var(--brand);
  flex: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea, select {
  display: block;
  max-width: 100%;
  padding: .55rem .68rem;
  border: 1px solid #93a5ae;
  border-radius: .4rem;
  color: var(--ink);
  background: var(--paper);
}
input[type="text"], input[type="password"], textarea { width: 100%; }
textarea { min-height: 7rem; resize: vertical; }
[hidden] { display: none !important; }
.skip-link {
  position: absolute;
  z-index: 5;
  top: .4rem;
  left: .4rem;
  padding: .55rem .75rem;
  background: var(--paper);
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }
.site-header { background: var(--paper); border-bottom: 1px solid #dbe2e6; }
.topbar, .container {
  width: min(100% - 2rem, 68rem);
  margin-inline: auto;
}
.topbar { min-height: 4.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.topbar-links, .actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.identity { display: inline-flex; gap: .55rem; align-items: center; font-weight: 750; text-decoration: none; color: var(--ink); }
.identity-mark {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  background: var(--brand);
  color: white;
  border-radius: .38rem;
  font-size: 1.38rem;
  line-height: 1;
}
.container { padding-block: 2.25rem 3rem; }
.narrow { max-width: 31rem; }
.work-container { max-width: 56rem; }
.eyebrow { font-size: .82rem; color: var(--subtle); font-weight: 680; margin-bottom: .35rem; }
.muted { color: var(--subtle); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.panel {
  padding: clamp(1rem, 3.5vw, 1.65rem);
  border-radius: .75rem;
  background: var(--paper);
  border: 1px solid #dbe2e6;
}
.panel > :last-child, .notice > :last-child { margin-bottom: 0; }
.button, button:not(.link-button) {
  display: inline-flex;
  min-height: 2.55rem;
  justify-content: center;
  align-items: center;
  padding: .45rem .8rem;
  border: 1px solid transparent;
  border-radius: .42rem;
  background: var(--brand);
  color: white;
  line-height: 1.2;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.button:hover, button:not(.link-button):hover { background: var(--brand-dark); color: white; }
.button.secondary, button.secondary {
  background: var(--paper);
  color: var(--brand);
  border-color: var(--line);
}
.button.secondary:hover, button.secondary:hover { background: var(--brand-pale); color: var(--brand-dark); }
.button.danger, button.danger { background: var(--danger); color: white; }
button:disabled { opacity: .65; cursor: default; }
.link-button {
  border: 0;
  padding: .3rem;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .17em;
}
.lang-switch { display: inline-flex; border: 1px solid #d0dade; border-radius: .42rem; padding: .12rem; gap: .12rem; }
.lang-switch a {
  padding: .2rem .48rem;
  border-radius: .28rem;
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}
.lang-switch [aria-current="true"] { color: var(--ink); background: var(--brand-pale); }
.notice, .error, .status { padding: .62rem .8rem; border-radius: .38rem; }
.notice, .status { background: var(--brand-pale); color: #174649; }
.error, .notice.error, .status.offline { background: var(--danger-pale); color: var(--danger); }
.errorlist { color: var(--danger); }
.message-stack { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 660; margin-bottom: .3rem; }
.staff-entry { margin-top: 1rem; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-block: .35rem .75rem; }
th, td { border: 1px solid #87949a; padding: .47rem .6rem; text-align: left; vertical-align: top; }
th { font-weight: 670; }
.material-cell-label { display: none; }
.material-choice-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.stages { display: grid; gap: .75rem; margin: 1.4rem 0; }
.stage-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 1rem; }
.stage-card p:last-child { margin-bottom: 0; }
.stage-card-status { color: var(--subtle); }
.stage-deadline { margin-bottom: .45rem; }
.work-title { margin-bottom: 1rem; }
.work-bar {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--paper);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
  padding: .7rem .85rem;
  border: 1px solid #ccd7dc;
  border-radius: .55rem;
  margin-bottom: .75rem;
}
.preview-bar { grid-template-columns: 1fr auto; }
.work-bar #submit-work { grid-column: -2; grid-row: 1; }
.clock { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 760; font-size: 1.13rem; }
.clock-label { display: block; font-size: .73rem; font-weight: 590; color: var(--subtle); }
.save-state { grid-column: 2; grid-row: 1; font-size: .9rem; line-height: 1.3; color: var(--subtle); }
.preview-bar .save-state { grid-column: 1; }
.save-state[data-state="saved"] { color: var(--brand-dark); }
.save-state[data-state="offline"], .save-state[data-state="error"] { color: var(--danger); }
.work-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; }
.question-nav { padding-block: .65rem; }
.question-nav .actions { gap: .35rem; }
.question-link {
  display: grid;
  min-width: 2rem;
  min-height: 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .3rem;
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.question-link[data-answered="true"] { background: var(--brand-pale); border-color: #6b9e9f; }
.question-link:hover { text-decoration: underline; }
.question { scroll-margin-top: 6rem; }
.question fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.question legend { width: 100%; font-size: 1.075rem; font-weight: 670; margin-bottom: .6rem; padding: 0; }
.content-block { margin-block: .6rem; }
.content-block:last-child { margin-bottom: 0; }
.content-block p { white-space: pre-wrap; }
.image-block { margin: .6rem 0; }
.image-block img { display: block; max-height: 30rem; object-fit: contain; object-position: left; }
.image-block a { display: inline-block; }
.image-block figcaption { margin-top: .35rem; color: var(--subtle); }
.choice-list { display: grid; gap: .22rem; margin-top: .5rem; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: .58rem;
  min-height: 2.35rem;
  padding: .35rem .25rem;
  cursor: pointer;
}
.choice input { margin-top: .16rem; }
.choice-number { font-variant-numeric: tabular-nums; }
.cell-choice {
  min-width: 2.4rem;
  padding: .15rem .2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.choice-help { color: var(--subtle); margin: .3rem 0 .55rem; font-size: .91rem; }
.answer-summary { display: grid; gap: .5rem; margin: .6rem 0 0; }
.answer-summary dt { font-weight: 660; }
.answer-summary dd { margin: 0; white-space: pre-wrap; }
.receipt-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .24rem .7rem; margin: .65rem 0; }
.receipt-meta dt { font-weight: 650; }
.receipt-meta dd { margin: 0; overflow-wrap: anywhere; }
.receipt-id { font-variant-numeric: tabular-nums; }
dialog {
  width: min(100% - 2rem, 31rem);
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: 1.2rem;
  color: var(--ink);
}
dialog::backdrop { background: #18282c70; }
.conflict-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.conflict-answers dl { margin: 0; overflow-wrap: anywhere; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 35rem) {
  .container, .topbar { width: calc(100% - 1.5rem); }
  .container { padding-block: 1.2rem 2rem; }
  .topbar {
    display: grid;
    justify-content: stretch;
    min-height: 0;
    padding-block: .65rem;
    gap: .35rem;
  }
  .topbar-links:empty { display: none; }
  .topbar-links { gap: .35rem .7rem; }
  .topbar-links > a, .topbar-links .link-button { padding-block: .55rem; }
  .lang-switch a { padding: .45rem .65rem; }
  .panel { padding: .85rem; }
  .stage-card { grid-template-columns: minmax(0, 1fr); row-gap: .6rem; }
  .stage-card > div:last-child:not(:has(a, button)) { display: none; }
  .stage-card .button, .stage-card .start-form button, .work-bar #submit-work { min-height: 2.75rem; }
  .work-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: .6rem;
    row-gap: .3rem;
    padding: .55rem .65rem;
  }
  .work-bar:not(.preview-bar) .save-state { grid-column: 1 / -1; grid-row: 2; }
  .question-nav .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.65rem, 1fr)); }
  .question-link { min-width: 0; min-height: 2.65rem; }
  .question { scroll-margin-top: 8.5rem; }
  .question legend { font-size: 1rem; }
  .choice { min-height: 2.75rem; padding-block: .5rem; }
  .clear-answer { min-height: 2.75rem; }
  th, td { padding: .38rem .46rem; }
  .material-table, .material-table tbody { display: block; }
  .material-table { margin: 0; }
  .material-table thead, .material-table .material-choice-number {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .material-table tbody { display: grid; gap: .55rem; }
  .material-table tbody tr {
    display: block;
    min-width: 0;
    padding-inline: .65rem;
    border: 1px solid var(--line);
    border-radius: .45rem;
  }
  .material-table td {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .65rem;
    padding: .43rem 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .material-table td + td { border-top: 1px solid #e2e8eb; }
  .material-table .material-cell-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--subtle);
  }
  .material-table tbody tr:has(input:checked) { border-color: var(--brand); }
  .material-table .material-choice-cell { display: block; padding: 0; }
  .material-table .cell-choice { justify-content: flex-start; gap: .55rem; min-height: 2.75rem; padding: .3rem 0; }
  .material-choice-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; font-weight: 670; }
  .receipt-meta { grid-template-columns: minmax(0, 1fr); }
  .receipt-meta dd { margin-bottom: .35rem; }
  .conflict-answers { grid-template-columns: 1fr; }
}
