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

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card-bg: var(--tg-theme-section-bg-color, #ffffff);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--secondary-bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.header {
  text-align: center;
  padding: 24px 8px 20px;
}

.pump {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.updated {
  margin-top: 6px;
  font-size: 13px;
  color: var(--hint);
}

.fuel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fuel-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 5px solid var(--accent, var(--hint));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fuel-card.unavailable {
  opacity: 0.75;
}

.fuel-status-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.fuel-info {
  flex: 1;
  min-width: 0;
}

.fuel-title {
  font-size: 16px;
  font-weight: 600;
}

.fuel-detail {
  font-size: 13px;
  color: var(--hint);
  margin-top: 2px;
}

.fuel-price {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.fuel-price.unavailable {
  font-size: 13px;
  font-weight: 500;
  color: var(--hint);
}

.skeleton {
  height: 62px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--secondary-bg) 50%, var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

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

.error-box {
  margin-top: 24px;
  text-align: center;
  padding: 20px;
}

.error-box p {
  color: var(--hint);
  margin-bottom: 12px;
  font-size: 14px;
}

.retry-btn {
  background: var(--button);
  color: var(--button-text);
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Навигация между страницами ===== */

.history-link {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--card-bg);
  color: var(--link);
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.history-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px 12px;
  gap: 12px;
}

.history-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.range-switch {
  display: flex;
  background: var(--secondary-bg);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.range-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.range-btn.active {
  background: var(--button);
  color: var(--button-text);
}

/* ===== Таймлайн наличия топлива ===== */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.timeline-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.timeline-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.timeline-fuel-name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-fuel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--dotcolor, var(--hint));
}

.timeline-uptime {
  font-size: 13px;
  color: var(--hint);
  font-weight: 600;
}

.timeline-bar {
  display: flex;
  width: 100%;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.timeline-segment {
  height: 100%;
}

.timeline-segment.avail {
  background: #34c759;
}

.timeline-segment.unavail {
  background: #ff3b30;
}

.timeline-dates {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--hint);
}

.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--hint);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.avail {
  background: #34c759;
}

.legend-dot.unavail {
  background: #ff3b30;
}
