/* ── TOKENS ── */
:root {
  --font-body: 'Inter', sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* LIGHT */
:root,
[data-theme="light"] {
  --bg: #f0ede8;
  --surface: #f7f5f1;
  --surface-2: #ffffff;
  --border: oklch(0.3 0.01 80 / 0.1);
  --text: #1a1814;
  --text-muted: #7a7570;
  --text-faint: #b8b4ae;
  --accent: #1a1814;
  --accent-fg: #f7f5f1;
  --danger: #c0392b;
  --warning-bg: #fef3cd;
  --warning-text: #92600a;
  --shadow-sm: 0 1px 3px oklch(0.2 0.01 60 / 0.07), 0 1px 2px oklch(0.2 0.01 60 / 0.04);
  --shadow-md: 0 4px 16px oklch(0.2 0.01 60 / 0.08), 0 2px 4px oklch(0.2 0.01 60 / 0.05);
  --shadow-lg: 0 12px 40px oklch(0.2 0.01 60 / 0.12), 0 4px 8px oklch(0.2 0.01 60 / 0.06);
  --wallet-text: #e8ddd4;
  --wallet-muted: #9c8878;
  --wallet-border: rgba(255, 255, 255, 0.1);
  --wallet-surface: #2a1f1f;
  --overlay: oklch(0.1 0.01 60 / 0.5);
}

/* DARK */
[data-theme="dark"] {
  --bg: #111009;
  --surface: #1a1814;
  --surface-2: #21201b;
  --border: oklch(0.9 0.01 80 / 0.08);
  --text: #e8e3dc;
  --text-muted: #8a8680;
  --text-faint: #55524e;
  --accent: #e8e3dc;
  --accent-fg: #1a1814;
  --danger: #e05a4a;
  --warning-bg: #2a2010;
  --warning-text: #d4a84b;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.5);
  --wallet-text: #c8bdb4;
  --wallet-muted: #7a6e66;
  --wallet-border: rgba(255, 255, 255, 0.07);
  --wallet-surface: #1a1210;
  --overlay: oklch(0.05 0 0 / 0.7);
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

/* ── TOP BAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.topbar-logo svg {
  width: 28px;
  height: 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

.icon-btn svg {
  display: block;
}

/* ── MAIN ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-16);
}

/* ── SCREEN SYSTEM ── */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ── HOME SCREEN ── */
.home-header {
  margin-bottom: var(--space-8);
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.2rem + 2.5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.home-title em {
  font-style: italic;
  color: var(--text-muted);
}

.home-subtitle {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── SEARCH ── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px oklch(0.5 0 0 / 0.08);
}

.search-input::placeholder { color: var(--text-faint); }

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
}

.search-clear:hover { color: var(--text); }

.search-results {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search-result-group {
  margin-bottom: var(--space-3);
}

.search-result-wallet {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.search-result-item:hover {
  border-color: var(--text-muted);
  background: var(--surface-2);
}

.search-result-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.search-result-dot.high { background: #e74c3c; box-shadow: 0 0 4px rgba(231,76,60,0.5); }
.search-result-dot.medium { background: #f39c12; }
.search-result-dot.low { background: var(--text-faint); }

.search-result-info { flex: 1; min-width: 0; }

.search-result-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.search-result-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.search-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── WALLET GRID ── */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--space-5);
}

/* ── WALLET CARD (HOME) — Folder Effect ── */

/* Folder tab (pseudo-element on wrapper) */
/* ── WALLET CARD ── */
.wallet-card {
  position: relative;
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
  box-shadow:
    0 2px 6px oklch(0.1 0.02 30 / 0.35),
    0 8px 24px oklch(0.1 0.02 30 / 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    repeating-linear-gradient(45deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.02) 2px,
      rgba(0, 0, 0, 0.02) 4px),
    linear-gradient(180deg, #3b2f2f 0%, #2a1f1f 40%, #1a1210 100%);
}

/* Stitching — 2px border */
.wallet-card::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--radius-2xl) - 4px);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.wallet-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 12px oklch(0.1 0.02 30 / 0.4),
    0 16px 40px oklch(0.1 0.02 30 / 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.wallet-card:active {
  transform: translateY(-1px);
}

.wallet-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.wallet-card-name {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1rem + 1.2vw, 2rem);
  font-weight: 400;
  color: var(--wallet-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 70%;
}

.wallet-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wallet-muted);
  flex-shrink: 0;
}

.wallet-card-icon svg {
  width: 20px;
  height: 20px;
}

.wallet-card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.wallet-card-count {
  font-size: var(--text-xs);
  color: var(--wallet-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wallet-card-count strong {
  display: block;
  font-size: clamp(1.6rem, 1rem + 1.5vw, 2.4rem);
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--wallet-text);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ── WALLET PILLS ── */
.wallet-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wallet-pill svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* Expiry pill — amber */
.wallet-pill.pill-expiry {
  background: rgba(251, 188, 4, 0.18);
  color: #f0c040;
  border: 1px solid rgba(251, 188, 4, 0.25);
}

/* Stale pill — blue-grey */
.wallet-pill.pill-stale {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(220, 210, 200, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.wallet-pill.pill-stale:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(240, 235, 228, 1);
}

.wallet-pill.pill-stale .pill-action {
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(200, 220, 240, 0.85);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ── ADD WALLET CARD ── */
.wallet-card-add {
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  cursor: pointer;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-faint);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.wallet-card-add:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
  background: var(--surface);
}

.wallet-card-add svg {
  width: 28px;
  height: 28px;
}

.wallet-card-add span {
  font-size: var(--text-sm);
}

/* ── WALLET DETAIL SCREEN ── */
.wallet-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.wallet-detail-back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: color var(--transition);
  padding: var(--space-1) 0;
  flex-shrink: 0;
}

.wallet-detail-back:hover {
  color: var(--text);
}

.wallet-detail-back svg {
  width: 16px;
  height: 16px;
}

.wallet-detail-title-row {
  flex: 1;
}

.wallet-detail-name {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 1rem + 2vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
}

.wallet-detail-meta {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.wallet-detail-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding-top: var(--space-2);
}

/* Stolen wallet button */
.btn-stolen {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--danger);
  border: 1px solid oklch(from var(--danger) l c h / 0.25);
  background: oklch(from var(--danger) l c h / 0.06);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-stolen:hover {
  background: oklch(from var(--danger) l c h / 0.12);
  border-color: oklch(from var(--danger) l c h / 0.5);
}

.btn-stolen svg {
  width: 13px;
  height: 13px;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--accent);
  color: var(--accent-fg);
  transition: opacity var(--transition), transform var(--transition);
}

.btn-primary:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.btn-primary:active {
  opacity: 1;
  transform: none;
}

.btn-primary svg {
  width: 15px;
  height: 15px;
}

/* ── EXPIRY ALERT BAR ── */
.expiry-alert-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--warning-bg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  color: var(--warning-text);
}

.expiry-alert-bar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── LIST VIEW ── */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.doc-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.doc-list-item:hover {
  border-color: var(--text-muted);
  background: var(--surface-2);
}

.doc-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.doc-list-dot.high { background: #e74c3c; box-shadow: 0 0 5px rgba(231,76,60,0.5); }
.doc-list-dot.medium { background: #f39c12; }
.doc-list-dot.low { background: var(--text-faint); }

.doc-list-info { flex: 1; min-width: 0; }

.doc-list-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.doc-list-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.doc-list-expiry {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.doc-list-expiry.expiring { color: #f39c12; }
.doc-list-expiry.expired { color: #e74c3c; }

/* ── CATEGORY FILTERS ── */
.filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.filter-chip {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.filter-chip.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ── DOCUMENT CARDS GRID ── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-4);
}

/* ── DOCUMENT CARD (credit card ratio) ── */
.doc-card {
  position: relative;
  aspect-ratio: 85.6 / 53.98;
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
  box-shadow: var(--shadow-sm);
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 64px 64px !important;
}

.doc-card:hover {
  box-shadow: var(--shadow-lg);
}

.doc-card-inner {
  position: absolute;
  inset: 0;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: inherit;
}

/* Holographic glare overlay */
.doc-card-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  mix-blend-mode: screen;
}

.doc-card:hover .doc-card-glare {
  opacity: 1;
}

/* Card themes by category */
.doc-card[data-cat="bank"] {
  background: linear-gradient(135deg, #2b3445 0%, #313b4d 58%, #252d3c 100%);
}

/* Favicon de l'entreprise en fond pour les cartes banque */
.doc-card[data-cat="bank"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background-position: center right 20px;
  background-repeat: no-repeat;
  background-size: 64px 64px;
  opacity: 0.5;
  pointer-events: none;
}

.doc-card[data-cat="bank"] .doc-card-inner {
  background: transparent;
}

.doc-card[data-cat="id"] {
  background: #f5f2ec;
}

.doc-card[data-cat="id"] .doc-card-inner {
  height: 100%;
  padding-top: 10px;
  position: relative;
  background: #fbfaf7;
  color: #1f2b38;
  overflow: hidden;
}

.doc-card[data-cat="id"] .doc-card-inner::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2em;
  background: linear-gradient(180deg, #20344d 0%, #1b2d44 100%);
}

.doc-card[data-cat="id"] .doc-card-glare {
  background: radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 20%, transparent 48%);
  opacity: .42;
}

.id-card-visual {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 66px 1fr 24px;
  grid-template-rows: auto 1fr auto;
  column-gap: 14px;
  row-gap: 8px;
  height: 100%;
  color: #1f2b38;
}

.id-card-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 28px 1fr 14px;
  align-items: center;
  column-gap: 10px;
  height: 100%;
  padding-top: 1px;
  color: #f8f7f3;
}

.id-card-kicker {
  font-size: 9px;
  line-height: 1;
  letter-spacing: .16em;
  font-weight: 700;
  opacity: .85;
  align-self: center;
}

.id-card-title {
  font-size: 11px;
  line-height: 1;
  letter-spacing: .22em;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.id-card-crit {
  justify-self: end;
  align-self: center;
}

.id-user-icon {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
  justify-self: center;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(180deg, #eef1f5 0%, #dfe6ee 100%);
  border: 1px solid rgba(27, 45, 68, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.id-user-icon svg {
  width: 42px;
  height: 42px;
  stroke: #29384a;
}

.id-info {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.id-company {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #223447;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.id-expiry {
  font-size: 10px;
  color: #6a7787;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.id-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}

.id-line {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 52, 74, 0.16) 0%, rgba(34, 52, 74, 0.08) 100%);
}

.id-line.w1 {
  width: 92%;
}

.id-line.w2 {
  width: 78%;
}

.id-line.w3 {
  width: 86%;
}

.id-line.w4 {
  width: 58%;
}

.id-signature {
  grid-column: 2;
  grid-row: 3;
  align-self: end;
  font-family: inherit;
  font-size: 0;
  line-height: 1;
  color: transparent;
  transform: rotate(-7deg);
  padding-left: 2px;
  width: 78px;
  height: 18px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 32'%3E%3Cpath d='M6 24c8-8 10-10 13-9 4 1-1 9 3 10 3 0 8-13 12-13 4 0 1 11 5 11 4 0 8-12 13-13 5 0 4 8 8 8 5 0 12-9 20-11 12-4 19-1 34 5' fill='none' stroke='%2324364c' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.id-barcode {
  grid-column: 3;
  grid-row: 2 / span 2;
  justify-self: end;
  align-self: stretch;
  width: 22px;
  height: 70%;
  margin: auto;
  border-radius: 0;
  background: repeating-linear-gradient(to bottom,
      rgba(28, 44, 67, 0.92) 0px,
      rgba(28, 44, 67, 0.92) 2px,
      transparent 2px,
      transparent 4px,
      rgba(28, 44, 67, 0.82) 4px,
      rgba(28, 44, 67, 0.82) 7px,
      transparent 7px,
      transparent 9px,
      rgba(28, 44, 67, 0.96) 9px,
      rgba(28, 44, 67, 0.96) 11px,
      transparent 11px,
      transparent 14px);
  opacity: .78;
  box-shadow: inset 0 0 0 1px rgba(28, 44, 67, 0.05);
}

.doc-card[data-cat="health"] .doc-card-inner,
.doc-card[data-cat="transport"] .doc-card-inner,
.doc-card[data-cat="loyalty"] .doc-card-inner,
.doc-card[data-cat="other"] .doc-card-inner {
  background: transparent;
}

.doc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.doc-card-category {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.4;
}

.doc-card-criticality {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.doc-card-criticality.high {
  background: #e74c3c;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.6);
}

.doc-card-criticality.medium {
  background: #f39c12;
  box-shadow: 0 0 6px rgba(243, 156, 18, 0.4);
}

.doc-card-criticality.low {
  background: rgba(255, 255, 255, 0.2);
}

.doc-card-mid {
  flex: 1;
  display: flex;
  align-items: center;
}

.doc-card-name {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 0.7rem + 0.8vw, 1.2rem);
  font-weight: 400;
  color: currentColor;
  opacity: 0.92;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.doc-card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.doc-card-issuer {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.35;
}

.doc-card-expiry {
  font-size: 10px;
  letter-spacing: 0.03em;
  color: currentColor;
  opacity: 0.35;
}

.doc-card-expiry.expiring {
  color: #f39c12;
}

.doc-card-expiry.expired {
  color: #e74c3c;
}

/* ── BANK CARD LAYOUT — inspired by physical credit cards ── */

/* Encoche droite */
/* Bank card inner: 3 zones — top, mid chip+info, bottom expiry */
.doc-card[data-cat="bank"] .doc-card-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* Zone haut : type à gauche, dot criticité à droite — comme les autres cartes */
.bank-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 14px 0 14px;
  min-height: 18px;
  width: 100%;
}

.bank-top-cat {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.55;
}

.bank-crit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
}

.bank-crit-dot.high {
  background: #e74c3c;
  box-shadow: 0 0 5px rgba(231, 76, 60, 0.7);
}

.bank-crit-dot.medium {
  background: #f39c12;
  box-shadow: 0 0 4px rgba(243, 156, 18, 0.5);
}

.bank-crit-dot.low {
  background: rgba(255, 255, 255, 0.2);
}

/* Zone milieu : puce côte à côte avec nom + issuer */
.bank-mid {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 14px 4px 14px;
  gap: 0;
}

.bank-chip-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Puce EMV réaliste — plus grande */
.bank-chip {
  width: 38px;
  height: 28px;
  border-radius: 5px;
  background:
    linear-gradient(135deg, #c4922a 0%, #e8c46a 30%, #f5d980 50%, #e8c46a 70%, #c4922a 100%);
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.bank-chip::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 3px;
  border: 1px solid rgba(160, 110, 20, 0.5);
  background: linear-gradient(135deg, #d4a030 0%, #f0d060 50%, #d4a030 100%);
}

.bank-chip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 17px;
  border: 1px solid rgba(140, 90, 10, 0.4);
  border-radius: 2px;
}

/* NFC supprimé */
.bank-nfc {
  display: none;
}

/* Textes côte à côte avec la puce : colonne nom + issuer */
.bank-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* Nom de la carte */
.bank-card-name {
  font-size: clamp(9px, 0.6rem + 0.5vw, 13px);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: currentColor;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Issuer — monospace comme un numéro de CB */
.bank-card-number {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: clamp(7px, 0.48rem + 0.3vw, 10px);
  letter-spacing: 0.14em;
  color: currentColor;
  opacity: 0.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

/* Zone bas : EXPIRE FIN + date — centré verticalement, pas collé au fond */
.bank-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 14px 14px;
  width: 100%;
}

.bank-expiry-block {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.bank-expiry-label {
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.45;
  line-height: 1.2;
  text-align: right;
}

.bank-expiry-date {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: clamp(9px, 0.6rem + 0.3vw, 12px);
  letter-spacing: 0.08em;
  color: currentColor;
  opacity: 0.75;
}

.bank-expiry-date.expiring {
  color: #f0b429;
}

.bank-expiry-date.expired {
  color: #e74c3c;
}

/* chip decoration — legacy, hidden for bank (using new system) */
.doc-card-chip {
  display: none !important;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-muted);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  margin-bottom: var(--space-4);
}

.empty-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state h3 {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 30ch;
  line-height: 1.5;
}

/* ── SORTABLE DRAG ── */
.doc-card-ghost {
  opacity: 0.35;
  border-radius: var(--radius-xl);
  background: var(--border);
}

.doc-card-dragging {
  box-shadow: var(--shadow-lg) !important;
  transform: scale(1.04) !important;
  z-index: 10;
}

/* ── EXPIRY DASHBOARD ── */
.expiry-modal { max-width: 480px; }

.expiry-group { margin-bottom: var(--space-4); }

.expiry-group-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}

.expiry-group-title.expired { color: var(--danger); }
.expiry-group-title.warning { color: #f39c12; }
.expiry-group-title.info { color: var(--text-muted); }

.expiry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-2);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  gap: var(--space-3);
}

.expiry-item:hover { background: var(--surface); }

.expiry-item + .expiry-item { border-top: 1px solid var(--border); }

.expiry-item-info { flex: 1; min-width: 0; }

.expiry-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.expiry-item-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.expiry-item-date {
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.expiry-item-date.expired { background: #fde8e8; color: var(--danger); }
.expiry-item-date.warning { background: #fef3cd; color: #92600a; }
.expiry-item-date.info { background: var(--surface); color: var(--text-muted); }

/* ── ISSUER AUTOCOMPLETE ── */
.ac-wrap { position: relative; }

.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: none;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 2px;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition);
  gap: var(--space-3);
}

.ac-item:hover { background: var(--surface); }

.ac-item + .ac-item { border-top: 1px solid var(--border); }

.ac-name { font-size: var(--text-sm); font-weight: 500; color: var(--text); }

.ac-cat {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── SLIDE-OVER PANEL ── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(4px);
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  background: var(--surface-2);
  z-index: 101;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 40px oklch(0 0 0 / 0.15);
}

@media (max-width: 480px) {
  .panel { box-shadow: none; }
}

.panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.panel-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.panel-close:hover {
  background: var(--border);
  color: var(--text);
}

.panel-close svg {
  width: 18px;
  height: 18px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Live card preview */
.card-preview {
  aspect-ratio: 85.6 / 53.98;
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: all var(--transition-slow);
  flex-shrink: 0;
}

.card-preview .doc-card-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-5);
}

/* chip handled by new bank layout */

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px oklch(0.5 0 0 / 0.08);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.field select option {
  background: var(--surface-2);
}

/* Premium custom color pickers */
.custom-color-picker {
  position: relative;
  width: 100%;
}

.custom-color-picker input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  z-index: 1;
}

.color-picker-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  height: 42px;
}

.color-picker-trigger:hover {
  border-color: var(--text-muted);
  background: var(--surface-2);
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: inline-block;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.color-picker-trigger:hover .color-swatch {
  transform: scale(1.15);
}

.color-hex {
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
}

/* Criticality slider */
.criticality-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.criticality-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.criticality-level-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color 0.25s ease;
}

.criticality-track-wrap {
  position: relative;
  height: 12px;
  display: flex;
  align-items: center;
}

.criticality-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(to right,
      #34a853 0%,
      #34a853 25%,
      #fbbc04 45%,
      #ff6d00 65%,
      #ea4335 100%);
  position: relative;
}

.criticality-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px oklch(0 0 0 / 0.25), 0 0 0 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: left 0.15s ease, box-shadow 0.15s ease;
  pointer-events: none;
}

.criticality-thumb.dragging {
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.35), 0 0 0 3px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%) scale(1.1);
}

input.crit-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.panel-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-submit {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: opacity var(--transition);
}

.btn-submit:hover {
  opacity: 0.85;
}

/* ── STOLEN MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(6px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
  }
}

.modal {
  background: var(--surface-2);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius-2xl);
    max-width: 520px;
    transform: scale(0.95) translateY(8px);
    opacity: 0;
    transition: transform var(--transition-slow), opacity var(--transition-slow);
  }

  .modal-overlay.open .modal {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.modal-danger-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: oklch(from var(--danger) l c h / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
}

.modal-danger-icon svg {
  width: 18px;
  height: 18px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
}

.modal-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-body {
  padding: var(--space-4) var(--space-6) var(--space-6);
}

.stolen-doc-item {
  display: flex;
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.stolen-doc-item:last-child {
  border-bottom: none;
}

.stolen-doc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stolen-doc-dot.high {
  background: var(--danger);
}

.stolen-doc-dot.medium {
  background: #f39c12;
}

.stolen-doc-dot.low {
  background: var(--text-faint);
}

.stolen-doc-info {
  flex: 1;
  min-width: 0;
}

.stolen-doc-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.stolen-doc-issuer {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.stolen-doc-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition);
}

.stolen-doc-link:hover {
  background: var(--surface);
}

.stolen-doc-link svg {
  width: 12px;
  height: 12px;
}

.no-link {
  font-size: var(--text-xs);
  color: var(--text-faint);
  flex-shrink: 0;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
}

.btn-outline {
  flex: 1;
  padding: var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-danger {
  flex: 1;
  padding: var(--space-3);
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: opacity var(--transition);
}

.btn-danger:hover {
  opacity: 0.85;
}

.btn-danger svg {
  width: 14px;
  height: 14px;
}

/* ── CREATE WALLET MODAL ── */
.create-wallet-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.icon-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: var(--space-2);
}

.icon-option {
  cursor: pointer;
  position: relative;
}

.icon-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.icon-option-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all var(--transition);
  height: 100%;
}

