/* Year-round CTHINGS QR styling. QR deliberately has no December variant. */
:root {
  color-scheme: light;
  --qr-brand: #292855;
  --qr-brand-hover: #211f48;
  --qr-brand-soft: #ececf6;
  --qr-canvas: #f5f6fa;
  --qr-surface: #ffffff;
  --qr-surface-soft: #f9f9fa;
  --qr-text: #28293d;
  --qr-text-strong: #232438;
  --qr-text-muted: #5f6877;
  --qr-border: #dfe3ea;
  --qr-shadow: 0 12px 34px rgba(32, 35, 63, 0.09);
  --qr-radius-shell: 12px;
  --qr-radius-card: 8px;
  --qr-radius-control: 7px;
}

body {
  background-color: var(--qr-canvas);
  color: var(--qr-text);
  font-family: "Poppins", sans-serif;
}

.panel,
.section,
.card:not(.action-card) {
  border-color: var(--qr-border);
  border-radius: 10px;
  background: var(--qr-surface);
  box-shadow: var(--qr-shadow);
}

.lang-select,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.bad):not(.ok),
select,
textarea {
  border-color: var(--qr-border);
  border-radius: 7px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
  font-family: inherit;
}

:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible,
:is(.btn, .action-btn, .status-check-btn, .failure-toggle-btn, .failure-submit-btn, .link-btn, .relocation-btn, .back-btn):focus-visible {
  outline: 2px solid var(--qr-brand);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(41, 40, 85, 0.14);
}

:is(.btn, .action-btn, .status-check-btn, .failure-toggle-btn, .failure-submit-btn, .link-btn, .relocation-btn, .confirm-accept-btn),
.action-card button:not(:disabled) {
  border-color: var(--qr-brand);
  border-radius: 8px;
  background: var(--qr-brand);
  color: #ffffff;
  font-family: inherit;
  font-weight: 600;
}

/* Every route uses the same action hierarchy. The relocation confirmation is
   deliberately separate because it changes a durable device assignment. */
