:root {
  /* Фирменные цвета «Профи Партнер» — жёлтый + чёрный, из логотипа.
     Не зависят от темы Telegram, чтобы бренд был одинаковым всегда. */
  --brand-yellow: #ffc700;
  --brand-yellow-dark: #e6b400;
  --brand-black: #141414;
  --brand-black-soft: #1f1f1f;

  --tg-bg: var(--tg-theme-bg-color, #ffffff);
  --tg-text: var(--tg-theme-text-color, #1a1a1a);
  --tg-hint: var(--tg-theme-hint-color, #7a7a7a);
  --tg-link: var(--tg-theme-link-color, #2481cc);
  --tg-secondary-bg: var(--tg-theme-secondary-bg-color, #f4f4f5);

  --accent: var(--brand-yellow);
  --accent-text: var(--brand-black);
  --danger: #e5484d;
  --success: #2fb344;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* ---------- Экран загрузки ----------
   Разметка лежит прямо в index.html, а стили — здесь, в той же таблице
   стилей, которая и так блокирует первый показ страницы. Поэтому заставка
   появляется в первом же кадре: никакого «белого экрана» между ответом
   сервера и запуском приложения больше нет. */

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tg-secondary-bg);
  transition: opacity .28s ease;
}

.boot-splash--done {
  opacity: 0;
  pointer-events: none;
}

.boot-splash__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px;
  max-width: 320px;
  text-align: center;
}

.boot-splash__logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 22px;
  animation: boot-splash-pulse 1.6s ease-in-out infinite;
}

.boot-splash__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .2px;
}

.boot-splash__track {
  width: 190px;
  height: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--tg-hint) 28%, transparent);
  overflow: hidden;
}

.boot-splash__bar {
  display: block;
  height: 100%;
  width: 8%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .35s ease;
}

.boot-splash__hint {
  font-size: 13px;
  color: var(--tg-hint);
  min-height: 18px;
}

@keyframes boot-splash-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.94); opacity: .78; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-splash__logo { animation: none; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Не даём iOS/Android зумить двойным тапом и «ездить» жестами */
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
}

#app {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + var(--safe-top, 0px)) 16px 14px;
  background: var(--brand-black);
  border-bottom: 3px solid var(--accent);
}

.app-header__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent);
}

.app-header__title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--accent);
  text-transform: uppercase;
}

.app-header__fullscreen {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.app-header__fullscreen.active {
  background: rgba(255, 199, 0, 0.18);
}

.view {
  flex: 1;
  min-height: 0;
  padding: 12px 14px 90px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Поддержка: поле ввода всегда видно над нижней панелью вкладок,
   без прокрутки всей страницы вниз. */
.view.view--chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(72px + var(--safe-bottom, 0px) + env(safe-area-inset-bottom, 0px));
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--brand-black);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 6px 4px calc(6px + var(--safe-bottom, 0px) + env(safe-area-inset-bottom));
}
.tabbar::-webkit-scrollbar { display: none; }

.tabbar__item {
  flex: 1 0 auto;
  border: none;
  background: none;
  color: #8a8a8a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 10px;
  cursor: pointer;
  min-width: 56px;
}

.tabbar__item span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* display:flex выше перекрывает нативный [hidden] в WebView Telegram */
.tabbar__item[hidden] {
  display: none !important;
}

.catalog-search {
  margin-bottom: 10px;
}
.catalog-search input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(127,127,127,0.35);
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 16px;
}
.catalog-search input[type="search"]::placeholder {
  color: var(--tg-hint);
}
.pricing [data-searchable][hidden] {
  display: none !important;
}

