/* ═══════════════════════════════════════════════
   КОМПОНЕНТЫ: хедер, карточки, кнопки,
   поля, пиллы, navbar, bottomsheet, skeleton, toast
════════════════════════════════════════════════ */
/* ─────────────────────────────────────────────
   ЛОГОТИП И БРЕНДИНГ ШАПКИ
───────────────────────────────────────────── */
.app-logo {
  font-size: var(--text-base);
  font-weight: 900;
  color: var(--color-yellow);
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-greeting {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

/* ─────────────────────────────────────────────
   КНОПКИ-ИКОНКИ
───────────────────────────────────────────── */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-dark);
  transition: background var(--transition-fast);
}

.btn-icon:active {
  background: rgba(0,0,0,0.08);
}

.btn-icon--light {
  color: rgba(255,255,255,0.8);
}

.btn-icon--light:active {
  background: rgba(255,255,255,0.1);
}

/* ─────────────────────────────────────────────
   ОСНОВНЫЕ КНОПКИ
───────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 16px var(--space-xl);
  background: var(--color-yellow);
  color: var(--color-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 900;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary:active {
  opacity: 0.85;
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary--dark {
  background: var(--color-dark);
  color: var(--color-white);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 13px var(--space-xl);
  background: var(--color-bg);
  color: var(--color-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.btn-secondary:active {
  opacity: 0.7;
}

.btn-danger {
  background: var(--c-loss-light);
  color: var(--c-loss);
}

/* ─────────────────────────────────────────────
   КАРТОЧКИ
───────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  overflow: hidden;
}

.card--sm {
  padding: var(--space-md);
}

.card--xl {
  padding: var(--space-xl);
}

.card--pressable {
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.card--pressable:active {
  transform: scale(0.975);
  opacity: 0.9;
}

/* ─────────────────────────────────────────────
   ПОЛЯ ВВОДА
───────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
}

.field-input {
  background: var(--color-bg);
  border-radius: 11px;
  padding: 11px 12px;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-dark);
  width: 100%;
  transition: box-shadow var(--transition-fast);
}

.field-input::placeholder {
  color: var(--color-muted);
  font-weight: 400;
}

.field-input:focus {
  box-shadow: 0 0 0 2px var(--color-dark);
}

.field-input--error {
  box-shadow: 0 0 0 2px var(--c-loss) !important;
}

textarea.field-input {
  resize: none;
  min-height: 88px;
}

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%238A8A8E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ─────────────────────────────────────────────
   PILL-БЕЙДЖИ
───────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-xl);
  font-weight: 700;
  font-size: var(--text-xs);
  padding: 3px 9px;
  white-space: nowrap;
}

.pill--green  { background: var(--c-profit-light);  color: var(--c-profit); }
.pill--red    { background: var(--c-loss-light);    color: var(--c-loss); }
.pill--blue   { background: var(--color-blue-bg);   color: var(--c-neutral); }
.pill--orange { background: var(--color-orange-bg); color: var(--c-loss); }
.pill--muted  { background: var(--color-bg);        color: var(--color-muted); }
.pill--yellow { background: var(--color-yellow);    color: var(--color-dark); }

/* ─────────────────────────────────────────────
   СТРОКИ СПИСКА (list-item)
───────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-white);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

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

.list-item + .list-item {
  border-top: 0.5px solid var(--color-border);
}

.list-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.list-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.list-item:only-child {
  border-radius: var(--radius-lg);
}

.list-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-xl);
}

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

.list-item__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__sub {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.list-item__amount {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-dark);
}

.list-item__amount--positive { color: var(--c-profit); }
.list-item__amount--negative { color: var(--c-loss); }

/* ─────────────────────────────────────────────
   NAVBAR
───────────────────────────────────────────── */
.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  height: var(--navbar-height);
  padding-bottom: var(--safe-bottom);
  background: var(--color-white);
  border-top: 0.5px solid var(--color-border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  padding: var(--space-sm) 4px;
  transition: opacity var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

.nav-item:active {
  opacity: 0.6;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 3px;
  color: #aaa;
  transition: color var(--transition-fast) ease;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  color: inherit;
}

.nav-item.active .nav-icon {
  color: #ffdd2d;
}

.nav-label {
  font-size: var(--text-xs);
  color: #888;
  transition: color var(--transition-fast) ease;
}

.nav-item__dot {
  display: none;
}

.nav-item.active .nav-label {
  color: #FFDD2D;
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   BOTTOMSHEET
───────────────────────────────────────────── */
.bottomsheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.bottomsheet-overlay.visible {
  opacity: 1;
}

.bottomsheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--color-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(100%);
  transition: transform var(--transition-base);
  padding-bottom: calc(var(--safe-bottom) + var(--space-xl));
  max-height: 92dvh;
  overflow-y: auto;
}

.bottomsheet.open {
  transform: translateY(0);
}

.bottomsheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-xs);
  background: var(--color-border);
  margin: var(--space-md) auto var(--space-sm);
}