body :is(
  .btn, .action-btn, .status-check-btn, .failure-submit-btn, .link-btn,
  .relocation-btn, .ping-btn, .submit-btn, .continue-btn, .logout-btn,
  .update-btn, .bag-btn
):not(.ghost):not(.secondary):not(.disabled):not([disabled]):not([aria-disabled="true"]):not(:where(#relocate-btn)) {
  border-color: var(--qr-brand);
  border-radius: 8px;
  background: var(--qr-brand);
  color: #ffffff;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  box-shadow: none;
}
body :is(
  .btn, .action-btn, .status-check-btn, .failure-submit-btn, .link-btn,
  .relocation-btn, .ping-btn, .submit-btn, .continue-btn, .logout-btn,
  .update-btn, .bag-btn
):not(.ghost):not(.secondary):not(.disabled):not([disabled]):not([aria-disabled="true"]):not(:where(#relocate-btn)):hover {
  border-color: var(--qr-brand-hover);
  background: var(--qr-brand-hover);
}
body :is(.btn.ghost, .btn.secondary, .action-btn.ghost, .action-btn.secondary,
  .failure-toggle-btn, .back-btn, .logout-btn.secondary) {
  border: 1px solid var(--qr-border);
  border-radius: 8px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
  font-family: "Poppins", sans-serif;
  box-shadow: none;
}
body :is(.btn.ghost, .btn.secondary, .action-btn.ghost, .action-btn.secondary,
  .failure-toggle-btn, .back-btn):not([disabled]):hover {
  border-color: var(--qr-brand);
  background: var(--qr-brand-soft);
  color: var(--qr-brand);
}
body #relocate-btn:not([disabled]) {
  border-color: #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-family: "Poppins", sans-serif;
}
body #dialog .cancel {
  border: 1px solid var(--qr-border);
  border-radius: 8px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
}
body #dialog .confirm:not([disabled]) {
  border: 1px solid #991b1b;
  border-radius: 8px;
  background: #991b1b;
  color: #ffffff;
}
body :is(.btn, .action-btn, .status-check-btn, .failure-submit-btn, .link-btn,
  .ping-btn, .submit-btn, .continue-btn, .logout-btn, .update-btn, .bag-btn,
  :where(#relocate-btn)):is([disabled], [aria-disabled="true"], .disabled) {
  border-color: var(--qr-border);
  background: var(--qr-surface-soft);
  color: var(--qr-text-muted);
  cursor: not-allowed;
  opacity: 1;
}
body :is(button, a, [role="button"], [role="tab"]):focus-visible,
body :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--qr-brand) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(41, 40, 85, .14);
}
body :is(.option-card, .service-option, .menu-card) {
  border-color: var(--qr-border);
  border-radius: 9px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
  box-shadow: none;
}
body :is(.option-card, .service-option, .menu-card):hover,
body :is(.option-card, .service-option, .menu-card):focus-visible {
  border-color: var(--qr-brand);
  background: var(--qr-brand-soft);
}
body :is(.option-card, .service-option, .menu-card) :is(.option-title, h2, h3) {
  color: var(--qr-text-strong);
}
body :is(.option-card, .service-option, .menu-card) :is(.option-desc, p) {
  color: var(--qr-text-muted);
}
body.qr-service-menu-page .container {
  border: 1px solid var(--qr-border);
  border-radius: 12px;
  background: var(--qr-surface);
  box-shadow: var(--qr-shadow);
}
body.qr-service-menu-page .installer-card,
body.qr-service-menu-page .option:not(.danger) {
  border-color: var(--qr-border);
  border-radius: 9px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
}
body.qr-service-menu-page .option:not(.danger):hover,
body.qr-service-menu-page .option:not(.danger):focus-visible {
  border-color: var(--qr-brand);
  background: var(--qr-brand-soft);
}
body.qr-service-menu-page .option.danger {
  border-color: #fecaca;
  border-radius: 9px;
  background: #fef2f2;
  color: #991b1b;
}
body.qr-service-menu-page .option.danger strong { color: #991b1b; }
body :is(.meta-item, .stat:not(.confirmed):not(.ok):not(.error):not(.warning),
  .status-check:not(.ok):not(.error):not(.warning), .qr-panel, .result) {
  border-color: var(--qr-border) !important;
  background: var(--qr-surface-soft) !important;
  color: var(--qr-text-strong);
}
body input[type="file"]::file-selector-button,
body .photo-file-button {
  border: 1px solid var(--qr-brand);
  border-radius: 7px;
  background: var(--qr-brand);
  color: #ffffff;
  font: 600 12px "Poppins", sans-serif;
  cursor: pointer;
}
body :is(.protocol-form, .file-multi) input[type="file"]::file-selector-button {
  border-color: var(--qr-brand);
  background: var(--qr-brand);
  color: #ffffff;
}
body input[type="file"]:hover::file-selector-button,
body :is(.protocol-form, .file-multi) input[type="file"]:hover::file-selector-button,
body .photo-file-button:hover {
  background: var(--qr-brand-hover);
}
body .photo-file-button:focus-visible {
  outline: 2px solid var(--qr-brand);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(41, 40, 85, .14);
}
body :is(input, select, textarea):focus:not([aria-invalid="true"]) {
  border-color: var(--qr-brand);
  box-shadow: 0 0 0 3px rgba(41, 40, 85, .14);
}
body .protocol-form label:not(.error) input[type="text"]:focus {
  border-color: var(--qr-brand);
  box-shadow: 0 0 0 3px rgba(41, 40, 85, .14);
}
body #modal-close:not([disabled]) {
  border-color: var(--qr-brand);
  border-radius: 8px;
  background: var(--qr-brand);
  color: #ffffff;
  font-family: "Poppins", sans-serif;
}
body :is(.login-link, .contact a):not(.btn) { color: var(--qr-brand); }
body .options .badge {
  border: 1px solid var(--qr-border);
  background: var(--qr-brand-soft);
  color: var(--qr-brand);
}

:is(.btn, .action-btn, .status-check-btn, .failure-toggle-btn, .failure-submit-btn, .link-btn, .relocation-btn):disabled,
.action-card button:disabled {
  border-color: #aeb3c1;
  background: #aeb3c1;
  color: #ffffff;
}

