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

:root {
  --bg-primary: #F5F3EF;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #F0EDE6;
  --bg-input: #F5F3EF;
  --gold: #A8874D;
  --gold-light: #C9A96E;
  --gold-dark: #8B6F3A;
  --text-primary: #1A1A28;
  --text-secondary: #5A5A6E;
  --text-muted: #8A8A9E;
  --border: #E0DDD6;
  --border-gold: rgba(168, 135, 77, 0.3);
  --danger: #C9556E;
  --success: #3A9A7A;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --bg-primary: #0D0D14;
  --bg-secondary: #151520;
  --bg-card: #1A1A28;
  --bg-elevated: #222233;
  --bg-input: #1E1E2E;
  --gold: #C9A96E;
  --gold-light: #E0C992;
  --gold-dark: #A8874D;
  --text-primary: #F0EDE6;
  --text-secondary: #9A9AAE;
  --text-muted: #6B6B7E;
  --border: #2A2A3D;
  --border-gold: rgba(201, 169, 110, 0.3);
  --danger: #C9556E;
  --success: #6EC9A9;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}
[data-theme="dark"] .app-header {
  background: rgba(13, 13, 20, 0.85);
}
[data-theme="dark"] .bag-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .detail-close-btn { background: rgba(255,255,255,0.15); }
[data-theme="dark"] .camera-overlay { background: #000; }

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  width: 100%;
}

#mainApp {
  overflow-x: hidden;
  width: 100%;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* ===== LOGIN GATE ===== */
.login-gate {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  min-height: 100vh;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--bg-primary);
  z-index: 1000;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
}

.login-logo {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.login-field input:focus {
  border-color: var(--gold);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-divider span { padding: 0 12px; white-space: nowrap; }

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-bottom: 16px;
  display: none;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
  margin-top: 8px;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-divider span {
  padding: 0 12px;
  white-space: nowrap;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  object-fit: cover;
}
.user-avatar:hover {
  border-color: var(--gold);
}
.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.btn-logout svg {
  width: 20px;
  height: 20px;
}
.btn-logout:hover {
  color: var(--accent-red, #c5556e);
}

/* ===== SETUP SCREEN ===== */
/* ===== SYNC INDICATOR ===== */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg-input);
  border-radius: 20px;
  margin-left: 12px;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.sync-dot.syncing {
  background: var(--gold);
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 20, 0.9);
  z-index: 600;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

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

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== HEADER ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 239, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px max(24px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left));
  padding-top: calc(16px + env(safe-area-inset-top));
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
}

.header-left { display: flex; align-items: center; min-width: 0; flex-shrink: 1; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  object-fit: cover;
}
.user-avatar:hover { border-color: var(--gold); }

.logo-group {
  display: flex;
  flex-direction: column;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo span {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0;
  margin-left: 12px;
  text-transform: none;
}

.app-version {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
  opacity: 0.6;
  margin-top: -2px;
}

/* ===== STATS BAR ===== */
.stats-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  box-sizing: border-box;
  width: 100%;
}

.stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--border-gold); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 600;
  color: var(--gold);
}

.stat-value.text-white { color: var(--text-primary); }
.stat-top-brand {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.stat-card-clickable { cursor: pointer; }
.stat-card-clickable:hover { border-color: var(--gold); background: var(--bg-elevated); }

/* ===== BRAND BREAKDOWN ===== */
.brand-breakdown-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.brand-breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-breakdown-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-drag-handle {
  display: none;
  justify-content: center;
  padding: 12px 0 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.drag-pill {
  width: 36px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 3px;
  opacity: 0.5;
}

.detail-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.detail-close:hover { color: var(--text-primary); }

.brand-breakdown-body { padding: 16px 24px 24px; max-height: 60vh; overflow-y: auto; }

.brand-breakdown-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.brand-breakdown-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.brand-breakdown-table th:nth-child(2),
.brand-breakdown-table td:nth-child(2) { text-align: center; }
.brand-breakdown-table th:last-child,
.brand-breakdown-table td:last-child { text-align: right; }
.brand-breakdown-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
  color: var(--text-primary);
}
.brand-breakdown-table tfoot td {
  border-top: 2px solid var(--gold);
  border-bottom: none;
  padding-top: 12px;
  color: var(--gold);
}

/* ===== TOOLBAR ===== */
.toolbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  box-sizing: border-box;
  width: 100%;
}

