:root {
  --navy: #002b5b;
  --navy-2: #0a3f76;
  --red: #c81240;
  --cream: #f7f3ec;
  --white: #ffffff;
  --ink: #14213a;
  --muted: #687386;
  --line: #dfe4ea;
  --success: #137a53;
  --warning: #9a5a00;
  --shadow: 0 18px 45px rgba(0, 43, 91, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #edf1f5;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy); }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, var(--navy) 0 220px, #edf1f5 220px); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(200, 18, 64, .25); outline-offset: 2px; }
.app-shell { width: min(780px, 100%); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(94px + env(safe-area-inset-bottom)); }
.topbar { color: white; display: flex; align-items: center; justify-content: space-between; padding: 24px 2px 22px; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(25px, 6vw, 36px); letter-spacing: -.03em; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; opacity: .72; }
.icon-btn { border: 0; width: 42px; height: 42px; border-radius: 14px; background: rgba(255,255,255,.14); color: inherit; font-size: 24px; display: grid; place-items: center; }
main { display: block; }
.stats-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 10px; }
.stat-card { background: white; border-radius: 20px; padding: 17px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 4px; font-size: clamp(25px, 7vw, 38px); line-height: 1; }
.stat-primary { background: var(--red); color: white; }
.stat-primary span { color: rgba(255,255,255,.78); }
.search-panel { margin-top: 16px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.search-box { min-height: 72px; display: flex; align-items: center; gap: 14px; background: white; border-radius: 22px; padding: 0 20px; box-shadow: 0 10px 30px rgba(0,43,91,.07); cursor: text; }
.search-box > span { color: var(--navy); font-size: 30px; line-height: 1; flex: 0 0 auto; }
.search-box input { border: 0; outline: 0; min-width: 0; min-height: 68px; flex: 1; font-size: 20px; line-height: 1.25; color: var(--ink); background: transparent; }
.search-box input::placeholder { color: #7c8798; opacity: 1; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 5px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { white-space: nowrap; border: 1px solid var(--line); background: rgba(255,255,255,.7); color: var(--muted); border-radius: 999px; padding: 9px 14px; font-weight: 700; }
.filter.active { background: var(--navy); border-color: var(--navy); color: white; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; }
.results-head h2 { margin: 0; font-size: 20px; }
.results-head span { color: var(--muted); font-size: 13px; }
.participant-list { display: grid; gap: 12px; }
.participant-card { border: 0; width: 100%; text-align: left; background: white; border-radius: 22px; padding: 18px 17px 17px 20px; box-shadow: 0 8px 24px rgba(0,43,91,.065); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; position: relative; overflow: hidden; }
.participant-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--red); }
.participant-card.issued::before { background: var(--success); }
.participant-card.issued { background: #f7fbf9; }
.participant-main { min-width: 0; }
.participant-bib { margin: 0 0 4px; color: var(--navy); font-size: clamp(31px, 6vw, 42px); line-height: 1; font-weight: 950; letter-spacing: -.035em; }
.participant-bib-prefix { margin-right: 5px; font-size: .55em; vertical-align: .18em; opacity: .7; }
.participant-name { margin: 0; color: #111820; font-size: clamp(19px, 3.5vw, 24px); line-height: 1.2; font-weight: 900; overflow-wrap: anywhere; }
.participant-meta { display: flex; flex-wrap: wrap; gap: 5px 13px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.meta-chip { display: inline-flex; align-items: center; gap: 4px; }
.meta-label { font-weight: 800; color: #667085; }
.participant-action { display: grid; justify-items: end; gap: 9px; }
.status-pill { border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; background: #fff0f3; color: var(--red); }
.issued .status-pill { background: #e3f4ed; color: var(--success); }
.issue-btn { min-width: 92px; border: 0; border-radius: 13px; padding: 10px 13px; background: var(--red); color: white; font-weight: 850; }
.issued .issue-btn { background: white; color: var(--success); border: 1px solid #b9ddcf; }
.empty-state { padding: 46px 20px; text-align: center; background: rgba(255,255,255,.7); border: 1px dashed #cfd6df; border-radius: 24px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { font-size: 42px; color: var(--navy); }
.empty-actions { margin-top: 18px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.hidden { display: none !important; }
.primary-btn, .secondary-btn, .danger-btn { border-radius: 14px; padding: 11px 15px; font-weight: 800; }
.primary-btn { border: 0; background: var(--red); color: white; }
.secondary-btn { border: 1px solid var(--line); background: white; color: var(--ink); }
.danger-btn { border: 1px solid #f0b7c5; background: #fff2f5; color: var(--red); }
.danger-link { border: 0; background: transparent; color: var(--red); font-weight: 800; }
.dialog { width: min(620px, calc(100% - 24px)); max-height: min(88vh, 850px); border: 0; border-radius: 25px; padding: 20px; box-shadow: 0 25px 80px rgba(0,43,91,.28); }
.dialog::backdrop { background: rgba(0,24,50,.62); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.dialog-head h2 { margin: 2px 0 0; }
.dialog .icon-btn { background: #eef1f5; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
.field-wide { grid-column: 1/-1; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfd; padding: 12px 13px; color: var(--ink); font-size: 16px; resize: vertical; }
.dialog-actions { margin-top: 20px; display: flex; gap: 9px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.spacer { flex: 1; }
.settings-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 10px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 25px); width: min(440px, calc(100% - 32px)); background: #101827; color: white; border-radius: 16px; padding: 13px 16px; box-shadow: 0 16px 35px rgba(0,0,0,.28); opacity: 0; pointer-events: none; transition: .22s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.issue-confirm-dialog { width: min(560px, calc(100% - 24px)); }
.confirm-message { margin: -3px 0 16px; color: var(--ink); font-size: 18px; line-height: 1.4; font-weight: 900; }
.confirm-card { border: 1px solid #d9e2ec; border-radius: 20px; padding: 18px; background: #f8fafc; }
.confirm-bib-label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.confirm-bib { display: block; margin: 4px 0 18px; color: var(--navy); font-size: clamp(40px, 10vw, 58px); line-height: 1; letter-spacing: -.04em; }
.confirm-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 18px; margin: 0; }
.confirm-fields div { min-width: 0; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.confirm-fields dt { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.confirm-fields dd { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.35; font-weight: 850; overflow-wrap: anywhere; }
.confirm-actions { margin-top: 17px; }
.confirm-issue-btn { min-width: 190px; }
.confirm-issue-btn:disabled { opacity: .65; cursor: wait; }

@media (max-width: 560px) {
  .app-shell { padding-inline: 12px; }
  .stats-grid { gap: 7px; }
  .stat-card { padding: 14px 12px; border-radius: 17px; }
  .search-panel { grid-template-columns: 1fr; }
  .participant-card { grid-template-columns: 1fr; padding: 17px 15px 15px 18px; }
  .participant-action { grid-template-columns: auto auto; justify-content: space-between; align-items: center; }
  .confirm-fields { grid-template-columns: 1fr; gap: 10px; }
  .confirm-actions { display: grid; grid-template-columns: 1fr; }
  .confirm-actions .secondary-btn, .confirm-issue-btn { width: 100%; }
  .issue-btn { min-width: 118px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .dialog { padding: 17px; }
}

/* NocoDB integration */
.topbar-actions { display: flex; gap: 8px; }
.icon-btn:disabled { opacity: .55; cursor: wait; }
.sync-status { margin: -4px 0 14px; min-height: 38px; display: flex; align-items: center; gap: 9px; border-radius: 14px; padding: 9px 12px; background: rgba(255,255,255,.92); color: var(--muted); font-size: 12px; font-weight: 750; box-shadow: 0 8px 24px rgba(0,43,91,.055); }
.sync-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: #8792a3; box-shadow: 0 0 0 4px rgba(135,146,163,.13); }
.sync-status[data-status="synced"] .sync-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(19,122,83,.13); }
.sync-status[data-status="syncing"] .sync-dot { background: #1976d2; box-shadow: 0 0 0 4px rgba(25,118,210,.13); animation: syncPulse 1s infinite alternate; }
.sync-status[data-status="pending"] .sync-dot { background: #d38400; box-shadow: 0 0 0 4px rgba(211,132,0,.13); }
.sync-status[data-status="offline"] .sync-dot,
.sync-status[data-status="error"] .sync-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(200,18,64,.13); }
@keyframes syncPulse { to { transform: scale(1.35); opacity: .55; } }
.sync-pending { color: #9a5a00; font-weight: 800; }
.sync-local { color: var(--red); font-weight: 800; }
.settings-dialog { overflow: auto; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title-row h3 { margin: 2px 0 0; }
.toggle-line { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
.toggle-line input { width: 18px; height: 18px; accent-color: var(--red); }
.settings-help { margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.connection-actions { margin-top: 12px; }
.mapping-details { margin-top: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f7f9fb; overflow: hidden; }
.mapping-details summary { cursor: pointer; padding: 13px 15px; color: var(--navy); font-weight: 850; }
.mapping-details[open] summary { border-bottom: 1px solid var(--line); }
.mapping-details > p,
.mapping-details > .form-grid { margin-left: 15px; margin-right: 15px; }
.mapping-details > .form-grid { margin-bottom: 15px; }
.noco-section { border: 1px solid #d8e2ec; border-radius: 20px; padding: 17px; background: #fbfcfe; }
.noco-section.settings-section { border-top: 1px solid #d8e2ec; }

@media (max-width: 560px) {
  .sync-status { margin-top: -2px; }
  .section-title-row { align-items: flex-start; }
}

/* V7: simplified event-only interface */
.app-shell { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
.topbar { align-items: flex-start; }
.topbar-copy { min-width: 0; }
.topbar h1 { max-width: 590px; font-size: clamp(22px, 5vw, 34px); line-height: 1.04; }
.station-label { margin: 9px 0 0; color: rgba(255,255,255,.78); font-size: 13px; font-weight: 750; }
.search-panel { grid-template-columns: minmax(0,1fr); }
.toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
.fixed-event-card { margin-bottom: 16px; border-radius: 18px; padding: 15px 16px; background: var(--navy); color: white; }
.fixed-event-card span { display: block; margin-bottom: 4px; color: rgba(255,255,255,.68); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.fixed-event-card strong { display: block; font-size: 17px; line-height: 1.25; }
.station-settings { margin-bottom: 18px; }
.confirm-station { margin-top: 12px; border-radius: 14px; padding: 12px 14px; background: #eef4fa; color: var(--navy); font-size: 13px; }

@media (max-width: 560px) {
  .topbar h1 { max-width: 265px; }
}

/* V8: operator registration and certificate photo flow */
.operator-settings-card { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 18px; padding: 15px 16px; background: #f8fafc; }
.operator-settings-card span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.operator-settings-card strong { display: block; font-size: 17px; line-height: 1.25; }
.registration-dialog { width: min(520px, calc(100% - 24px)); }
.registration-dialog::backdrop { background: rgba(0,24,50,.92); }
.registration-brand { margin-bottom: 22px; }
.registration-brand .eyebrow { color: var(--navy); opacity: 1; }
.registration-brand h2 { margin: 8px 0 8px; color: var(--ink); font-size: clamp(28px, 7vw, 38px); line-height: 1.05; }
.registration-brand p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.registration-fields { margin-bottom: 18px; }
.registration-submit { width: 100%; min-height: 52px; font-size: 16px; }
.certificate-dialog { width: min(520px, calc(100% - 24px)); }
.certificate-copy { margin: -4px 0 14px; color: var(--muted); line-height: 1.5; }
.certificate-participant { display: grid; gap: 4px; margin-bottom: 16px; border-radius: 15px; padding: 13px 14px; background: #eef4fa; }
.certificate-participant strong { color: var(--navy); font-size: 21px; }
.certificate-participant span { color: var(--ink); font-size: 14px; font-weight: 750; }
.certificate-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.camera-btn, .no-certificate-btn { min-height: 132px; border-radius: 20px; padding: 18px 14px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; }
.camera-btn { border: 0; background: var(--red); color: white; }
.no-certificate-btn { border: 1px solid #cfd8e3; background: white; color: var(--navy); }
.camera-btn span, .no-certificate-btn span { font-size: 34px; line-height: 1; }
.camera-btn strong, .no-certificate-btn strong { font-size: 15px; }
.camera-btn:disabled { opacity: .65; cursor: wait; }
.visually-hidden { position: fixed !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; opacity: 0 !important; }
.photo-preview-dialog { width: min(620px, calc(100% - 24px)); }
.photo-preview-frame { max-height: 58vh; min-height: 260px; display: grid; place-items: center; overflow: hidden; border-radius: 18px; background: #101827; }
.photo-preview-frame img { display: block; width: 100%; max-height: 58vh; object-fit: contain; }
.photo-help { margin: 12px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.photo-actions .primary-btn { min-width: 210px; }
.photo-actions .primary-btn:disabled { opacity: .65; cursor: wait; }

@media (max-width: 560px) {
  .registration-dialog { width: calc(100% - 20px); padding: 22px 18px; }
  .registration-fields { grid-template-columns: 1fr; }
  .operator-settings-card { align-items: flex-start; flex-direction: column; }
  .operator-settings-card .secondary-btn { width: 100%; }
  .certificate-actions { grid-template-columns: 1fr; }
  .camera-btn, .no-certificate-btn { min-height: 92px; grid-template-columns: auto 1fr; justify-items: start; text-align: left; padding: 16px 18px; }
  .camera-btn span, .no-certificate-btn span { font-size: 28px; }
  .photo-preview-frame { min-height: 220px; }
  .photo-actions { display: grid; grid-template-columns: 1fr; }
  .photo-actions button { width: 100%; }
}

/* V11: admin settings only on authorization screen + global config */
.registration-brand { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 16px; align-items: center; }
.registration-logo { width: 72px; height: 72px; border-radius: 20px; object-fit: cover; box-shadow: 0 10px 28px rgba(0,43,91,.18); }
.registration-actions { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; align-items: stretch; }
.registration-submit { min-width: 0; }
.admin-entry-btn { min-width: 105px; border: 1px solid #b9c9db; border-radius: 14px; background: #eef4fa; color: var(--navy); padding: 11px 16px; font-weight: 900; }
.global-config-state { margin: 0 0 16px; min-height: 40px; display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 10px 12px; background: #f4f6f8; color: var(--muted); font-size: 12px; font-weight: 800; }
.global-config-state[data-status="ready"] { background: #eaf7f1; color: var(--success); }
.global-config-state[data-status="ready"] .sync-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(19,122,83,.13); }
.global-config-state[data-status="error"] { background: #fff0f3; color: var(--red); }
.global-config-state[data-status="error"] .sync-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(200,18,64,.13); }
.admin-global-badge { display: grid; gap: 4px; border-radius: 18px; padding: 15px 16px; background: linear-gradient(135deg, #002b5b, #0a4c8d); color: white; }
.admin-global-badge strong { font-size: 17px; }
.admin-global-badge span { color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.45; }
.bootstrap-section { border: 1px solid #d7e3ef; border-radius: 20px; padding: 17px; background: #f8fbfe; }
.bootstrap-section.settings-section { border-top: 1px solid #d7e3ef; }
.mini-status { border-radius: 999px; padding: 6px 10px; background: #eef1f5; color: var(--muted); font-size: 11px; font-weight: 900; white-space: nowrap; }
.mini-status[data-status="ready"] { background: #e3f4ed; color: var(--success); }
.mini-status[data-status="error"] { background: #fff0f3; color: var(--red); }
.connection-code-card { margin-top: 15px; border-top: 1px dashed #cbd7e3; padding-top: 15px; }
.connection-code-card .connection-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-dialog { width: min(700px, calc(100% - 24px)); }

@media (max-width: 560px) {
  .registration-brand { grid-template-columns: 58px minmax(0,1fr); gap: 12px; align-items: start; }
  .registration-logo { width: 58px; height: 58px; border-radius: 16px; }
  .registration-actions { grid-template-columns: 1fr; }
  .admin-entry-btn { min-height: 48px; order: 2; }
  .registration-submit { order: 1; }
  .connection-code-card .connection-actions { display: grid; grid-template-columns: 1fr; }
  .connection-code-card .connection-actions button { width: 100%; }
}

/* V12: protected administrator access */
.admin-code-dialog { width: min(430px, calc(100% - 24px)); }
.admin-code-dialog::backdrop { background: rgba(0,24,50,.82); }
.admin-code-copy { margin: -2px 0 18px; color: var(--muted); line-height: 1.5; }
.admin-code-field input { min-height: 58px; text-align: center; font-size: 28px; font-weight: 900; letter-spacing: .35em; padding-left: calc(14px + .35em); }
.admin-code-error { min-height: 20px; margin: 8px 0 10px; color: var(--red); font-size: 13px; font-weight: 800; }
.admin-code-submit { width: 100%; min-height: 50px; }



.auth-code-dialog {
  width: min(100vw, 560px);
  max-width: 100vw;
  padding: 0;
  border: none;
  background: transparent;
}
.auth-code-dialog::backdrop {
  background: rgba(8, 10, 18, 0.72);
}
.auth-code-screen {
  min-height: min(92vh, 860px);
  padding: 28px 24px 40px;
  color: #fff;
  background:
    radial-gradient(circle at 25% 70%, rgba(255, 117, 102, 0.75), transparent 25%),
    radial-gradient(circle at 72% 82%, rgba(255, 97, 36, 0.72), transparent 28%),
    radial-gradient(circle at 52% 12%, rgba(160, 0, 40, 0.55), transparent 30%),
    linear-gradient(135deg, #06070b 0%, #3d000d 24%, #8f0017 62%, #5c0012 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.38);
}
.auth-code-head {
  width: 100%;
  text-align: center;
  padding-top: 8px;
}
.auth-code-head h2 {
  margin: 8px 0 16px;
  font-size: clamp(28px, 5vw, 40px);
  color: #fff;
}
.auth-code-eyebrow { color: rgba(255,255,255,0.78); }
.passcode-dots {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
}
.passcode-dot {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 999px;
  box-sizing: border-box;
  background: transparent;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.passcode-dot.filled {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.18);
  transform: scale(1.06);
}
.auth-code-error {
  min-height: 24px;
  margin: 18px 0 0;
  color: #ffd7d7;
  font-weight: 600;
}
.auth-keypad {
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 20px;
  justify-items: center;
  padding-bottom: 8px;
}
.keypad-key {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 20px rgba(0,0,0,0.18);
  backdrop-filter: blur(6px);
}
.keypad-key:active { transform: scale(0.98); }
.keypad-key .digit {
  font-size: 42px;
  line-height: 1;
  font-weight: 500;
}
.keypad-key .letters {
  font-size: 13px;
  letter-spacing: 0.08em;
  opacity: 0.92;
}
.keypad-key-clear,
.keypad-key-admin {
  font-size: 22px;
  font-weight: 700;
}
@media (max-width: 480px) {
  .auth-code-screen { padding: 22px 16px 28px; min-height: 100vh; border-radius: 0; }
  .auth-keypad { width: 100%; gap: 14px 14px; }
  .keypad-key { width: 84px; height: 84px; }
  .keypad-key .digit { font-size: 38px; }
}

/* V14: полноэкранный экран ввода кода */
.auth-code-dialog[open] {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #310008;
}

.auth-code-dialog::backdrop {
  background: #310008;
}

.auth-code-dialog .auth-code-screen {
  box-sizing: border-box;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  padding:
    max(26px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  border-radius: 0;
  overflow-y: auto;
}

@media (min-width: 700px) {
  .auth-code-dialog .auth-code-screen {
    justify-content: center;
    gap: 52px;
  }
}


/* V15: авторизация волонтёра и инструкция установки PWA */
.pwa-guide-btn {
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  border: 1px solid rgba(0, 43, 91, 0.18);
  border-radius: 14px;
  background: #f4f8fc;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.pwa-guide-btn:hover { background: #eaf2f9; }
.pwa-guide-btn:active { transform: translateY(1px); }

.install-guide-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: min(88dvh, 820px);
  overflow-y: auto;
}
.install-platforms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.install-platform-card {
  padding: 18px;
  border: 1px solid rgba(0, 43, 91, 0.12);
  border-radius: 18px;
  background: #f7f9fc;
}
.install-platform-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.install-platform-title > div {
  display: grid;
  gap: 2px;
}
.install-platform-title strong {
  color: var(--ink);
  font-size: 17px;
}
.install-platform-title span:not(.platform-icon) {
  color: var(--muted);
  font-size: 13px;
}
.platform-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #2f7fc1;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}
.platform-icon.apple-icon {
  background: #101820;
  font-size: 15px;
}
.install-steps {
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.5;
}
.install-steps li + li { margin-top: 9px; }
.install-guide-close {
  width: 100%;
  min-height: 50px;
}
@media (max-width: 620px) {
  .install-platforms { grid-template-columns: 1fr; }
  .install-guide-dialog { width: calc(100% - 20px); padding: 22px 18px; }
}


.admin-login-section,
.device-connect-section {
  display: grid;
  gap: 10px;
}
.admin-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.admin-or-divider::before,
.admin-or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #d9e2ec;
}
.device-connect-section {
  padding: 16px;
  border: 1px solid #d6e2ee;
  border-radius: 16px;
  background: #f5f9fd;
}
.device-connect-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 2px;
}
.device-connect-title strong {
  color: var(--navy);
  font-size: 16px;
}
.device-connect-title span {
  color: var(--muted);
  font-size: 13px;
}
.device-connect-section textarea {
  min-height: 86px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}
.quick-connect-btn {
  width: 100%;
  min-height: 48px;
}
.connection-code-card textarea[readonly] {
  background: #f6f8fb;
  color: #41556b;
}


.result-limit-notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef4fb;
  color: #38506b;
  font-size: 14px;
  line-height: 1.4;
}

.search-ready-state {
  min-height: 220px;
}

.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration { display: none; -webkit-appearance: none; }

.sync-status #syncText { flex: 1; min-width: 0; }
.sync-retry-btn { margin-left: auto; border: 0; border-radius: 10px; padding: 7px 10px; background: #002B5B; color: #fff; font: inherit; font-weight: 800; cursor: pointer; white-space: nowrap; }
.sync-retry-btn:disabled { opacity: .55; cursor: default; }
.sync-retry-btn.hidden { display: none; }
@media (max-width: 640px) { .sync-status { flex-wrap: wrap; } .sync-retry-btn { width: 100%; margin-left: 0; min-height: 42px; } }