.action-card {
  border: 1px solid var(--qr-border);
  border-radius: 8px;
  background: var(--qr-surface);
  box-shadow: none;
}
.action-card h3,
.section h2 {
  color: var(--qr-text-strong);
}
.action-card p {
  color: var(--qr-text-muted);
}
.legal-page-header,
.legal-section {
  border-color: var(--qr-border);
}
.legal-language a[aria-current="page"] {
  border-color: var(--qr-brand);
  background: var(--qr-brand);
}

/* Serial lookup mirrors the approved QR preview and retains its live form. */
body.qr-lookup-page {
  flex-direction: column;
  gap: 18px;
}
.qr-lookup-page .container {
  width: min(100%, 510px);
  max-width: 510px;
  padding: 37px 43px 38px;
  border: 1px solid var(--qr-border);
  border-radius: 12px;
  background: var(--qr-surface);
  box-shadow: var(--qr-shadow);
}
.qr-lookup-page .lang-switch {
  top: 17px;
  right: 22px;
}
.qr-lookup-page .logo {
  display: block;
  width: 170px;
  max-width: 58vw;
  margin: 3px auto 26px;
}
.qr-lookup-divider {
  width: 31px;
  height: 3px;
  margin: 0 auto 25px;
  border-radius: 999px;
  background: var(--qr-brand);
}
.qr-page-eyebrow {
  display: block;
  color: var(--qr-brand);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
/* One centered title panel for the installer and supporting QR flows. */
body .qr-page-header {
  position: relative;
  margin: 0 0 18px;
  padding: 46px 20px 24px;
  border: 1px solid var(--qr-border);
  border-top: 3px solid var(--qr-brand);
  border-radius: 10px;
  background: var(--qr-surface);
  color: var(--qr-text-strong);
  box-shadow: var(--qr-shadow);
  text-align: center;
}
body .qr-page-header .logo {
  display: block;
  width: 155px;
  max-width: 55%;
  height: auto;
  margin: 0 auto 22px;
}
body .qr-page-header :is(h1, h2, .page-title, .installer-title) {
  margin: 6px 0;
  color: var(--qr-text-strong);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}
body .qr-page-header :is(.meta, .sub, .subtitle, .installer-subtitle) {
  margin: 6px 0 0;
  color: var(--qr-text-muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
body .qr-page-header > p:not(.instruction),
body .qr-page-header .header p {
  margin: 6px 0 0;
  color: var(--qr-text-muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
body .qr-page-header :is(.qr-page-eyebrow, .installer-eyebrow, .eyebrow) {
  color: var(--qr-brand);
  text-align: center;
}
body .qr-page-header .back-btn {
  position: absolute;
  top: 14px;
  left: 16px;
}
body .qr-page-header .lang-switch {
  position: absolute;
  top: 14px;
  right: 16px;
}
body .qr-page-header .lang-switch label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body .qr-page-header .page-header,
body .qr-page-header .header {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}
body .qr-page-header .summary { justify-content: center; }
body .qr-page-header .summary-item { text-align: center; }
body .qr-page-header .hero { margin-top: 0; text-align: center; }
body .qr-page-header .hero-label { color: var(--qr-brand); }
body .qr-page-header .serial-title { overflow-wrap: anywhere; }
body.qr-installer-page.cthings-installer-page .installer-header {
  border-top: 3px solid var(--qr-brand);
  text-align: center;
}
body.qr-installer-page.cthings-installer-page .installer-header .logo {
  margin: 0 auto 24px;
}
body.qr-installer-page.cthings-installer-page :is(.installer-eyebrow, .installer-title, .installer-subtitle) {
  text-align: center;
}
@media (max-width: 460px) {
  body .qr-page-header { padding: 56px 14px 22px; }
  body .qr-page-header .back-btn { top: 12px; left: 12px; }
  body .qr-page-header .lang-switch { top: 12px; right: 12px; }
}
.qr-lookup-page h2 {
  margin: 7px 0;
  color: var(--qr-text-strong);
  font-size: 23px;
  line-height: 1.25;
}
.qr-lookup-page .container > p {
  margin: 0;
  color: var(--qr-text-muted);
  font-size: 12px;
  line-height: 1.65;
}
.qr-lookup-page .field {
  margin-top: 30px;
}
.qr-lookup-page label {
  color: var(--qr-text-strong);
  font-size: 11px;
  font-weight: 600;
}
.qr-lookup-page input {
  min-height: 47px;
}
.qr-lookup-page .hint {
  color: var(--qr-text-muted);
}
.qr-lookup-page .btn {
  min-height: 46px;
  margin-top: 17px;
}
.qr-page-footer {
  color: var(--qr-text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-align: center;
}

/* Installer actions stay functional; the new hierarchy follows the preview. */
.qr-installer-page .container {
  max-width: 560px;
}
.qr-installer-page .page-header {
  padding: 27px 31px 25px;
  border: 1px solid var(--qr-border);
  border-radius: 12px;
  box-shadow: var(--qr-shadow);
}
.qr-installer-page .page-header .logo {
  width: 155px;
  max-width: 50vw;
  margin: 0 auto 28px;
}
.qr-installer-page .lang-switch label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.qr-installer-page .page-header .qr-page-eyebrow,
.qr-installer-page .page-title,
.qr-installer-page .qr-device-caption {
  text-align: center;
}
.qr-installer-page .page-title {
  margin: 8px 0 5px;
  color: var(--qr-text-strong);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}
.qr-installer-page .qr-device-caption {
  margin: 0;
  color: var(--qr-text-muted);
  font-size: 12px;
  line-height: 1.6;
}
.qr-installer-page .panel.section {
  border: 1px solid var(--qr-border);
  border-radius: 10px;
  box-shadow: var(--qr-shadow);
}
.qr-installer-page .stats {
  gap: 10px;
}
.qr-installer-page .stat:not(.confirmed):not(.ok):not(.error):not(.warning) {
  border: 1px solid var(--qr-border);
  border-radius: 8px;
  background: var(--qr-surface-soft) !important;
}
.qr-installer-page .action-card {
  border-left: 3px solid var(--qr-brand);
}
.qr-installer-page .action-card .action-btn.procedure-btn {
  background: var(--qr-brand);
  box-shadow: none;
}
.qr-installer-page .status-check {
  border-color: var(--qr-border) !important;
  border-radius: 8px;
  background: var(--qr-surface-soft) !important;
}
.qr-installer-page .status-check-btn:focus-visible {
  outline-color: var(--qr-brand) !important;
}

@media (max-width: 460px) {
  body.qr-lookup-page {
    align-items: stretch;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 0px) !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
  }
  .qr-lookup-page .container {
    width: 100%;
    max-width: none;
    min-height: calc(var(--qr-visual-viewport-height, 100dvh) - 70px);
    padding: 37px 24px 30px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .qr-lookup-page .logo {
    width: 151px;
  }
  .qr-installer-page .page-header {
    padding: 25px 21px 22px;
  }
}

@media (prefers-contrast: more) {
  .panel,
  .section,
  .card,
  .qr-lookup-page .container {
    border-width: 2px;
  }
  .qr-page-eyebrow {
    color: #1e1d42;
  }
}

/* The installer dashboard is the QR workspace layout reference. Other QR
   screens share its single shell, flush header, section dividers and corners. */
body .qr-shell,
body.qr-service-menu-page .qr-shell,
body.qr-lookup-page .qr-shell {
  position: relative;
  width: min(100%, 560px);
  max-width: 560px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--qr-border);
  border-radius: var(--qr-radius-shell);
  background: var(--qr-surface);
  box-shadow: var(--qr-shadow);
}
body.qr-lookup-page .qr-shell { width: 100%; }
body .card.qr-shell { border-radius: var(--qr-radius-shell); }
body .qr-shell > .qr-page-header {
  position: relative;
  min-height: 150px;
  margin: 0;
  padding: 25px 21px 22px;
  border: 0;
  border-top: 3px solid var(--qr-brand);
  border-bottom: 1px solid var(--qr-border);
  border-radius: 0;
  background: var(--qr-surface);
  box-shadow: none;
}
body .qr-shell > .qr-page-header .logo { margin: 0 auto 23px; }
body .qr-shell > .qr-page-header .back-btn { top: 16px; left: 20px; }
body .qr-shell > .qr-page-header .lang-switch { top: 16px; right: 20px; }
body .qr-shell > :is(.panel, .section, .installer-card, .options, .actions, .done-stack, #relocation-form):not(.qr-page-header),
body .qr-shell > :is(form, .protocol-form) {
  margin: 0;
  padding: 18px 21px 21px;
  border: 0;
  border-bottom: 1px solid var(--qr-border);
  border-radius: 0;
  background: var(--qr-surface);
  box-shadow: none;
}
body .qr-shell > :is(.panel, .section) > :is(h2, .section-title) {
  margin: 0 0 11px;
  color: var(--qr-text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
body .qr-shell .qr-status-section .stats {
  display: block;
  margin: 0 0 8px;
}
body .qr-shell .qr-status-section .stat:not(.confirmed):not(.error):not(.warning) {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 3px 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  text-align: left;
}
body .qr-shell .qr-status-section .stat strong { order: 2; font-size: 11px; }
body .qr-shell .qr-status-section .stat span { order: 1; font-size: 10px; }
body .qr-shell .qr-status-section .hint {
  margin: 4px 0 10px;
  color: var(--qr-text-muted);
  font-size: 10px;
  line-height: 1.5;
}
body .qr-shell .qr-status-section .status-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  margin: 8px 0 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
}
body .qr-shell .qr-status-section .status-check-title,
body .qr-shell .qr-status-section .status-check-desc {
  grid-column: 1;
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
}
body .qr-shell .qr-status-section .status-check-title { font-weight: 600; }
body .qr-shell .qr-status-section .status-check-btn {
  grid-column: 2;
  grid-row: 1 / 3;
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 8px 11px;
  font-size: 10px;
}
body .qr-shell > :is(.summary-card, .info-group, .divider, .note, .footer-row,
  .footer-hint, .contact, .alert, .notice, .meta, .qr-panel, .result,
  .instruction, .success, .error, .message, .card:not(.qr-shell)) {
  margin-left: 21px;
  margin-right: 21px;
}
body .qr-shell > .instruction { margin-top: 18px; }
body .qr-shell > .qr-shell-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 21px;
  border-top: 1px solid var(--qr-border);
  color: var(--qr-text-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
}
body .qr-shell > p {
  margin-left: 21px;
  margin-right: 21px;
}
body .qr-shell > .btn {
  width: calc(100% - 42px);
  margin: 16px 21px 21px;
}
body .qr-shell :is(.action-card, .option-card, .option, .card:not(.qr-shell),
  .installer-card, .summary-card, .reverify-card, .jira-attachments,
  .failure-card, .completion-banner, .protocol-done, .success-screen,
  .success, .warning, .result, .ticket-banner, .status-check, .qr-panel,
  .message, .alert, .notice, .reason-option, .photo-thumbnail,
  .stat, .meta-item, .summary-item) {
  border-radius: var(--qr-radius-card);
}
body.qr-service-menu-page .qr-shell .option { border-radius: var(--qr-radius-card); }
body.qr-installer-page .completion-banner {
  border-radius: var(--qr-radius-card);
}
body .qr-shell :is(.btn, .action-btn, .link-btn, .status-check-btn,
  .failure-toggle-btn, .failure-submit-btn, .photo-file-button,
  .back-btn, .lang-select) {
  border-radius: var(--qr-radius-card);
}
@media (max-width: 460px) {
  body.qr-lookup-page {
    align-items: center;
    padding: 10px !important;
  }
  body .qr-shell > .qr-page-header { padding: 24px 14px 21px; }
  body .qr-shell > .qr-page-header .back-btn { top: 12px; left: 12px; }
  body .qr-shell > .qr-page-header .lang-switch { top: 12px; right: 12px; }
  body .qr-shell > :is(.panel, .section, .installer-card, .options, .actions, .done-stack, #relocation-form):not(.qr-page-header),
  body .qr-shell > :is(form, .protocol-form) { padding-inline: 16px; }
  body .qr-shell > :is(.summary-card, .info-group, .divider, .note, .footer-row,
    .footer-hint, .contact, .alert, .notice, .meta, .qr-panel, .result,
    .instruction, .success, .error, .message, .card:not(.qr-shell)),
  body .qr-shell > p {
    margin-left: 16px;
    margin-right: 16px;
  }
  body .qr-shell > .btn {
    width: calc(100% - 32px);
    margin-inline: 16px;
  }
}