.search-box { flex: 1; min-width: 200px; position: relative; }

.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 18px; height: 18px; }

.search-box input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--gold); }

.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); font-size: 22px;
  cursor: pointer; padding: 4px 8px; line-height: 1; transition: var(--transition);
}
.search-clear:hover { color: var(--text-primary); }

.toolbar-row { display: contents; }

/* Desktop: export/share inline, bottom-actions hidden */
.toolbar-desktop { display: inline-flex; }
.bottom-actions { display: none; }

.privacy-link {
  color: var(--gold);
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition);
  opacity: 0.7;
}
.privacy-link:hover { opacity: 1; }

.filter-select {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B7E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-select:focus { border-color: var(--gold); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.3);
}

.btn-gold:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger {
  background: rgba(201, 85, 110, 0.15);
  color: var(--danger);
  border: 1px solid rgba(201, 85, 110, 0.3);
}

.btn-danger:hover { background: rgba(201, 85, 110, 0.25); }

/* ===== COLLECTION GRID ===== */
.collection {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  box-sizing: border-box;
  width: 100%;
}

.bag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.bag-card:hover { transform: translateY(-4px); border-color: var(--border-gold); box-shadow: var(--shadow); }

.bag-card-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-elevated); display: block;
  opacity: 0; transition: opacity 0.3s ease;
}
.bag-card-img.loaded { opacity: 1; }

.bag-card-placeholder {
  width: 100%; aspect-ratio: 1; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}

.bag-card-placeholder svg { width: 48px; height: 48px; opacity: 0.4; }

.bag-card-body { padding: 16px 18px 18px; }

.bag-card-brand { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); margin-bottom: 4px; }

.bag-card-model { font-family: 'Playfair Display', serif; font-size: clamp(15px, 2.5vw, 18px); font-weight: 600; color: var(--text-primary); margin-bottom: 8px; line-height: 1.3; }

.bag-card-meta { display: flex; align-items: center; justify-content: space-between; }

.bag-card-price { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* ===== DUAL CURRENCY DISPLAY ===== */
.secondary-price {
  font-size: 0.75em;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}
.stat-secondary-price {
  font-size: 0.55em;
  color: var(--text-secondary);
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

.bag-card-condition {
  font-size: 11px; padding: 4px 10px; border-radius: 20px;
  background: rgba(110, 201, 169, 0.12); color: var(--success);
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ===== EMPTY STATE ===== */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 80px 24px; }
.empty-state > svg { width: 80px; height: 80px; color: #fff; opacity: 1; margin-bottom: 24px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08)); }
.empty-state h2 { font-family: 'Playfair Display', serif; font-size: clamp(20px, 3.5vw, 24px); font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 200; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 640px; box-shadow: var(--shadow); animation: slideUp 0.3s ease;
}

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

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: 'Playfair Display', serif; font-size: clamp(18px, 3.5vw, 22px); font-weight: 600; }

.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; min-width: 44px; min-height: 44px; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text-primary); }
.modal-close svg { width: 24px; height: 24px; }

.modal-body { padding: 28px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 20px 28px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* ===== URL IMPORT ===== */
.url-import-section {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 28px;
}

.url-import-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.url-import-row .form-input {
  flex: 1;
  min-width: 0;
}

.url-import-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 11px 18px;
  gap: 6px;
}

.url-import-btn svg {
  width: 16px;
  height: 16px;
}

.url-import-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 0;
  transition: var(--transition);
}

.url-import-status:empty {
  display: none;
}

.url-import-status.loading {
  color: var(--gold);
}

.url-import-status.success {
  color: var(--success);
}

.url-import-status.error {
  color: var(--danger);
}

.price-estimated-badge {
  font-size: 11px;
  color: var(--gold);
  background: rgba(201, 169, 110, 0.1);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 4px 10px;
  margin-top: 6px;
  display: inline-block;
}

