:root {
  --yellow: #ffd21c;
  --yellow-dark: #e0aa00;
  --green: #11a64a;
  --green-soft: #eaf8ef;
  --red: #f01818;
  --red-soft: #fff0f0;
  --orange: #ff7900;
  --orange-soft: #fff6ec;
  --text: #111216;
  --muted: #70727f;
  --line: #e7e7ec;
  --card: #fff;
  --bg: #fbfbfc;
  --shadow: 0 12px 34px rgba(30, 30, 45, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #f1f2f5; }
body {
  margin: 0;
  min-height: 100vh;
  background: #f1f2f5;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }

.app-shell {
  position: relative;
  max-width: 600px;
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
  background: var(--bg);
  overflow-x: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 64px 1fr 54px;
  align-items: center;
  gap: 14px;
  padding: 6px 0 18px;
}
.app-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(255, 210, 28, .35);
}
.brand h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1.05;
  letter-spacing: -.04em;
}
.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 17px;
}
.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(30, 30, 45, .08);
}
.bell { font-size: 27px; }
.notification-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 24px;
  height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--yellow);
  font-size: 13px;
  font-weight: 900;
}
.hidden { display: none !important; }

main { display: grid; gap: 16px; }
.hero-card, .summary-card, .panel-card, .pwa-card, .recommendation-card {
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero-card {
  padding: 18px;
  background: linear-gradient(145deg, #fff, #fff9db);
}
.hero-card h2, .summary-card h2, .panel-card h2, .pwa-card h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.02em;
}
.hero-card p, .panel-card p, .pwa-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.48;
}
.hero-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.mode-label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(17, 166, 74, .10);
  color: #187d35;
  font-weight: 900;
}
.primary-button, .telegram-link {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--yellow);
  color: #131313;
  font-weight: 900;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(255, 210, 28, .35);
}
select, input[type="search"] {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
}

.summary-card { padding: 18px; }
.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.freshness {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
.freshness i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}
.status-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.status-tabs button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
}
.status-tabs button.active {
  border-color: var(--yellow);
  background: var(--yellow);
}
.status-tabs b { margin-left: 5px; }
#count-available { color: var(--green); }
#count-partial { color: var(--orange); }
#count-unavailable { color: var(--red); }
.fuel-filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.summary-stats div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--yellow);
  font-size: 22px;
}
.summary-stats p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.summary-stats strong {
  font-size: 15px;
  line-height: 1.2;
}

.recommendation-card {
  padding: 16px;
  border-color: rgba(255, 210, 28, .75);
}
.recommendation-card span {
  color: var(--yellow-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.recommendation-card h2 {
  margin: 7px 0 4px;
  font-size: 20px;
}
.recommendation-card p { margin: 0; color: var(--muted); }

.view { display: none; }
.active-view { display: block; }
.stations-list {
  display: grid;
  gap: 12px;
}
.station-card {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(30, 30, 45, .055);
}
.station-card.is-selected {
  border-color: var(--yellow);
  box-shadow: 0 10px 24px rgba(255, 210, 28, .18);
}
.station-logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 16px rgba(30, 30, 45, .10);
}
.station-logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
}
.station-main { min-width: 0; }
.station-main h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}
.station-address {
  margin: 5px 0 10px;
  color: var(--muted);
  line-height: 1.35;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 10px;
  background: #f0f1f4;
  color: #8b8d96;
  font-weight: 800;
  font-size: 14px;
}
.chip.good {
  background: var(--green-soft);
  color: #187d35;
}
.chip.status {
  border: 1px solid currentColor;
  background: #fff;
}
.chip.status.available { color: var(--green); }
.chip.status.partial { color: var(--orange); }
.chip.status.unavailable { color: var(--red); }
.chip.status.unknown { color: #8b8d96; }
.station-side {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.station-side span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.card-arrow {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #fff7d2;
  font-size: 22px;
}
.station-actions {
  grid-column: 1 / -1;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 12px;
}
.station-card.is-selected .station-actions { display: grid; }
.station-actions button, .station-actions a {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.station-actions .report-button {
  border-color: var(--yellow);
  background: var(--yellow);
}
.empty-state {
  padding: 32px 18px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.panel-card, .pwa-card {
  padding: 18px;
}
.recent-reports {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.recent-report {
  padding: 12px;
  border-radius: 16px;
  background: #f7f7f9;
}
.recent-report b { display: block; }
.recent-report span { color: var(--muted); font-size: 14px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: min(calc(100% - 32px), 568px);
  padding: 10px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 34px rgba(30, 30, 45, .14);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}
.bottom-nav button {
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #5f616c;
  font-size: 24px;
}
.bottom-nav button span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 800;
}
.bottom-nav button.active {
  background: #fff1a8;
  color: #bd8d00;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .18);
}
.sheet {
  width: min(100%, 600px);
  max-height: min(86vh, 720px);
  overflow-y: auto;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: #fff;
  box-shadow: 0 -18px 40px rgba(30, 30, 45, .18);
}
.sheet-handle {
  width: 48px;
  height: 5px;
  margin: 4px auto 12px;
  border-radius: 99px;
  background: #c9cad1;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sheet-head h2 { margin: 0; font-size: 22px; }
.sheet-head p { margin: 7px 0 0; color: var(--muted); }
.close-button {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #f0f0f2;
  font-size: 34px;
  line-height: 1;
}
.sheet h3 {
  margin: 22px 0 12px;
  font-size: 17px;
}
.report-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.report-status-grid input,
.fuel-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.report-status-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 18px;
  font-weight: 900;
}
.report-status-grid input:checked + .status-yes { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.report-status-grid input:checked + .status-no { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.report-status-grid input:checked + .status-partial { border-color: var(--orange); background: var(--orange-soft); color: var(--orange); }
.fuel-select-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.fuel-select-title span {
  color: var(--muted);
  font-size: 12px;
}
.fuel-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.fuel-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f8fa;
  font-weight: 900;
}
.fuel-options input:checked + span {
  border-color: #a7dfb9;
  background: var(--green-soft);
  color: #187d35;
}
.comment-label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--text);
  font-weight: 800;
}
textarea {
  width: 100%;
  min-height: 82px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  resize: vertical;
}
.submit-report {
  width: 100%;
  min-height: 62px;
  margin-top: 18px;
  border: 0;
  border-radius: 18px;
  background: var(--yellow);
  color: #111;
  font-size: 19px;
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(255, 210, 28, .38);
}
.privacy-note {
  margin: 14px 0 0;
  color: var(--muted);
  text-align: center;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(540px, calc(100% - 32px));
  padding: 13px 18px;
  border-radius: 16px;
  background: #16171c;
  color: #fff;
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: .2s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 520px) {
  .hero-actions, .fuel-filter-row { grid-template-columns: 1fr 1fr; }
  .report-status-grid { grid-template-columns: repeat(3, 1fr); }
  .fuel-options { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 420px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .topbar { grid-template-columns: 56px 1fr 48px; gap: 10px; }
  .app-logo { width: 52px; height: 52px; }
  .brand h1 { font-size: 22px; }
  .brand p { font-size: 15px; }
  .summary-stats { gap: 8px; }
  .station-card { grid-template-columns: 58px 1fr; }
  .station-side {
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
    justify-items: start;
  }
  .card-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
  .station-actions { grid-template-columns: 1fr; }
}
