/* ==========================================================================
   QR Studio — design tokens
   ========================================================================== */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f8;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --ink: #0f172a;
  --ink-soft: #475069;
  --ink-faint: #6b7488;
  --line: #e3e6f0;
  --line-strong: #cfd4e4;

  --brand: #5b4bff;
  --brand-strong: #4030e8;
  --brand-soft: #eeecff;
  --accent: #06b6d4;
  --success: #0f9d58;
  --success-soft: #e6f6ee;
  --danger: #d92d20;
  --danger-soft: #fdeceb;
  --warn: #b45309;
  --warn-soft: #fdf3e3;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px -8px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, 0.32);
  --shadow-brand: 0 14px 30px -14px rgba(91, 75, 255, 0.6);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --header-h: 68px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p {
  margin: 0;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: #0d1225;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.site-header .wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex: none;
}

.brand:hover {
  text-decoration: none;
}

.brand .mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 6px 16px -6px rgba(91, 75, 255, 0.9);
  flex: none;
}

.brand .mark svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-right: auto;
  min-width: 0;
}

.nav a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav a:hover {
  color: #fff;
  text-decoration: none;
}

.nav a.active {
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* Keep the dark bar on one line all the way down to small phones. */
@media (max-width: 720px) {
  .site-header .wrap {
    padding: 0 16px;
    gap: 14px;
  }

  .nav {
    gap: 16px;
  }

  .header-user span:not(.avatar):not(.sr-only) {
    display: none;
  }
}

@media (max-width: 460px) {
  .brand-name {
    display: none;
  }

  .site-header .wrap {
    gap: 10px;
  }

  .nav {
    gap: 14px;
  }

  .nav a {
    font-size: 13px;
  }
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6d5cff, #17c0dc);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  --btn-bd: var(--brand);
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not([disabled]) {
  --btn-bg: var(--brand-strong);
}

.btn-dark {
  --btn-bg: #1b2137;
  --btn-fg: #fff;
  --btn-bd: #1b2137;
}

.btn-dark:hover:not([disabled]) {
  --btn-bg: #2a3150;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-bd: var(--line-strong);
}

.btn-ghost:hover:not([disabled]) {
  --btn-bg: var(--bg-soft);
}

.btn-header-ghost {
  --btn-bg: transparent;
  --btn-fg: rgba(255, 255, 255, 0.85);
  --btn-bd: rgba(255, 255, 255, 0.22);
}

.btn-header-ghost:hover:not([disabled]) {
  --btn-fg: #fff;
  --btn-bd: rgba(255, 255, 255, 0.5);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: var(--r-sm);
}

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 72px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 15px;
  font-weight: 650;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand);
}

.muted {
  color: var(--ink-faint);
}

.small {
  font-size: 13px;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.field {
  display: block;
  margin-bottom: 14px;
}

.field > .label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.16);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

.field-hint {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type='color'] {
  width: 46px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--brand);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  border: 1px solid transparent;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
}

.alert > span {
  min-width: 0;
}

/* Inline code inside alerts must not break the sentence apart. */
.alert code {
  display: inline;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(13, 18, 37, 0.07);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

/* ==========================================================================
   Email verification
   ========================================================================== */
.verify-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 24px;
  border: 1px solid #f0dcbb;
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, #fffaf0, var(--warn-soft));
  box-shadow: var(--shadow-sm);
}

.verify-banner-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: #fff;
  color: var(--warn);
  border: 1px solid #f0dcbb;
}

.verify-banner-icon svg {
  width: 19px;
  height: 19px;
}

.verify-banner-body {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.verify-banner-body strong {
  font-size: 14px;
  font-weight: 650;
  color: #7c4a03;
}

.verify-banner-body span {
  font-size: 13px;
  color: var(--ink-soft);
}

.verify-banner-body .dev-link {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
}

.verify-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* Centred single-card pages (check-email, verify, verify-email, mailbox) */
.center-shell {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.center-card {
  width: 100%;
  max-width: 470px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 34px 32px;
  text-align: center;
}

.center-card h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.center-card > p {
  color: var(--ink-soft);
  font-size: 14px;
}

.center-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.center-icon svg {
  width: 26px;
  height: 26px;
}

.center-icon.success {
  background: var(--success-soft);
  color: var(--success);
}

.center-icon.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.center-icon.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.center-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.email-chip {
  display: inline-block;
  margin: 12px 0 0;
  padding: 6px 13px;
  border-radius: var(--r-full);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
}

.center-foot {
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-faint);
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Development mailbox */
.mailbox-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 72px;
}

.mailbox-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.mailbox-list {
  display: grid;
  gap: 14px;
}

.mail-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.mail-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.mail-item .subject {
  font-size: 14px;
  font-weight: 650;
}

.mail-item .meta {
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--mono);
}

.mail-item pre {
  margin: 0;
  padding: 15px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-all;
}

