/* TimeQRS admin + public styles. No inline styles anywhere (strict CSP). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; font-size: 1rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
img, svg { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Layout */
.container { max-width: 1160px; margin: 0 auto; padding: 24px 20px 48px; }
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.center-text { text-align: center; }
.section { margin-top: 48px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar { background: var(--nav-bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--on-nav); text-decoration: none; }
.brand:hover { color: var(--on-nav); }
.logo-mark { display: block; }
.logo-signal { fill: var(--mark); }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--on-nav); text-decoration: none; font-weight: 600; }
.topnav a:hover { background: var(--surface); color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-name, .lang-link { color: var(--on-nav); font-size: 0.875rem; }
.theme-toggle { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: transparent; color: var(--on-nav); font: inherit; font-size: 0.875rem; cursor: pointer; }
.inline-form { display: inline; margin: 0; }
.site-footer { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; text-align: center; color: var(--muted); font-size: 0.875rem; padding: 24px; }
.footer-links { display: inline-flex; gap: 16px; }

/* Buttons */
.btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn-primary { background: var(--accent-action); border-color: var(--accent-action); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-action); color: var(--on-accent); border-color: var(--ink); }
.btn-secondary { background: var(--surface-raised); }
.btn-danger { background: var(--err); border-color: var(--err); color: var(--on-status); }
.btn-danger:hover { background: var(--err-hover); color: var(--on-status); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg); border-color: transparent; }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 0.875rem; }
.btn-lg { padding: 13px 22px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* Cards */
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-tight { padding: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { border-color: var(--accent); }

/* Forms */
form { margin: 0; }
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--text); }
.optional { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=color], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: var(--surface-raised);
}
input[type=color] { padding: 2px; height: 42px; }
textarea { resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 6px 0 0; display: block; }
.field-error { color: var(--err); font-size: 0.875rem; margin: 6px 0 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-weight: 500; cursor: pointer; }
.check input { margin-top: 4px; width: 17px; height: 17px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* Flash */
.flash { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash-error { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.flash-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.callout { padding: 14px 16px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.callout-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 0.875rem; font-weight: 700; background: var(--surface); color: var(--text); white-space: nowrap; }
.badge-free { background: var(--surface); color: var(--muted); }
.badge-pro { background: var(--accent); color: var(--on-nav); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-test { background: var(--warn-bg); color: var(--warn); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--line-strong); }
.dot-on { background: var(--ok); }

/* Page header & event subnav */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header p { margin: 4px 0 0; }
.breadcrumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--text); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }

/* Stats */
.stat { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-label { color: var(--muted); font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.stat-sub { color: var(--muted); font-size: 0.875rem; }
.meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--accent); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0 6px 28px; position: relative; }
.checklist li::before { content: ''; position: absolute; left: 2px; top: 11px; width: 14px; height: 8px; border-left: 3px solid var(--ok); border-bottom: 3px solid var(--ok); transform: rotate(-45deg); }
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setup-steps li:last-child { border-bottom: 0; }
.step-icon { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto; }
.step-done .step-icon { background: var(--ok); border-color: var(--ok); }
.step-done .step-title { color: var(--muted); text-decoration: line-through; }
.step-title { flex: 1; font-weight: 600; }

/* Empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* Landing */
.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); max-width: 860px; margin: 0 auto 16px; color: var(--ink); }
.lead { font-family: var(--font-serif); font-size: 1.2rem; color: var(--text); max-width: 720px; margin: 0 auto 24px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feature h3 { margin-top: 0; }
.plan-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.plan-card-highlight { border: 2px solid var(--accent); }
.plan-price { color: var(--muted); font-weight: 600; }

/* Auth */
.auth-card { max-width: 480px; margin: 32px auto; }

.eyebrow { margin: 0 0 8px; color: var(--accent); font-family: var(--mono); font-size: 0.875rem; letter-spacing: 0.04em; text-transform: uppercase; }
.legal-doc { max-width: 68ch; padding: 48px 0; }
.legal-doc section { padding: 24px 0; border-top: 1px solid var(--line); }
.legal-doc section h2 { font-size: 1.25rem; }
.legal-updated { color: var(--muted); font-family: var(--mono); font-size: 0.875rem; }
.legal-lead { margin-left: 0; }

/* Role chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.875rem; }
.chip-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.1); }

/* QR and passes */
.qr svg { width: 100%; height: auto; display: block; }
.qr-box { max-width: 220px; margin: 0 auto; background: #fff; padding: 8px; border-radius: var(--radius-sm); }

/* Details / danger zone */
details.danger { border: 1px solid var(--err-line); border-radius: var(--radius); background: var(--surface-raised); }
details.danger summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--err); }
details.danger > div { padding: 0 16px 16px; }

