/* ─── Tokens / theming ─────────────────────────────────────────────── */
:root {
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.10);
}

/* Light (default for system mode) */
:root,
[data-theme="light"] {
  --bg: #faf7f2;
  --bg-elev: #ffffff;
  --bg-elev-2: #f4efe7;
  --bg-overlay: rgba(255,255,255,0.85);
  --text: #1a1714;
  --text-dim: #7a7268;
  --text-soft: #a39a8e;
  --border: #ebe4d8;
  --border-strong: #d8cfbf;
  --accent: #a8826b;        /* warm tan */
  --accent-strong: #6b4d39; /* deep cocoa */
  --accent-soft: #f0e5d7;
  --danger: #c4453a;
  --danger-soft: #faeae8;
  --input-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(60,40,20,0.04), 0 4px 16px rgba(60,40,20,0.06);
}

/* Dark when device prefers it AND user hasn't overridden */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16141d;
    --bg-elev: #1f1c28;
    --bg-elev-2: #2a2636;
    --bg-overlay: rgba(22,20,29,0.85);
    --text: #f3efe6;
    --text-dim: #a098b0;
    --text-soft: #6e6680;
    --border: #2e2a3b;
    --border-strong: #3d3850;
    --accent: #d4b896;
    --accent-strong: #e8cfa8;
    --accent-soft: rgba(212,184,150,0.16);
    --danger: #e87a72;
    --danger-soft: rgba(232,122,114,0.16);
    --input-bg: #2a2636;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
  }
}

/* Explicit dark override */
[data-theme="dark"] {
  --bg: #16141d;
  --bg-elev: #1f1c28;
  --bg-elev-2: #2a2636;
  --bg-overlay: rgba(22,20,29,0.85);
  --text: #f3efe6;
  --text-dim: #a098b0;
  --text-soft: #6e6680;
  --border: #2e2a3b;
  --border-strong: #3d3850;
  --accent: #d4b896;
  --accent-strong: #e8cfa8;
  --accent-soft: rgba(212,184,150,0.16);
  --danger: #e87a72;
  --danger-soft: rgba(232,122,114,0.16);
  --input-bg: #2a2636;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
}

/* ─── Base ────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  min-height: 100vh;
  padding-bottom: calc(96px + var(--safe-bottom));
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em; }

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: calc(14px + var(--safe-top)) 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.top-actions { display: flex; gap: 4px; align-items: center; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s;
  font-family: inherit;
  font-size: 16px;
}
.icon-btn:hover { background: var(--bg-elev-2); }
.icon-btn:active { background: var(--border); }

.profile-btn { width: auto !important; padding: 4px; }

/* ─── App container & views ───────────────────────────────────────────── */
#app { padding: 18px; max-width: 1100px; margin: 0 auto; }

.view { display: none; animation: fadeView 0.22s ease; }
.view.active { display: block; }
@keyframes fadeView {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Search bar ──────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  margin-bottom: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-bar svg { color: var(--text-soft); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 0;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}
.search-bar input::placeholder { color: var(--text-soft); }
.search-clear {
  width: 28px !important;
  height: 28px !important;
  font-size: 14px;
  color: var(--text-soft);
}

/* ─── Chips ───────────────────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 18px 12px;
  margin: 0 -18px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ─── Grid + cards ────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.card {
  background: var(--bg-elev);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 3/4;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:active { transform: scale(0.98); }

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.card .card-info .type {
  font-size: 10px;
  color: rgba(255,255,255,0.78);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 2px;
}
.card .card-info .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .card-info .brand {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-style: italic;
}

/* ─── Empty states ────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty .empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}
.empty h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--text);
}
.empty p { margin: 0 0 4px; font-size: 14px; }

.hidden { display: none !important; }

/* ─── Bottom nav ──────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 12px;
  min-width: 56px;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.nav-btn:hover { color: var(--text-dim); }
.nav-btn.active { color: var(--text); }
.nav-btn.active svg { stroke-width: 2.5; }

.nav-avatar {
  width: 22px !important;
  height: 22px !important;
  font-size: 11px !important;
}

.add-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  margin-top: -20px;
  transition: transform 0.15s;
}
.add-fab:hover { transform: translateY(-2px); }
.add-fab:active { transform: scale(0.94); }

/* ─── Modal ───────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding-bottom: var(--safe-bottom);
  border: 1px solid var(--border);
  border-bottom: none;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (min-width: 600px) {
  .modal { align-items: center; padding: 20px; }
  .modal-content {
    border-radius: var(--radius-lg);
    max-height: 88vh;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.modal-header h2 { margin: 0; font-size: 20px; font-weight: 500; }

/* ─── Forms ───────────────────────────────────────────────────────────── */
#add-form, #wishlist-form, #new-profile-form, #pin-form { padding: 0 18px 18px; }

#add-form label, #wishlist-form label, #new-profile-form label, #pin-form label, fieldset {
  display: block;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#add-form label small, #wishlist-form label small, #new-profile-form label small {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--text-soft);
  margin-left: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row label { margin-bottom: 0; }

input[type="text"],
input[type="url"],
input[type="search"],
input[type="password"],
select {
  width: 100%;
  padding: 13px 14px;
  margin-top: 7px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a39a8e' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

input::placeholder { color: var(--text-soft); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

fieldset { border: none; padding: 0; margin: 0 0 14px; }
fieldset legend { padding: 0 0 8px; font-size: 12px; }

.photo-picker {
  display: block !important;
  margin-bottom: 18px !important;
  cursor: pointer;
}
.photo-picker input { display: none; }
.photo-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-elev);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-soft);
  overflow: hidden;
  position: relative;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color 0.15s, background-color 0.15s;
}
.photo-preview:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.season-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.season-options label {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  border: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  transition: all 0.15s;
}
.season-options input { display: none; }
.season-options label:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