.icon-option:hover .icon-option-content {
  border-color: var(--text-muted);
  color: var(--text);
}

.icon-option input[type="radio"]:checked+.icon-option-content {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}

.icon-option input[type="radio"]:focus-visible+.icon-option-content {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-option-content svg {
  width: 22px;
  height: 22px;
}

.icon-option-content span {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

/* ── SETTINGS MODAL ── */
.settings-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: var(--text-sm);
  color: var(--text);
}

.settings-row-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}

.toggle input:checked+.toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px oklch(0 0 0 / 0.2);
}

.toggle input:checked~.toggle-thumb {
  transform: translateX(20px);
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 640px) {
  main {
    padding: var(--space-6) var(--space-4) var(--space-16);
  }

  .topbar {
    padding: var(--space-3) var(--space-4);
  }

  .wallet-detail-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .wallet-detail-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .wallet-detail-actions .icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .wallet-detail-actions .btn-stolen {
    height: 38px;
    justify-content: center;
    font-size: 11px;
    padding: 0 var(--space-3);
    flex: 1;
    min-width: 0;
    order: 2;
  }

  .wallet-detail-actions .btn-primary {
    height: 38px;
    width: 100%;
    justify-content: center;
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
    order: 3;
  }

  .panel-body {
    padding: var(--space-4);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  text-align: center;
  max-width: 90vw;
  white-space: nowrap;
}

.toast.out {
  animation: toastOut 0.25s ease forwards;
}

@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(-8px) scale(0.95); }
}