.staff-perms {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.staff-perm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.staff-perm input { width: 18px; height: 18px; accent-color: var(--accent); }

.inv-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.inv-stat {
  background: var(--tg-bg);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inv-stat b { font-size: 16px; }
.inv-stat--accent {
  grid-column: 1 / -1;
  background: var(--accent);
  color: var(--accent-text);
}
.inv-stat--accent .muted { color: rgba(0,0,0,0.55); }
.inv-stat--accent b { font-size: 20px; }

.inv-period {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}
.inv-period .field { margin: 0; }
.inv-period .field input[type="date"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.inv-period-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.inv-period-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}
.bw-week { display: flex; flex-direction: column; gap: 8px; }
.bw-day {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.bw-day__label { display: flex; align-items: center; gap: 6px; }
.bw-day__times { display: flex; align-items: center; gap: 6px; }
.bw-day__times input[type="time"] { width: 7.2rem; }
.inv-unit-checks {
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  background: var(--tg-secondary-bg, rgba(0,0,0,0.03));
  border-radius: var(--radius);
}
.inv-unit-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.inv-unit-check input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }

.inv-fleet-units {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-fleet-unit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(120, 120, 128, 0.08);
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
}

.tabbar__item.active {
  color: var(--accent-text);
  background: var(--accent);
}

.tabbar__icon { font-size: 19px; }

.card {
  background: var(--tg-bg);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.05);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--tg-text);
}

.card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.muted { color: var(--tg-hint); font-size: 13px; }

.pricing {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.pricing span {
  background: var(--tg-secondary-bg);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
  width: 100%;
}

.btn.secondary {
  background: var(--brand-black);
  color: var(--accent);
  border: 1px solid rgba(127, 127, 127, 0.3);
}

.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.small { width: auto; padding: 8px 12px; font-size: 12px; }

.btn:disabled { opacity: .5; cursor: default; }

.row-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.field { margin-bottom: 12px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--tg-hint);
  margin-bottom: 4px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 16px; /* не меньше 16px — анти-зум iOS */
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(127, 127, 127, 0.25);
}

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 1px solid rgba(127, 127, 127, 0.3);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  background: var(--tg-bg);
  cursor: pointer;
  user-select: none;
}

.chip.selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.chip-count {
  display: inline-block;
  min-width: 16px;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  background: rgba(127, 127, 127, 0.22);
}
.chip.selected .chip-count {
  background: rgba(255, 255, 255, 0.28);
  color: var(--accent-text);
}

.badge {
  font-size: 11px;
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 700;
}

