:root {
  --bg: #f5f3ff;
  --surface: #ffffff;
  --surface2: #ede9fe;
  --border: #ddd6fe;
  --accent: #7c3aed;
  --accent2: #6d28d9;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.12);
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --green: #059669;
  --yellow: #d97706;
  --red: #dc2626;
  --orange: #ea580c;
  --teal: #0891b2;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.logo svg { flex-shrink: 0; }

.logo-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  line-height: 1;
}

.settings-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.settings-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main ── */
main {
  flex: 1;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── API Key Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.modal h3 { font-size: 1.1rem; margin-bottom: 6px; }
.modal p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 20px; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 12px 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}
.btn-primary:hover { background: #7c74ff; box-shadow: 0 4px 20px var(--accent-glow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Instruction card ── */
.instruction-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.instruction-card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.25);
}

.step-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-top: 3px;
}
.step-text strong { color: var(--text); }

/* ── Capture zone ── */
.capture-zone {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
  background: var(--surface);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-zone:hover { border-color: var(--accent); box-shadow: 0 4px 24px var(--accent-glow); }
.capture-zone.has-image { border-color: var(--accent); }

.capture-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
  width: 100%;
  cursor: pointer;
  background: linear-gradient(160deg, rgba(124,58,237,0.07) 0%, rgba(109,40,217,0.04) 100%);
  transition: background 0.2s;
}
.capture-placeholder:hover { background: linear-gradient(160deg, rgba(124,58,237,0.12) 0%, rgba(109,40,217,0.07) 100%); }

