:root {
  /* Warm Editorial Paper Theme (Light) */
  --bg-page: #F5F2EB;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EDE8DF;
  --bg-elevated: #FAF8F5;
  --text-main: #18181B;
  --text-secondary: #3F3D39;
  --text-muted: #6E6A63;
  --text-faint: #9E9990;
  --brand: #14532D;
  --brand-hover: #0F3F22;
  --brand-light: #166534;
  --brand-tint: #E6F2EB;
  --amber: #B45309;
  --amber-tint: #FEF3C7;
  --indigo: #1E40AF;
  --indigo-tint: #DBEAFE;
  --danger: #B91C1C;
  --danger-tint: #FEE2E2;
  --border: #E2DDD3;
  --border-strong: #CFC8BA;
  --shadow-sm: 0 2px 6px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 10px 28px rgba(24, 24, 27, 0.08);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
}

body.dark-theme {
  --bg-page: #111110;
  --bg-surface: #1A1A18;
  --bg-subtle: #242320;
  --bg-elevated: #201F1C;
  --text-main: #F4F1EA;
  --text-secondary: #D6D2C9;
  --text-muted: #9B978E;
  --text-faint: #68645C;
  --brand: #22C55E;
  --brand-hover: #16A34A;
  --brand-light: #4ADE80;
  --brand-tint: rgba(34, 197, 94, 0.14);
  --amber: #F59E0B;
  --amber-tint: rgba(245, 158, 11, 0.15);
  --indigo: #60A5FA;
  --indigo-tint: rgba(96, 165, 250, 0.15);
  --danger: #F87171;
  --danger-tint: rgba(248, 113, 113, 0.15);
  --border: #2C2B28;
  --border-strong: #3D3B37;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  padding-bottom: 92px;
}

svg.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}

.topbar-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, #166534, #0F3F22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(20, 83, 45, 0.25);
  flex-shrink: 0;
}

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

.brand-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.15;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* UNIFIED USER STATS PILL (Coins + Trust in one sleek capsule) */
.user-stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.user-stats-pill:active {
  transform: scale(0.97);
}

.stat-coins {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--amber);
  font-weight: 800;
}

.stat-sep {
  width: 1px;
  height: 12px;
  background: var(--border-strong);
}

.stat-trust {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #F59E0B;
  font-weight: 800;
}

.stat-trust b {
  color: var(--text-main);
}

/* COMPACT ACTION BUTTONS (Guide, Theme) */
.icon-btn-compact {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.icon-btn-compact:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.icon-btn-compact:active {
  transform: scale(0.92);
}

.icon-btn-compact .icon {
  width: 16px;
  height: 16px;
}

/* RADAR INPUTS ROW (Clean on Mobile) */
.radar-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

@media (min-width: 500px) {
  .radar-input-row {
    flex-direction: row;
  }
}

/* LEGACY FALLBACKS */
.score-pill {
  padding: 5px 10px;
  border-radius: 9px;
  background: var(--amber-tint);
  border: 1px solid rgba(180, 83, 9, 0.2);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--amber);
  cursor: pointer;
}

.trust-pill {
  padding: 5px 8px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 3px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn:hover {
  background: var(--bg-subtle);
}

/* LAYOUT WRAPPER */
.wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 14px 16px;
}

.page-view {
  display: none;
  animation: fadeIn 0.18s ease;
}

.page-view.active {
  display: block;
}

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

/* HERO / CATALOG HEADER BAR */
.catalog-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 4px 2px;
  gap: 12px;
}

.catalog-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.3px;
}

.catalog-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0 0;
  font-weight: 500;
}

