*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 24px rgba(0,0,0,0.15);
  --radius: 1rem;
  --font: 'Noto Sans', system-ui, -apple-system, sans-serif;
}
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-y: auto; }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 40px 24px 32px;
  border-radius: 0 0 24px 24px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 0;
}
.hero-content { position: relative; z-index: 1; }
.hero-logo { height: 28px; margin-bottom: 12px; }
.hero-title { font-size: 1.75em; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.hero-subtitle { color: var(--text-muted); font-size: 0.9em; }

/* Category rows */
.category-section { padding: 0 0 12px; }
.category-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 10px; }
.category-header h2 { color: var(--text); font-size: 1.15em; font-weight: 700; }
.category-header .arrow-btn { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #e5e7eb; background: transparent; color: var(--text); font-size: 1.1em; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.category-header .arrow-btn:hover { background: #f3f4f6; }

/* Horizontal scroll row */
.card-row {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 16px;
  padding: 4px 0 16px;
  scroll-padding-left: 24px;
}
.card-row::-webkit-scrollbar { display: none; }
.card-row > :first-child { margin-left: 24px; }
.card-row::after { content: ''; flex: 0 0 24px; }

/* Thumbnail card (Airbnb-style) */
.card-thumb {
  flex: 0 0 260px;
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: 14px;
  transition: transform 0.15s;
}
.card-thumb:hover { transform: scale(1.02); }
.card-thumb:active { transform: scale(0.98); }

.card-art {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.card-icon {
  position: absolute;
  bottom: -10px;
  right: -10px;
  width: 110px;
  height: 110px;
  opacity: 0.18;
  filter: brightness(0) invert(1);
  pointer-events: none;
  user-select: none;
}

.card-art .card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ffffffee;
  backdrop-filter: blur(4px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1f2937;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  margin: 0;
  display: inline-block;
}

.card-info { padding: 10px 2px 0; }
.card-info .card-title { font-size: 0.95em; font-weight: 600; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info .card-subtitle { color: #9ca3af; font-size: 0.8em; margin-bottom: 0; }

/* ── Detail dialog ── */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.detail-overlay.visible { display: flex; }

.detail-sheet {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 24px 32px;
  animation: sheetUp 0.3s ease-out;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.detail-sheet .sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: #d1d5db; margin: 0 auto 16px; }
.detail-sheet .sheet-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.72em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.detail-sheet .sheet-title { font-size: 1.25em; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.detail-sheet .sheet-subtitle { color: var(--text-muted); font-size: 0.85em; margin-bottom: 16px; }

/* Form fields (shared) */
.field-group { margin-bottom: 10px; }
.field-group label {
  display: block; font-size: 0.75em; color: var(--text-muted); margin-bottom: 3px; font-weight: 500;
}
.field-group input, .field-group select {
  width: 100%; padding: 9px 11px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  background: #fafaff; color: var(--text); font-size: 0.9em; font-family: var(--font);
  outline: none; transition: border-color 0.2s;
}
.field-group input:focus, .field-group select:focus { border-color: var(--primary); }
.field-group input::placeholder { color: #9ca3af; }

.row { display: flex; gap: 10px; }
.row .field-group { flex: 1; }

.prefill-link { display: inline-block; color: var(--primary); font-size: 0.75em; cursor: pointer; margin-bottom: 10px; }
.prefill-link:hover { text-decoration: underline; }

/* Buttons */
.issue-btn {
  width: 100%; padding: 13px; border: none; border-radius: 10px; font-size: 1em;
  font-weight: 600; font-family: var(--font); cursor: pointer; margin-top: 14px;
  background: var(--primary); color: #fff; transition: background 0.15s, transform 0.1s;
}
.issue-btn:hover { background: var(--primary-hover); }
.issue-btn:active { transform: scale(0.98); }

.issue-btn-dc {
  width: 100%; padding: 13px; border: 2px solid var(--primary); border-radius: 10px;
  font-size: 1em; font-weight: 600; font-family: var(--font); cursor: pointer; margin-top: 6px;
  background: transparent; color: var(--primary); transition: background 0.15s, color 0.15s;
}
.issue-btn-dc:hover { background: var(--primary); color: #fff; }

/* Action group: visually separates wallet-import buttons from DC API issuance,
   and side-by-sides format variants when both mDoc and SD-JWT are offered.
   Uses a flex column with `gap` so single-button and multi-button layouts both
   space their children consistently. */
.actions-group {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid #e5e7eb;
}
.actions-label {
  margin: 0 0 2px 2px;
  font-size: 0.7em; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.actions-row { display: flex; gap: 8px; }
.actions-row .issue-btn { flex: 1; margin-top: 0; padding: 11px 8px; font-size: 0.92em; }
.actions-group .issue-btn { margin-top: 0; }
.actions-group .issue-btn-dc { margin-top: 0; padding: 10px; font-size: 0.88em; }

/* Format-coded button variants — picks up the same palette as the mdoc/sdjwt
   badges so the format choice is visible at a glance. */
.issue-btn-mdoc { background: #2563eb; }
.issue-btn-mdoc:hover { background: #1d4ed8; }
.issue-btn-sdjwt { background: #d97706; }
.issue-btn-sdjwt:hover { background: #b45309; }

/* TX toggle */
.tx-toggle {
  display: block; width: 100%; padding: 8px; border: 1px dashed #d1d5db; border-radius: 8px;
  font-size: 0.8em; font-weight: 500; font-family: var(--font); cursor: pointer; margin-top: 10px;
  background: #fafafa; color: var(--text-muted); transition: background 0.15s;
}
.tx-toggle:hover { background: #f0f0f5; }
.tx-data-section { display: none; margin-top: 8px; padding: 10px; background: #fffbeb; border-radius: 8px; border: 1px solid #fde68a; }
.tx-data-section.expanded { display: block; }

/* Badge color variants inside art */
.badge-mdoc { background: #dbeafe; color: #1e40af; }
.badge-sdjwt { background: #fef3c7; color: #92400e; }
.badge-sca { background: #fef3c7; color: #92400e; }

/* SCA card styling in detail — the SCA badge already signals the category,
   no need for an extra accent bar. */

/* Result overlay */
.result-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.result-overlay.visible { display: flex; }
.result-box {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px; max-width: 400px; width: 100%; text-align: center;
}
.result-box h2 { margin-bottom: 12px; font-size: 1.1em; }
.result-box .qr-img { max-width: 220px; margin: 12px auto; border-radius: 12px; }
.result-box .status { color: var(--text-muted); font-size: 0.9em; margin: 12px 0; }
.result-box .deep-link { word-break: break-all; font-size: 0.7em; color: var(--primary); }
.result-box .close-btn {
  margin-top: 14px; padding: 10px 24px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  background: transparent; color: var(--text); cursor: pointer; font-family: var(--font); font-size: 0.9em;
}

.card-select-label { display: none; }
.multi-issue-bar { display: none; }

/* Inline boolean attribute (e.g. age_over_18 checkbox on the AV detail card). */
.claim-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  font-size: 0.95em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.claim-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Hide dots (no longer needed) */
.dots { display: none; }

/* Background picker carousel */
.bg-picker-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.66);
  display: flex; justify-content: center; align-items: center; z-index: 9999;
}
.bg-picker-dialog {
  background: #fff; border-radius: 16px; padding: 24px; max-width: 760px; width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25); max-height: 80vh; overflow: auto;
}
.bg-picker-dialog h2 { margin-bottom: 16px; font-size: 1.3em; }
.bg-picker-strip {
  display: flex; gap: 16px; overflow-x: auto; padding: 8px 0 16px 0;
  scroll-snap-type: x mandatory;
}
.bg-picker-tile {
  flex: 0 0 200px; scroll-snap-align: start; cursor: pointer;
  border: 3px solid transparent; border-radius: 12px; padding: 4px;
  transition: border-color 0.1s;
}
.bg-picker-tile.selected { border-color: var(--primary, #6366f1); }
.bg-picker-tile img {
  width: 100%; height: 120px; object-fit: cover; border-radius: 8px; display: block;
}
.bg-picker-label { text-align: center; margin-top: 6px; font-weight: 600; }
.bg-picker-actions { display: flex; justify-content: flex-end; gap: 10px; }
.bg-picker-actions button { padding: 10px 18px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; }
.bg-picker-cancel { background: #e5e7eb; color: #111827; }
.bg-picker-confirm { background: var(--primary, #6366f1); color: #fff; }