.bottomsheet-content {
  padding: var(--space-sm) var(--space-lg) 0;
}

.bottomsheet-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-lg);
}

/* ─────────────────────────────────────────────
   SKELETON
───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    #EBEBEB 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

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

.skeleton-line {
  height: var(--space-lg);
  border-radius: 7px;
  margin-bottom: var(--space-sm);
}

.skeleton-line--sm  { height: var(--space-md); }
.skeleton-line--lg  { height: 20px; border-radius: var(--radius-sm); }
.skeleton-line--xl  { height: 48px; border-radius: var(--radius-md); }

.skeleton-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

/* ─────────────────────────────────────────────
   TOAST
───────────────────────────────────────────── */
.toast {
  position: fixed;
  left: var(--space-lg);
  right: var(--space-lg);
  bottom: calc(var(--navbar-height) + var(--safe-bottom) + var(--space-md));
  z-index: 300;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-dark);
  color: var(--color-white);
  font-size: var(--text-base);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--transition-base) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast--success { background: var(--c-profit); }
.toast--error   { background: var(--c-loss); }
.toast--warning { background: var(--c-loss); }
.toast--info    { background: var(--c-neutral); }

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.toast-text {
  flex: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.toast--out {
  animation: toast-out var(--transition-base) ease forwards;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ─────────────────────────────────────────────
   СВОДНАЯ КАРТОЧКА (summary card)
───────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.summary-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.summary-card--full {
  grid-column: 1 / -1;
}

.summary-card__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
}

.summary-card__value {
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-dark);
  letter-spacing: -0.03em;
}

.summary-card__value--green  { color: var(--c-profit); }
.summary-card__value--red    { color: var(--c-loss); }

.summary-card__delta {
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   СЕГМЕНТНЫЙ КОНТРОЛЬ (tabs)
───────────────────────────────────────────── */
.segment-control {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segment-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-align: center;
}

.segment-btn--active {
  background: var(--color-white);
  color: var(--color-dark);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════
   ДИЗАЙН-СИСТЕМА: компоненты от дизайнера
═══════════════════════════════════════════════════════════ */

/* ── Файл 1: секционный лейбл, белая карточка, ряды ── */

.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: #8A8A8E;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0 4px;
  margin-top: 16px;
  margin-bottom: var(--space-sm);
  line-height: 1.2;
}

.white-card {
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 0;
  border: none;
  overflow: hidden;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: var(--space-lg) 16px;
  box-sizing: border-box;
}

.card-row:not(:last-child) {
  border-bottom: 0.5px solid var(--color-bg);
}

/* ── Файл 3: хедер экрана и переключатель месяца ── */

.header {
  background-color: var(--color-dark);
  padding: 24px 16px 16px 16px;
  margin: -12px -16px var(--space-sm) -16px;
}

.header-greeting {
  font-size: var(--text-sm);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 2px;
  line-height: 1.2;
}

.header-name {
  font-size: var(--text-xl);
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.2;
}

.month-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: transparent;
  margin-top: 12px;
  height: 32px;
}

.month-switcher-chevron {
  color: rgba(255, 255, 255, 0.45);
  font-size: var(--text-lg);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.month-switcher-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: #FFFFFF;
  text-align: center;
}

.stat-value {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--color-dark);
  margin-bottom: 2px;
  line-height: 1.2;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  line-height: 1.2;
}