.mail-item .mail-actions {
  padding: 0 16px 15px;
  display: flex;
  gap: 8px;
}


.alert-error {
  background: var(--danger-soft);
  border-color: #f7cfcb;
  color: #912018;
}

.alert-success {
  background: var(--success-soft);
  border-color: #c4e8d5;
  color: #0a6c3d;
}

.alert-info {
  background: var(--brand-soft);
  border-color: #d9d4ff;
  color: #3b2ec4;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 15px;
  border-radius: var(--r-md);
  background: #131a30;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out;
}

.toast.error {
  background: #7f1d1d;
}

.toast.success {
  background: #0b5132;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ==========================================================================
   Generator page
   ========================================================================== */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(26px, 3.4vw, 36px);
  margin-bottom: 8px;
}

.hero p {
  color: var(--ink-soft);
  max-width: 56ch;
}

.trial-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.trial-dots {
  display: inline-flex;
  gap: 4px;
}

.trial-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  background: var(--line-strong);
}

.trial-dot.on {
  background: var(--brand);
}

.trial-pill.exhausted {
  background: var(--warn-soft);
  border-color: #f0dcbb;
  color: var(--warn);
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .studio {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Type picker */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.type-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.type-chip svg {
  width: 17px;
  height: 17px;
}

.type-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #fff;
}

.type-chip[aria-pressed='true'] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

details.advanced {
  border-top: 1px dashed var(--line-strong);
  margin-top: 6px;
  padding-top: 14px;
}

details.advanced > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

details.advanced > summary::-webkit-details-marker {
  display: none;
}

details.advanced > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

details.advanced[open] > summary::after {
  transform: rotate(-135deg);
}

.advanced-body {
  padding-top: 14px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.preset {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.preset[aria-pressed='true'] {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

/* Preview panel */
.preview-sticky {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.preview-stage {
  display: grid;
  place-items: center;
  padding: 26px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 120% at 15% 0%, #ffffff 0%, var(--bg-soft) 60%, #e6e9f6 100%);
  border: 1px solid var(--line);
  min-height: 300px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  max-width: 100%;
}

.preview-frame img {
  display: block;
  width: 260px;
  height: 260px;
  max-width: 100%;
  image-rendering: pixelated;
  border-radius: 4px;
}

.preview-empty {
  text-align: center;
  color: var(--ink-faint);
  font-size: 13.5px;
  max-width: 30ch;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 11.5px;
  font-weight: 700;
}

.download-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.download-row .btn-block {
  width: 100%;
}

.payload-preview {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: #0d1225;
  color: #cfd6f5;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 132px;
  overflow: auto;
}

.recent-list {
  margin-top: 24px;
}

.recent-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 18px 22px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.recent-item img {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: #fff;
  image-rendering: pixelated;
  flex: none;
}

.recent-item .meta {
  min-width: 0;
}

.recent-item strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item span {
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth-shell {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 940px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    display: none;
  }
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
}

.auth-card h1 {
  font-size: 25px;
  margin-bottom: 6px;
}

.auth-card .sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 22px;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 56px 48px;
  background:
    radial-gradient(90% 70% at 20% 10%, rgba(91, 75, 255, 0.55), transparent 60%),
    radial-gradient(80% 80% at 90% 90%, rgba(6, 182, 212, 0.42), transparent 60%),
    #0d1225;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
}

.auth-aside h2 {
  font-size: 30px;
  max-width: 20ch;
}

.auth-aside .points {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-aside .points li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.82);
}

.auth-aside .points svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  color: #7ff0e0;
}

.auth-foot {
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--ink-faint);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* ==========================================================================
   Dashboard
   ========================================================================== */
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dash-head h1 {
  font-size: 25px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  padding: 18px 20px;
}

.stat .k {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stat .v {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.toolbar .input {
  max-width: 280px;
}

.search-wrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  pointer-events: none;
}

.search-wrap .input {
  padding-left: 34px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 20px 22px;
}

.qr-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.qr-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.qr-thumb {
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(160deg, #f8f9fd, #eef1fa);
  border-bottom: 1px solid var(--line);
}

.qr-thumb img {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
  box-shadow: var(--shadow-sm);
}

.qr-body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.qr-body strong {
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-body .payload {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.qr-foot .date {
  font-size: 11.5px;
  color: var(--ink-faint);
}

.qr-actions {
  display: flex;
  gap: 4px;
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
}

.empty-state .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--ink-faint);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(100deg, #eef0f7 30%, #f7f8fc 50%, #eef0f7 70%);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(13, 18, 37, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--warn-soft);
  color: var(--warn);
}

.modal h2 {
  font-size: 19px;
  margin-bottom: 8px;
}

.modal p {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

/* ==========================================================================
   404
   ========================================================================== */
.notfound {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  text-align: center;
  padding: 48px 24px;
}

.notfound .code {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--brand);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
