/* ═══════════════════════════════════════════════════════════════
   VERA Vault — Design System & Component Styles
   Dark + Light themes, Lucide icons, VERA branding
   ═══════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Design Tokens (Dark Theme - Default) ─────────────────── */
:root, [data-theme="dark"] {
  /* Surfaces */
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --bg-elevated: #1e1e24;

  /* Borders */
  --border-default: #3f3f46;
  --border-muted: #27272a;
  --border-accent: rgba(129, 140, 248, 0.3);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Brand */
  --accent-primary: #818cf8;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #818cf8, #a78bfa);

  /* Semantic */
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --success-border: rgba(52, 211, 153, 0.25);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --warning-border: rgba(251, 191, 36, 0.25);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --error-border: rgba(248, 113, 113, 0.25);
  --info-bg: rgba(129, 140, 248, 0.1);
  --info-border: rgba(129, 140, 248, 0.25);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ─── Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f4f4f5;
  --bg-tertiary: #e4e4e7;
  --bg-elevated: #fafafa;

  --border-default: #d4d4d8;
  --border-muted: #e4e4e7;
  --border-accent: rgba(99, 102, 241, 0.3);

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --success-border: rgba(22, 163, 74, 0.2);
  --warning: #ca8a04;
  --warning-bg: rgba(202, 138, 4, 0.08);
  --warning-border: rgba(202, 138, 4, 0.2);
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.08);
  --error-border: rgba(220, 38, 38, 0.2);
  --info-bg: rgba(99, 102, 241, 0.08);
  --info-border: rgba(99, 102, 241, 0.2);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* ─── Theme-Aware Visibility ──────────────────────────────── */
.dark-only { display: block; }
.light-only { display: none; }
[data-theme="light"] .dark-only { display: none; }
[data-theme="light"] .light-only { display: block; }

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

svg {
  display: block;
}

html {
  background: transparent;
}

body {
  width: 360px;
  height: 540px;
  border-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Shell ────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-primary);
}

.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px;
  scroll-behavior: smooth;
}

.view-container::-webkit-scrollbar {
  width: 4px;
}
.view-container::-webkit-scrollbar-track {
  background: transparent;
}
.view-container::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

/* Views */
.view {
  display: none;
  animation: viewFadeIn var(--duration-normal) var(--ease-out);
}
.view.active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Header ───────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-muted);
  z-index: 10;
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo svg {
  color: var(--accent-primary);
}

.header-logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

/* ─── Bottom Navigation ────────────────────────────────────── */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 12px 12px;
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  background: none;
  border: none;
  font-family: inherit;
}

.nav-item:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ─── Dashboard ────────────────────────────────────────────── */
.dashboard-content {
  padding: 20px;
}

.refined-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.refined-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.refined-stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.refined-stat-icon.secure {
  background: rgba(67, 97, 238, 0.15);
  color: var(--primary);
}

.refined-stat-icon.verified {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.refined-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.refined-stat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.refined-stat-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Recent Activity */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: border-color var(--duration-fast);
}

.activity-item:hover {
  border-color: var(--border-default);
}

.activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--info-bg);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* Explainer Card */
.explainer-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 16px;
}

.explainer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.explainer-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.explainer-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.explainer-body {
  padding: 0 16px 16px;
  display: none;
}