@media (max-width: 640px) {
  .url-import-row {
    flex-direction: column;
  }
  .url-import-btn {
    justify-content: center;
  }
}

/* ===== FORM ===== */
.form-section { margin-bottom: 28px; }
.form-section-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--gold); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.form-input, .form-textarea, .form-select {
  padding: 11px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-primary); font-size: 14px; font-family: 'Inter', sans-serif; transition: var(--transition); outline: none; width: 100%;
}

.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--gold); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B7E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* ===== PHOTO UPLOAD ===== */
.photo-area { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.photo-thumb { width: 100px; height: 100px; border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--border); flex-shrink: 0; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

.photo-thumb .remove-photo {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.7); border: none; color: white; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition);
}
.photo-thumb .rotate-photo {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.7); border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition); padding: 0;
}
.photo-thumb .rotate-photo svg { width: 13px; height: 13px; }
.photo-thumb:hover .remove-photo, .photo-thumb:hover .rotate-photo { opacity: 1; }

.photo-actions { display: flex; gap: 8px; }

/* ===== DOCUMENT UPLOAD ===== */
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; }

.doc-icon { width: 36px; height: 36px; border-radius: 8px; background: rgba(201, 169, 110, 0.12); color: var(--gold); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon svg { width: 18px; height: 18px; }

.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-size { font-size: 11px; color: var(--text-muted); }

.doc-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; min-width: 44px; min-height: 44px; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.doc-remove:hover { color: var(--danger); }
.doc-remove svg { width: 16px; height: 16px; }

.doc-upload-btn {
  width: 100%; padding: 14px; border: 2px dashed var(--border); border-radius: 8px; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 13px; font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: var(--transition);
}
.doc-upload-btn:hover { border-color: var(--gold); color: var(--gold); }
.doc-upload-btn svg { width: 18px; height: 18px; }

/* ===== CAMERA MODAL ===== */
.camera-overlay { display: none; position: fixed; inset: 0; background: #000; z-index: 300; flex-direction: column; }
.camera-overlay.active { display: flex; }

.camera-header { padding: calc(16px + env(safe-area-inset-top)) 20px 16px 20px; display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.5); position: absolute; top: 0; left: 0; right: 0; z-index: 2; }
.camera-header h3 { font-family: 'Playfair Display', serif; font-size: 18px; color: white; }

#cameraVideo { width: 100%; height: 100%; object-fit: cover; }
#cameraCanvas { display: none; }

.camera-controls { position: absolute; bottom: 0; left: 0; right: 0; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 24px; background: linear-gradient(transparent, rgba(0,0,0,0.8)); z-index: 2; }

.camera-capture-btn { width: 70px; height: 70px; border-radius: 50%; border: 4px solid white; background: transparent; cursor: pointer; position: relative; transition: var(--transition); }
.camera-capture-btn::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: white; transition: var(--transition); }
.camera-capture-btn:hover::after { background: var(--gold); }

.camera-cancel-btn { background: rgba(255,255,255,0.15); border: none; color: white; padding: 12px 24px; border-radius: 30px; font-size: 14px; font-family: 'Inter', sans-serif; cursor: pointer; transition: var(--transition); }
.camera-cancel-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== DETAIL VIEW ===== */
.detail-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 200; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px;
}
.detail-overlay.active { display: flex; animation: fadeIn 0.25s ease; }

.detail-modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 700px; box-shadow: var(--shadow); animation: slideUp 0.3s ease; overflow: hidden; }

.detail-carousel { position: relative; width: 100%; aspect-ratio: 4/3; background: var(--bg-elevated); overflow: hidden; }
.detail-carousel img { width: 100%; height: 100%; object-fit: contain; background: var(--bg-elevated); }
.detail-carousel-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.detail-carousel-placeholder svg { width: 64px; height: 64px; opacity: 0.3; }

.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,0.5); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.carousel-nav:hover { background: rgba(0,0,0,0.8); }
.carousel-nav.prev { left: 12px; }
.carousel-nav.next { right: 12px; }
.carousel-nav svg { width: 20px; height: 20px; }

