/* ==========================================================================
   app.css — unified design system for the Pokemon Restock community app
   Replaces: auth.css, dashboard.css (for new pages)
   Old files kept for index.html / dashboard.js compatibility.
   ========================================================================== */

/* ── CSS Variables ───────────────────────────────────────────────────────── */

:root {
  /* Rich dark palette — layered, not flat */
  --bg:            #0d0f14;
  --surface:       #161b24;
  --surface-2:     #1e2530;
  --surface-3:     #252d3a;
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  /* Typography */
  --text:    #f0f2f5;
  --text-2:  #c8cdd6;
  --muted:   #8892a4;
  --muted-2: #6b7485;

  /* Brand — vibrant orange */
  --accent:      #f97316;
  --accent-dim:  rgba(249,115,22,0.15);
  --accent-glow: rgba(249,115,22,0.30);

  /* Legacy aliases kept for backward compat */
  --accent-2: #ffb06b;
  --accent-soft: rgba(249,115,22,0.12);
  --good: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
  --text-muted: #8892a4; /* alias for --muted, used by some components */

  /* Status */
  --status-queue:       #f59e0b;
  --status-queue-bg:    rgba(245,158,11,0.15);
  --status-restock:     #3b82f6;
  --status-restock-bg:  rgba(59,130,246,0.15);
  --status-stock:       #22c55e;
  --status-stock-bg:    rgba(34,197,94,0.15);
  --status-soldout:     #ef4444;
  --status-soldout-bg:  rgba(239,68,68,0.15);

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.45);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.55);
  --shadow-lg: 0 8px 36px rgba(0,0,0,0.65);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);

  /* Tier colors */
  --tier-lurker: #6b7280;
  --tier-spotter: #3b82f6;
  --tier-scout: #8b5cf6;
  --tier-ranger: #f59e0b;

  /* Layout tokens */
  --tab-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);

  /* Font */
  --font: -apple-system, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

html {
  /* Prevent iOS from auto-scaling text in landscape */
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  /* Push content below the notch / Dynamic Island */
  padding-top: env(safe-area-inset-top);
  /* Reserve space for bottom tab bar + safe area */
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }

/* ── Bottom Tab Bar ──────────────────────────────────────────────────────── */

#app-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  z-index: 100;
  /* Elevated shadow to feel like a floating bar */
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 64px;
  height: var(--tab-height);
  padding: 10px 8px 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: none;
  border-top: 2px solid transparent;
  background: transparent;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, opacity 0.15s;
  flex: 1;
  opacity: 0.5;
}

.tab-item:hover { color: var(--text); opacity: 0.8; }

.tab-item.active {
  color: var(--accent);
  border-top-color: var(--accent);
  opacity: 1;
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
  display: block;
}

.tab-label {
  font-size: 11px;
  font-weight: 500;
  display: block;
  letter-spacing: 0.02em;
}

/* Center Report button — elevated orange circle */
.tab-item.tab-report {
  position: relative;
  top: -14px;
}

.tab-item.tab-report .tab-icon-circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #e8621a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 6px 24px rgba(255, 122, 26, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-bottom: 4px;
}

.tab-item.tab-report:hover .tab-icon-circle {
  background: #ff8f38;
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(255, 122, 26, 0.6);
}

.tab-item.tab-report:active .tab-icon-circle {
  transform: scale(0.95);
}

.tab-item.tab-report .tab-label { color: var(--muted); }
.tab-item.tab-report.active .tab-label { color: var(--accent); }

/* ── Card styles ─────────────────────────────────────────────────────────── */

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s;
}

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

/* Left edge heat indicator */
.app-card.heat-hot  { border-left: 4px solid var(--accent); }
.app-card.heat-warm { border-left: 4px solid var(--warn); }
.app-card.heat-cold { border-left: 4px solid var(--muted-2); }

/* ── Intel Cards ─────────────────────────────────────────────────────────── */

