:root {
  color-scheme: light dark;
  --navy: #09233f;
  --teal: #087f83;
  --ink: #152333;
  --muted: #5e6c7d;
  --paper: #f6f8fb;
  --card: #ffffff;
  --line: #d8e0e8;
  --focus: #f3a712;
}
* { box-sizing: border-box; }
*:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d1723;
  --card: #142333;
  --ink: #eef5fb;
  --muted: #b5c2cf;
  --line: #33485b;
  --teal: #5ed8cf;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--teal); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .75rem; z-index: 5; }
.topbar {
  background: var(--navy);
  color: #ffffff;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.brand { color: #ffffff; text-decoration: none; font-weight: 800; letter-spacing: .03em; }
.mark { color: #48c5bb; }
.nav { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.nav a, .nav button {
  color: #ffffff;
  background: transparent;
  border: 0;
  padding: .6rem .75rem;
  border-radius: .4rem;
  text-decoration: none;
  min-height: 44px;
}
.nav a:hover, .nav button:hover { background: #173b5d; }
.inline { display: inline; margin: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 1.25rem clamp(1rem, 4vw, 3rem) 4rem; }
.banner {
  background: #e5f5f3;
  color: #12484a;
  border-left: 5px solid var(--teal);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}
html[data-theme="dark"] .banner { background: #163b3c; color: #dffbf8; }
.eyebrow { color: var(--teal); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: 1rem;
  box-shadow: 0 4px 15px #09233f10;
}
.panel + .panel { margin-top: 1rem; }
.card h2, .card h3 { margin: .25rem 0 .5rem; }
.media {
  aspect-ratio: 4/3;
  background: #dfe8ef;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .55rem;
  margin: -.25rem -.25rem 1rem;
}
.media img { width: 100%; height: 100%; object-fit: cover; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; }
.meta dt { font-weight: 700; color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.tag { display: inline-block; border: 1px solid var(--line); padding: .2rem .5rem; border-radius: 2rem; font-size: .82rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .6rem 1rem;
  border: 1px solid var(--teal);
  border-radius: .45rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: #087f83; color: #ffffff; }
.secondary { background: transparent; color: var(--teal); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; margin: 1rem 0; }
.field { display: grid; gap: .35rem; flex: 1; min-width: 180px; }
.password-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; align-items: stretch; }
.password-toggle { white-space: nowrap; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: .7rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.field textarea { min-height: 120px; }
.candidate-picker { max-height: 34rem; overflow: auto; padding: .25rem; margin-bottom: 1rem; }
.selectable-card { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; align-items: start; cursor: pointer; }
.selectable-card input { width: 1.25rem; height: 1.25rem; grid-row: 1 / span 3; }
.selectable-card:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 35%, transparent); }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 34rem; }
.receipt-thumb { display: block; width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: .45rem; }
.receipt-preview { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }
.receipt-preview img { display: block; width: 100%; max-height: 70rem; object-fit: contain; border-radius: .45rem; }
.receipt-preview iframe { display: block; width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: .45rem; background: #ffffff; }
.comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.comparison pre { white-space: pre-wrap; overflow-wrap: anywhere; }
details summary { cursor: pointer; font-weight: 700; }
.notice { padding: .75rem 1rem; background: #fff5dc; color: #493400; border-left: 5px solid #e5a719; }
.error { padding: .75rem 1rem; background: #ffe5e5; color: #571515; border-left: 5px solid #be3b3b; }
html[data-theme="dark"] .notice { background: #493c17; color: #fff5cc; }
html[data-theme="dark"] .error { background: #4d2326; color: #ffe8e8; }
.pagination { display: flex; gap: .5rem; justify-content: center; margin: 1.5rem 0; }
.footer { color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 3rem; }
.qr { background: #ffffff; color: #09233f; padding: 1rem; border: 1px solid var(--line); text-align: center; break-inside: avoid; }
.qr img { display: block; width: min(100%, 320px); height: auto; margin: 0 auto .75rem; }
.qr-destination { font-size: .75rem; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .password-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .hero h1 { font-size: 1.7rem; }
  .receipt-preview { padding: .5rem; }
  .receipt-preview iframe { min-height: 60vh; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .meta { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .banner, .footer, .print-controls { display: none !important; }
  body, .page { background: #ffffff; margin: 0; padding: 0; max-width: none; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); gap: .25in; }
  .qr { border: 1px solid #777777; box-shadow: none; padding: .15in; }
  .qr img { width: 2.35in; }
  .qr a { display: none; }
}