.carousel-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.4); border: none; cursor: pointer; transition: var(--transition); padding: 10px; box-sizing: content-box; }
.carousel-dot.active { background: var(--gold); width: 20px; border-radius: 4px; }

.detail-body { padding: 28px; }
.detail-brand { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); margin-bottom: 4px; }
.detail-model { font-family: 'Playfair Display', serif; font-size: clamp(22px, 4vw, 28px); font-weight: 700; margin-bottom: 20px; line-height: 1.2; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 4px; }
.detail-field-value { font-size: 15px; color: var(--text-primary); font-weight: 500; }

.detail-notes { margin-bottom: 24px; }
.detail-notes-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 6px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: var(--transition); user-select: none;
}
.detail-notes-label:hover { color: var(--text-secondary); }
.detail-notes-label .notes-chevron {
  width: 12px; height: 12px; transition: transform 0.2s ease; flex-shrink: 0;
}
.detail-notes.expanded .notes-chevron { transform: rotate(90deg); }
.detail-notes-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; display: none; margin-top: 6px; }
.detail-notes.expanded .detail-notes-text { display: block; }

.detail-docs { margin-bottom: 24px; }
.detail-docs-title {
  font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--gold); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none;
}
.detail-docs-title .notes-chevron { width: 14px; height: 14px; transition: transform 0.2s ease; flex-shrink: 0; color: var(--gold); }
.detail-docs.expanded .notes-chevron { transform: rotate(90deg); }
.detail-docs #detailDocList { display: none; }
.detail-docs.expanded #detailDocList { display: block; }

.detail-doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: var(--transition); }
.detail-doc-item:hover { border-color: var(--gold); }

.detail-actions { display: flex; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-actions .btn { flex: 1; justify-content: center; }
.wishlist-detail-actions .btn, .wishlist-detail-actions .btn-move-collection { flex: 1; justify-content: center; }

/* ===== BRAND RECOGNITION ===== */
.brand-detect-btn {
  display: none; width: 100%; padding: 12px; margin-top: 10px;
  background: linear-gradient(135deg, rgba(201, 169, 110, 0.15), rgba(201, 169, 110, 0.05));
  border: 1px solid var(--border-gold); border-radius: 8px; color: var(--gold);
  font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer;
  align-items: center; justify-content: center; gap: 8px; transition: var(--transition);
}
.brand-detect-btn.visible { display: flex; }
.brand-detect-btn:hover { background: linear-gradient(135deg, rgba(201, 169, 110, 0.25), rgba(201, 169, 110, 0.1)); border-color: var(--gold); }
.brand-detect-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.brand-detect-btn svg { width: 16px; height: 16px; }

.brand-detect-result { display: none; margin-top: 10px; padding: 14px 16px; background: rgba(201, 169, 110, 0.08); border: 1px solid var(--border-gold); border-radius: 8px; }
.brand-detect-result.visible { display: block; }
.brand-detect-result-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.brand-detect-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }

.brand-suggest-chip {
  padding: 10px 16px; min-height: 44px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-primary); font-size: 13px; font-family: 'Inter', sans-serif; cursor: pointer;
  transition: var(--transition); display: flex; align-items: center; gap: 6px;
}
.brand-suggest-chip:hover { border-color: var(--gold); color: var(--gold); }
.brand-suggest-chip .confidence { font-size: 10px; color: var(--text-muted); font-weight: 500; }

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.brand-detect-btn.analyzing { background: linear-gradient(90deg, rgba(201,169,110,0.1), rgba(201,169,110,0.25), rgba(201,169,110,0.1)); background-size: 200% 100%; animation: shimmer 1.5s ease infinite; }

/* ===== DETAIL CLOSE BUTTON (mobile) ===== */
.detail-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.detail-close-btn svg { width: 24px; height: 24px; }