.intel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s, transform 0.1s ease, box-shadow 0.1s ease;
  position: relative;
  overflow: hidden;
}
.intel-card:hover { border-color: var(--border-strong); }
.intel-card:active { transform: scale(0.98); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.intel-card.heat-hot  { border-left: 4px solid var(--accent); }
.intel-card.heat-warm { border-left: 4px solid var(--warn); }
.intel-card.heat-cold { border-left: 4px solid var(--muted-2); }
.intel-card.blurred-card { border-color: rgba(255,255,255,0.06); }

/* Card header row */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.card-chain {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-time-ago {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.card-neighborhood {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Product chips inside a card */
.card-products {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.product-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 122, 26, 0.3);
  border-radius: 999px;
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 500;
  white-space: nowrap;
}

/* Line count row */
.card-line-count {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Card note */
.card-note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 6px;
}

/* Actions row */
.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  min-height: 34px;
}
.action-btn:hover { color: var(--text); border-color: var(--border-strong); }
.action-btn.voted-up   { color: var(--good); border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.08); }
.action-btn.voted-down { color: var(--bad);  border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }

.flag-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-2);
  font-size: 14px;
  cursor: pointer;
  min-height: 34px;
  transition: color 0.15s;
}
.flag-btn:hover { color: var(--bad); }
.flag-confirm {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.flag-confirm a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.flag-confirm a:hover { text-decoration: underline; }

.actions-spacer { flex: 1; }
.card-expiry {
  font-size: 11px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-expiry.expiring-soon { color: var(--warn); }

/* Blur overlay for locked content */
.blurred-text {
  filter: blur(5px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  padding: 0 2px;
  display: inline-block;
}

.unlock-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
  font-weight: 500;
}
.unlock-cta:hover { text-decoration: underline; }

/* Line count update prompt (slides in below actions) */
.line-update-prompt {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
  animation: slide-down 0.2s ease;
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.line-prompt-label { color: var(--muted); margin-bottom: 8px; }
.line-prompt-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.line-prompt-chip {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  min-height: 32px;
  transition: all 0.15s;
  font-family: inherit;
}
.line-prompt-chip:hover { color: var(--text); border-color: var(--border-strong); }
.line-prompt-chip.selected {
  background: var(--accent-soft);
  border-color: rgba(255,122,26,0.5);
  color: var(--accent);
  font-weight: 600;
}
.line-prompt-actions { display: flex; gap: 8px; }
.line-prompt-skip {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  min-height: 34px;
}
.line-prompt-skip:hover { color: var(--text); }
.line-prompt-submit {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 34px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.line-prompt-submit.ready { opacity: 1; }

/* ── Location Banner ──────────────────────────────────────────────────────── */

.location-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 122, 26, 0.08);
  border: 1px solid rgba(255, 122, 26, 0.25);
  border-radius: var(--radius-sm);
  margin: 8px 16px;
  font-size: 13px;
  color: var(--text);
  gap: 10px;
}
.location-banner-text { flex: 1; min-width: 0; }
.location-banner-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.location-banner-link:hover { text-decoration: underline; }

/* ── Chain Filter Chips ──────────────────────────────────────────────────── */

.chain-filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 20;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chain-filter-bar::-webkit-scrollbar { display: none; }
.chain-filter-inner {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  width: max-content;
  min-width: 100%;
}

.chain-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  transition: all 0.15s ease;
  font-family: inherit;
}
.chain-chip:hover { color: var(--text); border-color: var(--border-strong); }
.chain-chip.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* ── Section Headers ──────────────────────────────────────────────────────── */

.section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 16px 4px;
}

/* ── Feed Layout ─────────────────────────────────────────────────────────── */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 16px 16px;
  max-width: 640px;
  margin: 0 auto;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; margin-bottom: 20px; line-height: 1.6; }

/* ── Chip styles (product selection) ─────────────────────────────────────── */

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

.select-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: -0.005em;
}
.select-chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.select-chip.selected {
  background: var(--accent-soft);
  border-color: rgba(255, 122, 26, 0.5);
  color: var(--accent);
  font-weight: 600;
}

