html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, Segoe UI, Roboto, sans-serif; }
* { box-sizing: border-box; }
#app { display: flex; flex-direction: column; height: 100%; position: relative; }

#offline-banner {
  flex: 0 0 auto; background: #7a2e2e; color: #fff; font-size: 13px;
  padding: 8px 16px; text-align: center;
}

#topbar {
  height: 52px; flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: #1c1c1c; color: #eee; box-sizing: border-box;
}
#title { font-weight: 600; white-space: nowrap; }
#search {
  flex: 0 1 320px; padding: 6px 10px; border-radius: 6px; border: 1px solid #444;
  background: #2b2b2b; color: #eee; font-size: 14px;
}
#nearest-btn {
  padding: 6px 12px; border-radius: 16px; border: 1px solid #444; background: #333;
  color: #ddd; font-size: 13px; cursor: pointer; white-space: nowrap;
}
#meta { margin-left: auto; font-size: 12px; opacity: .7; white-space: nowrap; }

/* Компактная мобильная панель — скрыта на десктопе (п.14 ТЗ) */
#mobile-bar {
  display: none;
  flex: 0 0 auto; gap: 8px; padding: 8px 12px; background: #262626;
  border-bottom: 1px solid #333;
}
#mobile-bar select {
  flex: 1 1 auto; min-height: 44px; font-size: 15px; border-radius: 8px;
  border: 1px solid #444; background: #333; color: #eee; padding: 0 8px;
}
#m-refresh {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; font-size: 18px;
  border-radius: 8px; border: 1px solid #444; background: #333; color: #eee; cursor: pointer;
}

#fuelbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: #262626; color: #ddd; border-bottom: 1px solid #333;
}
#fuelbar .label { font-size: 13px; opacity: .8; }
#fuel-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.fuel-btn {
  padding: 5px 12px; border-radius: 16px; border: 1px solid #444; background: #333;
  color: #ddd; font-size: 13px; cursor: pointer; user-select: none;
}
.fuel-btn.active { background: #3a7bd5; border-color: #3a7bd5; color: #fff; }

#body { flex: 1 1 auto; display: flex; min-height: 0; }
#filters {
  width: 220px; flex: 0 0 auto; overflow-y: auto; padding: 12px; box-sizing: border-box;
  background: #f4f4f4; border-right: 1px solid #ddd; font-size: 13px;
}
.filter-group { margin-bottom: 16px; }
.filter-title { font-weight: 600; margin-bottom: 6px; color: #333; }
.filter-group label { display: block; margin-bottom: 4px; cursor: pointer; }
#freshness { width: 100%; padding: 4px; }
#stats { margin-top: 20px; font-size: 12px; color: #666; line-height: 1.6; white-space: pre-line; }

#map { flex: 1 1 auto; }

.popup-title { font-weight: 700; margin-bottom: 2px; }
.popup-address { font-size: 12px; color: #777; margin-bottom: 8px; }
.fuel-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-top: 1px solid #eee; cursor: pointer; }
.fuel-row:hover { background: #f7f7f7; }
.fuel-row .fname { font-weight: 600; width: 60px; }
.fuel-row .fstatus { flex: 1; }
.fuel-row .fago { font-size: 11px; color: #999; }
.fuel-row .fconf { font-size: 11px; color: #999; width: 44px; text-align: right; }
.dot-inline { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.sources-panel { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #ddd; font-size: 12px; }
.sources-panel .src-row { padding: 4px 0; border-top: 1px solid #f0f0f0; }
.sources-panel .src-name { font-weight: 600; }
.sources-panel .src-quote { font-style: italic; color: #666; margin-top: 2px; }
.popup-footer { margin-top: 8px; font-size: 10px; color: #aaa; }

/* ---- Manual report block (п.5-6 ТЗ) ---- */
.report-block { margin-top: 12px; padding-top: 10px; border-top: 2px solid #eee; }
.report-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.report-main-buttons { display: flex; gap: 8px; margin-bottom: 10px; }
.report-btn {
  flex: 1 1 0; min-height: 40px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #fff;
}
.report-yes { background: #2ecc71; }
.report-no { background: #e74c3c; }
.report-unsure { background: #9e9e9e; }

.report-aux { font-size: 12px; color: #666; }
.aux-label { margin-top: 6px; margin-bottom: 4px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.chip {
  padding: 6px 10px; min-height: 32px; border-radius: 14px; border: 1px solid #ccc;
  background: #fff; font-size: 12px; cursor: pointer;
}
.chip-active { background: #3a7bd5; border-color: #3a7bd5; color: #fff; }

.report-confirm { margin-top: 10px; padding: 8px; background: #fff8e1; border-radius: 8px; font-size: 13px; }
.confirm-question { margin-bottom: 8px; font-weight: 600; }
.confirm-yes, .confirm-cancel {
  min-height: 36px; padding: 0 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; margin-right: 8px;
}
.confirm-yes { background: #2ecc71; color: #fff; font-weight: 600; }
.confirm-cancel { background: #eee; color: #333; }
.report-error { color: #c0392b; }
.report-thanks { margin-top: 10px; padding: 8px; background: #e8f8ef; color: #1e8e3e;
  border-radius: 8px; font-size: 13px; font-weight: 600; text-align: center; }

/* ---- Мобильный bottom sheet (замена popup на узких экранах, п.13 ТЗ) ---- */
#sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1000;
}
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001;
  background: #fff; border-radius: 16px 16px 0 0; max-height: 75vh; overflow-y: auto;
  padding: 8px 16px 24px; box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
#sheet-handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; margin: 6px auto 10px; }
#sheet-close {
  position: absolute; top: 8px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: none; background: #f0f0f0; font-size: 18px; cursor: pointer; color: #555;
}

/* ---- Мобильная раскладка (п.13 ТЗ) ---- */
@media (max-width: 768px) {
  #mobile-bar { display: flex; }
  #filters { display: none; }
  #search { flex: 1 1 auto; min-width: 0; }
  #nearest-btn { display: none; } /* дублируется мобильной панелью через геолокацию по кнопке ниже при желании */
  #meta { display: none; } /* технические детали — не перегружаем узкий топбар (freshness видна в карточке) */
  .fuel-btn { min-height: 36px; display: flex; align-items: center; padding: 6px 14px; font-size: 14px; }
  .fuel-row { min-height: 44px; }
  .report-btn { min-height: 48px; font-size: 15px; }
  .chip { min-height: 36px; padding: 8px 12px; font-size: 13px; }
}