/* ── PIN LOCK SCREEN ── */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
}

.pin-overlay.active { display: flex; }

.pin-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8);
  max-width: 320px;
  width: 100%;
}

.pin-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.pin-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
}

.pin-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: -8px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin: var(--space-2) 0;
  width: 100%;
}

.pin-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all var(--transition);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.pin-error {
  font-size: var(--text-xs);
  color: var(--danger);
  min-height: 1.2em;
  text-align: center;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  width: 100%;
  max-width: 260px;
}

.pin-keypad-sm {
  max-width: 220px;
  margin: 0 auto;
}

.pin-key {
  height: 56px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pin-key:hover { background: var(--surface-2); border-color: var(--text-muted); }
.pin-key:active { transform: scale(0.95); }

.pin-key-blank { pointer-events: none; border-color: transparent; background: transparent; }

.pin-key-del { font-size: 16px; color: var(--text-muted); }

.pin-forgot {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: var(--space-2);
  transition: color var(--transition);
}

.pin-forgot:hover { color: var(--text); }

/* ── FAQ ── */
.faq-modal { max-width: 520px; }

.faq-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.faq-a {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── ONBOARDING ── */
.onboarding-modal {
  max-width: 420px;
  text-align: center;
}

.onboarding-body {
  padding: var(--space-10) var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.onboarding-steps {
  position: relative;
  min-height: 240px;
  width: 100%;
}

.onboarding-step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.onboarding-step.active {
  display: flex;
  animation: fadeIn 0.35s ease forwards;
}

.onboarding-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.onboarding-icon svg {
  width: 30px;
  height: 30px;
}

.onboarding-step h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.onboarding-step p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 30ch;
  margin: 0;
}

.onboarding-dots {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition);
}

.onboarding-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: var(--radius-full);
}

