/* CardScan v2 */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 62px; /* clear sticky nav + breathing room */
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde1e7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text: #111827;
  --text-muted: #6b7280;
  --error: #dc2626;
  --error-light: #fef2f2;
  --field-missing-bg: #fff5f5;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 24px;
  line-height: 1.5;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 12px;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header h1 span {
  color: var(--primary);
}

header p {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone.drag-reject {
  border-color: var(--error);
  background: var(--error-light);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.upload-zone p strong {
  color: var(--primary);
}

.upload-hint-mobile { display: none; }
.scan-hidden { display: none !important; }
@media (max-width: 768px) {
  .upload-hint-desktop { display: none; }
  .upload-hint-mobile  { display: block; }
}

#preview-wrap {
  display: none;
}

#preview-wrap img {
  max-height: 280px;
  max-width: 100%;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-block {
  width: 100%;
  margin-top: 18px;
  padding: 12px 20px;
  font-size: 1rem;
}

.btn-lg { padding: 12px 32px; }

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
}

.btn-success {
  background: var(--success);
  color: #fff;
  width: 100%;
  margin-top: 16px;
  padding: 12px 20px;
  font-size: 1rem;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

/* Spinner */
.spinner {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 0;
  text-align: center;
}

.spinner.active { display: flex; }

.spin-ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.spinner p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Alert */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-top: 14px;
  line-height: 1.4;
}

.alert.active { display: block; }

.alert-error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* Form fields */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.field-full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  width: 100%;
}

.form-group textarea {
  resize: vertical;
  min-height: 72px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* Results section */
#results-section {
  display: none;
}

#results-section.active {
  display: block;
}

/* Collapsible card (details/summary) */
details.card { padding: 0; }
details.card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > .card-body { padding: 0 24px 20px; }
details.card[open] > .card-body { animation: collapseOpen 0.2s ease-out; }
@keyframes collapseOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.collapsible-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
details.card[open] .collapsible-chevron { transform: rotate(90deg); }

/* Collapsible section inside a card */
details.section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  padding: 0;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::marker { display: none; }
details.section > summary p { margin: 0; }
details.section[open] > .section-body { animation: collapseOpen 0.2s ease-out; }
details.section[open] .collapsible-chevron { transform: rotate(90deg); }

/* Admin specific */
.admin-header {
  margin-bottom: 24px;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.admin-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.token-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.key-display {
  font-family: monospace;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

footer {
  text-align: center;
  margin-top: 32px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

/* ── Nav bar ─────────────────────────────────────────────────────────────── */
.site-nav {
  background: #1e293b;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
}

.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.nav-brand span { color: #60a5fa; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 8px;
  border-radius: 6px;
  margin-left: auto;
  transition: background 0.15s, color 0.15s;
}
.nav-hamburger:hover { background: rgba(255,255,255,.08); color: #fff; }

.nav-links a {
  color: #94a3b8;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #cbd5e1;
  font-size: 0.875rem;
  font-family: inherit;
  padding: 0 6px;
  white-space: nowrap;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 200;
  overflow: hidden;
}

.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: #94a3b8 !important;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-dropdown-menu a:hover {
  background: rgba(255,255,255,.07);
  color: #fff !important;
  text-decoration: none;
}

/* Obfuscated email */
.obf-email::before { content: attr(data-user) "\0040"; }
.obf-email::after  { content: attr(data-domain); }

/* Logout icon */
.nav-logout-icon {
  display: flex;
  align-items: center;
  color: #64748b;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  margin-left: 2px;
}

.nav-logout-icon:hover {
  background: rgba(255,255,255,.08);
  color: #f87171 !important;
  text-decoration: none;
}

@media (max-width: 640px) {
  .nav-hamburger { display: flex; }

  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: 52px;
    padding: 0 16px;
  }

  .nav-links {
    display: none;
    position: static;
    transform: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 2px;
    padding: 6px 0 12px;
  }

  .nav-links.open { display: flex; }

  .nav-links > a,
  .nav-dropdown-trigger {
    padding: 10px 12px !important;
    width: 100%;
    border-radius: 6px;
    box-sizing: border-box;
    text-align: left;
  }

  .nav-dropdown { width: 100%; }

  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,.04);
    border-radius: 6px;
    margin-top: 2px;
    min-width: 0;
  }

  .nav-dropdown-menu a { padding: 9px 20px !important; }

  .nav-logout-icon { padding: 10px 12px; width: 100%; border-radius: 6px; }
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
}

/* ── User management table ───────────────────────────────────────────────── */
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.user-table th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  background: var(--bg);
}

