* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #212121;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  color: #212121;
  outline: none;
}

.field:focus { border-color: #FF0000; }

textarea.field { resize: vertical; font-family: inherit; }

.btn {
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary { background: #FF0000; color: #fff; }
.btn-outline { background: #fff; color: #FF0000; border: 1.5px solid #FF0000; }
.btn-lg { width: 100%; padding: 14px; font-size: 17px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-grow { flex: 1; }

/* ===== Вход ===== */
#screen-login { justify-content: center; min-height: 70vh; }

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #FF0000;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 8px;
}

#login-form { display: flex; flex-direction: column; gap: 12px; }

/* Чекбокс «Запомнить меня» */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #555;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: #FF0000;
  margin: 0;
}

/* ===== Шапка ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #FF0000;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar .btn-outline { border-color: #fff; color: #fff; background: transparent; }

.topbar-user { font-weight: 700; font-size: 15px; }
.topbar-extra { font-size: 12px; opacity: .92; margin-top: 2px; }

/* ===== Баннеры ===== */
.banner {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  display: block;
}

.banner-error { background: #FDE8E8; color: #F44336; border: 1px solid #F44336; }
.banner-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #4CAF50; }
.banner-info { background: #FFEBEE; color: #C62828; border: 1px solid #FF0000; }

/* ===== Сканер ===== */
#reader { width: 100%; border-radius: 8px; overflow: hidden; background: #000; min-height: 200px; }
#reader video { border-radius: 8px; }

.scanner-controls, .send-row { display: flex; gap: 8px; align-items: center; }
.scanner-controls .btn { flex: 1; }

/* Блок быстрых дат: по верхнему краю строки, кнопки в ряд, дата ниже с отступом */
.send-row { align-items: flex-start; }

/* Баннер отложенных отправок (офлайн-очередь) */
.pending-card {
  background: #FFEBEE;
  border: 1px solid #C62828;
  border-radius: 8px;
  padding: 10px 12px;
}

.pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: #C62828;
}

#date-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}

.date-quick { display: flex; gap: 6px; }

/* ===== Список штрихкодов ===== */
.list-header { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }

.barcode-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.barcode-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f7fa;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}

.barcode-index {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FF0000;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.barcode-value { flex: 1; word-break: break-all; }

.barcode-remove {
  border: none;
  background: transparent;
  color: #F44336;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
}

/* ===== Дата ===== */
.field-date { flex: 0 0 auto; width: 150px; padding: 10px 8px; }

/* ===== Успех ===== */
.success-card { align-items: center; text-align: center; padding: 32px 20px; }

.success-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #4CAF50;
  color: #fff;
  font-size: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.success-title { font-size: 20px; font-weight: 700; color: #2E7D32; }
.success-sub { color: #555; margin-bottom: 18px; }

/* ===== Модалка АЗС ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-title { font-size: 18px; font-weight: 700; }

.station-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
}

.station-item {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
}

.station-item:active { background: #FFEBEE; }

.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 100px; }

#custom-panel { display: flex; flex-direction: column; gap: 8px; }