.onboarding-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6) var(--space-8);
  border-top: 1px solid var(--border);
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen.active>* {
  animation: fadeIn 0.3s ease forwards;
}

/* ── IMPORT MODAL ── */
.import-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.import-item:hover {
  background: var(--surface);
}

.import-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.import-item-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.import-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.import-item-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── PRINT CONTAINER ── */
#printContainer {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 32px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 12px;
  color: #1a1814;
  line-height: 1.5;
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #c0392b;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.print-brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px;
}

.print-urgent {
  font-size: 11px;
  font-weight: 700;
  color: #c0392b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.print-emergency {
  background: #fef3cd;
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 11px;
}

.print-emergency p { margin: 2px 0; }

.print-wallet-name {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 4px;
}

.print-date {
  font-size: 10px;
  color: #666;
  margin-bottom: 16px;
}

.print-doc-item {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  page-break-inside: avoid;
}

.print-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.print-doc-cat {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
}

.print-doc-crit {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.print-crit-critique { background: #fde8e8; color: #c0392b; }
.print-crit-important { background: #fef3cd; color: #92600a; }
.print-crit-faible { background: #eee; color: #555; }

.print-doc-name {
  font-size: 13px;
  font-weight: 600;
}

.print-doc-issuer {
  font-size: 11px;
  color: #555;
}

.print-doc-expiry {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

.print-doc-cancel {
  font-size: 10px;
  margin-top: 4px;
  word-break: break-all;
}

.print-doc-cancel a { color: #1a1814; }

.print-doc-note {
  font-size: 10px;
  color: #555;
  margin-top: 4px;
  font-style: italic;
}

.print-footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
  font-size: 9px;
  color: #999;
  text-align: center;
}

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  body > *:not(#printContainer) { display: none !important; }
  #printContainer {
    display: block !important;
    padding: 0;
  }
  .print-emergency { break-inside: avoid; }
  .print-doc-item { break-inside: avoid; }
}