.catalog-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.catalog-stat-pill b {
  color: var(--brand);
  font-weight: 800;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.summary-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 15px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

/* ONBOARDING BANNER */
.onboard-banner {
  background: var(--brand-tint);
  border: 1px solid rgba(20, 83, 45, 0.22);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.onboard-banner-text {
  font-size: 12.5px;
  color: var(--text-main);
}

.onboard-banner-text strong {
  display: block;
  font-size: 13px;
  color: var(--brand);
  margin-bottom: 1px;
}

/* SCOPE SEGMENTED TABS (Maktabimda / Tumanimda / Barchasi) */
.scope-grid {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  scrollbar-width: none;
}

.scope-grid::-webkit-scrollbar {
  display: none;
}

.scope-btn {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.scope-btn.active {
  background: var(--bg-surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* SEARCH BAR */
.search-box {
  position: relative;
  margin-bottom: 10px;
}

.search-box svg.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 11px 36px 11px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

/* HORIZONTAL FILTER CHIPS (Quick Filters) */
.filter-chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 1px 12px 1px;
  margin-bottom: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-chip-scroll::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  padding: 7px 14px;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.chip-btn:hover {
  border-color: var(--brand);
  color: var(--text-main);
}

.chip-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
}

.chip-filter-modal-btn {
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.filter-active-count {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

.filter-modal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* BOT QUICK-ADD BANNER */
.bot-add-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.09) 0%, rgba(16, 185, 129, 0.09) 100%);
  border: 1.5px solid rgba(59, 130, 246, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 10px;
  margin-bottom: 8px;
  position: relative;
  box-shadow: 0 3px 12px rgba(59, 130, 246, 0.06);
}

.bot-add-badge {
  position: absolute;
  top: -9px;
  right: 14px;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2.5px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.bot-add-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-add-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.bot-add-content {
  flex: 1;
  min-width: 0;
}

.bot-add-content h4 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--text-main);
}

.bot-add-content p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.bot-add-btn {
  flex-shrink: 0;
  padding: 8px 13px;
  font-size: 12px;
  white-space: nowrap;
}

.or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.or-divider span {
  padding: 0 10px;
}

/* HORIZONTAL CHIPS (Legacy tabs-bar fallback) */
.tabs-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* BOOK CARDS */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.book-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.book-item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.book-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

/* REAL COVER PHOTO WRAPPER (Crisp, Prominent, No Overlaid Text or Dark Mask) */
.book-cover-wrap {
  width: 96px;
  height: 138px;
  min-width: 96px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.13);
  position: relative;
  background: var(--bg-subtle);
  cursor: pointer;
  display: block;
}

.book-cover-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  transition: transform 0.22s ease;
}

.book-item:hover .book-cover-photo,
.book-cover-wrap:hover .book-cover-photo {
  transform: scale(1.03);
}

/* 3D Cloth-bound Book Cover (Used when no photo uploaded) */
.book-spine-cover {
  width: 96px;
  height: 138px;
  min-width: 96px;
  border-radius: 5px 10px 10px 5px;
  position: relative;
  flex-shrink: 0;
  padding: 12px 10px 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.2), inset 5px 0 8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.book-spine-cover::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.24);
  z-index: 2;
}

.book-spine-cover.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.15);
  z-index: 1;
}