/* ===== TOUCH FEEDBACK ===== */
.btn-gold:active { transform: scale(0.97); filter: brightness(0.9); }
.btn-outline:active { background: rgba(201, 169, 110, 0.1); transform: scale(0.97); }
.btn-danger:active { background: rgba(201, 85, 110, 0.35); transform: scale(0.97); }
.bag-card:active { transform: scale(0.98); transition-duration: 0.1s; }
.fab:active { transform: scale(0.9); transition-duration: 0.1s; }
.carousel-nav:active { background: rgba(0,0,0,0.9); transform: translateY(-50%) scale(0.9); }
.filter-select:active { border-color: var(--gold); }
.doc-upload-btn:active { border-color: var(--gold); background: rgba(201, 169, 110, 0.05); }
.autocomplete-item:active { background: rgba(201, 169, 110, 0.2); }
.detail-doc-item:active { background: var(--bg-elevated); }

/* ===== RESPONSIVE: TABLET (1024px) ===== */
@media (max-width: 1024px) {
  .app-header { padding: 18px 20px; }
  .logo span { font-size: 13px; margin-left: 10px; }
  .stats-bar { padding: 20px 20px 0; }
  .toolbar { padding: 20px 20px 0; }
  .collection { padding: 20px; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .detail-modal { max-width: 600px; }
  .modal { max-width: 580px; }
}

/* ===== FABS (hidden by default, shown by media queries) ===== */
.fab { display: none; position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); right: calc(24px + env(safe-area-inset-right)); width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #0D0D14; border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(201, 169, 110, 0.4); z-index: 50; align-items: center; justify-content: center; transition: var(--transition); }
.fab:hover { transform: scale(1.1); }
.fab svg { width: 26px; height: 26px; }

/* ===== RESPONSIVE: LARGE MOBILE (768px) ===== */
@media (max-width: 768px) {
  .app-header { padding: 16px 18px; padding-top: calc(16px + env(safe-area-inset-top)); padding-right: max(18px, env(safe-area-inset-right)); padding-left: max(18px, env(safe-area-inset-left)); }
  .logo span { display: none; }
  .stats-bar { padding: 16px 18px 0; gap: 12px; }
  .stat-card { padding: 16px 18px; min-width: 120px; }
  /* Mobile toolbar: search full-width, filters wrap below */
  .toolbar { padding: 16px 18px 0; flex-direction: column; gap: 10px; align-items: stretch; }
  .search-box { min-width: 0; flex: none; }
  .search-box input { font-size: 16px; padding: 14px 44px 14px 46px; }
  .search-box svg { width: 20px; height: 20px; left: 16px; }
  .toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; }
  .filter-select { flex: 1; min-width: 0; }
  .toolbar-desktop { display: none !important; }
  .bottom-actions {
    display: flex;
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0 18px 24px;
    gap: 12px;
    align-items: center;
    justify-content: center;
  }
  .collection { padding: 18px; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .detail-body { padding: 24px; }
  .modal-body { padding: 24px; }
  .fab { display: flex; }
  .photo-thumb .remove-photo { opacity: 1; width: 32px; height: 32px; font-size: 18px; }
  .photo-thumb .rotate-photo { opacity: 1; width: 32px; height: 32px; }
  .photo-thumb .rotate-photo svg { width: 16px; height: 16px; }
}

/* ===== RESPONSIVE: SMALL MOBILE (640px) ===== */
@media (max-width: 640px) {
  .app-header { padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top)); padding-right: max(16px, env(safe-area-inset-right)); padding-left: max(16px, env(safe-area-inset-left)); }
  .header-right { gap: 8px; }
  .header-inner { gap: 8px; }
  #addBtnDesktop { padding: 10px 14px; font-size: 13px; }
  .sync-badge { display: none; }
  .stats-bar { padding: 14px 16px 0; gap: 10px; }
  .stat-card { padding: 14px 16px; min-width: 100px; }
  .toolbar { padding: 14px 16px 0; }
  .collection { padding: 16px; gap: 14px; grid-template-columns: repeat(2, 1fr); }
  .bag-card-body { padding: 12px 14px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  /* Full-screen modals */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    max-width: 100%; border-radius: 0; border: none;
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    animation: none;
  }
  .modal-header { padding: 18px 20px; padding-top: calc(18px + env(safe-area-inset-top)); }
  .modal-body { flex: 1; max-height: none; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px; }
  .modal-footer {
    position: sticky; bottom: 0; background: var(--bg-secondary);
    border-top: 1px solid var(--border); padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  /* Full-screen detail view */
  .detail-overlay { padding: 0; align-items: stretch; }
  .detail-modal {
    max-width: 100%; border-radius: 0; border: none;
    min-height: 100vh; min-height: 100dvh;
    position: relative;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .detail-close-btn { display: flex; position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
  /* Brand breakdown full-screen on mobile */
  .brand-breakdown-modal {
    max-width: 100%; border-radius: 16px 16px 0 0; border: none;
    min-height: 100vh; min-height: 100dvh;
    margin-top: env(safe-area-inset-top, 44px);
  }
  .modal-drag-handle {
    display: flex;
  }
  .brand-breakdown-header {
    padding-top: 8px;
  }
  .detail-body { padding: 20px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .detail-grid { grid-template-columns: 1fr; }

  /* Sticky action bars at bottom of detail views */
  .detail-actions, .wishlist-detail-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    margin: 0;
    z-index: 15;
    flex-wrap: nowrap;
  }
  .wishlist-detail-actions { flex-direction: row; }
}

.hidden { display: none !important; }

.autocomplete-wrapper { position: relative; }
.autocomplete-list { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; max-height: 180px; overflow-y: auto; z-index: 10; margin-top: 4px; }
.autocomplete-list.active { display: block; }
.autocomplete-item { padding: 10px 14px; font-size: 14px; cursor: pointer; transition: var(--transition); color: var(--text-primary); }
.autocomplete-item:hover { background: rgba(201, 169, 110, 0.12); color: var(--gold); }


.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(100px); background: var(--bg-elevated); border: 1px solid var(--border-gold); color: var(--text-primary); padding: 12px 24px; border-radius: 30px; font-size: 14px; z-index: 500; transition: transform 0.3s ease; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); }