/* ── Form styles ─────────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--muted-2);
}

.form-input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  min-height: 48px;
  transition: all 0.15s ease;
  -webkit-appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.15);
}
.form-input::placeholder { color: var(--muted-2); }
.form-input.error { border-color: var(--bad); }

.form-error {
  font-size: 12px;
  color: var(--bad);
  margin-top: 4px;
}

.form-textarea {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  resize: vertical;
  min-height: 80px;
  transition: all 0.15s ease;
  -webkit-appearance: none;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.15);
}
.form-textarea::placeholder { color: var(--muted-2); }

.char-counter {
  font-size: 11px;
  color: var(--muted-2);
  text-align: right;
  margin-top: 3px;
}
.char-counter.over { color: var(--bad); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.98); opacity: 0.8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e8621a);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 122, 26, 0.3);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #ff8f38, #d95510); box-shadow: 0 6px 16px rgba(255, 122, 26, 0.4); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #e8621a);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 122, 26, 0.3);
}
.btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, #ff8f38, #d95510); box-shadow: 0 6px 16px rgba(255, 122, 26, 0.4); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  min-height: 44px;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  min-height: 44px;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }

.btn-danger {
  background: transparent;
  color: var(--bad);
  border: 1px solid rgba(248, 113, 113, 0.4);
  min-height: 44px;
}
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.08); }

.btn + .btn { margin-top: 10px; }

/* Inline width variant */
.btn-auto { display: inline-flex; width: auto; align-items: center; justify-content: center; }

/* ── Messages / Alerts ───────────────────────────────────────────────────── */

.msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  line-height: 1.5;
}
.msg.visible { display: block; }
.msg.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--bad);
}
.msg.success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--good);
}
.msg.warn {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.3);
  color: var(--warn);
}

/* ── Toast notifications ─────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: var(--surface-3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
  font-weight: 600;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: #22c55e; color: #22c55e; }
.toast.error   { border-color: #ef4444; color: #ef4444; }

/* ── Loading Skeletons ───────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skel-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
}
.skel-line.sm  { width: 35%; height: 12px; }
.skel-line.md  { width: 60%; height: 14px; }
.skel-line.lg  { width: 85%; height: 14px; }
.skel-line.xl  { width: 100%; height: 16px; }

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Tab switcher (login) ────────────────────────────────────────────────── */

.tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Or divider ──────────────────────────────────────────────────────────── */

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted-2);
  font-size: 12px;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Tier badges ─────────────────────────────────────────────────────────── */

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tier-badge.lurker  { background: rgba(107,114,128,0.18); color: var(--tier-lurker);  border: 1px solid rgba(107,114,128,0.35); }
.tier-badge.spotter { background: rgba(59,130,246,0.18);  color: var(--tier-spotter); border: 1px solid rgba(59,130,246,0.4); }
.tier-badge.scout   { background: rgba(139,92,246,0.18);  color: var(--tier-scout);   border: 1px solid rgba(139,92,246,0.4); }
.tier-badge.ranger  { background: rgba(245,158,11,0.18);  color: var(--tier-ranger);  border: 1px solid rgba(245,158,11,0.45); box-shadow: 0 0 8px rgba(245,158,11,0.2); }

/* ── Profile styles ──────────────────────────────────────────────────────── */

.page-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 20px;
}