.badge.free { background: #e5f6e8; color: var(--success); }
.badge.rented { background: #fde8e8; color: var(--danger); }
.badge.maintenance { background: #fff3d6; color: #b8860b; }
.badge.reserved { background: #fff8dd; color: #a67c00; }
.badge.muted-badge { background: rgba(120, 120, 128, 0.12); color: var(--tg-hint); }

.book-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 18px 18px;
  border-radius: 18px;
  background:
    linear-gradient(160deg, #fff9e8 0%, #ffffff 48%, #f7f7f8 100%);
  border: 1px solid rgba(20, 20, 20, 0.06);
  box-shadow:
    0 8px 24px rgba(20, 20, 20, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}
.book-price__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.book-price__eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a867c;
}
.book-price__tariff {
  font-size: 15px;
  font-weight: 600;
  color: #2a2a2a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-price__value {
  flex-shrink: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #1a1a1a;
  line-height: 1;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 199, 0, 0.18);
  border: 1px solid rgba(255, 199, 0, 0.28);
  box-shadow: none;
}

.empty {
  text-align: center;
  color: var(--tg-hint);
  padding: 40px 10px;
}

.thumb {
  display: block;
  width: 100%;
  min-height: 80px;
  max-height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 8px;
  cursor: pointer;
  background: var(--tg-secondary-bg);
}

.thumb--broken {
  cursor: default;
  min-height: 44px;
  background: var(--tg-secondary-bg) center center no-repeat;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  object-fit: contain;
}

.profile-gate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-gate__card {
  background: var(--tg-bg);
  color: var(--tg-text);
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.profile-gate__card h2 {
  margin: 0 0 8px;
}

.profile-gate__card p {
  margin: 0 0 16px;
  color: var(--tg-hint);
  font-size: 14px;
}

.profile-gate__card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 16px;
  margin-bottom: 8px;
}

.profile-gate__card .muted {
  min-height: 18px;
  color: #d33;
  font-size: 13px;
  margin-bottom: 8px;
}

.profile-gate__card .btn {
  width: 100%;
}

.tabs-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tabs-sub .chip { white-space: nowrap; }

.toast {
  position: fixed;
  bottom: 78px;
  left: 14px;
  right: 14px;
  background: var(--brand-black);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all .25s ease;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.toast.show { opacity: 1; transform: translateY(0); }

.spinner {
  text-align: center;
  padding: 30px;
  color: var(--tg-hint);
}

.vehicle-loader {
  padding: 26px 10px 18px;
  text-align: center;
}

.vehicle-loader__road {
  position: relative;
  height: 40px;
  margin-bottom: 10px;
  overflow: hidden;
  border-bottom: 2px dashed rgba(0, 0, 0, 0.15);
}

.vehicle-loader__icon {
  position: absolute;
  top: 0;
  left: -15%;
  font-size: 28px;
  line-height: 1;
  animation: vehicleDriveAcross 1.8s linear infinite;
  display: inline-block;
}

.vehicle-loader__text {
  color: var(--tg-hint);
  font-size: 13px;
  font-weight: 600;
}

@keyframes vehicleDriveAcross {
  0% { left: -15%; transform: translateY(0); }
  50% { transform: translateY(-3px); }
  100% { left: 110%; transform: translateY(0); }
}

.status-form {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--tg-secondary-bg);
  border: 1px dashed rgba(0,0,0,0.15);
}

.status-form .field { margin-bottom: 8px; }
.status-form .field:last-of-type { margin-bottom: 0; }

/* ---------- Главная — чистый, спокойный тёмный hero ---------- */

.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 48px 24px 30px;
  margin-bottom: 22px;
  text-align: center;
  color: #fff;
  isolation: isolate;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 26% 4%, #2c2410 0%, var(--brand-black) 42%, #0a0a0a 100%);
}

.fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-hero__badge {
  display: inline-block;
  align-self: center;
  background: rgba(255, 255, 255, 0.05);
  color: #b3b3b3;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-bottom: 30px;
}

.home-hero__icon {
  color: var(--accent);
  margin: 2px 0 20px;
  display: flex;
  justify-content: center;
}

.home-hero__title {
  margin: 0 0 14px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.2;
  color: var(--accent);
}

.home-hero__subtitle {
  margin: 0 auto 30px;
  max-width: 320px;
  font-size: 15px;
  color: #adadad;
  line-height: 1.55;
}

.home-hero__stats {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.home-hero__stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 6px;
}

.home-hero__stat b {
  display: block;
  color: var(--accent);
  font-size: 26px;
  font-weight: 800;
}

.home-hero__stat span {
  font-size: 11px;
  color: #9a9a9a;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.home-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-hero__actions .btn {
  padding: 15px 10px;
  font-size: 16px;
}

.home-hero__scrollhint {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #767676;
  font-size: 12px;
}

.home-hero__scrollhint-chevron {
  font-size: 22px;
  line-height: 1;
  animation: scrollHintBounce 1.8s ease-in-out infinite;
}

@keyframes scrollHintBounce {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(6px); opacity: 1; }
}

.home-section { margin-bottom: 8px; }

.home-section__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tg-hint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 4px 2px 10px;
}

.home-section .card { padding: 18px 16px; }

.home-admin-shortcut {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.home-admin-shortcut__title {
  font-weight: 700;
  margin-bottom: 4px;
}

.home-admin-shortcut .btn {
  width: 100%;
  box-sizing: border-box;
}

.list-card { padding: 4px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.list-item:last-child { border-bottom: none; }

.list-item:active { background: var(--tg-secondary-bg); }

.list-item__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tg-secondary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.list-item__body { flex: 1; min-width: 0; }

.list-item__title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--tg-text);
}

.list-item__meta {
  font-size: 12px;
  color: var(--tg-hint);
  margin-bottom: 2px;
}