.user-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-admin {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-user {
  background: var(--bg);
  color: var(--text-muted);
}

.badge-active {
  background: var(--success-light);
  color: var(--success);
}

.badge-pending {
  background: #fffbeb;
  color: #d97706;
}

.badge-unconfirmed {
  background: var(--error-light);
  color: var(--error);
}

/* ── Toast notification ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  z-index: 999;
  cursor: pointer;
  max-width: 320px;
  line-height: 1.4;
  animation: toastIn 0.2s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}
.toast-error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid #fecaca;
}
.toast-hide {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Back-to-top button ──────────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  z-index: 998;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#back-to-top:hover {
  background: var(--primary-dark, #1d4ed8);
}

/* ── Credits bubble ─────────────────────────────────────────────────────── */
.credits-bubble {
  position: fixed;
  top: 62px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 99;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  pointer-events: auto;
  text-decoration: none;
}
.credits-bubble:hover {
  opacity: 0.75;
}

/* ── User management form helpers ───────────────────────────────────────── */
.section-body { margin-top: 14px; }
.section-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.section-delete {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.form-contents  { display: contents; }
.form-field-inline { margin-bottom: 0; flex: 1; min-width: 120px; }
.form-field-fixed  { margin-bottom: 0; }
.form-group label.label-sm { font-size: .78rem; }
.form-group input.input-sm  { padding: 5px 8px; font-size: .85rem; }
.btn-row  { padding: 5px 14px; font-size: .8rem; }
.btn-xs   { padding: 3px 10px; font-size: .75rem; }
.btn-delete    { color: var(--error); box-shadow: inset 0 0 0 1px #fca5a5; }
.btn-free-play-on { color: var(--success); box-shadow: inset 0 0 0 1px var(--success); }
.select-role {
  padding: 5px 28px 5px 8px;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
}
.text-pending { color: #d97706; }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-muted   { color: var(--text-muted); }

/* ── User list rows (users.php) ─────────────────────────────────────────── */
.user-row-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-row-username {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.user-row-fullname {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row-you {
  font-size: .72rem;
  color: var(--text-muted);
}
/* user list header & sort */
.user-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
}
.user-header-identity { flex: 1; min-width: 0; }
.user-header-meta {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  font-size: .78rem;
}
.user-header-chevron-spacer { width: 16px; flex-shrink: 0; }
.sort-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.sort-btn:hover { color: var(--text); }
.sort-ind { font-size: .7rem; }
.user-col-created { width: 96px; font-size: .78rem; color: var(--text-muted); }

/* pagination */
.page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.user-row-meta {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  font-size: .78rem;
}
.user-col-status  { width: 100px; display: flex; align-items: center; justify-content: flex-start; }
.user-col-role    { width: 68px;  display: flex; align-items: center; justify-content: flex-start; }
.user-col-credits { width: 72px;  display: flex; align-items: center; justify-content: flex-end; }
.user-header-meta .user-col-credits { justify-content: flex-end; }
.user-col-created { display: flex; align-items: center; justify-content: flex-start; }

@media (max-width: 520px) {
  .user-list-card details.section > summary {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .user-row-identity { order: 0; flex: 1; min-width: 0; }
  .user-list-card .collapsible-chevron { order: 1; flex-shrink: 0; }
  .user-row-meta     { order: 2; flex-basis: 100%; justify-content: flex-start; }
  .user-col-status  { width: 96px; }
  .user-col-role    { width: 60px; }
  .user-col-credits { width: auto; justify-content: flex-start; }
  .user-col-created { display: none; }
  .user-header-chevron-spacer { display: none; }
}

/* ── Wide container modifier ─────────────────────────────────────────────── */
.container--wide {
  max-width: 680px;
  padding-top: 16px;
}

/* ── Step infographic ───────────────────────────────────────────────────── */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.step-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}
.step-number--sm {
  width: 34px;
  height: 34px;
  font-size: .85rem;
}
.step-number--xs {
  width: 32px;
  height: 32px;
  font-size: .8rem;
}
.step-connector {
  width: 2px;
  flex: 1;
  min-height: 24px;
  background: var(--border);
  margin: 4px 0;
}
.step-body {
  padding-bottom: 24px;
}
.step-item:last-child .step-body { padding-bottom: 0; }
.step-body--sm {
  padding-bottom: 18px;
}
.step-item:last-child .step-body--sm { padding-bottom: 0; }
.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.step-label strong { font-size: .95rem; }
.step-body > p {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.step-label--sm {
  gap: 8px;
  margin-bottom: 3px;
}
.step-label--sm strong { font-size: .85rem; }
.step-body--sm > p {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Callout / tip box ───────────────────────────────────────────────────── */
.callout {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Utility classes ─────────────────────────────────────────────────────── */
.form-group--inline { flex: 1; margin-bottom: 0; }

.flex-col { display: flex; flex-direction: column; gap: 16px; }

.icon-sm { flex-shrink: 0; margin-top: 2px; }

/* Action buttons (VCF + webhook) */
.action-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}
.btn-label-short { display: none; }
@media (max-width: 420px) {
  .btn-label-full  { display: none; }
  .btn-label-short { display: inline; }
}

.data-table th,
.data-table td  { padding: 6px 8px; }
.data-table th  { color: var(--text-muted); font-weight: 600; }

/* ── Modal overlay ─────────────────────────────────────────────────────── */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 900;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  position: relative;
  width: min(90vw, 320px);
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s;
}
.modal-overlay.is-open .modal-box { transform: scale(1); }
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
}
.modal-close:hover { color: var(--text); }
