:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --brand: #0f766e;
  --brand-soft: #ecfdf5;
  --danger: #b91c1c;
  --radius-lg: 16px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
}

:root.dark {
  --bg: #020617;
  --bg-card: #020617;
  --bg-muted: #020617;
  --border: #1f2937;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --brand-soft: #022c22;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e0f2fe 0, var(--bg) 40%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-title {
  font-size: 14px;
  font-weight: 600;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.nav-link:hover {
  border-color: var(--border);
  color: var(--text);
}

.nav-link.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.theme-toggle {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

/* Main */

.main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.hero {
  text-align: left;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 620px;
}

.search-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-container {
  flex: 1 1 260px;
  display: flex;
  gap: 8px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  outline: none;
}

.search-input:focus {
  border-color: var(--brand);
}

.search-button {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.search-button:hover {
  opacity: 0.95;
}

.zip-container {
  display: flex;
  gap: 6px;
  align-items: center;
}

.zip-input {
  width: 90px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  outline: none;
}

.zip-input:focus {
  border-color: var(--brand);
}

.state-select {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  outline: none;
}

.search-options {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Pills */

.pill {
  font-size: 11px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid transparent;
}

.pill-outline {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

.pill-outline.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.pill-muted {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.pill-primary {
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

/* Cards */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 14px;
  box-shadow: var(--shadow-soft);
}

.card-table {
  padding: 0;
  overflow-x: auto;
}

/* Results */

.results-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.results-title {
  font-size: 15px;
  font-weight: 600;
}

.results-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.results-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

/* Table */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  color: var(--text-muted);
  font-weight: 500;
}

.table tr:last-child td {
  border-bottom: none;
}

/* Cards grid */

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.result-title {
  font-size: 13px;
  font-weight: 500;
}

.result-store {
  font-size: 11px;
  color: var(--text-muted);
}

.result-price {
  font-size: 16px;
  font-weight: 600;
}

.result-unit {
  font-size: 11px;
  color: var(--text-muted);
}

.result-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-source {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Near / List / Cart */

.near-section {
  margin-top: 8px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.list-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

/* Ads */

.ad-section {
  margin: 18px 0;
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.footer-right a {
  margin-left: 10px;
}

/* Cookie banner */

.cookie-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  z-index: 40;
}

.cookie-card {
  max-width: 640px;
  width: calc(100% - 24px);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cookie-text {
  font-size: 11px;
  color: var(--text-muted);
}

.cookie-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* Utility */

.hidden {
  display: none !important;
}