.img-preview-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 400; align-items: center; justify-content: center; flex-direction: column; touch-action: none; user-select: none; }
.img-preview-overlay.active { display: flex; }
.img-preview-overlay img { max-width: 90%; max-height: 80vh; object-fit: contain; border-radius: 8px; touch-action: none; transition: transform 0.15s ease; will-change: transform; }
.img-preview-close { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.15); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; }
.img-preview-close svg { width: 24px; height: 24px; }
.img-preview-counter { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.6); font-size: 13px; z-index: 10; }
.img-preview-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.15); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; }
.img-preview-nav:hover { background: rgba(255,255,255,0.25); }
.img-preview-nav.prev { left: 12px; }
.img-preview-nav.next { right: 12px; }
.img-preview-nav svg { width: 24px; height: 24px; }

/* Upload progress */
.upload-progress { margin-top: 8px; }
.upload-progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--gold); width: 0%; transition: width 0.3s ease; }
.upload-progress-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== MOMENTUM SCROLLING ===== */
.modal-body,
.detail-overlay,
.modal-overlay {
  -webkit-overflow-scrolling: touch;
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .stats-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 0;
  }
  .stat-card { min-width: 130px; padding: 10px 14px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .modal { min-height: auto; max-height: 100vh; max-height: 100dvh; }
  .modal-body { max-height: 60vh; max-height: 60dvh; }
  .detail-carousel { aspect-ratio: 16/9; }
  .app-header { padding: 10px 16px; }
  .fab { bottom: 16px; right: 16px; width: 48px; height: 48px; }
  .fab svg { width: 22px; height: 22px; }
}

/* ===== VIEW TABS ===== */
.view-tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px 0;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.view-tab:hover { color: var(--text-secondary); }
.view-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.tab-count {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== WISHLIST CARD VARIANT ===== */
.wishlist-card { position: relative; }
.wishlist-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.5;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 1;
}

.wishlist-heart {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  z-index: 2;
}
.wishlist-heart svg { width: 16px; height: 16px; }

/* ===== PRICE CHANGE INDICATORS ===== */
.wishlist-price-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
}

