:root {
  color-scheme: light;
  --bg: #f6fbff;
  --surface: #ffffff;
  --surface-soft: #eef8ff;
  --text: #081a4a;
  --muted: #4c5f86;
  --line: #dce7f5;
  --accent: #0b78f0;
  --accent-strong: #006be2;
  --success: #0aa876;
  --warning: #d86c00;
  --shadow: 0 16px 42px rgba(20, 52, 96, 0.1);
  --radius: 14px;
  --font-scale: 1;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
}

html[data-font-scale="compact"] {
  --font-scale: 0.875;
}

html[data-font-scale="large"] {
  --font-scale: 1.15;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071120;
  --surface: #0e1a2c;
  --surface-soft: #10263f;
  --text: #edf5ff;
  --muted: #a9b9d3;
  --line: #243b5c;
  --accent: #4aa3ff;
  --accent-strong: #1687ff;
  --success: #36c991;
  --warning: #ffb05c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: calc(16px * var(--font-scale));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 18%, rgba(8, 119, 242, 0.08), transparent 26rem),
    radial-gradient(circle at 15% 72%, rgba(10, 168, 118, 0.06), transparent 22rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(100% - 28px, 1480px);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 48px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand.small {
  font-size: 1.0625rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #17c8b0;
  position: relative;
  box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 9px #dff8f3;
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
}

.nav-links,
.footer nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.lang-control {
  display: inline-flex;
  align-items: center;
}

.lang-control select {
  width: auto;
  min-width: 80px;
  min-height: 32px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0 4px 0 8px;
  border-radius: 6px;
  cursor: pointer;
}

.font-scale-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.font-scale-control span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.font-scale-control select {
  width: 52px;
  min-height: 32px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0 4px 0 8px;
  border-radius: 6px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 20px;
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

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

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 4px 16px rgba(11, 120, 240, 0.3);
}

.button.success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  width: 100%;
}

.button.ghost {
  background: var(--surface);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 36px;
  align-items: end;
  padding: 56px 0 24px;
}

.hero-copy h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(40px, 4.5vw, 60px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero-copy h1 span {
  color: #0ca99b;
}

.hero-copy p {
  max-width: 600px;
  margin: 18px 0 22px;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
}

.search-panel,
.panel,
.metric-card,
.map-card,
.price-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.search-panel {
  display: grid;
  grid-template-columns: 1.25fr 0.8fr 0.75fr 0.65fr auto;
  gap: 12px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

select:hover,
input:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

input:disabled,
select:disabled {
  cursor: not-allowed;
  background: var(--surface-soft);
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.search-button {
  align-self: end;
  white-space: nowrap;
}

.metric-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  overflow: hidden;
}

.metric-card div {
  min-height: 110px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-card div:nth-child(2n) {
  border-right: 0;
}

.metric-card div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric-card strong {
  font-size: 2rem;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.metric-card span {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.875rem;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(560px, 0.92fr);
  gap: 18px;
  padding: 20px 0 24px;
  align-items: stretch;
}

.dashboard > * {
  min-width: 0;
}

.map-card {
  min-height: clamp(640px, calc(100dvh - 210px), 900px);
  position: relative;
  overflow: hidden;
}

#leaflet-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-summary {
  position: absolute;
  left: 22px;
  top: 22px;
  z-index: 2;
  width: 178px;
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 35px rgba(20, 52, 96, 0.16);
}

.map-summary strong {
  color: #0ca99b;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.map-summary span {
  font-weight: 800;
}

.map-summary small {
  color: var(--muted);
  font-weight: 650;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head.compact {
  align-items: start;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) minmax(120px, 0.95fr) minmax(100px, 0.7fr) minmax(150px, 1.05fr);
  gap: 10px;
  align-items: end;
  margin: 0 0 16px;
}

.list-controls label {
  gap: 6px;
}

.check-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--text);
}

.check-control input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

.availability {
  display: flex;
  flex-direction: column;
  max-height: clamp(640px, calc(100dvh - 210px), 900px);
  overflow: hidden;
}

.availability .table-wrap {
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 18%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 22%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 12%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 16%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 16%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 16%;
}

th,
td {
  padding: 13px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

td {
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.badge.stock {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.badge.low {
  background: rgba(216, 108, 0, 0.15);
  color: var(--warning);
}

.badge.out {
  background: rgba(216, 60, 60, 0.12);
  color: #c03030;
}

.state-banner,
.empty-state {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 750;
}

.state-banner.loading {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.state-banner.error {
  background: rgba(216, 108, 0, 0.13);
}

.empty-state {
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
}

.empty-state span,
.panel p,
.price-panel span {
  color: var(--muted);
}

.insights {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 0.8fr;
  gap: 18px;
  padding: 0 0 28px;
}

.alert-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0;
}

.alert-options button {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.chart {
  height: 130px;
  display: flex;
  align-items: end;
  gap: 9px;
  padding: 16px 0 10px;
}

.chart span {
  flex: 1;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent));
}

.alternatives-card ul,
.price-panel ul {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: grid;
  gap: 10px;
}

.alternatives-card li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 0.875rem;
}

.health-card {
  display: grid;
  gap: 14px;
}

.health-card strong {
  color: var(--success);
  font-size: 1.0625rem;
  font-weight: 700;
}

.health-dots {
  display: flex;
  gap: 12px;
}

.health-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
}

.health-dots .muted {
  background: #b7c5d7;
}

.pricing {
  display: grid;
  grid-template-columns: 0.72fr 1fr 1.25fr;
  gap: 26px;
  align-items: stretch;
  padding: 32px 0 48px;
}

.pricing-copy {
  align-self: center;
}

.pricing-copy h2 {
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.price-panel {
  position: relative;
  padding: 28px;
  display: grid;
  gap: 10px;
}

.price-panel.featured {
  background: linear-gradient(135deg, color-mix(in srgb, var(--success) 16%, var(--surface)), var(--surface));
}

.price-panel strong {
  font-size: 2.375rem;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.price-panel li {
  color: var(--text);
  font-weight: 700;
}

.plan-label {
  position: absolute;
  right: 24px;
  top: 0;
  transform: translateY(-50%);
  padding: 5px 12px;
  border-radius: 6px;
  background: #088f86;
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer nav {
  gap: 22px;
  font-size: 0.875rem;
}

.theme-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1060px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 24px;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .dashboard,
  .pricing {
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-button {
    grid-column: 1 / -1;
  }

  .insights {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 22px, 1280px);
  }

  .topbar {
    min-height: 64px;
    padding: 0 14px;
  }

  .brand {
    font-size: 22px;
  }

  .nav-actions .ghost {
    display: none;
  }

  .button {
    padding: 0 16px;
  }

  .hero {
    padding-top: 36px;
  }

  .hero-copy h1 {
    font-size: 40px;
    line-height: 1.02;
  }

  .hero-copy p {
    font-size: 16px;
  }

  .search-panel,
  .metric-card,
  .insights {
    grid-template-columns: 1fr;
  }

  .metric-card div,
  .metric-card div:nth-child(2n),
  .metric-card div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-card div:last-child {
    border-bottom: 0;
  }

  .map-card {
    min-height: 480px;
  }

  .map-summary {
    width: 156px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 0;
  }

  .footer nav {
    flex-wrap: wrap;
  }

  .list-controls {
    grid-template-columns: 1fr;
  }
}