.profile-card { /* .app-card subtype */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.profile-avatar.spotter { border-color: var(--tier-spotter); background: rgba(59,130,246,0.12); color: var(--tier-spotter); }
.profile-avatar.scout   { border-color: var(--tier-scout);   background: rgba(139,92,246,0.12); color: var(--tier-scout); }
.profile-avatar.ranger  { border-color: var(--tier-ranger);  background: rgba(245,158,11,0.12); color: var(--tier-ranger); }

.profile-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.profile-name  { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.profile-email { font-size: 13px; color: var(--muted); margin-top: 2px; }

.points-big {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.points-unit { font-size: 16px; color: var(--muted); font-weight: 400; }

.progress-bar-wrap {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label { font-size: 12px; color: var(--muted); }

.tier-ladder { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.tier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
}
.tier-row.current {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.tier-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.tier-row-name  { font-size: 14px; font-weight: 600; flex: 1; }
.tier-row-range { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tier-current-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.stat-box {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.stat-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Collapsible card section */
.card-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  user-select: none;
  transition: background 0.12s;
}
.card-section-header:hover { background: var(--surface-2); }
.card-section-chevron { font-size: 11px; color: var(--muted-2); transition: transform 0.2s; }
.card-section-chevron.open { transform: rotate(180deg); }
.card-section-body { padding: 0 20px 20px; display: none; }
.card-section-body.open { display: block; }

/* ── Alert Preferences toggle switch ───────────────────────────── */
.ap-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.ap-toggle input { opacity: 0; width: 0; height: 0; }
.ap-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-3);
  border-radius: 28px;
  transition: .2s;
  border: 1px solid var(--border);
}
.ap-toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.ap-toggle input:checked + .ap-toggle-slider { background: var(--accent); border-color: var(--accent); }
.ap-toggle input:checked + .ap-toggle-slider:before { transform: translateX(20px); }

/* ── Alert Preferences store rows ──────────────────────────────── */
.ap-region-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 4px;
  cursor: pointer;
}
.ap-region-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ap-region-selall {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-family: inherit;
}
.ap-store-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.ap-store-row:hover { background: var(--surface-2); }
.ap-store-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .12s;
  font-size: 11px;
  color: #fff;
}
.ap-store-check.checked { background: var(--accent); border-color: var(--accent); }
.ap-store-name { font-size: 13px; color: var(--text); flex: 1; line-height: 1.3; }
.ap-store-area { font-size: 11px; color: var(--text-muted); }
.ap-chain-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}
.ap-chain-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Submit form specific ─────────────────────────────────────────────────── */

.submit-step {
  display: none;
  flex-direction: column;
  min-height: calc(100dvh - var(--tab-height) - var(--safe-bottom));
  max-width: 480px;
  margin: 0 auto;
}
.submit-step.active { display: flex; }

/* Screen A — locating */
.screen-locating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  padding: 40px 20px;
}
.locating-text { font-size: 18px; font-weight: 600; color: var(--text); }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Screen B — confirm store */
.screen-confirm {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 8px;
}
.confirm-prompt { font-size: 16px; color: var(--muted); margin-bottom: 8px; }
.confirm-store-icon { font-size: 40px; margin-bottom: 4px; }
.confirm-store-name { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.confirm-neighborhood { font-size: 15px; color: var(--muted); text-align: center; margin-bottom: 16px; }
.confirm-different { font-size: 14px; color: var(--muted); text-align: center; margin-top: 12px; }
.confirm-different a { color: var(--accent); text-decoration: none; cursor: pointer; }
.confirm-different a:hover { text-decoration: underline; }

/* Screen C — chain grid */
.screen-chain-grid {
  padding: 20px 16px;
}
.screen-chain-grid h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.screen-chain-grid p {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}
.chain-grid-cells {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.chain-grid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 86px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  padding: 14px;
  text-align: center;
  letter-spacing: -0.01em;
  font-family: inherit;
}
.chain-grid-cell:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chain-grid-cell:active { transform: scale(0.96); }
.chain-grid-emoji { font-size: 26px; margin-bottom: 6px; display: block; }

/* Screen C2 — store list */
.submit-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 10;
}
.submit-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  min-height: 40px;
  flex-shrink: 0;
}
.submit-back-btn:hover { color: var(--text); border-color: var(--border-strong); }
.submit-step-title-wrap { min-width: 0; }
.submit-step-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.submit-step-subtitle { font-size: 12px; color: var(--muted); margin-top: 1px; }