.mb { margin-bottom: 16px; }
.promo-compact { font-size: 6.5pt; color: var(--muted); line-height: 1.2; }
progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
progress.meter::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 6px 0; }
.service-checks { columns: 2 220px; margin-top: 8px; }
.service-checks .check { break-inside: avoid; margin: 4px 0; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
dl.details dt { color: var(--muted); font-size: 0.875rem; }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
.input-row { display: flex; gap: 8px; }
.left-text { text-align: left; }
.center-row { justify-content: center; }
.count-box { min-width: 220px; }
.filters { margin-bottom: 16px; }
.filters .field { margin-bottom: 8px; }
tr.is-test td { color: var(--warn); background: var(--warn-bg); }
.station-body { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.station-qr { max-width: 140px; margin: 0; }
.station-form .service-field { display: none; }
.station-form:has(select[name=mode] option[value=service]:checked) .service-field { display: block; }
.card-test { border-color: var(--warn-line); background: var(--warn-bg); }
.service-progress { margin-bottom: 12px; }
.inside-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.inside-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.branding-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .branding-layout { grid-template-columns: 1fr; } }
.branding-preview-card { position: sticky; top: 72px; }
.upload-box { display: flex; gap: 16px; align-items: center; }
.upload-preview { max-height: 80px; max-width: 160px; object-fit: contain; background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: var(--radius-sm); padding: 4px; }
.upload-empty { width: 120px; height: 72px; border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.875rem; text-align: center; }
.pro-fieldset[disabled] { opacity: 0.7; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
.brand-preview { border-radius: var(--radius); overflow: hidden; background: var(--event-background, var(--nav-bg)); font-family: var(--event-font, var(--font)); padding: 16px; }
.preview-header { background: var(--surface-raised); border-radius: var(--radius); padding: 8px 12px; display: flex; gap: 10px; align-items: center; color: var(--event-primary, var(--accent)); }
.preview-header img { max-height: 32px; max-width: 80px; object-fit: contain; }
.preview-result { margin-top: 12px; background: var(--ok); color: var(--surface-raised); border-radius: var(--radius); padding: 18px; text-align: center; }
.preview-check { font-size: 2rem; font-weight: 900; line-height: 1; }
.preview-title { font-size: 1.3rem; font-weight: 800; margin: 6px 0; }
.preview-tagline { color: var(--on-nav); text-align: center; margin-top: 10px; font-weight: 700; min-height: 1.2em; }
.preview-promo { color: var(--on-nav); font-size: 0.875rem; text-align: center; margin-top: 8px; opacity: 0.9; }
.input-narrow { width: 90px !important; }
.input-medium { width: 280px !important; max-width: 100%; }
.pass-event-image { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius-sm); margin: 12px 0; }
.badge-event-image { display: block; width: 100%; max-height: 16mm; object-fit: cover; border-radius: 2mm; margin: 1mm 0; }
.setup-summary { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.setup-summary li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-strong); padding-bottom: 6px; }


.setup-requirements { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.setup-requirements li { display: flex; justify-content: space-between; gap: 12px; }
.setup-requirements .req-missing, li.req-missing { color: var(--err); }
.setup-guide { color: var(--muted); padding-left: 18px; display: grid; gap: 4px; }
.review-summary { display: grid; gap: 6px; margin: 8px 0; }
.review-line { display: grid; grid-template-columns: minmax(140px, 30%) 1fr; gap: 12px; border-bottom: 1px solid var(--line-strong); padding-bottom: 6px; }
.review-line dt { color: var(--muted); font-size: 0.875rem; }
.review-line dd { margin: 0; }

/* Guided setup */
.setup { max-width: 820px; margin: 0 auto; }
.setup-header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.setup-header h1 { margin: 0 0 8px; font-size: 1.4rem; }
.setup-progress { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; }
.setup-progress-item { flex: 1 1 90px; font-size: 0.875rem; text-align: center; border-top: 3px solid var(--line-strong); padding-top: 6px; color: var(--muted); }
.setup-progress-item a { color: inherit; text-decoration: none; }
.setup-progress-item a:hover { text-decoration: underline; }
.setup-progress-item.state-done { border-top-color: var(--ok); color: var(--ink); }
.setup-progress-item.state-skipped { border-top-color: var(--warn-line); }
.setup-progress-item.state-current { border-top-color: var(--accent); color: var(--ink); font-weight: 700; }
.setup-body { padding: 20px; }
.setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-strong); flex-wrap: wrap; }
.setup-advanced summary { cursor: pointer; color: var(--muted); }

.verify { max-width: 560px; margin: 32px auto; display: grid; gap: 12px; }
.verify-status { font-weight: 800; font-size: 1.15rem; padding: 12px 14px; border-radius: var(--radius-sm); }
.verify-valid { background: var(--ok-bg); color: var(--ok); }
.verify-revoked { background: var(--err-bg); color: var(--err); }
.report-table th, .report-table td { white-space: nowrap; }
.report-table tfoot th { background: var(--surface); color: var(--ink); font-size: 0.875rem; text-transform: none; letter-spacing: 0; }
.progress-cell { min-width: 120px; }
.progress-cell progress.meter { margin-top: 0; }
.report-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.top-list { padding-left: 22px; margin: 0; }
.top-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.top-list strong { float: right; font-variant-numeric: tabular-nums; }
@media print {
  body.report-print .final-report .stat, body.report-print section { break-inside: avoid; }
  .table-wrap { overflow: visible; border: 0; }
}
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; }
  .topnav { order: 3; width: 100%; overflow-x: auto; }
  .user-name { display: none; }
  h1 { font-size: 1.45rem; }
}

@media print {
  .topbar, .site-footer, .no-print, .subnav, .flash { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
}
