* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #182c23;
  background: #f3f6f2;
  --green: #145b43;
  --dark: #123d30;
  --muted: #4f6258;
  --line: #dbe5df;
  --white: #fff;
}
body { margin: 0; min-width: 300px; }
a { color: var(--green); }
.topbar { background: var(--dark); color: white; }
.topbar-inner { max-width: 1216px; min-height: 70px; margin: auto; padding: 0 28px; display: flex; align-items: center; gap: 40px; }
.brand { color: white; text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.mark { display: grid; place-items: center; border-radius: 9px; width: 34px; height: 34px; background: #b6e3c8; color: var(--dark); font-size: 25px; line-height: 1; }
nav { display: flex; gap: 5px; }
nav a { text-decoration: none; color: #e0f0e7; white-space: nowrap; padding: 9px 13px; border-radius: 7px; font-size: 14px; font-weight: 600; }
nav a:hover, nav a[aria-current] { color: white; background: #2a5647; }
.environment { margin-left: auto; color: #ddf4e6; border: 1px solid #659281; border-radius: 100px; padding: 5px 11px; white-space: nowrap; font-size: 12px; font-weight: 650; }
main { max-width: 1216px; margin: auto; padding: 39px 28px 56px; }
.page-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; column-gap: 24px; row-gap: 14px; margin-bottom: 25px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(32px, 5vw, 45px); letter-spacing: -.055em; line-height: 1.05; }
h2 { line-height: 1.3; font-size: 19px; letter-spacing: -.025em; }
p { color: var(--muted); line-height: 1.5; }
.page-heading p { margin-top: 8px; }
.date-label { color: var(--muted); font-size: 14px; font-weight: 650; }
.service-layout { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; align-items: start; }
.service-side { display: grid; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.scan-panel, .result-panel, .today-panel { padding: 22px; }
.viewfinder { background: #eaf2ed; margin: 16px 0; border-radius: 10px; position: relative; min-height: 232px; display: grid; place-content: center; justify-items: center; gap: 15px; overflow: hidden; }
.viewfinder p { text-align: center; font-size: 14px; padding: 0 10px; }
.viewfinder.has-camera { background: #122c23; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.scan-target { width: 95px; height: 95px; position: relative; color: #236850; }
.scan-target i { position: absolute; width: 23px; height: 23px; border: 3px solid currentColor; }
.scan-target i:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 5px; }
.scan-target i:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 5px; }
.scan-target i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 5px; }
.scan-target i:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 5px; }
.scan-target span { position: absolute; top: 46px; left: 9px; right: 9px; height: 2px; background: #46896e; }
.scan-actions, .dialog-actions, .field-row { display: flex; flex-wrap: wrap; gap: 8px; }
button, .button, input, select { font: inherit; }
button, .button { border: 1px solid #b8c9bf; border-radius: 8px; min-height: 42px; padding: 8px 13px; background: white; color: var(--dark); font-weight: 650; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: #eff6f1; }
.primary { background: var(--green); color: white; border-color: var(--green); }
.primary:hover { background: #104934; }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 3px solid #328467; outline-offset: 3px; }
.topbar :focus-visible { outline-color: #c6ebd5; }
.reader-form { margin-top: 20px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
input, select { min-height: 42px; border: 1px solid #adbfb4; border-radius: 8px; padding: 7px 10px; color: inherit; background: white; min-width: 0; font-size: 16px; }
.field-row { margin-top: 6px; flex-wrap: nowrap; }
.field-row input { flex: 1; }
.demo-tools { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.demo-tools p { font-size: 13px; }
.demo-tools button { min-height: 36px; padding: 6px 9px; font-size: 13px; }
.result { margin-top: 15px; border-radius: 10px; min-height: 186px; background: #f0f4f1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; padding: 18px; overflow-wrap: anywhere; }
.result-icon { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; background: #e0eae4; font-size: 19px; margin-bottom: 4px; }
.result strong { font-size: 18px; }
.result-person { font-size: 24px; font-weight: 730; letter-spacing: -.02em; }
.result-person:empty { display: none; }
.result[data-state="served"] { background: #e6f5eb; color: #145335; }
.result[data-state="served"] .result-icon { background: #ccebd7; }
.result[data-state="duplicate"] { background: #fff1d4; color: #684509; }
.result[data-state="duplicate"] .result-icon { background: #ffe2a5; }
.result[data-state="error"], .global-message { background: #fcebe7; color: #8a3128; }
.result[data-state="error"] .result-icon { background: #f7d7d0; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 15px 0 14px; }
.mini-stats div + div { border-left: 1px solid var(--line); padding-left: 17px; }
.mini-stats dt, .report-stats span { font-size: 14px; color: var(--muted); }
.mini-stats dd, .report-stats strong { display: block; margin: 1px 0 0; font-size: 32px; font-weight: 740; font-variant-numeric: tabular-nums; }
.text-link { font-size: 14px; font-weight: 650; text-underline-offset: 3px; }
.report-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.report-stats > div { padding: 15px 18px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 16px; }
.filters label { min-width: 140px; max-width: 100%; }
.filters select { max-width: 280px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { text-align: left; padding: 10px 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); background: #f6f9f7; font-size: 13px; }
td:first-child { font-weight: 650; }
td .card-button { min-height: 34px; padding: 5px 8px; font-size: 13px; }
.pill { font-size: 13px; font-weight: 650; display: inline-block; border-radius: 100px; background: #edf1ee; padding: 4px 9px; white-space: nowrap; }
.pill.served { color: #155633; background: #e3f4e9; }
.empty-row { color: var(--muted); padding: 22px 16px; }
.global-message { border-radius: 8px; padding: 10px 14px; margin-bottom: 15px; }
dialog { max-width: min(100% - 28px, 460px); width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 0; color: inherit; }
dialog::backdrop { background: #102b22a6; }
.dialog-inner { display: grid; gap: 12px; padding: 20px; }
.dialog-actions { justify-content: end; }
.form-error { color: #8a3128; }
.form-error:empty { display: none; }
.print-card { display: grid; justify-items: center; border: 1px dashed #abbdb4; border-radius: 12px; padding: 10px 12px 14px; text-align: center; overflow-wrap: anywhere; }
.print-card img { max-width: 100%; height: auto; }
.print-card strong { font-size: 22px; }
.print-card span { color: var(--muted); }
@media (max-width: 760px) {
  .topbar-inner { padding: 12px 16px; gap: 9px; flex-wrap: wrap; }
  nav { order: 3; width: 100%; gap: 4px; overflow-x: auto; }
  nav a { padding: 8px; }
  main { padding: 25px 14px 35px; }
  .service-layout { grid-template-columns: 1fr; }
  .scan-panel, .result-panel, .today-panel { padding: 16px; }
  th, td { padding: 9px 10px; }
  .report-stats > div { padding: 10px; }
  .report-stats { gap: 6px; }
}
@media print {
  @page { margin: 12mm; }
  body, :root { background: white; }
  .topbar, main, .dialog-actions, dialog h2 { display: none !important; }
  #card-dialog[open] { position: static; margin: 0; width: 66mm; max-width: 100%; border: 0; }
  dialog::backdrop { display: none; }
  #card-dialog .dialog-inner { padding: 0; }
  .print-card { break-inside: avoid; }
  .print-card img { width: 47mm; }
}
.button[aria-disabled='true'] { opacity: .6; pointer-events: none; }

.viewfinder.has-camera { aspect-ratio: 4 / 3; max-height: 360px; }
.has-camera .scan-target {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 1;
  width: clamp(112px, 48%, 182px);
  height: clamp(112px, 62%, 182px);
  color: #fff;
  filter: drop-shadow(0 0 2px #132825);
  pointer-events: none;
}
.has-camera .scan-target span { display: none; }
.camera-status { display: grid; gap: 3px; margin: -6px 0 12px; padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; background: #edf3ef; }
.camera-status[data-state="served"] { background: #e6f5eb; color: #145335; }
.camera-status[data-state="duplicate"] { background: #fff1d4; color: #684509; }
.camera-status[data-state="error"] { background: #fcebe7; color: #8a3128; }
.camera-status span { font-size: 14px; }
.demo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