.capture-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 8px 24px rgba(124,58,237,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.capture-placeholder:hover .capture-icon {
  transform: scale(1.07);
  box-shadow: 0 12px 32px rgba(124,58,237,0.4);
}

.capture-placeholder h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.capture-placeholder p {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  line-height: 1.5;
}

.capture-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.chip-upload {
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.chip-upload:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

#preview-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

#preview-wrap { position: relative; }

.preview-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 14px 18px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-change {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.preview-change:hover { background: rgba(255,255,255,0.28); }

/* Analyze button overlaid on the image */
.analyze-btn-overlay {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  box-shadow: 0 4px 20px rgba(124,58,237,0.45);
  transition: all 0.2s;
  letter-spacing: -0.01em;
}
.analyze-btn-overlay:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(124,58,237,0.6); }
.analyze-btn-overlay:active { transform: translateY(0); }
.analyze-btn-overlay:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.analyze-btn-overlay.loading { pointer-events: none; }

/* ── Analyze button ── */
.analyze-btn {
  padding: 16px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 24px rgba(108, 99, 255, 0.3);
}
.analyze-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 32px rgba(108, 99, 255, 0.45); }
.analyze-btn:active { transform: translateY(0); }
.analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.analyze-btn.loading { pointer-events: none; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ── */
.results { display: flex; flex-direction: column; gap: 16px; }
.results.hidden { display: none; }

.result-header {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.device-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.device-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-green { background: rgba(5,150,105,0.1); color: var(--green); border: 1px solid rgba(5,150,105,0.25); }
.badge-yellow { background: rgba(217,119,6,0.1); color: var(--yellow); border: 1px solid rgba(217,119,6,0.25); }
.badge-red { background: rgba(220,38,38,0.1); color: var(--red); border: 1px solid rgba(220,38,38,0.25); }
.badge-orange { background: rgba(234,88,12,0.1); color: var(--orange); border: 1px solid rgba(234,88,12,0.25); }
.badge-purple  { background: rgba(124,58,237,0.1); color: var(--accent); border: 1px solid rgba(124,58,237,0.25); }
.badge-verified { background: rgba(8,145,178,0.1); color: var(--teal); border: 1px solid rgba(8,145,178,0.25); }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.card-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-value {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Score bar */
.score-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.score-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-fill.green { background: linear-gradient(90deg, #059669, #10b981); }
.score-fill.yellow { background: linear-gradient(90deg, #d97706, #f59e0b); }
.score-fill.red { background: linear-gradient(90deg, #dc2626, #ef4444); }
.score-fill.orange { background: linear-gradient(90deg, #ea580c, #f97316); }

/* Verdict card */
.verdict-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.verdict-card h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.verdict-card p {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text);
}

/* Reset btn */
.reset-btn {
  padding: 13px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* API key banner */
.api-banner {
  background: rgba(108, 99, 255, 0.1);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--accent2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.api-banner:hover { background: rgba(108, 99, 255, 0.18); }
.api-banner.hidden { display: none; }

/* Error toast */
.error-toast {
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--red);
  line-height: 1.4;
}
.error-toast.hidden { display: none; }

/* Hidden */
.hidden { display: none !important; }

/* Camera view */
.camera-view {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 300;
  display: flex;
  flex-direction: column;
}
.camera-view.hidden { display: none; }

#camera-feed {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: cover;
}

.camera-controls {
  flex-shrink: 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shutter-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 4px solid white;
  background: white;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
}
.shutter-btn:active { transform: scale(0.9); }

.cam-cancel {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 12px;
  opacity: 0.85;
}

.cam-flip {
  color: white;
  cursor: pointer;
  padding: 12px;
  opacity: 0.85;
  background: none;
  border: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Auth Screen ── */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 500;
}
.auth-screen.hidden { display: none; }

.auth-inner {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-logo-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.auth-logo-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(124,58,237,0.15);
}

.auth-error {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--red);
  margin-top: 12px;
  line-height: 1.4;
}
.auth-error.hidden { display: none; }

.auth-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 16px;
  line-height: 1.5;
}

/* ── App shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.app-shell.hidden { display: none; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ── User avatar / dropdown ── */
.user-avatar-wrap {
  position: relative;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #7c74ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  user-select: none;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(124,58,237,0.15);
  z-index: 200;
}
.user-dropdown.hidden { display: none; }

.user-dropdown-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  word-break: break-all;
}

.user-dropdown-plan {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent2);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.user-dropdown-logout {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.user-dropdown-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Tab bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,0.95);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(124,58,237,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  z-index: 90;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.2s;
  padding: 10px 0 0;
}
.tab-btn.active { color: var(--accent); }
.tab-btn svg { transition: transform 0.2s; }
.tab-btn.active svg { transform: scale(1.1); }

/* ── Tab content ── */
.tab-content {
  display: none;
  padding: 20px;
  max-width: 480px;
  margin: 0 auto;
  flex-direction: column;
  gap: 20px;
}
.tab-content.active { display: flex; }

.tab-header {
  padding-bottom: 4px;
}
.tab-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.tab-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Loading message ── */
.loading-msg {
  text-align: center;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 6px;
  padding: 4px 0;
  animation: fadeInOut 1.2s ease-in-out infinite;
}
.loading-msg.hidden { display: none; }

@keyframes fadeInOut {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Result actions ── */
.result-actions {
  display: flex;
  gap: 10px;
}

.result-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.result-action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.result-action-primary { background: rgba(124,58,237,0.08); border-color: rgba(124,58,237,0.25); color: var(--accent); }
.result-action-primary:hover { background: rgba(124,58,237,0.15); }
.result-action-whatsapp { background: rgba(37,211,102,0.08); border-color: rgba(37,211,102,0.3); color: #128c3e; }
.result-action-whatsapp:hover { background: rgba(37,211,102,0.15); border-color: #25d366; color: #128c3e; }
.result-action-danger:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.06); }

/* ── History ── */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.snap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.snap-card:hover { border-color: rgba(124,58,237,0.4); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(124,58,237,0.1); }

.snap-card-img-wrap {
  position: relative;
  height: 100px;
  overflow: hidden;
}
.snap-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.snap-card-blurred .snap-card-img-wrap img {
  filter: blur(6px);
}

.snap-blur-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.snap-blur-overlay span {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}
.snap-upgrade-cta {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.snap-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.snap-card-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.snap-card-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.snap-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.snap-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.2s;
}
.snap-delete-btn:hover { color: var(--red); }

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 48px 20px;
}
.history-empty.hidden { display: none; }
.history-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-empty h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.history-empty p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Profile tab ── */
.profile-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), #7c74ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-email {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.profile-plan-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Usage bar ── */
.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.usage-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.usage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.usage-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.upgrade-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124,58,237,0.4); }

.signout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.signout-btn:hover { border-color: var(--red); color: var(--red); }

/* ── Upgrade modal ── */
.upgrade-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: flex-end;
}
.upgrade-modal.hidden { display: none; }

.upgrade-modal-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  text-align: center;
}

.upgrade-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.upgrade-close:hover { color: var(--text); }

.upgrade-icon {
  width: 56px;
  height: 56px;
  background: rgba(108,99,255,0.12);
  border: 1px solid rgba(108,99,255,0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.upgrade-modal-inner h3 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.upgrade-price {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent2);
}
.upgrade-price strong { color: var(--text); }

.upgrade-features {
  list-style: none;
  text-align: left;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
}
.upgrade-features li {
  font-size: 0.875rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.upgrade-features li::before {
  content: '';
}

.upgrade-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.upgrade-dismiss:hover { color: var(--text); }

/* ── Detail sheet ── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
}
.sheet-overlay.hidden { display: none; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  z-index: 310;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.hidden { display: none; }
.sheet.sheet-open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-content {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-img-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  height: 200px;
}
.sheet-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 4px 24px rgba(124,58,237,0.15);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.25s, transform 0.25s;
}
.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast-success { border-color: rgba(16,185,129,0.4); color: var(--green); }
.toast-error { border-color: rgba(248,113,113,0.4); color: var(--red); }

/* ── Upgrade plans modal ── */
.upgrade-plans { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.upgrade-plan {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.upgrade-plan:hover { border-color: var(--accent); transform: translateY(-1px); }
.upgrade-plan-pro { border-color: rgba(124,58,237,0.35); background: rgba(124,58,237,0.05); }
.upgrade-plan-pro:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(124,58,237,0.15); }
.upgrade-plan-biz { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.05); }
.upgrade-plan-biz:hover { border-color: #10b981; box-shadow: 0 4px 20px rgba(16,185,129,0.15); }
.upgrade-plan-ent { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.upgrade-plan-ent:hover { border-color: #f59e0b; box-shadow: 0 4px 20px rgba(245,158,11,0.15); }

.upgrade-plan-cta {
  margin-top: 10px;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.15s;
}
.upgrade-plan-pro .upgrade-plan-cta { background: var(--accent); }
.upgrade-plan-biz .upgrade-plan-cta { background: #10b981; }

.uplan-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.uplan-name { font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.uplan-price { font-size: 0.85rem; color: var(--text-muted); }
.uplan-price strong { font-size: 1.1rem; color: var(--text); }
.uplan-badge { background: rgba(108,99,255,0.2); color: var(--accent2); border: 1px solid rgba(108,99,255,0.3); padding: 2px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.uplan-features { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.uplan-features li { font-size: 0.78rem; color: var(--text-muted); }

/* ── 4-col pricing grid ── */
.pricing-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .pricing-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pricing-grid-4 { grid-template-columns: 1fr; } }

.plan-icon { font-size: 1.5rem; margin-bottom: 8px; }
.pf-no { color: var(--text-muted) !important; opacity: 0.45; }
.pf-biz { color: #10b981 !important; }
.pf-ent { color: #f59e0b !important; }
.price-custom { font-size: 1.4rem !important; background: linear-gradient(135deg,#f59e0b,#fb923c); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.pricing-card-biz { border-color: rgba(16,185,129,0.25) !important; }
.pricing-card-biz:hover { border-color: #10b981 !important; box-shadow: 0 8px 32px rgba(16,185,129,0.15) !important; }
.pricing-card-biz .plan-cta-biz { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); display:block; text-align:center; padding:12px; border-radius:10px; font-weight:600; font-size:0.9rem; text-decoration:none; transition:all 0.2s; }
.pricing-card-biz .plan-cta-biz:hover { background: #10b981; color: #000; }

.pricing-card-ent { border-color: rgba(245,158,11,0.25) !important; }
.pricing-card-ent:hover { border-color: #f59e0b !important; box-shadow: 0 8px 32px rgba(245,158,11,0.15) !important; }
.plan-cta-ent { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); display:block; text-align:center; padding:12px; border-radius:10px; font-weight:600; font-size:0.9rem; text-decoration:none; transition:all 0.2s; }
.plan-cta-ent:hover { background: #f59e0b; color: #000; }

/* ── Consent checkbox (signup) ── */
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}
.consent-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.consent-link {
  color: var(--accent);
  text-decoration: underline;
}
.consent-link:hover { color: var(--accent2); }

/* ── GDPR section in profile ── */
.gdpr-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gdpr-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.gdpr-section-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -4px;
}
.gdpr-actions {
  display: flex;
  gap: 8px;
}
.gdpr-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.gdpr-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.gdpr-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.gdpr-btn-delete {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid rgba(220,38,38,0.3);
  color: var(--red);
}
.gdpr-btn-delete:hover { background: rgba(220,38,38,0.06); border-color: var(--red); }
.gdpr-btn-delete:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Privacy policy modal ── */
.privacy-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
}
.privacy-modal.hidden { display: none; }
.privacy-modal-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.privacy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.privacy-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.privacy-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.privacy-close:hover { color: var(--text); border-color: var(--accent); }
.privacy-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.privacy-body h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 16px;
  margin-bottom: 4px;
}
.privacy-body h4:first-child { margin-top: 0; }
.privacy-body p { margin-bottom: 4px; }
.privacy-body ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.privacy-body a { color: var(--accent); text-decoration: underline; }
.privacy-updated { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; font-style: italic; }
.privacy-modal-inner > .btn-primary { margin: 16px 24px calc(16px + env(safe-area-inset-bottom)); flex-shrink: 0; }

/* ── Auth extras ── */
.auth-forgot {
  text-align: center;
  color: var(--accent2);
  font-size: 0.82rem;
  margin-top: 14px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.auth-forgot:hover { opacity: 1; }

/* ── History icon cards (replaces image thumbnails) ── */
.snap-card-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(124,58,237,0.07), rgba(167,139,250,0.05));
  min-height: 90px;
}
.snap-category-icon {
  font-size: 2.4rem;
  line-height: 1;
}

/* ── History maintenance / warranty indicators ── */
.snap-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0;
}
.snap-meta-indicator {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
}
.indicator-overdue { background: rgba(220,38,38,0.1); color: var(--red); border: 1px solid rgba(220,38,38,0.2); }
.indicator-soon { background: rgba(217,119,6,0.1); color: var(--yellow); border: 1px solid rgba(217,119,6,0.2); }
.indicator-ok { background: rgba(5,150,105,0.1); color: var(--green); border: 1px solid rgba(5,150,105,0.2); }

/* ── Metadata section (optional details after analysis) ── */
.metadata-section {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.metadata-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.metadata-toggle:hover { background: var(--accent-glow); }
.metadata-chevron { transition: transform 0.25s; flex-shrink: 0; }
.metadata-form {
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.metadata-form.hidden { display: none; }
.meta-group { display: flex; flex-direction: column; gap: 6px; }
.meta-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.meta-group-icon { font-size: 1rem; }
.meta-detected-badge {
  background: rgba(5,150,105,0.1);
  color: var(--green);
  border: 1px solid rgba(5,150,105,0.25);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.meta-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 10px 13px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.meta-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.meta-textarea { min-height: 72px; resize: vertical; margin-top: 8px; }
.meta-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}
.meta-save-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.35); }
.meta-save-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; }

/* ── Detail sheet metadata card ── */
.meta-detail-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.meta-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.meta-detail-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.meta-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.meta-detail-value {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

/* ── Detail sheet icon header ── */
.sheet-icon-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 8px;
}
.sheet-category-icon {
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(167,139,250,0.06));
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── History loading / error states ── */
.history-loading,
.history-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