.row { display: flex; gap: 10px; margin-top: 18px; }
.row button { flex: 1; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
button.primary, button.secondary, button.danger {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.005em;
  transition: transform 0.1s, background-color 0.15s, box-shadow 0.15s;
}
button.primary {
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
button.primary:hover { background: var(--accent-strong); }
button.primary:active { transform: scale(0.98); }
button.secondary {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover { background: var(--bg-elev-2); }
button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
button.danger:hover { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ─── Outfits ─────────────────────────────────────────────────────────── */
.outfit-actions { display: flex; gap: 10px; margin-bottom: 22px; }
.outfit-actions button { flex: 1; }

.current-outfit {
  background: var(--bg-elev);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 24px;
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-card);
}
.current-outfit h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.outfit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.outfit-grid .item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elev-2);
  position: relative;
}
.outfit-grid .item img { width: 100%; height: 100%; object-fit: cover; }
.outfit-grid .item .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.78), transparent);
  padding: 5px 6px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  font-weight: 600;
}

.section-title {
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 24px 0 14px;
  font-family: var(--sans);
  font-weight: 600;
}

.saved-outfits { display: grid; gap: 12px; }
.saved-outfit {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.saved-outfit-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.saved-outfit-delete {
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}
.saved-outfit-delete:hover { color: var(--danger); }

/* ─── Item detail ─────────────────────────────────────────────────────── */
.item-detail {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.item-detail .detail-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.item-detail .detail-body { padding: 20px; }
.item-detail h2 { margin: 4px 0 6px; font-size: 28px; font-weight: 500; }
.item-detail .detail-type {
  color: var(--accent-strong);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-family: var(--sans);
}
.detail-meta {
  display: grid;
  gap: 0;
  margin-top: 16px;
  font-size: 14px;
}
.detail-meta .meta-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.detail-meta .meta-row:last-child { border-bottom: none; }
.detail-meta .meta-row span:first-child { color: var(--text-dim); }
.detail-actions { display: flex; gap: 10px; margin-top: 18px; }
.detail-actions button { flex: 1; }

/* ─── Builder ─────────────────────────────────────────────────────────── */
.builder-hint { color: var(--text-dim); font-size: 14px; margin: 0 0 16px; }
.builder-section { margin-bottom: 24px; }
.builder-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin: 0 0 10px;
  font-family: var(--sans);
  font-weight: 600;
}
.builder-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.builder-row::-webkit-scrollbar { display: none; }
.builder-item {
  flex-shrink: 0;
  width: 110px;
  aspect-ratio: 3/4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elev);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.builder-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.builder-item img { width: 100%; height: 100%; object-fit: cover; }

.builder-footer {
  position: sticky;
  bottom: calc(84px + var(--safe-bottom));
  background: var(--bg);
  padding: 14px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
#builder-preview {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 40px;
  flex-wrap: wrap;
}
#builder-preview .mini {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#builder-preview .mini img { width: 100%; height: 100%; object-fit: cover; }
#builder-save { width: 100%; }

/* ─── Wishlist ────────────────────────────────────────────────────────── */
.wishlist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 500px) {
  .wishlist-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.wishlist-card {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.2s;
}
.wishlist-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wishlist-card .wl-img {
  width: 100px;
  flex-shrink: 0;
  background: var(--bg-elev-2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wishlist-card .wl-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.wishlist-card .wl-img .wl-placeholder {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--accent);
}
.wishlist-card .wl-body {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wishlist-card .wl-brand {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  font-weight: 600;
  margin-bottom: 3px;
}
.wishlist-card .wl-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.wishlist-card .wl-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: 13px;
  color: var(--text-dim);
}
.wishlist-card .wl-price {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text);
}
.wishlist-card .wl-link {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-decoration: none;
}

/* ─── Auth screen ─────────────────────────────────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  overflow-y: auto;
}

.auth-screen::before {
  content: "";
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
}
.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo-circle {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  font-style: italic;
}
.auth-logo-circle::after { content: "C"; }
.auth-logo h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text);
}
.auth-logo h1 em {
  font-style: italic;
  color: var(--accent-strong);
  font-weight: 400;
}
.auth-logo p {
  color: var(--text-dim);
  margin: 8px 0 0;
  font-size: 14px;
}

.profile-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  width: 100%;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.15s;
}
.profile-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.profile-tile:active { transform: scale(0.99); }
.profile-tile .avatar { width: 44px; height: 44px; font-size: 18px; }
.profile-tile .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.profile-tile .meta .name { font-weight: 600; }
.profile-tile .meta .sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.profile-tile .lock { color: var(--text-soft); font-size: 14px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  font-family: var(--serif);
  letter-spacing: 0;
}

.pin-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}

.profile-current {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-md);
}
.profile-current .avatar { width: 48px; height: 48px; font-size: 20px; }
.profile-current .info { flex: 1; }
.profile-current .info .name {
  font-weight: 500;
  font-size: 17px;
  font-family: var(--serif);
}
.profile-current .info .sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.settings-group { margin-top: 18px; }
.settings-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: 8px;
  font-weight: 600;
}
.theme-toggle {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 2px;
}
.theme-toggle button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 9px 6px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── App footer ──────────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  padding: 8px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--sans);
}
.app-footer svg { color: var(--danger); }

/* ─── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(110px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