.wishlist-price-change.price-down {
  color: var(--success);
  background: rgba(110, 201, 169, 0.12);
}

.wishlist-price-change.price-up {
  color: var(--danger);
  background: rgba(201, 85, 110, 0.12);
}

.wishlist-price-change.price-stable {
  color: var(--text-muted);
  background: rgba(107, 107, 126, 0.12);
}

/* ===== PRICE HISTORY ===== */
.price-history-section {
  margin-top: 16px;
}

.price-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none;
}
.price-history-title:hover { color: var(--text-primary); }
.price-history-title .notes-chevron { width: 12px; height: 12px; transition: transform 0.2s ease; flex-shrink: 0; }
.price-history-section #wishlistPriceHistory { display: none; }
.price-history-section.expanded #wishlistPriceHistory { display: block; }
.price-history-section.expanded .notes-chevron { transform: rotate(90deg); }

.price-history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}

.price-history-date {
  color: var(--text-muted);
  font-size: 12px;
}

.price-history-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== WISHLIST DETAIL ACTIONS ===== */
.wishlist-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn-move-collection {
  background: linear-gradient(135deg, rgba(201, 169, 110, 0.15), rgba(201, 169, 110, 0.05));
  border: 1px solid var(--border-gold);
  color: var(--gold);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.btn-move-collection:hover { background: linear-gradient(135deg, rgba(201, 169, 110, 0.25), rgba(201, 169, 110, 0.1)); }
.btn-move-collection svg { width: 16px; height: 16px; }

/* ===== SOURCE URL ===== */
.wishlist-source-section {
  margin-top: 12px;
}

.wishlist-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  transition: var(--transition);
}
.wishlist-source-badge:hover { color: var(--gold); border-color: var(--border-gold); }
.wishlist-source-badge svg { width: 14px; height: 14px; }

/* ===== WISHLIST MODE FORM TOGGLES ===== */
.wishlist-mode .collection-only { display: none !important; }
.wishlist-only { display: none; }
.wishlist-mode .wishlist-only { display: block; }

/* ===== JEWELRY MODE FORM TOGGLES ===== */
.jewelry-only { display: none; }
.jewelry-mode .jewelry-only { display: block; }
.jewelry-mode .bag-only { display: none !important; }

/* ===== WISHLIST TYPE TOGGLE (bag vs jewelry) ===== */
.wishlist-type-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.wtt-btn {
  flex: 1;
  min-width: 96px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.wtt-btn.active {
  background: var(--gold);
  color: #3a2a0a;
}

/* Wishlist section headings (Bags / Jewelry) span the full grid width */
.wishlist-section-title {
  grid-column: 1 / -1;
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 8px 2px 0;
}
.wishlist-section-title:first-child { margin-top: 0; }

/* When a jewelry dream is selected in the wishlist form, hide bag-only fields */
.wishlist-mode.wl-jewelry .bag-only { display: none !important; }

/* ===== TOOLBAR ACTION BUTTONS (Export PDF, Share) ===== */
.btn-toolbar {
  background: rgba(201, 169, 110, 0.12);
  color: var(--gold);
  border: 1px solid var(--border-gold);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-toolbar:hover { background: rgba(201, 169, 110, 0.2); }
.btn-toolbar:active { transform: scale(0.97); }
.btn-toolbar svg { width: 14px; height: 14px; }

/* ===== SHARE MODAL ===== */
.share-link-display {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'Inter', monospace;
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
  text-align: left;
  user-select: all;
}
.share-expiry-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ===== RESPONSIVE WISHLIST ===== */
@media (max-width: 768px) {
  .view-tabs { padding: 8px 16px 0; }
  .view-tab { padding: 10px 16px; font-size: 13px; }
}

@media (max-width: 640px) {
  .view-tabs { padding: 8px 12px 0; }
  .view-tab { padding: 8px 14px; font-size: 12px; }
  .wishlist-detail-actions { flex-direction: column; }
  .wishlist-detail-actions button { width: 100%; justify-content: center; }
}

/* ===== PULL TO REFRESH ===== */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-40px);
  z-index: 500;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
}
.ptr-indicator.ptr-ready .ptr-spinner {
  border-color: var(--gold);
  border-top-color: transparent;
}
.ptr-indicator.ptr-loading .ptr-spinner {
  animation: spin 0.6s linear infinite;
}