.list-item__chevron {
  font-size: 20px;
  font-weight: 700;
  color: var(--tg-hint);
  flex-shrink: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-grid .card { margin-bottom: 0; }

.stat-value { font-size: 20px; font-weight: 800; color: var(--tg-text); }

.progress {
  height: 8px;
  border-radius: 6px;
  background: var(--tg-secondary-bg);
  overflow: hidden;
  margin-top: 6px;
}

.progress__bar {
  height: 100%;
  background: var(--accent);
}

.chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg--bot {
  align-self: flex-start;
  background: var(--tg-bg);
  border: 1px solid rgba(0,0,0,0.08);
  border-bottom-left-radius: 4px;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.chat-msg--typing {
  opacity: 0.6;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 0 4px;
  background: var(--tg-secondary-bg);
  border-top: 1px solid rgba(127, 127, 127, 0.2);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.chat-input-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 16px;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-input-row .btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
}

/* ---------- Принудительная светлая/тёмная тема ----------
   Задаём напрямую переменные --tg-bg/--tg-text/--tg-hint/--tg-secondary-bg
   (а не --tg-theme-*), потому что именно их используют все компоненты —
   и правило с классом на <html> специфичнее правила :root, поэтому
   гарантированно перекрывает то, что actor applyTheme() берёт из Telegram. */
html.theme-light {
  --tg-bg: #ffffff;
  --tg-text: #1a1a1a;
  --tg-hint: #7a7a7a;
  --tg-secondary-bg: #f4f4f5;
}

html.theme-dark {
  --tg-bg: #1c1c1e;
  --tg-text: #f5f5f5;
  --tg-hint: #9a9a9a;
  --tg-secondary-bg: #2c2c2e;
}

.theme-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.theme-sheet[hidden] { display: none; }

.theme-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.theme-sheet__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--tg-bg);
  color: var(--tg-text);
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom, 0px));
}

.theme-sheet__card h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.theme-sheet__card .btn { margin-top: 8px; }

.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.theme-swatch.selected {
  border-color: var(--tg-text);
  box-shadow: 0 0 0 2px var(--accent);
}

.theme-swatch--custom {
  background: var(--tg-secondary-bg);
  font-size: 14px;
}

.theme-swatch--custom input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ---------- Графики (дашборд админки) ---------- */

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  overflow-x: auto;
  padding-top: 18px;
}

.chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 0 auto;
  min-width: 18px;
  height: 100%;
}

.chart-bar-col__value {
  font-size: 9px;
  font-weight: 700;
  color: var(--tg-hint);
  white-space: nowrap;
  margin-bottom: 2px;
}

.chart-bar-col__track {
  flex: 1;
  width: 100%;
  max-width: 22px;
  display: flex;
  align-items: flex-end;
  background: var(--tg-secondary-bg);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-col__fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .2s ease;
}

.chart-bar-col__label {
  font-size: 9px;
  color: var(--tg-hint);
  margin-top: 4px;
  white-space: nowrap;
}

