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

:root {
  --tnb-green: #1a7a3a;
  --tnb-green-dark: #145f2d;
  --tnb-red: #e31e24;
  --tnb-gray: #f5f5f5;
  --tnb-text: #333;
  --tnb-border: #e0e0e0;
  --available: #1a7a3a;
  --unavailable: #e31e24;
}

html {
  background: var(--tnb-gray);
}

body {
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  color: var(--tnb-text);
  background: #fff;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* flex-элементы с max-width не должны сжиматься до ширины контента */
body > .site-header,
body > .intro,
body > .main-content,
body > .prices-bar,
body > .site-footer {
  width: 100%;
}

/* Header — стиль tnboil.ru */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--tnb-green);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 24px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 48px;
}

.header-logo img {
  height: 48px;
  width: auto;
  display: block;
  transform: translateY(3px);
}

.header-title {
  flex: 1;
  text-align: center;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--tnb-green-dark);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.header-phone {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tnb-red);
  white-space: nowrap;
  line-height: 1.2;
  text-decoration: none;
  transition: opacity 0.15s;
}

.header-phone:hover {
  opacity: 0.75;
}

/* Intro */
.intro {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.intro p {
  font-size: 0.95rem;
  color: #555;
  max-width: 900px;
}

/* Prices bar */
.prices-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

.prices-bar-inner {
  background: var(--tnb-gray);
  border-radius: 10px;
  padding: 18px 20px 20px;
  border: 1px solid var(--tnb-border);
}

.prices-bar-header {
  margin-bottom: 14px;
}

.prices-bar-header h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tnb-green-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.prices-bar-header p {
  font-size: 0.78rem;
  color: #888;
}

.prices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.prices-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  padding: 12px;
}

.price-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 12px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--tnb-border);
  transition: box-shadow 0.15s;
}

.price-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

.price-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tnb-green);
}

.price-card--95::before {
  background: #2e9b4a;
}

.price-card--premium::before {
  background: linear-gradient(90deg, #c9a227, #e8c547);
}

.price-card--dt::before {
  background: #455a64;
}

.price-card-type {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tnb-green-dark);
  margin-bottom: 6px;
}

.price-card--dt .price-card-type {
  color: #455a64;
}

.price-card--premium .price-card-type {
  color: #9a7b0a;
}

.price-card-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--tnb-text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.price-card-value--empty {
  font-size: 1.4rem;
  color: #bbb;
}

.price-card-unit {
  font-size: 0.68rem;
  color: #999;
  margin-top: 4px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .prices-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .price-card-value {
    font-size: 1.45rem;
  }
}

@media (max-width: 400px) {
  .prices-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .price-card {
    padding: 12px 8px 10px;
  }
}

/* Main layout */
.main-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  min-height: 580px;
}

#map {
  width: 100%;
  min-width: 0;
  height: 580px;
  border-radius: 8px;
  border: 1px solid var(--tnb-border);
  z-index: 1;
}

/* Station list panel */
.stations-panel {
  display: flex;
  flex-direction: column;
  height: 580px;
  border: 1px solid var(--tnb-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.panel-header {
  padding: 14px 16px;
  background: var(--tnb-green);
  color: #fff;
}

.panel-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-controls {
  padding: 12px 16px;
  border-bottom: 1px solid var(--tnb-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--tnb-green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--tnb-green-dark);
}

.btn-primary:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--tnb-border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--tnb-green);
}

select.search-input {
  cursor: pointer;
  background: #fff;
}

.stations-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.station-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--tnb-border);
  cursor: pointer;
  transition: background 0.12s;
}

.station-card:hover {
  background: #f7f7f7;
}

.station-card.active {
  background: #f0faf3;
  box-shadow: inset 3px 0 0 var(--tnb-green);
}

.station-card .station-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.station-updated {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #888;
  margin: 4px 0 6px;
  cursor: help;
}

.station-card.active .station-updated {
  color: var(--tnb-green-dark);
}

.station-card .station-address {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 6px;
}

.station-card .station-distance {
  font-size: 0.75rem;
  color: var(--tnb-green);
  font-weight: 500;
  margin-bottom: 6px;
}

.fuel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fuel-tag {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.fuel-tag.available {
  background: #e8f5e9;
  color: var(--available);
}

.fuel-tag.unavailable {
  background: #fdecea;
  color: var(--unavailable);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 16px;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  background: var(--tnb-gray);
  border-top: 1px solid var(--tnb-border);
  padding: 20px 24px;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
}

/* Yandex Maps balloon */
.popup-address {
  color: #666;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.popup-fuels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.popup-fuels .fuel-tag {
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  #map {
    height: 400px;
  }

  .stations-panel {
    height: 400px;
  }

  .header-inner {
    flex-direction: column;
    text-align: center;
  }

  .header-title {
    order: 2;
  }

  .header-phone {
    order: 3;
  }
}