/* ===== OFFLINE INDICATOR ===== */
.offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 600;
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
  padding-top: calc(6px + env(safe-area-inset-top));
  letter-spacing: 0.5px;
  transition: transform 0.3s ease;
}
.offline-banner.active { display: block; }
.offline-banner .offline-queued { font-weight: 400; opacity: 0.85; margin-left: 8px; }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ===== RECOMMENDED TAB ===== */
.recommendation-photo {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.recommendation-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}
.recommendation-placeholder {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
  position: relative;
  overflow: hidden;
}
.recommendation-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: recShimmer 3s ease infinite;
}
@keyframes recShimmer { to { left: 100%; } }

.brand-initial {
  font-family: 'Playfair Display', serif;
  font-size: 64px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.rec-wishlist-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 2;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 0;
}
.rec-wishlist-btn:hover { color: #e74c6f; transform: scale(1.1); }
.rec-wishlist-btn.added { color: #e74c6f; }
.rec-wishlist-btn svg { width: 18px; height: 18px; }
[data-theme="dark"] .rec-wishlist-btn { background: rgba(0,0,0,0.65); }

.recommendation-ai-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.92);
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 2;
}
.recommendation-ai-badge svg { width: 12px; height: 12px; }
[data-theme="dark"] .recommendation-ai-badge {
  background: rgba(0,0,0,0.65);
  color: var(--gold-light);
}

.recommendation-reason-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
}
.recommendation-reason-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.recommendation-reason-title svg { width: 16px; height: 16px; flex-shrink: 0; }
.recommendation-reason-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .brand-initial { font-size: 48px; }
  .recommendation-ai-badge { top: 8px; right: 8px; font-size: 9px; padding: 3px 7px; }
}
@media (max-width: 640px) {
  .brand-initial { font-size: 40px; }
  .recommendation-reason-section { padding: 16px; }
  .trend-reason-section { padding: 16px; }
}

/* ===== TRENDS ===== */
.trends-controls {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.trends-categories {
  display: flex;
  gap: 8px;
}
.trends-pill {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.trends-pill:hover { border-color: var(--gold); color: var(--text-secondary); }
.trends-pill.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.trends-mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.trends-mode {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.trends-mode:hover { color: var(--text-secondary); }
.trends-mode.active {
  background: var(--gold);
  color: #fff;
}

/* Refresh info */
.trends-refresh-info {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.3px;
}

/* Section headers */
.trends-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 20px 0 4px;
  margin: 0;
}
.trends-section-header svg { color: var(--gold); flex-shrink: 0; }

/* Trend badge (fire icon) */
.trend-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 100, 50, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 2;
}
.trend-badge svg { width: 12px; height: 12px; }

/* Lyst badge */
.trend-lyst-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 7px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.2px;
  z-index: 2;
}

/* Trend reason section in detail overlay */
.trend-reason-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
}
.trend-reason-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.trend-reason-title svg { width: 16px; height: 16px; flex-shrink: 0; }
.trend-reason-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

/* Trend score bar */
.trend-score {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
}
.trend-score-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  max-width: 120px;
  overflow: hidden;
}
.trend-score-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
  transition: width 0.5s ease;
}

/* Responsive */
@media (max-width: 640px) {
  .trends-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 16px 4px;
  }
  .trends-categories { justify-content: center; }
  .trends-mode-toggle { justify-content: center; }
  .trends-pill { padding: 6px 14px; font-size: 12px; }
  .trends-mode { padding: 6px 12px; font-size: 11px; }
  .trends-section-header { font-size: 16px; padding: 16px 0 4px; }
  .trend-badge { top: 8px; right: 8px; font-size: 9px; padding: 3px 7px; }
  .trend-lyst-badge { top: 6px; right: 6px; font-size: 6px; padding: 1px 4px; }
}