/* ---------- Обзор: период + календарь дня ---------- */
.overview-period-card { margin-bottom: 10px; }
.overview-period-card .chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.overview-range {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: end;
}
.overview-range .field { margin: 0; }
.overview-range .field input[type="date"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 520px) {
  .overview-range {
    grid-template-columns: 1fr 1fr;
  }
  .overview-range .btn {
    width: 100%;
  }
}
.ov-compare {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(127,127,127,.18);
}
.ov-compare__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 620px) {
  .ov-compare__grid { grid-template-columns: 1fr; }
}
.ov-compare__col .overview-range {
  grid-template-columns: 1fr 1fr;
}
.ov-cmp-overall {
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  background: var(--tg-secondary-bg, #f4f4f5);
}
.ov-cmp-overall--a {
  background: color-mix(in srgb, #2fb344 18%, var(--tg-secondary-bg, #f4f4f5));
}
.ov-cmp-overall--b {
  background: color-mix(in srgb, #2481cc 18%, var(--tg-secondary-bg, #f4f4f5));
}
.ov-cmp-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(127,127,127,.12);
}
.ov-cmp-row:last-child { border-bottom: none; }
.ov-cmp-row__label { font-weight: 700; margin-bottom: 4px; }
.ov-cmp-row__vals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 14px;
}
.ov-cmp-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
}
.ov-cmp-win {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.ov-cmp-win--a {
  background: rgba(47,179,68,.15);
  color: #1b7a2e;
}
.ov-cmp-win--b {
  background: rgba(36,129,204,.15);
  color: #145a91;
}
.overview-day-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: 10px;
  margin-bottom: 10px;
  align-items: start;
}
@media (max-width: 720px) {
  .overview-day-layout { grid-template-columns: 1fr; }
}
.overview-day-detail {
  margin: 0;
  min-height: 120px;
}
.ov-day-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
}
@media (max-width: 520px) {
  .ov-day-stats { grid-template-columns: repeat(2, 1fr); }
}
.ov-day-stat {
  padding: 8px;
  border-radius: 10px;
  background: var(--tg-secondary-bg, #f4f4f5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ov-day-stat b { font-size: 15px; }
.ov-day-stat--accent {
  background: color-mix(in srgb, var(--accent, #2aabee) 18%, var(--tg-secondary-bg, #f4f4f5));
}
.ov-day-h {
  margin: 12px 0 6px;
  font-size: 13px;
}
.ov-day-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(127,127,127,.12);
  font-size: 13px;
}
.ov-day-row:last-child { border-bottom: none; }

/* ---------- Heatmap дней (Обзор) ---------- */
.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 10px 8px;
  justify-items: center;
}
.heat-cell {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  max-width: 48px;
}
.heat-cell__box {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.heat-cell:active .heat-cell__box,
.heat-cell:hover .heat-cell__box {
  transform: scale(1.06);
}
.heat-cell__day {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-hint, #888);
  line-height: 1;
}
.heat-cell--active .heat-cell__box {
  box-shadow: 0 0 0 2px var(--accent, #2aabee);
}
.heat-cell--active .heat-cell__day {
  color: var(--tg-text, #111);
}

/* песочная палитра — выручка (как на макете) */
.heat-cell--sand.heat-cell--l0 .heat-cell__box,
.heat-swatch.heat-cell--sand.heat-cell--l0 { background: #ececec; }
.heat-cell--sand.heat-cell--l1 .heat-cell__box,
.heat-swatch.heat-cell--sand.heat-cell--l1 { background: #e6d3b4; }
.heat-cell--sand.heat-cell--l2 .heat-cell__box,
.heat-swatch.heat-cell--sand.heat-cell--l2 { background: #c4a06a; }
.heat-cell--sand.heat-cell--l3 .heat-cell__box,
.heat-swatch.heat-cell--sand.heat-cell--l3 { background: #8a6a3a; }

/* синяя палитра — загрузка */
.heat-cell--blue.heat-cell--l0 .heat-cell__box,
.heat-swatch.heat-cell--blue.heat-cell--l0 { background: #ececec; }
.heat-cell--blue.heat-cell--l1 .heat-cell__box,
.heat-swatch.heat-cell--blue.heat-cell--l1 { background: #c5daf5; }
.heat-cell--blue.heat-cell--l2 .heat-cell__box,
.heat-swatch.heat-cell--blue.heat-cell--l2 { background: #6fa0e0; }
.heat-cell--blue.heat-cell--l3 .heat-cell__box,
.heat-swatch.heat-cell--blue.heat-cell--l3 { background: #2f5fa8; }

.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--tg-hint, #888);
}
.heat-legend__label {
  font-weight: 600;
  color: var(--tg-text, #333);
}
.heat-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.heat-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.rental-end-soon {
  color: #c47a00;
  font-size: 13px;
}
.rental-end-soon--late {
  color: #c62828;
}
.rental-end-card {
  border-left: 3px solid transparent;
}
.rental-end-card:has(.rental-end-soon:not(.rental-end-soon--late)) {
  border-left-color: #e6a23c;
}
.rental-end-card:has(.rental-end-soon--late) {
  border-left-color: #c62828;
}

.rental-debt {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #b3261e;
  background: rgba(198, 40, 40, 0.12);
}
.rental-end-card--debt {
  border-left-color: #c62828;
}
html.theme-dark .rental-debt {
  color: #ffb4a9;
  background: rgba(255, 128, 112, 0.16);
}

.cal-mini-card {
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(42,171,238,0.10), rgba(42,171,238,0.02)),
    var(--tg-secondary-bg, #f4f4f5);
  border: 1px solid rgba(42,171,238,0.18);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}
.cal-mini__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}
.cal-mini__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  color: var(--tg-text, #111);
}
.cal-mini__nav {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  color: var(--tg-text, #111);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.cal-mini-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 10px;
  color: var(--tg-hint);
  text-transform: uppercase;
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-mini-day {
  position: relative;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tg-text, #111);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  line-height: 32px;
}
.cal-mini-day--empty {
  visibility: hidden;
  pointer-events: none;
}
.cal-mini-day--today {
  background: var(--accent, #2aabee);
  color: #fff;
}
.cal-mini-day--busy {
  background: rgba(42,171,238,0.12);
}
.cal-mini-day--note::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #e67e22;
}
.cal-mini-dot { display: none; }
.cal-mini-day--active {
  outline: 1.5px solid var(--accent, #2aabee);
  outline-offset: 0;
  background: rgba(42,171,238,0.22);
}
.cal-mini-hint {
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.25;
}
.cal-mini-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.cal-mini-panel__title {
  font-size: 11px;
  font-weight: 700;
}
.cal-mini-panel .field input {
  font-size: 11px;
  padding: 6px 8px;
}
.cal-mini-panel .btn.small {
  font-size: 11px;
  padding: 6px 8px;
}
.cal-mini-notes {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 90px;
  overflow: auto;
}
.cal-mini-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  line-height: 1.3;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.65);
}
.cal-mini-note .btn {
  flex-shrink: 0;
  padding: 0 4px;
  min-width: 0;
  font-size: 10px;
}

.chart-bars--selectable {
  user-select: none;
  touch-action: pan-y;
  cursor: default;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chart-bar-col {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  min-width: 28px;
}
.chart-bar-col--zero .chart-bar-col__track {
  opacity: 0.45;
}
.chart-bar-col--selected {
  background: color-mix(in srgb, var(--accent, #2aabee) 16%, transparent);
  border-radius: 8px;
}
.chart-bar-col--selected .chart-bar-col__track {
  outline: 2px solid rgba(42,171,238,0.55);
  outline-offset: 1px;
  border-radius: 4px;
}
.chart-bar-col--selected .chart-bar-col__fill {
  filter: brightness(1.08);
}
.chart-range-controls {
  margin: 0 0 8px;
}
.chart-range-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chart-range-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tg-hint);
}
.chart-range-row select {
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--tg-bg, #fff);
  color: var(--tg-text, #111);
  min-width: 84px;
}
.chart-range-summary {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
}
.chart-range-summary--active {
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #2aabee) 12%, var(--tg-secondary-bg, #f4f4f5));
  color: var(--tg-text, #111);
}

/* ---------- CRM: выбор клиентов для рассылки ---------- */

.crm-select {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.crm-select input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- История ремонта техники ---------- */

.history-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.history-panel .muted { margin-bottom: 4px; }

/* ---------- Финансовый отчёт за период ---------- */

.report-range {
  display: flex;
  gap: 8px;
}

.report-range .field { flex: 1; margin-bottom: 0; }

.route-card {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.route-card:active { transform: scale(0.985); }
.route-card h3 { font-size: 14px; margin: 0; }
.route-card__cta {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

body.route-map-open {
  overflow: hidden;
}
body.route-map-open #app {
  visibility: hidden;
}

.route-map-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: var(--tg-bg, #fff);
}
.route-map-sheet[hidden] {
  display: none !important;
}
.route-map-sheet__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand-black, #111);
  color: #fff;
  flex-shrink: 0;
}
.route-map-sheet__back {
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.route-map-sheet__titles { min-width: 0; flex: 1; }
.route-map-sheet__title {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route-map-sheet__meta {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}
.route-map-sheet__map {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #dfe6e9;
}
.route-map-sheet__footer {
  flex-shrink: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--tg-bg, #fff);
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.route-map-sheet__stops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  max-height: 72px;
  overflow: auto;
  font-size: 11px;
  color: var(--tg-hint, #888);
}
.route-map-sheet__stop { white-space: nowrap; }
.route-map-sheet .leaflet-control-attribution {
  display: none !important;
}

/* Опасное действие (удаление профиля) — отделяем от обычных кнопок карточки,
   чтобы «Сохранить» и «Удалить» не стояли вплотную. */
.danger-zone {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.danger-zone .btn.danger {
  margin-top: 8px;
}

.ws-preview {
  margin-top: 8px;
  font-size: 13px;
}
.ws-preview__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.ws-preview__total {
  font-weight: 700;
  margin-top: 6px;
}
.ws-preview__err {
  color: var(--danger);
}