/* ── Файл 5: строки с аватарами, кассы, статусы парка ── */

.row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cash-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-dark);
}

.cash-amount {
  font-size: var(--text-base);
  font-weight: 700;
}

.cash-amount.positive { color: var(--c-profit); }
.cash-amount.negative { color: var(--c-loss);   }

.fleet-letter {
  font-size: var(--text-sm);
  font-weight: 800;
}

.status-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-dark);
}

.status-count {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-dark);
}

.fleet-rented { background-color: #E3F9F0; color: var(--c-profit); }
.fleet-idle   { background-color: var(--color-bg); color: #6C757D;    }
.fleet-repair { background-color: #FFF3E0; color: #F97316;            }

/* ═══════════════════════════════════════════════
   APP HEADER — универсальный хедер экрана
════════════════════════════════════════════════ */

.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  height: var(--header-height);
  padding: 0 var(--space-sm);
  padding-top: max(8px, env(safe-area-inset-top));
}

.app-header--dark {
  background: var(--color-dark);
  color: var(--color-white);
}

.app-header--light {
  background: var(--color-white);
  color: var(--color-dark);
  border-bottom: 0.5px solid var(--color-border);
}

/* Кнопка-иконка слева (back и т.п.) */
.app-header__btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.app-header__btn:active {
  opacity: 0.7;
}

/* Центральный слот: заголовок */
.app-header__center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.app-header__title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

/* Подзаголовок-счётчик справа (для fleet/drivers — «8 машин») */
.app-header__subtitle {
  font-size: var(--text-sm);
  font-weight: 500;
  color: currentColor;
  opacity: 0.55;
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: var(--space-md);
}

/* Пустой спейсер 44px — балансирует кнопку слева, чтобы title был ровно по центру */
.app-header__spacer {
  width: 44px;
  flex-shrink: 0;
}
/* ═══════════════════════════════════════════════
   PERIOD SWITCHER — переключатель периода (месяца)
════════════════════════════════════════════════ */

.period-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
}

.period-switcher__btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  color: inherit;
}

.period-switcher__btn:active:not(:disabled) {
  transform: scale(0.94);
}

.period-switcher__btn--disabled,
.period-switcher__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.period-switcher__spacer {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.period-switcher__label {
  font-size: var(--text-base);
  font-weight: 600;
  text-align: center;
  min-width: 110px;
  color: inherit;
}

/* Тёмная тема (на тёмной шапке) */
.period-switcher--dark .period-switcher__btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
}

.period-switcher--dark .period-switcher__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.period-switcher--dark .period-switcher__label {
  color: var(--color-white);
}

/* Светлая тема (на светлом фоне) */
.period-switcher--light .period-switcher__btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-dark);
}

.period-switcher--light .period-switcher__btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.09);
}

.period-switcher--light .period-switcher__label {
  color: var(--color-dark);
}
/* ═══════════════════════════════════════════════
   PILL — выбираемый таб-фильтр
   Используется для табов статусов/типов в списках.
════════════════════════════════════════════════ */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.pill:active {
  opacity: 0.85;
}

/* Тёмная тема (на тёмном фоне — например, в шапке истории) */
.pill--dark {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
}

.pill--dark:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pill--dark.pill--active {
  background: var(--color-yellow);
  color: var(--color-dark);
  font-weight: 500;
}

/* Светлая тема (на светлом фоне — табы в парке/водителях) */
.pill--light {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-muted);
}

.pill--light:hover {
  background: rgba(0, 0, 0, 0.09);
}

.pill--light.pill--active {
  background: var(--color-yellow);
  color: var(--color-dark);
  font-weight: 500;
}

/* Растягивающийся (flex: 1) — для табов на всю ширину контейнера */
.pill--stretch {
  flex: 1;
  min-width: 0;
}

/* ─────────────────────────────────────────────
   Money typography — символ валюты
   Применять как: 12 450 <span class="rub">₽</span>
───────────────────────────────────────────── */
.rub {
  font-size: 0.65em;
  font-weight: 500;
  margin-left: 0.15em;
  vertical-align: 0.08em;
  opacity: 0.55;
}