:root {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #172640;
  background: #f2f5fa;
  --navy: #0e1d36;
  --blue: #1f59d0;
  --deep-blue: #194bb2;
  --border: #dce4ef;
  --muted: #52637c;
  --soft: #f6f8fc;
  --white: #fff;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, a, input, select, summary, [tabindex] { outline-offset: 3px; }
:focus-visible { outline: 2px solid #2d69e3; }
h1, h2, h3, p, pre { margin: 0; }
svg { width: 1rem; height: 1rem; flex: 0 0 auto; vertical-align: middle; }
.shell { width: min(1260px, calc(100% - 72px)); margin-inline: auto; }
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 3; box-shadow: 0 2px 8px #10203c1a; }
.header-inner { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark { background: #285fda; color: white; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.brand-mark svg { width: 23px; height: 23px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .11em; font-size: 1rem; font-weight: 750; }
.brand small { color: #bccce3; font-size: .76rem; margin-top: 2px; }
.navigation { display: flex; gap: 8px; }
.navigation a { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 8px; color: #c5d1e5; font-weight: 600; font-size: .88rem; }
.navigation a:hover, .navigation a[aria-current] { color: #fff; background: #243957; }
main { padding-bottom: 6px; }
main > section { scroll-margin-top: 94px; }
.page-heading { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin: 34px 0 23px; }
h1 { font-size: clamp(1.65rem, 3.1vw, 2.45rem); letter-spacing: -.042em; line-height: 1.1; color: #101e35; font-weight: 760; }
.page-intro p { color: var(--muted); font-size: 1rem; margin-top: 8px; line-height: 1.5; }
.page-intro .database { margin-top: 11px; }
.profile-card { display: flex; align-items: center; gap: 14px; min-width: 0; max-width: 100%; padding: 11px 16px; background: var(--white); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 3px 10px #12274c0a; }
.profile-photo { width: 64px; height: 64px; flex: 0 0 auto; border: 2px solid #d4b978; border-radius: 50%; box-shadow: 0 0 0 3px #f8f2e6; object-fit: cover; }
.profile-text { min-width: 0; color: var(--muted); font-size: .875rem; line-height: 1.35; }
.profile-text strong, .profile-text span { display: block; }
.profile-text strong { margin-bottom: 3px; color: var(--navy); font-size: 1.02rem; }
.database { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 7px 11px; border: 1px solid var(--border); background: #fff; color: #4f5f77; border-radius: 30px; font-size: .81rem; font-weight: 650; }
.database span { width: 8px; height: 8px; background: #8393aa; border-radius: 50%; }
.database.connected { color: #136642; border-color: #c5e5d7; background: #ecf9f2; }
.database.connected span { background: #159764; }
.database.offline { color: #a33432; border-color: #efccca; background: #fff2f1; }
.database.offline span { background: #cd483e; }
.generator-grid { display: grid; grid-template-columns: 1.12fr 1fr; gap: 22px; align-items: start; }
.card { min-width: 0; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 23px; box-shadow: 0 2px 5px #12274c06; }
.card-title { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.section-icon { display: grid; place-items: center; width: 41px; height: 41px; flex: 0 0 auto; color: var(--blue); background: #edf3ff; border-radius: 10px; }
.section-icon svg { width: 20px; height: 20px; }
h2 { font-size: 1.16rem; line-height: 1.25; letter-spacing: -.015em; font-weight: 740; }
.card-title p { color: var(--muted); font-size: .875rem; line-height: 1.35; margin-top: 3px; }
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; border: 1px solid #e0e7f0; background: #f0f3f8; border-radius: 9px; margin: 0; padding: 4px; min-width: 0; }
.mode label { position: relative; min-width: 0; }
.mode input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode label span { min-height: 37px; display: flex; justify-content: center; align-items: center; gap: 7px; color: #516179; font-size: .875rem; font-weight: 650; padding: 5px 7px; text-align: center; cursor: pointer; border: 1px solid transparent; border-radius: 6px; }
.mode input:checked + span { color: var(--deep-blue); background: #fff; border-color: #dbe3f0; box-shadow: 0 1px 3px #22345b12; }
.mode input:focus-visible + span { outline: 2px solid var(--blue); }
.help { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.mode-help { margin: 9px 0 16px; }
.field-toolbar, .payload-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-toolbar { font-size: .88rem; font-weight: 700; border-bottom: 1px solid #e9eef5; padding-bottom: 8px; margin-bottom: 12px; }
.text-actions { display: flex; flex-wrap: wrap; gap: 5px 12px; justify-content: flex-end; }
.text-button { color: var(--deep-blue); border: 0; background: transparent; display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; font-size: .86rem; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.text-button.muted { color: var(--muted); }
.field-list, .settings-content { display: grid; gap: 12px; }
.data-field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.data-field label, .field-heading { font-size: .875rem; font-weight: 650; color: #263854; }
.field-heading { display: flex; align-items: center; gap: 8px; min-height: 20px; }
input:is([type=text], [type=url], [type=search], [type=number], [type=date], [type=file]), input:not([type]), select, .colour-field {
  width: 100%; height: 40px; min-width: 0; border: 1px solid #d3deeb; border-radius: 7px; padding: 8px 10px; background: white; color: #142540; font-size: .94rem;
}
input[readonly] { background: #f4f7fc; color: #52637c; }
input::placeholder { color: #667890; }
input[type=checkbox] { margin: 0; width: 16px; height: 16px; flex: 0 0 auto; accent-color: #245fdd; cursor: pointer; }
select { appearance: none; padding-right: 32px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2352637c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; }
.mono, .payload, #encoded, #serial, #start { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; }
#encoded { font-size: .83rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; }
.manual-toggle { margin-left: auto; white-space: nowrap; }
.field-heading .manual-toggle { font-size: .81rem; color: var(--muted); font-weight: 600; }
.settings { margin-top: 15px; border: 1px solid #e0e7f0; border-radius: 8px; background: #f8fafe; }
.settings summary { display: flex; align-items: center; gap: 9px; padding: 10px 12px; cursor: pointer; font-size: .875rem; font-weight: 680; color: #344d70; list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary svg:last-child { margin-left: auto; }
.settings[open] summary svg:last-child { transform: rotate(180deg); }
.settings-content { padding: 4px 12px 12px; }
.colour-field { display: flex; align-items: center; gap: 8px; }
.colour-field input { flex: 0 0 auto; width: 28px; height: 26px; padding: 0; border: 0; background: transparent; }
.colour-field output { font-family: monospace; font-size: .9rem; }
.check-group { display: flex; gap: 10px 18px; flex-wrap: wrap; font-size: .875rem; }
.operator { margin-top: 13px; }
.required { color: #b43b28; }
.form-actions, .download-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 7px; padding: 8px 12px; font-size: .875rem; font-weight: 680; line-height: 1.25; text-align: center; }
.button.primary { color: white; background: var(--blue); border-color: var(--blue); }
.button.primary:hover:not(:disabled) { background: var(--deep-blue); }
.button.secondary { color: #223c61; background: white; border-color: #d4deec; }
.button.secondary:hover:not(:disabled), .button.subtle:hover:not(:disabled) { background: #eef3fa; }
.button.subtle { color: #4f6078; background: transparent; }
.preview-heading { gap: 10px; }
.preview-size { margin-left: auto; font-size: .8rem; color: #3d5579; background: #eff4fc; border-radius: 6px; padding: 5px 8px; font-weight: 680; white-space: nowrap; }
.preview-stage { display: grid; place-items: center; min-height: 318px; padding: 18px; border: 1px solid #e0e8f4; border-radius: 10px; background: #f0f5fc radial-gradient(#c4d2e8 1px, transparent 1px) 0 0 / 16px 16px; }
.qr-label { width: min(100%, 232px); display: flex; align-items: center; flex-direction: column; gap: 4px; padding: 13px 12px; background: white; color: #111d2e; border: 1px solid #dee7f3; border-radius: 8px; box-shadow: 0 4px 16px #1b386015; text-align: center; }
.qr-label strong { font-size: .95rem; }
.qr-label img { width: min(100%, 196px); height: auto; image-rendering: pixelated; }
.qr-label span { font-size: .82rem; }
.qr-label strong, .qr-label span { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty-preview { color: #526884; padding: 14px; text-align: center; background: #f0f5fc; border-radius: 8px; }
.empty-preview svg { width: 36px; height: 36px; margin-bottom: 8px; }
.empty-preview p { max-width: 35ch; }
.payload-head { margin: 17px 0 8px; }
h3 { font-size: .94rem; }
.payload { padding: 11px; min-height: 53px; color: #304764; background: #f5f8fc; border: 1px solid #dfe7f2; border-radius: 7px; font-size: .84rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; }
.download-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
.preview-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; border-top: 1px solid #e6edf5; margin-top: 16px; padding-top: 11px; }
.notice { border: 1px solid #cddcf4; color: #204479; background: #f0f6ff; font-size: .875rem; line-height: 1.4; border-radius: 7px; padding: 8px 10px; margin-top: 10px; overflow-wrap: anywhere; }
.notice[data-tone=error] { background: #fff1f0; color: #9e2a25; border-color: #f0ccc8; }
.notice[data-tone=success] { background: #eaf8f0; color: #12603f; border-color: #c5e6d5; }
.workspace-card { margin-top: 22px; }
.station-mode { max-width: 440px; }
.station-handoff { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-top: 13px; }
.station-handoff .data-field { flex: 0 1 250px; }
.station-help { margin-top: 10px; }
.station-qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 13px; margin-top: 15px; }
.station-qr-card { display: grid; justify-items: center; align-content: start; gap: 9px; min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--soft); }
.station-qr-card img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 4px; }
.station-qr-card code { min-height: 2.5em; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; text-align: center; }
.batch-mode { width: min(100%, 395px); margin-bottom: 13px; }
.batch-help, #file-fields .help { margin-top: 8px; }
#file-fields .text-button { margin-top: 6px; }
.verify-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1fr); gap: 18px; }
.scanner-stage { background: #eef4fc; border: 1px solid #dfe7f2; border-radius: 9px; overflow: hidden; display: grid; place-items: center; min-height: 225px; color: #4f6688; }
#scanner-placeholder { display: grid; gap: 8px; justify-items: center; font-size: .875rem; }
#scanner-placeholder svg { width: 32px; height: 32px; }
#scanner-video { width: 100%; max-height: 360px; object-fit: contain; background: #101e35; }
.verify-content { min-width: 0; }
.verify-content .payload { margin-top: 6px; }
.image-field { margin-top: 12px; }
input[type=file] { height: auto; }
input::file-selector-button { margin-right: 8px; background: #edf3ff; border: 0; color: #234983; padding: 4px 7px; border-radius: 4px; cursor: pointer; }
.history-head > button { margin-left: auto; flex-shrink: 0; }
.history-filters { display: grid; grid-template-columns: minmax(11rem, 1.6fr) minmax(8.5rem, 1.05fr) 1fr 1fr auto; align-items: end; gap: 10px; margin-bottom: 15px; }
.history-actions { display: flex; gap: 4px; }
.table-scroll { overflow: auto; border: 1px solid #e0e7f0; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
thead { background: #f3f6fb; color: #3c5374; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e8edf5; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td { max-width: 25ch; overflow-wrap: anywhere; }
td:last-child { white-space: nowrap; }
td button + button { margin-left: 10px; }
.empty-row td { color: var(--muted); white-space: normal; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.site-footer { color: #596b85; display: flex; justify-content: space-between; gap: 10px; font-size: .875rem; padding-block: 17px 23px; }
dialog { padding: 0; width: min(calc(100% - 28px), 590px); max-height: 90vh; border: 1px solid #dbe4f0; border-radius: 12px; color: #172640; }
dialog::backdrop { background: #0c1c36a1; }
.dialog-inner { padding: 20px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
dl { display: grid; grid-template-columns: minmax(8em, 1fr) 3fr; gap: 8px; font-size: .875rem; }
dt { font-weight: 700; }
dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-inner .payload { margin-block: 8px 12px; }
@media (max-width: 1000px) {
  .shell { width: calc(100% - 40px); }
  .generator-grid { gap: 14px; }
  .card { padding: 18px; }
  .history-filters { grid-template-columns: 1.4fr 1fr 1fr; }
}
@media (max-width: 760px) {
  .header-inner { min-height: 0; flex-wrap: wrap; gap: 8px; padding: 10px 0 6px; }
  .navigation { width: 100%; justify-content: space-between; gap: 3px; }
  .navigation a { padding: 8px 6px; font-size: .82rem; gap: 5px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark svg { width: 19px; height: 19px; }
  main > section { scroll-margin-top: 103px; }
  .shell { width: calc(100% - 28px); }
  .page-heading { margin: 22px 0 15px; align-items: flex-start; flex-direction: column; gap: 14px; }
  .generator-grid, .verify-grid { grid-template-columns: 1fr; }
  .preview-stage { min-height: 275px; }
  .history-filters { grid-template-columns: 1fr 1fr; }
  .history-actions { grid-column: 1 / -1; }
  .workspace-card { margin-top: 15px; }
  .site-footer { flex-wrap: wrap; }
  input:is([type=text], [type=url], [type=search], [type=number], [type=date]), input:not([type]), select { font-size: 1rem; }
  #encoded { font-size: 1rem; }
}
@media (max-width: 370px) {
  .card { padding: 13px; }
  .navigation a svg { display: none; }
  .encoded-heading { flex-wrap: wrap; }
  .manual-toggle { margin-left: 0; }
  .history-head { flex-wrap: wrap; }
  .history-head > button { margin-left: 0; }
}
#print-label { display: none; }
@media print {
  body { background: white; }
  body > :not(#print-label) { display: none !important; }
  #print-label:not([hidden]) { display: block; }
  #print-label .qr-label { background: white; border: none; box-shadow: none; width: fit-content; }
  #print-label img { width: 45mm; print-color-adjust: exact; }
}

#preview-heading { scroll-margin-top: 118px; }