.store-search-wrap {
  padding: 10px 16px 4px;
  background: var(--bg);
  position: sticky;
  top: calc(61px + env(safe-area-inset-top));
  z-index: 9;
}
.store-search-input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  width: 100%;
  min-height: 44px;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.store-search-input:focus { outline: none; border-color: var(--accent); }
.store-search-input::placeholder { color: var(--muted-2); }

.store-list-rows { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.store-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  gap: 12px;
  min-height: 56px;
}
.store-row:hover { background: var(--surface-2); }
.store-row:active { background: var(--surface-3); }
.store-row-text { min-width: 0; flex: 1; }
.store-row-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-row-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.store-row-distance { font-size: 13px; color: var(--muted-2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.store-row-arrow { color: var(--muted-2); font-size: 14px; flex-shrink: 0; }

/* Screen D — products */
.products-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.product-preview {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 40px;
}
.product-preview .preview-label { color: var(--muted-2); font-size: 11px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.product-preview .preview-items { color: var(--accent-2); font-size: 13px; font-weight: 500; }

.when-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.when-btn {
  flex: 1;
  padding: 9px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.when-btn:hover { color: var(--text); }
.when-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

.submit-footer {
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}

/* Duplicate banner */
.duplicate-banner {
  background: rgba(250,204,21,0.08);
  border: 1px solid rgba(250,204,21,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--warn);
  display: none;
  margin: 0 0 12px;
}
.duplicate-banner.visible { display: block; }
.duplicate-banner a { color: var(--accent); text-decoration: underline; }

/* Screen E — success */
.screen-success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 8px;
}
.success-icon { font-size: 64px; margin-bottom: 8px; }
.success-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--good); }
.success-store { font-size: 16px; color: var(--muted); margin-top: 8px; }
.success-products { font-size: 15px; font-weight: 500; color: var(--text); margin-top: 4px; }
.success-points {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0;
}
.points-earned {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.scoop-bonus {
  font-size: 14px;
  color: var(--warn);
  background: rgba(250,204,21,0.08);
  border: 1px solid rgba(250,204,21,0.2);
  border-radius: 20px;
  padding: 4px 14px;
}
.success-ctas {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}
.success-ctas .btn { flex: 1; }

/* ── Login page ──────────────────────────────────────────────────────────── */

.login-wrap {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-mark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  box-shadow: 0 4px 20px rgba(255,122,26,0.4);
}
.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.login-logo p { font-size: 14px; color: var(--muted); margin: 0; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--card-shadow);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.google-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.google-g {
  font-size: 18px;
  font-weight: 700;
  /* Google color gradient on G */
  background: linear-gradient(135deg, #4285F4 0%, #34A853 33%, #FBBC05 66%, #EA4335 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ── Predictions / Forecast page ─────────────────────────────────────────── */

.forecast-header {
  padding: 16px 16px 8px;
  max-width: 640px;
  margin: 0 auto;
}
.forecast-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.forecast-subtitle { font-size: 13px; color: var(--muted); margin: 0; }

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 16px 16px;
  max-width: 640px;
  margin: 0 auto;
}
.forecast-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, transform 0.1s ease, box-shadow 0.1s ease;
}
.forecast-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.forecast-card:active { transform: scale(0.98); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }

.forecast-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.forecast-card-store { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.forecast-card-meta  { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.heat-bar {
  display: flex;
  gap: 5px;
}
.heat-day-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 36px;
}
.heat-day-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}
.heat-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  transition: transform 0.1s;
}
.heat-dot:hover { transform: scale(1.15); }
.heat-dot.hot  { background: rgb(220, 50, 50);  color: #fff; }
.heat-dot.warm { background: rgb(220, 180, 0);  color: #1a1200; }
.heat-dot.cold { background: #2a2d38;            color: var(--muted); }
.heat-score {
  font-size: 9px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.community-reports {
  margin-top: 10px;
  font-size: 12px;
  color: var(--good);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Page status / loading ────────────────────────────────────────────────── */

.page-status {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Mobile refinements ──────────────────────────────────────────────────── */

@media (max-width: 540px) {
  body { font-size: 14px; }
  .login-wrap { padding: 24px 16px 80px; }
  .login-card { padding: 20px 16px; border-radius: var(--radius-md); }
  .chain-grid-cells { grid-template-columns: 1fr 1fr; gap: 8px; }
  .chain-grid-cell { min-height: 76px; padding: 12px; font-size: 14px; }
  .heat-day-wrap { min-width: 30px; }
  .heat-dot { width: 24px; height: 24px; font-size: 9px; }
}

/* ── Status badges (intel feed cards) ───────────────────────────────────────── */

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-in-stock   { background: rgba(74,222,128,0.18);  color: #4ade80; border: 1px solid rgba(74,222,128,0.35); }
.status-queue      { background: rgba(250,204,21,0.18);  color: #facc15; border: 1px solid rgba(250,204,21,0.35); }
.status-restocking { background: rgba(255,122,26,0.18);  color: #ff7a1a; border: 1px solid rgba(255,122,26,0.4); }
.status-sold-out   { background: rgba(107,114,128,0.15); color: #9ca3af; border: 1px solid rgba(107,114,128,0.3); }
.status-no-stock   { background: rgba(239,68,68,0.12);   color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* ── Community Intel badge (facebook-sourced) ────────────────────────────── */

.community-intel-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(99, 179, 237, 0.15);
  color: #63b3ed;
  border: 1px solid rgba(99, 179, 237, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Edit button (owner quick actions) ───────────────────────────────────── */

.card-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.card-edit-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

/* ── Quick-action bottom sheet ───────────────────────────────────────────── */

.action-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.action-sheet-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 301;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 640px;
  margin: 0 auto;
}
.action-sheet.visible { transform: translateY(0); }

.action-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 4px auto 12px;
}

.action-sheet-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 52px;
}
.action-sheet-btn:hover { background: var(--surface-2); }
.action-sheet-btn:active { background: var(--surface-3); }
.action-sheet-btn.cancel { color: var(--muted); }
.action-sheet-btn.destructive { color: var(--bad); }

.action-sheet-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Edit note textarea inside action sheet */
.action-sheet-note-area {
  padding: 0 20px 12px;
}
.action-sheet-note-textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.action-sheet-note-textarea:focus { outline: none; border-color: var(--accent); }
.action-sheet-note-save {
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  min-height: 44px;
}

/* ── Intel photo on cards ─────────────────────────────────────────────────── */

.intel-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
  display: block;
}

/* ── Lightbox (fullscreen photo) ─────────────────────────────────────────── */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  pointer-events: none;
}

/* ── Freeform note (below status badge) ──────────────────────────────────── */

.intel-freeform-note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  cursor: pointer;
  line-height: 1.5;
  transition: all 0.15s;
}
.intel-freeform-note.expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* ── Sold-out card opacity ────────────────────────────────────────────────── */

.intel-card.sold-out-card { opacity: 0.7; }

/* ── Card animations ─────────────────────────────────────────────────────── */
@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-enter {
  animation: cardSlideUp 0.22s ease forwards;
}

/* ── Status badge overrides ──────────────────────────────────────────────── */
.status-in_stock, .status-restocking {
  background: var(--status-stock-bg) !important;
  color: var(--status-stock) !important;
}
.status-queue_forming, .status-queue-forming {
  background: var(--status-queue-bg) !important;
  color: var(--status-queue) !important;
}
.status-sold_out, .status-sold-out {
  background: var(--status-soldout-bg) !important;
  color: var(--status-soldout) !important;
}
.status-no_stock, .status-no-stock {
  background: rgba(239,68,68,0.12) !important;
  color: #ef4444 !important;
}

/* ── Input focus glow ────────────────────────────────────────────────────── */
input:focus, textarea:focus, select:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Button active press ─────────────────────────────────────────────────── */
button:active:not(:disabled) {
  transform: scale(0.96);
}
