/* ============================================================
   PRICE TRACKER V3 - BASE STYLES
   Core components - requires theme CSS for variables
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  font-family: var(--font-primary);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}

.nav-links { display: flex; align-items: center; gap: 0.15rem; flex: 1; }

.nav-link {
  padding: 0.375rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover { color: var(--text-secondary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-muted); }

.nav-right { display: flex; align-items: center; gap: 0.6rem; }

.plan-chip {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.nav-btn:hover { color: var(--text-primary); border-color: var(--border-hover); background: var(--bg-hover); }
.nav-btn svg { width: 17px; height: 17px; }
.nav-btn .dot { position: absolute; top: -1px; right: -1px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-base); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
  cursor: pointer;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  position: relative;
  z-index: 1;
}

/* ============================================================
   WELCOME CARD
   ============================================================ */
.welcome-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn 0.4s ease-out;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.welcome-card h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.15rem; }
.welcome-card p { color: var(--text-secondary); font-size: 0.88rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn:hover { border-color: var(--border-hover); background: var(--bg-hover); }

.btn-accent, .btn-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-accent:hover, .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-small { padding: 0.35rem 0.8rem; font-size: 0.78rem; }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-danger:hover { background: #e11d48; }
.btn-ghost { background: transparent; border: none; color: var(--text-tertiary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ============================================================
   BENTO GRID
   ============================================================ */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.4s ease-out 0.06s both;
}

.bento-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  transition: all 0.2s;
}

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

.bento-stat { grid-column: span 3; }
.bento-usage { grid-column: span 4; }
.bento-wide { grid-column: span 6; }
.bento-full { grid-column: span 12; }

.bento-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.bento-value {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.bento-value.teal { color: var(--accent); }
.bento-value.green { color: var(--success); }
.bento-value.amber { color: var(--warning); }
.bento-value.red { color: var(--danger); }

.bento-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

.bento-badge {
  display: inline-flex;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  margin-top: 0.3rem;
}

.bento-badge.up { color: var(--success); background: var(--success-muted); }
.bento-badge.down { color: var(--danger); background: var(--danger-muted); }

/* ============================================================
   USAGE BARS
   ============================================================ */
.usage-label { display: flex; justify-content: space-between; margin-bottom: 0.4rem; }
.usage-name { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); }
.usage-count { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; color: var(--text-primary); }

.track {
  height: 6px;
  background: var(--bg-active);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill.teal { background: var(--accent-gradient); box-shadow: 0 0 8px var(--accent-glow); }
.fill.amber { background: linear-gradient(90deg, #f59e0b, #f97316); }
.fill.green { background: linear-gradient(90deg, #10b981, #059669); }
.fill.red { background: linear-gradient(90deg, #f43f5e, #e11d48); }

.usage-cta { font-size: 0.7rem; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.usage-cta:hover { color: var(--accent-hover); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  animation: fadeIn 0.4s ease-out 0.12s both;
}

.section-title { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }

.seg-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.seg-tab {
  padding: 0.35rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.seg-tab.active { background: var(--accent-muted); color: var(--accent); }
.seg-tab:hover:not(.active) { color: var(--text-secondary); }

/* ============================================================
   ITEM LIST / CARDS
   ============================================================ */
.items-list, .card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: fadeIn 0.4s ease-out 0.18s both;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.item-row:last-child { border-bottom: none; }

.item-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s;
}

.item-row:hover { background: var(--bg-hover); }
.item-row:hover::before { opacity: 1; }

.item-thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--bg-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
}

.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

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

.item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 0;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-active);
  border-radius: 4px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  display: inline-block;
  vertical-align: middle;
}

.price-col { text-align: right; flex-shrink: 0; min-width: 110px; }

.price-main {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.price-delta { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; }
.price-delta.drop { color: var(--success); }
.price-delta.rise { color: var(--danger); }

.price-merchant { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

.badge-lowest {
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: var(--warning-muted);
  color: var(--warning);
  margin-top: 0.15rem;
}

.watch-eye {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

.watch-eye:hover { color: var(--accent); border-color: var(--accent); }
.watch-eye.active { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }

/* ============================================================
   FAB
   ============================================================ */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.25s;
  z-index: 40;
  text-decoration: none;
}

.fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 600px;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group textarea { min-height: 120px; resize: none; }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-messages { margin-bottom: 1rem; }

.flash {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease-out;
}

.flash-success { background: var(--success-muted); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.flash-error { background: var(--danger-muted); color: var(--danger); border: 1px solid rgba(244,63,94,0.2); }
.flash-info, .flash-warning { background: var(--warning-muted); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: 0.7; }
.flash-close:hover { opacity: 1; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.active { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  animation: modalIn 0.25s ease-out;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

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

/* ============================================================
   TABLES
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
}

.data-table td { font-size: 0.85rem; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES & ALERTS
   ============================================================ */
.badge {
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  text-transform: uppercase;
}

.badge-success { background: var(--success-muted); color: var(--success); }
.badge-warning { background: var(--warning-muted); color: var(--warning); }
.badge-danger { background: var(--danger-muted); color: var(--danger); }
.badge-info { background: var(--accent-muted); color: var(--accent); }

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.alert-info { background: var(--accent-muted); border: 1px solid rgba(14,165,233,0.2); color: var(--accent); }
.alert-success { background: var(--success-muted); border: 1px solid rgba(16,185,129,0.2); color: var(--success); }
.alert-warning { background: var(--warning-muted); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); }
.alert-danger { background: var(--danger-muted); border: 1px solid rgba(244,63,94,0.2); color: var(--danger); }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.85rem; margin-bottom: 1.25rem; }

/* ============================================================
   CARD STYLES
   ============================================================ */
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 0.9rem; font-weight: 700; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-subtle); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .brand-mark { width: 48px; height: 48px; font-size: 1.5rem; margin: 0 auto 0.75rem; }
.auth-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.85rem; }
.auth-links { text-align: center; margin-top: 1.5rem; font-size: 0.82rem; color: var(--text-tertiary); }
.auth-links a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-links a:hover { color: var(--accent-hover); }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.settings-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); }
.settings-header h3 { font-size: 0.9rem; font-weight: 700; }
.settings-body { padding: 1.25rem; }

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 0.85rem; font-weight: 500; }
.settings-value { font-size: 0.82rem; color: var(--text-tertiary); }

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-active);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--accent-gradient); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   THEME SELECTOR
   ============================================================ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.theme-option {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.theme-option:hover { border-color: var(--border-hover); }
.theme-option.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }

.theme-preview {
  height: 60px;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.theme-option[data-theme="midnight"] .theme-preview { background: linear-gradient(135deg, #0a0f14 0%, #0ea5e9 100%); }
.theme-option[data-theme="terminal"] .theme-preview { background: linear-gradient(135deg, #000000 0%, #22c55e 100%); }
.theme-option[data-theme="radar"] .theme-preview { background: linear-gradient(135deg, #020a0f 0%, #22c55e 100%); }

.theme-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.theme-desc { font-size: 0.72rem; color: var(--text-muted); }

.mode-toggle { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem; }

.mode-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.mode-btn.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1.5rem; }

.pagination a, .pagination span {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.pagination a {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.pagination a:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }
.pagination .active { background: var(--accent-muted); border: 1px solid var(--accent); color: var(--accent); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .bento { grid-template-columns: repeat(6, 1fr); }
  .bento-stat { grid-column: span 3; }
  .bento-usage { grid-column: span 6; }
}

@media (max-width: 768px) {
  .topnav-inner { padding: 0 1rem; }
  .nav-links { display: none; }
  .content { padding: 1.25rem 1rem 4rem; }
  
  .welcome-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
  }
  
  .welcome-card h1 { font-size: 1.25rem; }
  
  .bento { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .bento-stat { grid-column: span 1; }
  .bento-usage { grid-column: span 2; }
  .bento-wide { grid-column: span 2; }
  
  .item-row { flex-wrap: wrap; gap: 0.75rem; }
  
  .price-col {
    order: 3;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: calc(36px + 0.5rem);
    padding-top: 0;
  }
  
  .fab { bottom: 1rem; right: 1rem; width: 46px; height: 46px; }
  .modal { max-width: calc(100% - 2rem); }
  .theme-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .bento { grid-template-columns: 1fr; }
  .bento-stat, .bento-usage, .bento-wide { grid-column: span 1; }
  .auth-card { padding: 1.75rem; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

/* Mobile safe area */
@supports (padding: env(safe-area-inset-bottom)) {
  .fab { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

/* Prevent iOS zoom */
input, select, textarea, button { font-size: 16px; }
button, a.btn, .nav-btn, .nav-link { min-height: 44px; min-width: 44px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* Print & reduced motion */
@media print {
  .topnav, .fab, .modal-backdrop { display: none !important; }
  body { background: white !important; color: black !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
# [paste the contents of item-cards.css here]
# [paste contents of group-page.css]
# [paste contents of group-page.css]

/* ============================================================
   GROUP PAGE & ITEM CARDS - V3 COMPLETE STYLES
   ============================================================ */

/* === PAGE LAYOUT === */
.group-container {
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-title-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-icon {
  font-size: 1.5rem;
}

.page-title-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* === DISPLAY MODE CARD === */
.display-mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.display-mode-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.toggle-buttons {
  display: flex;
  gap: 0.5rem;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  background: var(--bg-hover);
}

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

.toggle-btn svg {
  opacity: 0.7;
}

.toggle-btn.active svg {
  opacity: 1;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.sort-controls label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.sort-select {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* === SCRAPE STATUS === */
.scrape-status-container {
  margin-bottom: 1rem;
}

/* === ITEMS GRID === */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* === ITEM CARD SIMPLE === */
.item-card-simple {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.item-card-simple:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.item-card-simple::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s;
}

.item-card-simple:hover::before {
  opacity: 1;
}

.item-card-content {
  padding: 1rem;
  position: relative;
}

/* Remove Button */
.item-remove {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 5;
}

.item-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-muted);
}

/* Favorite Star */
.fav-star {
  position: absolute;
  top: 0.5rem;
  left: 2.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 5;
}

.fav-star:hover {
  border-color: var(--warning);
  color: var(--warning);
}

.fav-star-active,
.fav-star.fav-star-active {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-muted);
}

/* Item Image */
.item-image {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Item Title */
.item-title {
  margin-bottom: 0.5rem;
}

.item-title h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* Price Badge */
.item-price-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.price-amount {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stock-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.stock-in {
  background: var(--success-muted);
  color: var(--success);
}

.stock-out {
  background: var(--danger-muted);
  color: var(--danger);
}

/* Merchant Mini */
.item-merchant-mini {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.item-merchant-mini small {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Price Change Badges */
.price-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  margin-right: 0.5rem;
}

.price-drop-badge {
  background: var(--success-muted);
  color: var(--success);
}

.price-rise-badge {
  background: var(--danger-muted);
  color: var(--danger);
}

/* Lowest Ever Badge */
.lowest-ever-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--warning-muted);
  color: var(--warning);
  margin-bottom: 0.5rem;
}

/* Status Pending */
.status-pending {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* Card Footer Row */
.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* Recommendation Badge */
.card-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.rec-buy {
  background: var(--success-muted);
  color: var(--success);
}

.rec-good {
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent);
}

.rec-watch {
  background: var(--warning-muted);
  color: var(--warning);
}

.rec-wait {
  background: var(--danger-muted);
  color: var(--danger);
}

.rec-stable {
  background: var(--bg-active);
  color: var(--text-secondary);
}

/* Stock Watch Badge */
.stock-watch-badge {
  font-size: 0.85rem;
}

/* Compare Button */
.card-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}

.card-compare-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* Text Accent */
.text-accent {
  color: var(--accent);
}

/* === GROUPED MODE CARDS === */
.item-card-grouped {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
}

.item-card-grouped:hover {
  border-color: var(--border-hover);
}

.grouped-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  position: relative;
}

.grouped-card-header .item-remove {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
}

.grouped-card-header .fav-star {
  position: absolute;
  top: 0.5rem;
  left: 2.5rem;
}

.grouped-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grouped-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.grouped-title {
  flex: 1;
  min-width: 0;
  padding-top: 0.25rem;
}

.grouped-title h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
}

/* Grouped Merchants */
.grouped-merchants {
  padding: 0 1rem 1rem;
}

.merchants-header {
  margin-bottom: 0.5rem;
}

.merchants-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.merchants-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.merchant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.merchant-row.out-of-stock {
  opacity: 0.6;
}

.merchant-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.merchant-name {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-badge-mini {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.merchant-price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

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

.merchant-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text-tertiary);
  transition: all 0.15s;
}

.merchant-link:hover {
  color: var(--accent);
  background: var(--accent-muted);
}

.merchant-link svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Best Price Banner */
.best-price-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem;
  margin-top: 0.5rem;
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.best-price-banner svg {
  color: var(--warning);
}

/* No Merchants */
.no-merchants {
  padding: 1rem;
  text-align: center;
}

/* === MODAL OVERLAY === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[style*="flex"] {
  display: flex;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-state p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-actions {
    width: 100%;
  }
  
  .header-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.5rem;
  }
  
  .display-mode-toggle {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .sort-controls {
    margin-left: 0;
    width: 100%;
  }
  
  .sort-select {
    flex: 1;
  }
  
  .items-grid {
    grid-template-columns: 1fr;
  }
  
  .grouped-card-header {
    padding-top: 2.5rem;
  }
}

@media (max-width: 480px) {
  .toggle-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .toggle-btn {
    width: 100%;
    justify-content: center;
  }
  
  .item-image {
    height: 150px;
  }
}

/* ============================================================
   GROUP SECTIONS (Dashboard By Group view)
   ============================================================ */
.group-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-subtle);
}

.group-header:hover {
  background: var(--bg-hover);
}

.group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.group-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.group-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.group-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.group-items {
  padding: 0;
}

.group-items .item-row {
  border-bottom: 1px solid var(--border-subtle);
  margin: 0;
}

.group-items .item-row:last-child {
  border-bottom: none;
}

/* Group collapsed state - hide bottom border on header */
.group-section .group-header:only-child,
.group-items[style*="display: none"] + .group-header,
.group-header:has(+ .group-items[style*="none"]) {
  border-bottom: none;
}
.group-section:has(.group-items[style*="none"]) .group-header {
  border-bottom: none;
}

/* Enhanced group styling - matching Recent view */
.group-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0;
  overflow: hidden;
}

.group-section + .group-section {
  border-top: none;
  border-radius: 0;
}

.group-section:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.group-section:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.group-section:only-child {
  border-radius: var(--radius-lg);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-subtle);
}

.group-header:hover {
  background: var(--bg-hover);
}

/* When collapsed, remove bottom border */
.group-section:has(.group-items[style*="none"]) .group-header {
  border-bottom: none;
}

.group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.group-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Accent button style for Open */
.group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent-gradient);
  color: white;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.group-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.group-items {
  padding: 0;
  background: var(--bg-surface);
}

.group-items .item-row {
  border-bottom: 1px solid var(--border-subtle);
  margin: 0;
  padding-left: 1.25rem;
}

.group-items .item-row:last-child {
  border-bottom: none;
}

/* ============================================================
   BRAND: FLAMING TRACKER
   ============================================================ */
.brand-text {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Ember theme: fire-colored brand highlight */
[data-theme^="ember"] .brand-highlight {
  background: var(--ember-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme^="ember"] .brand-mark {
  background: var(--ember-gradient);
  box-shadow: 0 0 20px var(--ember-glow);
  font-size: 1rem;
}

/* ============================================================
   🔥 FLAMING PANEL - UNIFIED NAVBAR OVERRIDE
   Forces navbar to match hosting.minikiller.xyz regardless of theme
   ============================================================ */
.topnav {
  background: rgba(255,255,255,0.02) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}
.topnav-inner {
  max-width: 1280px !important;
  height: 58px !important;
  padding: 0 1.5rem !important;
  gap: 1.5rem !important;
}
.topnav .brand {
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: 1.125rem !important;
  color: #fff !important;
  gap: 0.5rem !important;
  letter-spacing: 0 !important;
}
.topnav .brand svg,
.topnav .brand .brand-flame {
  width: 28px !important;
  height: 28px !important;
}
.topnav .brand-text {
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: 0 !important;
}
.topnav .brand-highlight,
[data-theme] .topnav .brand-highlight {
  color: #f97316 !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: #f97316 !important;
  background-clip: unset !important;
}
.topnav .nav-links {
  gap: 0.125rem !important;
}
.topnav .nav-link {
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  color: #6b7280 !important;
  background: transparent !important;
}
.topnav .nav-link:hover {
  color: #d1d5db !important;
  background: rgba(255,255,255,0.05) !important;
}
.topnav .nav-link.active {
  color: #f97316 !important;
  background: rgba(249,115,22,0.1) !important;
}
.topnav .nav-right {
  gap: 0.75rem !important;
}
.topnav .plan-chip {
  font-size: 0.65rem !important;
  font-weight: 600 !important;
  padding: 0.25rem 0.625rem !important;
  background: rgba(249,115,22,0.15) !important;
  color: #f97316 !important;
  box-shadow: none !important;
}
.topnav .nav-btn {
  width: auto !important;
  height: auto !important;
  padding: 0.375rem !important;
  border-radius: 0.5rem !important;
  color: #6b7280 !important;
  background: transparent !important;
  border: none !important;
}
.topnav .nav-btn:hover {
  color: #d1d5db !important;
  background: rgba(255,255,255,0.05) !important;
  border: none !important;
}
.topnav .avatar {
  width: 28px !important;
  height: 28px !important;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%) !important;
  font-weight: 500 !important;
  font-size: 0.75rem !important;
  box-shadow: none !important;
}

/* Scrape progress bar shimmer animation */
.fill.scrape-active {
  position: relative;
  overflow: hidden;
}
.fill.scrape-active::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  animation: scrape-shimmer 3s ease-in-out infinite;
}
@keyframes scrape-shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}


/* ============================================================
   MOBILE RESPONSIVE V2
   ============================================================ */

/* --- Fix horizontal overflow globally --- */
.bento-card, .welcome-card, .card {
  overflow: hidden;
  word-break: break-word;
}



/* --- Mobile Bottom Nav --- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 0.3rem 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 0.6rem;
  font-weight: 500;
  transition: color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

/* --- More Sheet (slide-up) --- */
.more-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.more-sheet-backdrop.show {
  display: block;
  opacity: 1;
}

.more-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  max-height: 75vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.more-sheet.show {
  transform: translateY(0);
}

.more-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 0.6rem 0 0.3rem;
}

.more-sheet-handle::after {
  content: '';
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.more-sheet-items {
  padding: 0.25rem 0.75rem 1rem;
}

.more-sheet-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}

.more-sheet-item:hover, .more-sheet-item:active {
  background: var(--bg-hover);
}

.more-sheet-item.active {
  color: var(--accent);
}

.more-sheet-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.more-sheet-item span.more-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.more-sheet-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.25rem 0.85rem;
}

/* --- PWA Install Banner --- */
.pwa-install-banner {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--accent-muted);
  border-bottom: 1px solid var(--accent);
  font-size: 0.78rem;
  color: var(--text-primary);
}

.pwa-install-banner.show { display: flex; }
.pwa-install-text { flex: 1; }
.pwa-install-text strong { font-weight: 600; }

.pwa-install-btn {
  padding: 0.35rem 0.85rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.pwa-install-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  line-height: 1;
}

/* ============================================================
   MOBILE OVERRIDES (max 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Show mobile bottom nav, hide desktop nav links */
  .mobile-nav { display: block; }
  .nav-links { display: none; }

  /* Hide entire nav-right on mobile - plan chip shown separately */
  .nav-right { display: none !important; }

  /* Tighter topnav */
  .topnav-inner { height: 46px; padding: 0 0.75rem; gap: 0.5rem; }
  .brand { font-size: 0.95rem; gap: 0.4rem; }
  .brand-mark { width: 24px; height: 24px; font-size: 0.7rem; }
  .nav-right { gap: 0.4rem; }
  .nav-btn { min-height: 34px; min-width: 34px; width: 34px; height: 34px; }
  .nav-btn svg { width: 16px; height: 16px; }

  /* Content with bottom nav space */
  .content { padding: 0.75rem 0.65rem 5rem !important; }

  /* Welcome card */
  .welcome-card { padding: 0.85rem 1rem; margin-bottom: 0.75rem; }
  .welcome-card h1 { font-size: 1.05rem; }
  .welcome-card p { font-size: 0.75rem; }

  /* Bento - always 2 columns */
  .bento { gap: 0.5rem; margin-bottom: 0.65rem; grid-template-columns: 1fr 1fr !important; }
  .bento-stat { grid-column: span 1 !important; }
  .bento-usage { grid-column: span 1 !important; }
  .bento-wide { grid-column: span 2 !important; }
  .bento-full { grid-column: span 2 !important; }
  .bento-card { padding: 0.65rem 0.75rem; border-radius: var(--radius-md); }
  .bento-label { font-size: 0.6rem; margin-bottom: 0.2rem; }
  .bento-value { font-size: 1.2rem; }
  .bento-sub { font-size: 0.6rem; }

  /* Usage stat bars */
  .usage-label { font-size: 0.7rem; }
  .usage-value { font-size: 0.7rem; }

  /* Item rows */
  .items-list, .card { border-radius: var(--radius-md); }
  .item-row { padding: 0.6rem 0.7rem; gap: 0.5rem; }
  .item-thumb { width: 36px; height: 36px; border-radius: 6px; }
  .item-title { font-size: 0.78rem; }
  .item-meta { font-size: 0.6rem; gap: 0.3rem; flex-wrap: wrap; }
  .chip { font-size: 0.55rem; padding: 0.05rem 0.3rem; }

  /* Price column */
  .price-col { min-width: auto; }
  .price-main { font-size: 0.82rem; }
  .price-delta { font-size: 0.58rem; }
  .badge-lowest { font-size: 0.52rem; padding: 0.08rem 0.25rem; }

  /* Item actions */
  .item-actions { margin-right: 0 !important; }
  .item-actions .watch-eye { width: 26px; height: 26px; font-size: 0.8rem; }

  /* Section heads */
  .section-head { margin: 0.65rem 0 0.4rem; }
  .section-title { font-size: 0.8rem; }

  /* Buttons */
  .btn { padding: 0.4rem 0.65rem; font-size: 0.72rem; min-height: 36px; }
  .btn-accent { padding: 0.4rem 0.8rem; }
  .header-actions { gap: 0.35rem; flex-wrap: wrap; }
  .header-actions .btn { font-size: 0.68rem; padding: 0.35rem 0.5rem; min-height: 32px; }

  /* FAB above bottom nav */
  .fab { width: 42px; height: 42px; bottom: 4.5rem; right: 0.75rem; font-size: 1.2rem; }

  /* Widget cards */
  .widget-grid { grid-template-columns: 1fr !important; gap: 0.5rem !important; }

  /* Modals */
  .modal-backdrop { padding: 0.5rem; }
  .modal { max-width: 100%; border-radius: var(--radius-lg); }
  .modal-body { padding: 1rem; }
  .modal-header { padding: 0.75rem 1rem; }

  /* Detail modal */
  .detail-modal { max-width: 100% !important; max-height: 95vh !important; border-radius: var(--radius-lg) !important; }
  .dm-body { padding: 0 0.8rem 0.8rem !important; }
  .dm-hero { flex-direction: column !important; align-items: center !important; text-align: center !important; }
  .dm-image { width: 90px !important; height: 90px !important; margin: 0 auto !important; }
  .dm-title { font-size: 0.92rem !important; }
  .dm-price-amount { font-size: 1.4rem !important; }
  .dm-price-card { padding: 0.7rem !important; }
  .dm-tabs { gap: 0 !important; }
  .dm-tab { font-size: 0.7rem !important; padding: 0.45rem 0.55rem !important; }
  .dm-actions-mini { flex-wrap: wrap !important; gap: 0.3rem !important; }
  .dm-action-btn { font-size: 0.7rem !important; padding: 0.4rem 0.6rem !important; flex: 1; min-width: 75px; text-align: center; justify-content: center; }

  /* Seg tabs */
  .seg-tabs { gap: 0.2rem; }
  .seg-tab { font-size: 0.68rem; padding: 0.3rem 0.55rem; }

  /* Theme grid */
  .theme-grid { grid-template-columns: 1fr !important; }

  /* Empty state */
  .empty-state { padding: 2rem 1rem; }

  /* Push card */
  #push-settings-card { padding: 0.55rem 0.7rem !important; }
}

/* Extra small phones (<380px) */
@media (max-width: 380px) {
  .topnav-inner { padding: 0 0.5rem; }
  .brand-text { font-size: 0.85rem; }
  .content { padding: 0.5rem 0.45rem 5rem !important; }
  .bento-card { padding: 0.5rem 0.6rem; }
  .bento-value { font-size: 1rem; }
  .item-row { padding: 0.5rem 0.55rem; gap: 0.5rem; }
  .item-thumb { width: 30px; height: 30px; }
  .price-col { min-width: 65px; }
  .price-main { font-size: 0.75rem; }
}

/* Override old 480px single-column */
@media (max-width: 480px) {
  .bento { grid-template-columns: 1fr 1fr !important; }
  .bento-stat { grid-column: span 1 !important; }
  .bento-usage { grid-column: span 1 !important; }
}


/* Mobile modal + chip fixes */
@media (max-width: 768px) {
  .modal-overlay { padding-bottom: 4.5rem; }
  .detail-modal { margin-bottom: 0.5rem; }

  .chip { max-width: 100px; font-size: 0.52rem; }
  
  .item-meta { min-width: 0; }



  /* Plan chip in top bar - small version */
  .mobile-plan-chip {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    text-decoration: none;
    background: var(--accent-muted);
    color: var(--accent);
    letter-spacing: 0.03em;
  }
}