.cover-title-mini {
  position: relative;
  z-index: 3;
  font-family: var(--font-serif);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.cover-author-mini {
  position: relative;
  z-index: 3;
  font-size: 8px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Book Cover Color Palettes */
.tone-emerald { background: linear-gradient(145deg, #14532D, #052E16); }
.tone-burgundy { background: linear-gradient(145deg, #7F1D1D, #450A0A); }
.tone-navy { background: linear-gradient(145deg, #1E3A8A, #0F172A); }
.tone-ochre { background: linear-gradient(145deg, #92400E, #451A03); }
.tone-slate { background: linear-gradient(145deg, #334155, #0F172A); }
.tone-plum { background: linear-gradient(145deg, #4C1D95, #2E1065); }

.book-details {
  flex: 1;
  min-width: 0;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-loan { background: var(--indigo-tint); color: var(--indigo); }
.badge-barter { background: var(--amber-tint); color: var(--amber); }
.badge-gift { background: var(--brand-tint); color: var(--brand); }
.badge-loc { background: var(--bg-subtle); color: var(--text-secondary); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }

.book-heading {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2px;
  color: var(--text-main);
}

.book-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.owner-line {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.book-note {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 8px 11px;
  border-radius: 9px;
  margin-top: 10px;
  font-style: italic;
  border-left: 2.5px solid var(--brand);
}

.book-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* BUTTONS */
.btn {
  flex: 1;
  padding: 9.5px 13px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-solid {
  background: var(--brand);
  color: #fff;
}

.btn-solid:hover {
  background: var(--brand-hover);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-danger {
  background: var(--danger-tint);
  color: var(--danger);
  border-color: transparent;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
  border-radius: 8px;
  flex: 0 0 auto;
}

/* PANELS & FORMS */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.panel-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.input:focus {
  border-color: var(--brand);
  background: var(--bg-surface);
}

/* BOOK ADD LIVE PREVIEW & UPLOAD STUDIO (Spacious, prominent, eye-catching) */
.cover-studio-wrap {
  display: flex;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  align-items: flex-start;
}

.cover-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cover-preview-box #liveCoverBox {
  width: 104px;
  height: 152px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.clear-cover-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.clear-cover-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.cover-controls-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cover-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cover-action-btn.primary-upload {
  background: rgba(16, 185, 129, 0.07);
  border: 1.5px dashed var(--brand);
}

.cover-action-btn.primary-upload:hover {
  background: rgba(16, 185, 129, 0.13);
}

.cover-action-btn.secondary-upload {
  background: var(--bg-page);
  border: 1px dashed var(--border);
}

.action-icon {
  width: 20px;
  height: 20px;
  color: var(--brand);
  flex-shrink: 0;
}

.secondary-upload .action-icon {
  color: var(--text-muted);
}

.action-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.action-text small {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.action-text span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

.upload-badge-success {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  width: fit-content;
  margin-top: -2px;
  margin-bottom: 2px;
}

.tone-picker-section {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.tone-picker-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.swatch.selected {
  border-color: var(--text-main);
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* MODE SELECTOR CARDS (Omonat / Barter / Hadya) */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.mode-card {
  border: 1.5px solid var(--border);
  background: var(--bg-page);
  border-radius: 11px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-card strong {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  color: var(--text-main);
}

.mode-card span {
  font-size: 10px;
  color: var(--text-muted);
}

.mode-card.active {
  border-color: var(--brand);
  background: var(--brand-tint);
}

/* PASSPORT CERTIFICATE & TIMELINE */
.passport-header-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px;
  margin-bottom: 14px;
}

.passport-stamp {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--brand);
  color: var(--brand);
  margin-bottom: 6px;
}

.timeline-list {
  position: relative;
  padding-left: 16px;
  border-left: 2px solid var(--border-strong);
  margin-left: 6px;
}

.timeline-node {
  position: relative;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  margin-bottom: 10px;
}

.timeline-node::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-surface);
}

/* LOAN COUNTDOWN BAR */
.timer-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  margin-top: 8px;
}

.timer-bar-bg {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
}

.timer-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.timer-bar-fill.urgent {
  background: var(--amber);
}

/* STAR RATING PICKER */
.star-picker {
  display: inline-flex;
  gap: 6px;
}

.star-btn {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--border-strong);
  line-height: 1;
  transition: transform 0.1s, color 0.1s;
}

.star-btn.active {
  color: #F59E0B;
}

.star-btn:active {
  transform: scale(1.2);
}

/* LIST ROWS & LEADERBOARD */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.pos-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.pos-1 { background: #FEF3C7; color: #B45309; border: 1px solid #F59E0B; }
.pos-2 { background: #E2E8F0; color: #334155; }
.pos-3 { background: #FFEDD5; color: #9A3412; }

/* PROGRESS BAR FOR RANK */
.rank-card {
  background: linear-gradient(135deg, #14532D 0%, #064E3B 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.rank-progress-track {
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  margin: 8px 0 5px;
}

.rank-progress-bar {
  height: 100%;
  background: #4ADE80;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.user-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  backdrop-filter: blur(4px);
}

select.input {
  cursor: pointer;
}

/* BOTTOM NAVIGATION BAR */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 7px 6px 14px;
}

.tab-link {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  position: relative;
}

.tab-link.active {
  color: var(--brand);
  font-weight: 700;
}

.tab-badge {
  position: absolute;
  top: 0;
  right: 8px;
  background: var(--amber);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  display: none;
}

/* BOTTOM SHEETS / MODALS */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.62);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.overlay.open {
  display: flex;
}

.sheet {
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 18px 18px 28px;
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: sheetUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
}

/* GUIDE STEPS */
.guide-step {
  display: none;
}

.guide-step.active {
  display: block;
}

.guide-illustration {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--brand-tint);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.guide-dots {
  display: flex;
  gap: 6px;
  margin: 16px 0;
}

.guide-dot {
  height: 6px;
  flex: 1;
  border-radius: 4px;
  background: var(--border);
  transition: background 0.2s;
}

.guide-dot.active {
  background: var(--brand);
}

/* SNACKBAR NOTIFICATION */
.snackbar {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  z-index: 300;
  display: none;
  max-width: 90vw;
  text-align: center;
}