.explainer-body.open {
  display: block;
  animation: slideDown var(--duration-normal) var(--ease-out);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.explainer-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.explainer-step-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.explainer-step-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Credentials ──────────────────────────────────────────── */
.credentials-content {
  padding: 20px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.wallet-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wallet-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wallet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px dashed var(--border-muted);
}

.wallet-store-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-store-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-store-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.wallet-date {
  font-size: 11px;
  color: var(--text-muted);
}

.wallet-card-body {
  padding: 12px 16px;
}

.wallet-sku-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.wallet-sku-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-card-footer {
  padding: 10px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wallet-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.wallet-status.secured {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.wallet-status-icon {
  display: flex;
}

/* Credential Detail */
.detail-view {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  z-index: 20;
  animation: slideInRight var(--duration-normal) var(--ease-out);
}

.detail-view.active {
  display: flex;
  flex-direction: column;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.detail-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast);
  display: flex;
}

.detail-back:hover {
  color: var(--text-primary);
}

.detail-title {
  font-size: 16px;
  font-weight: 600;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.detail-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.detail-field-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-field-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-field-value.hidden {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-size: 12px;
}

.detail-field-value.revealed {
  color: var(--accent-primary);
}

.detail-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  margin-top: 24px;
}

.detail-delete:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ─── History ──────────────────────────────────────────────── */
.history-content {
  padding: 20px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.history-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.history-icon.verified {
  background: var(--info-bg);
  color: var(--accent-primary);
}

.history-icon.failed {
  background: var(--error-bg);
  color: var(--error);
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.history-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.history-badge.verified {
  background: var(--info-bg);
  color: var(--accent-primary);
  border: 1px solid var(--info-border);
}

.history-badge.failed {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

/* ─── Settings ─────────────────────────────────────────────── */
.settings-content {
  padding: 20px;
}

.settings-group {
  margin-bottom: 20px;
}

.settings-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.setting-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-left svg {
  color: var(--text-muted);
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.setting-value {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Toggle */
.toggle {
  width: 38px;
  height: 22px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.toggle.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--ease-out);
}

.toggle.active::after {
  transform: translateX(16px);
}

/* Settings buttons */
.setting-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  margin-bottom: 6px;
  border: 1px solid;
}

.setting-btn.destructive {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

.setting-btn.destructive:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ─── About ────────────────────────────────────────────────── */
.about-content {
  padding: 20px;
}

.about-hero {
  text-align: center;
  padding: 24px 0;
  margin-bottom: 20px;
}

.about-logo {
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.about-name {
  font-size: 20px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.about-tagline {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.about-section {
  margin-bottom: 20px;
}

.about-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.about-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.about-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.about-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

.about-step-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.about-step-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.about-meta {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-muted);
}

.about-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.about-meta-label {
  font-size: 12px;
  color: var(--text-muted);
}

.about-meta-value {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Contact Cards ───────────────────────────────────────── */
.about-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
}

.about-contact-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
}

.about-contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.about-contact-icon svg {
  width: 16px;
  height: 16px;
}

.about-contact-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.about-contact-value {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Empty States ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.empty-icon {
  display: flex;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.4;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 240px;
  margin: 0 auto;
}

/* ─── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn var(--duration-normal) var(--ease-out);
}

.toast.dismissing {
  animation: toastOut var(--duration-fast) var(--ease-out) forwards;
}

.toast.success { border: 1px solid var(--success-border); }
.toast.error { border: 1px solid var(--error-border); }
.toast.warning { border: 1px solid var(--warning-border); }
.toast.info { border: 1px solid var(--info-border); }

.toast-icon { flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--accent-primary); }

.toast-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ─── Onboarding ───────────────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 50;
  display: none;
  flex-direction: column;
}

.onboarding-overlay.active {
  display: flex;
}

.onboarding-slide {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  text-align: center;
}

.onboarding-slide.active {
  display: flex;
  animation: viewFadeIn var(--duration-slow) var(--ease-out);
}

.onboarding-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--info-bg);
  border: 1px solid var(--border-accent);
  color: var(--accent-primary);
  border-radius: 20px;
  margin-bottom: 28px;
}

.onboarding-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.onboarding-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
  min-height: 72px;
}

.onboarding-footer {
  padding: 20px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.onboarding-dots {
  display: flex;
  gap: 8px;
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-default);
  transition: all var(--duration-fast);
}

.onboarding-dot.active {
  background: var(--accent-primary);
  width: 20px;
  border-radius: var(--radius-full);
}

.onboarding-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  box-shadow: 0 2px 8px rgba(129, 140, 248, 0.3);
}

.onboarding-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.4);
}

/* ─── Confirm Dialog ───────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.confirm-overlay.active {
  display: flex;
}

.confirm-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 300px;
  animation: viewFadeIn var(--duration-normal) var(--ease-out);
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  border: 1px solid;
}

.confirm-btn.cancel {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.confirm-btn.cancel:hover {
  background: var(--border-muted);
}

.confirm-btn.danger {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

.confirm-btn.danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ─── Utilities ────────────────────────────────────────────── */
.icon-spin {
  animation: spin 1s linear infinite;
}

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

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

/* ─── Branding Images ──────────────────────────────────────── */
.header-logo-img {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.about-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 12px auto;
}

.onboarding-banner {
  max-width: 160px;
  height: 52px;
  margin-bottom: 48px;
  object-fit: contain;
}


/* ─── Consent Flow ─────────────────────────────────────────── */
.consent-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.consent-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.consent-link:hover {
  color: var(--accent-secondary);
}

.consent-separator {
  color: var(--text-muted);
  font-size: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── Legal Modal ──────────────────────────────────────────── */
.legal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.legal-overlay.active {
  display: flex;
}

.legal-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 320px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  animation: viewFadeIn var(--duration-normal) var(--ease-out);
}

.legal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.legal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.legal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.legal-close:hover {
  color: var(--text-primary);
}

.legal-body {
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.legal-body::-webkit-scrollbar {
  width: 4px;
}
.legal-body::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.legal-body h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 16px;
  margin-bottom: 6px;
}

.legal-body h4:first-child {
  margin-top: 0;
}

.legal-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 16px;
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.legal-dismiss:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
}

/* ─── Clickable Settings ───────────────────────────────────── */
.setting-item.clickable {
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.setting-item.clickable:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
}

/* ─── Light Mode Overrides ─────────────────────────────────── */
[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-muted);
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border-muted);
}

[data-theme="light"] .onboarding-overlay {
  background: var(--bg-primary);
}

[data-theme="light"] .header-logo-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
