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

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  min-height: 100vh;
}

#app {
  width: 100%;
  min-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Блок контента с центрированием */
.page-center {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100vh;
  flex: 1;
}

/* ===== ВЕРХНЕЕ МЕНЮ ===== */
.top-menu {
  background-color: #fff;
  border-bottom: 2px solid #e0e0e0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
}

.logo {
  display: block;
  height: 44px;
  width: auto;
  max-height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.menu-buttons {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  margin-left: 24px;
  margin-right: 24px;
}

.menu-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  background-color: #f0f0f0;
  color: #666;
}

.menu-btn.active {
  background-color: #ff9800;
  color: white;
}

.menu-btn:not(.active):hover {
  background-color: #e0e0e0;
}

.menu-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.menu-dropdown-wrapper .menu-btn:not(.active) {
  background-color: #4caf50;
  color: white;
}

.menu-dropdown-wrapper .menu-btn:not(.active):hover {
  background-color: #45a049;
}

.menu-dropdown-wrapper .menu-btn.active {
  background-color: #ff9800;
  color: white;
}

.menu-dropdown-wrapper .menu-btn.active:hover {
  background-color: #f57c00;
}

.menu-dropdown-wrapper:last-child .menu-btn:not(.active) {
  background-color: #2196f3;
  color: white;
}

.menu-dropdown-wrapper:last-child .menu-btn:not(.active):hover {
  background-color: #1976d2;
}

/* Выпадающее меню настроек */
.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
  margin-top: 4px;
  border-radius: 4px;
  overflow: hidden;
}

/* Меню для настроек - зеленое */
#settings-dropdown {
  background-color: #4caf50;
}

/* Меню для заказов - оранжевое */
#orders-dropdown {
  background-color: #ff9800;
}

/* Меню для аналитики - синее */
#analytics-dropdown {
  background-color: #2196f3;
}

.menu-dropdown.show {
  display: block;
}

.menu-dropdown-item {
  padding: 12px 20px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

/* Hover для зеленого меню */
#settings-dropdown .menu-dropdown-item:hover {
  background-color: #45a049;
}

/* Hover для оранжевого меню */
#orders-dropdown .menu-dropdown-item:hover {
  background-color: #f57c00;
}

/* Hover для синего меню */
#analytics-dropdown .menu-dropdown-item:hover {
  background-color: #1976d2;
}

.menu-dropdown-item:first-child {
  padding-top: 16px;
}

.menu-dropdown-item:last-child {
  padding-bottom: 16px;
}

/* Разделитель между пунктами меню */
.menu-dropdown-divider {
  height: 2px;
  background-color: white;
  margin: 0;
  opacity: 0.3;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  padding: 8px 32px 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 200px;
}

.search-icon {
  position: absolute;
  right: 10px;
  color: #999;
  font-size: 16px;
}

.user-info {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
}

/* ===== ВЫБОР ДАТЫ ===== */
.date-selector {
  background-color: #fff;
  border-bottom: none;
  padding: 16px 24px;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.date-range label {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
}

.date-input-wrapper {
  position: relative;
  display: inline-block;
}

.date-input-display {
  padding: 8px 28px 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 120px;
  background-color: white;
  cursor: pointer;
}

.date-input-display:focus {
  outline: none;
  border-color: #ff9800;
}

.date-input-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.date-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 10px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 10;
}

.date-arrow:hover {
  color: #ff9800;
}

.date-btn {
  padding: 8px 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: white;
  color: #333;
}

.ok-btn {
  background-color: #ff9800;
  color: white;
  border-color: #ff9800;
}

.ok-btn:hover {
  background-color: #f57c00;
}

.clear-btn:hover {
  background-color: #f5f5f5;
}

/* ===== ФИЛЬТР ТИПОВ АВТОМОБИЛЕЙ ===== */
.machine-type-filter {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.machine-type-filter-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
  white-space: nowrap;
  margin-top: 4px;
}

.machine-type-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.machine-type-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  user-select: none;
}

.machine-type-filter-item:hover {
  color: #ff9800;
}

.machine-type-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ff9800;
}

.machine-type-filter-item span {
  white-space: nowrap;
}

/* ===== ОСНОВНАЯ ТАБЛИЦА ===== */
.table-container {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #fff;
  position: relative;
  min-height: 0; /* Важно для flex-контейнера */
  max-height: calc(100vh - 200px); /* Высота экрана минус меню, селектор дат и фильтр типов */
  border: 1px solid #000;
  border-top: none;
  outline: none !important;
  width: 100%;
  max-width: 100%;
  padding-bottom: 20px;
  box-sizing: border-box;
}

/* Обёртка для масштабирования таблицы на мобильном (все машины в ширину экрана, скролл по вертикали) */
.table-scale-wrap {
  display: block;
  width: fit-content;
  height: fit-content;
}

.table-container:focus,
.table-container:focus-visible,
.table-container:focus-within {
  outline: none !important;
  border-top: none !important;
}

.table-container::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.main-table {
  width: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 335px; /* 45 + 45 + 45 + 60 + 140 = 335px */
  table-layout: fixed !important;
  border: 1px solid #000;
  border-top: none; /* Убираем верхнюю границу таблицы */
  margin-bottom: 0; /* Убираем нижний отступ у таблицы, так как он есть у контейнера */
}

.main-table.centered {
  margin-left: auto;
  margin-right: auto;
}

/* Фиксированная шапка при вертикальной прокрутке */
.main-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #0088cc;
}

/* Строка-определитель ширины колонок: нулевая высота, не видна */
.main-table .col-def-row {
  height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  line-height: 0 !important;
  font-size: 0 !important;
  overflow: hidden;
  visibility: visible;
}

.main-table .col-def-row th {
  height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden;
  line-height: 0;
}

/* Заголовок машины */
.machine-header {
  background-color: #0088cc;
  border-top: 1px solid #000 !important;
  border-bottom: 1px solid #000 !important;
  border-left: 1px solid #000 !important;
  border-right: 1px solid #000 !important; /* Черная граница по умолчанию */
  padding: 12px 16px;
  text-align: left;
  height: 80px;
  max-height: 80px;
  vertical-align: top;
  position: sticky;
  top: 0;
  z-index: 11;
  box-sizing: border-box;
}

.machine-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.machine-title {
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.driver-name {
  font-size: 13px;
  color: #000;
  font-weight: 400;
  margin-top: 4px;
}

.driver-phone {
  font-size: 12px;
  color: #000;
  font-weight: 400;
}

/* Подзаголовки колонок */
.sub-header {
  background-color: #0088cc;
  border-bottom: 1px solid #000 !important;
  position: sticky;
  top: 80px; /* Высота первой строки с машинами */
  z-index: 9;
}

.sub-header .date-header {
  height: auto;
  max-height: none;
  border-top: 1px solid #000 !important;
  border-bottom: 1px solid #000 !important;
  border-left: 1px solid #000 !important;
  border-right: 1px solid #000 !important;
  top: 80px; /* Высота первой строки с машинами */
  left: 0;
  z-index: 10;
  box-sizing: border-box;
}

.column-header {
  padding: 8px 16px;
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  color: #000;
  text-transform: uppercase;
  border-top: 1px solid #000 !important;
  border-bottom: 1px solid #000 !important;
  border-left: 1px solid #000 !important;
  border-right: 1px solid #000 !important; /* Черная граница по умолчанию */
  background-color: #0088cc;
  position: sticky;
  top: 80px; /* Высота первой строки с машинами */
  z-index: 9;
  box-sizing: border-box;
}

.column-header:first-child {
  border-left: 1px solid #000 !important;
}

.column-header:last-child {
  border-right: 1px solid #000 !important; /* Черная граница для последней колонки */
}

/* Красная граница между машинами - только после колонки ЗАКАЗЧИК (column-header-customer), кроме последней */
.column-header-customer:not(:last-child) {
  border-right: 1px solid #f44336 !important;
}

/* Границы между заголовками машин в первой строке - красные между машинами */
.machine-header:not(:last-child) {
  border-right: 1px solid #f44336 !important;
}

.machine-header:last-child {
  border-right: 1px solid #000 !important;
}

/* Границы между date-header и первой машиной - 2px */
.date-header + .machine-header {
  border-left: 1px solid #000 !important;
}

/* Ширины столбцов: только по классам ячеек (для всех машин) */
.main-table tbody .hours-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
}

.main-table tbody .price-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
}

.main-table tbody .total-cell {
  width: 60px !important;
  min-width: 60px;
  max-width: 60px;
}

.main-table tbody .address-cell {
  width: 140px !important;
  min-width: 140px;
  max-width: 140px;
}

/* Новая ячейка заказа (одна ячейка вместо 4) */
.main-table tbody .order-cell {
  width: 290px !important;
  min-width: 290px;
  max-width: 290px;
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
  position: relative;
  cursor: pointer;
  border-bottom: 1px solid #000 !important; /* Черная горизонтальная граница внутри дня */
  border-right: 1px solid #f44336 !important; /* Красная вертикальная граница между машинами */
  min-height: 20px;
}

/* Убираем красную границу у последней машины */
.order-cell:last-child {
  border-right: 1px solid #000 !important;
}

/* Hover эффект для пустой ячейки заказа */
.order-cell:not([data-order-data]):hover {
  background-color: #f44336 !important;
  color: #fff;
}

/* Текст "Добавить запись" при hover на пустой ячейке */
.order-cell:not([data-order-data]):hover::after {
  content: "Добавить запись";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* Утолщенная граница для последней строки дня */
.work-row.last-row-of-day .order-cell {
  border-bottom: 2px solid #000 !important;
}

/* ===== ЯЧЕЙКИ ВЫПОЛНЕННОГО ЗАКАЗА ===== */
/* Ячейки выполненного заказа имеют те же размеры, что и заголовки */
.completed-hours-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  text-align: right;
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid #000 !important;
  border-right: 1px solid #000 !important;
}

.completed-price-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  text-align: right;
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid #000 !important;
  border-right: 1px solid #000 !important;
}

.completed-total-cell {
  width: 60px !important;
  min-width: 60px;
  max-width: 60px;
  text-align: right;
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid #000 !important;
  border-right: 1px solid #000 !important;
}

.completed-customer-cell {
  width: 140px !important;
  min-width: 140px;
  max-width: 140px;
  text-align: left;
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid #000 !important;
  border-right: 1px solid #f44336 !important; /* Красная граница между машинами */
}

/* Убираем красную границу у последней машины */
.completed-customer-cell.completed-last-machine {
  border-right: 1px solid #000 !important;
}

/* Утолщенная граница для последней строки дня */
.work-row.last-row-of-day .completed-hours-cell,
.work-row.last-row-of-day .completed-price-cell,
.work-row.last-row-of-day .completed-total-cell,
.work-row.last-row-of-day .completed-customer-cell {
  border-bottom: 2px solid #000 !important;
}

/* Заголовки подколонок: Часы, Цена, Сумма — центровка по классу (для любого числа машин) */
.column-header-hours,
.column-header-price,
.column-header-total {
  padding: 8px 4px;
  text-align: center;
}

.column-header-customer {
  padding: 8px 4px;
}

.date-header {
  padding: 8px 4px;
  background-color: #0088cc;
  border-top: 1px solid #000 !important;
  border-bottom: 1px solid #000 !important;
  border-left: 1px solid #000 !important;
  border-right: 1px solid #000 !important;
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 12;
  height: 80px;
  max-height: 80px;
  vertical-align: top;
  box-sizing: border-box;
}

.sub-header .date-header {
  border-top: 1px solid #000 !important;
  border-bottom: 1px solid #000 !important;
}

/* Вертикальный текст "ДАТА" */
.date-header-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: #000;
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

/* Ячейка с датой */
.date-cell {
  background-color: #f8f9fa;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000; /* Черная граница внутри дня */
  border-left: 1px solid #000;
  padding: 0;
  vertical-align: middle;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 5;
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  height: auto;
  box-sizing: border-box;
}

/* Граница между днями для ячейки даты - 2px */
.work-row.last-row-of-day .date-cell {
  border-bottom: 2px solid #000;
}

.work-row.empty .date-cell {
  height: 20px !important;
}

/* Чередование цветов для дней по дню недели */
.date-cell.day-even {
  background-color: #e8f5e9 !important; /* Светло-зеленый */
  z-index: 5;
}

.date-cell.day-odd {
  background-color: #e3f2fd !important; /* Светло-синий */
  z-index: 5;
}

/* Сегодняшний день - оранжевый */
.date-cell.today {
  background-color: #ff9800 !important; /* Оранжевый */
  z-index: 5;
}

.date-content {
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  height: 100%;
  text-align: center;
}

.work-row.empty .date-content {
  min-height: 20px !important;
  height: 20px !important;
}

.date-number {
  font-size: 13px;
  font-weight: 600;
  color: #000; /* Черный цвет */
  line-height: 1.2;
  text-align: center;
}

.day-name {
  font-size: 11px;
  color: #000; /* Черный цвет */
  margin-top: 2px;
  line-height: 1.2;
  text-align: center;
}

/* Строки работы */
.work-row {
  border-bottom: 1px solid #000; /* Черная граница внутри дня */
  transition: background-color 0.15s ease;
  cursor: pointer;
}

/* Разделитель между днями - черная линия 2px */
.work-row.last-row-of-day {
  border-bottom: 2px solid #000;
}

/* Внешние границы таблицы */
.work-row:first-child {
  border-top: 1px solid #000;
}

.work-row:last-child {
  border-bottom: 2px solid #000; /* 2px для последней строки */
}

/* Отступ снизу для последней строки таблицы, чтобы она была полностью видна при прокрутке */
.main-table tbody tr:last-child td {
  padding-bottom: 20px !important;
  box-sizing: border-box;
}

.work-row.empty {
  height: 20px !important;
  max-height: 20px !important;
}

.work-row.has-order {
  height: auto;
  min-height: 20px;
}

/* Чередование цветов для строк по дню недели */
.work-row.day-even {
  background-color: #e8f5e9; /* Светло-зеленый */
}

.work-row.day-odd {
  background-color: #e3f2fd; /* Светло-синий */
}

.work-row.today {
  background-color: #ff9800; /* Оранжевый для сегодня */
}

/* Подсветка ячеек одной машины при hover */
.hours-cell.machine-hover:not([data-order-data]):not(.order-description-cell),
.price-cell.machine-hover:not([data-order-data]):not(.order-description-cell),
.total-cell.machine-hover:not([data-order-data]):not(.order-description-cell),
.address-cell.machine-hover:not([data-order-data]):not(.order-description-cell) {
  background-color: #f44336 !important;
}

/* Ячейки данных */
.hours-cell,
.price-cell,
.total-cell,
.address-cell {
  padding: 2px 16px;
  border-right: 1px solid #000; /* Черная граница по умолчанию */
  border-bottom: 1px solid #000; /* Черная граница внутри дня */
  vertical-align: top;
  height: 20px;
  line-height: 16px;
}

/* Красная граница между машинами - только после колонки ЗАКАЗЧИК (address-cell), кроме последней */
.address-cell:not(:last-child) {
  border-right: 1px solid #f44336 !important;
}

/* Черная линия разделения дней в ячейках данных - 2px */
.work-row.last-row-of-day .hours-cell,
.work-row.last-row-of-day .price-cell,
.work-row.last-row-of-day .total-cell,
.work-row.last-row-of-day .address-cell {
  border-bottom: 2px solid #000;
}

/* Внешние границы для первой колонки */
.hours-cell {
  border-left: 1px solid #000;
}

/* Последняя колонка последней машины - черная граница */
.main-table tbody .address-cell:last-child {
  border-right: 1px solid #000;
}

.work-row.empty .hours-cell,
.work-row.empty .price-cell,
.work-row.empty .total-cell,
.work-row.empty .address-cell {
  padding: 2px 16px !important;
  height: 20px !important;
  max-height: 20px !important;
  line-height: 16px !important;
  overflow: hidden;
}

.work-row.has-order .hours-cell,
.work-row.has-order .price-cell,
.work-row.has-order .total-cell {
  height: auto;
}

.hours-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  padding: 2px 4px;
}

.work-row.empty .hours-cell {
  padding: 2px 4px !important;
  height: 20px !important;
  max-height: 20px !important;
}

.price-cell {
  width: 45px !important;
  min-width: 45px;
  max-width: 45px;
  padding: 2px 4px;
}

.work-row.empty .price-cell {
  padding: 2px 4px !important;
  height: 20px !important;
  max-height: 20px !important;
}

.total-cell {
  width: 60px !important;
  min-width: 60px;
  max-width: 60px;
  padding: 2px 4px;
}

.work-row.empty .total-cell {
  padding: 2px 4px !important;
  height: 20px !important;
  max-height: 20px !important;
}

/* ЧАСЫ, ЦЕНА, СУММА — для всех машин: фиксированная ширина, центровка, обрезка */
.main-table tbody .hours-cell,
.main-table tbody .price-cell,
.main-table tbody .total-cell {
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
  box-sizing: border-box !important;
  text-align: center !important;
  overflow: hidden !important;
  padding: 2px 4px !important;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}

.main-table tbody .total-cell {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
}

.hours-cell,
.price-cell,
.total-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.total-cell {
  font-weight: 600;
  color: #2e7d32;
}

.total-cell:not(:empty) {
  color: #2e7d32;
}

.address-cell {
  width: 140px !important;
  min-width: 140px;
  max-width: 140px;
  padding: 2px 4px;
  text-align: left;
  font-size: 13px;
  color: #333;
  word-wrap: break-word;
  line-height: 1.4;
}

.work-row.empty .address-cell {
  padding: 2px 4px !important;
  height: 20px !important;
  max-height: 20px !important;
}

/* Пустые ячейки */
.work-row.empty .hours-cell,
.work-row.empty .price-cell,
.work-row.empty .total-cell {
  color: #ccc;
}

/* Tooltip при наведении - показывается только в ячейке ЗАКАЗЧИК */
.address-cell.machine-hover:not([data-order-data]):not(.order-description-cell)::after {
  content: "Добавить заявку";
  position: absolute;
  background-color: transparent;
  color: #fff;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  align-items: center;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Позиционирование tooltip */
.hours-cell,
.price-cell,
.total-cell,
.address-cell {
  position: relative;
  cursor: pointer;
}

/* Пустые ячейки с данными */
.hours-cell:empty,
.price-cell:empty,
.total-cell:empty {
  color: #ccc;
}

/* ===== МОДАЛЬНОЕ ОКНО ДЛЯ ЗАЯВКИ ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  overflow-x: visible;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 4px solid #ff9800;
  margin: auto;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px 20px 24px;
  border-bottom: 1px solid #e0e0e0;
  min-height: 60px;
  box-sizing: border-box;
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #ff9800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #ff9800;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #f57c00;
}

.order-form {
  padding: 24px;
  overflow: visible;
}

.driver-form {
  padding: 24px;
  overflow: visible;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  overflow: visible;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: #ff9800;
  margin-bottom: 8px;
  display: block;
  white-space: nowrap;
  overflow: visible;
}

.form-label.required::after {
  content: "*";
  color: #ff9800;
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background-color: white;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #ff9800;
}

.form-input[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.form-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #ff9800;
}

/* Автодополнение */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.autocomplete-item:hover {
  background-color: #fff3e0;
}

.form-actions {
  display: flex;
  gap: 11px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.btn-primary {
  padding: 11px 22px;
  background-color: #ff9800;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: #f57c00;
}

.btn-secondary {
  padding: 11px 22px;
  background-color: white;
  color: #ff9800;
  border: 2px solid #ff9800;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-complete {
  padding: 11px 22px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-complete:hover {
  background-color: #45a049;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: #fff3e0;
}

.btn-telegram {
  background-color: #0088cc;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-telegram:hover {
  background-color: #006ba3;
}

.btn-delete {
  padding: 11px 22px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-delete:hover {
  background-color: #d32f2f;
}

/* Строка с заявкой */
.work-row.has-order.day-even {
  background-color: #e8f5e9; /* Светло-зеленый */
}

.work-row.has-order.day-odd {
  background-color: #e3f2fd; /* Светло-синий */
}

.work-row.has-order.today {
  background-color: #ff9800; /* Оранжевый для сегодня */
}

/* Ячейка с заполненным заказом */
.order-description-cell {
  padding: 4px 16px !important;
  text-align: left;
  font-size: 13px;
  color: #333;
  word-wrap: break-word;
  line-height: 1.4;
  height: auto !important;
  min-height: 20px;
  vertical-align: top;
  border-bottom: 1px solid #000 !important; /* Черная горизонтальная граница внутри дня */
  border-right: 1px solid #f44336 !important; /* Красная вертикальная граница между машинами */
}

/* Убираем красную границу у последней машины */
.order-description-cell.order-last-machine,
.order-description-cell:last-child {
  border-right: 1px solid #000 !important;
}

/* Утолщенная граница для последней строки дня */
.work-row.last-row-of-day .order-description-cell {
  border-bottom: 2px solid #000 !important;
}

.order-description-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== РАЗДЕЛ ВОДИТЕЛЕЙ ===== */
.drivers-section {
  padding: 24px;
  background-color: #fff;
}

.drivers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.drivers-title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.btn-add-driver {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-add-driver:hover {
  background-color: #45a049;
}

.add-icon {
  font-size: 18px;
  font-weight: bold;
}

.drivers-search {
  margin-bottom: 20px;
}

.search-drivers-input {
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 300px;
}

.search-drivers-input:focus {
  outline: none;
  border-color: #4caf50;
}

.drivers-table-container {
  overflow-x: auto;
}

.drivers-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.drivers-table thead {
  background-color: #f8f9fa;
}

.drivers-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid #dee2e6;
}

.drivers-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.drivers-table th.sortable:hover {
  background-color: #e9ecef;
}

.sort-arrows {
  font-size: 10px;
  color: #999;
  margin-left: 8px;
}

.drivers-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.15s ease;
}

.drivers-table tbody tr:hover {
  background-color: #f8f9fa;
}

.drivers-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
}

.driver-name-cell,
.driver-phone-cell,
.driver-birthdate-cell,
.driver-hiredate-cell,
.driver-firedate-cell {
  vertical-align: middle;
}

.driver-edit-cell {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.driver-edit-icon {
  cursor: pointer;
  color: #666;
  font-size: 16px;
  padding: 4px;
  display: inline-block;
}

.driver-edit-icon:hover {
  color: #ff9800;
}

.driver-inactive .driver-name-cell,
.driver-inactive .driver-phone-cell,
.driver-inactive .driver-birthdate-cell,
.driver-inactive .driver-hiredate-cell,
.driver-inactive .driver-firedate-cell {
  text-decoration: line-through;
  color: #999;
}

.driver-actions-cell {
  text-align: right;
}

.driver-action-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.driver-action-btn.btn-fire {
  background-color: #f44336;
  color: white;
}

.driver-action-btn.btn-fire:hover {
  background-color: #d32f2f;
}

.driver-action-btn.btn-restore {
  background-color: #2196f3;
  color: white;
}

.driver-action-btn.btn-restore:hover {
  background-color: #1976d2;
}

/* Модальное окно для водителя */
.driver-modal {
  max-width: 600px;
  overflow: visible;
}

.driver-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  overflow: visible;
}

.driver-form .form-group {
  overflow: visible;
  min-width: 0;
}

/* ===== РАЗДЕЛ АВТОПАРКА ===== */
.fleet-section {
  padding: 24px;
  background-color: #fff;
}

.fleet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.fleet-title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.btn-add-machine {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-add-machine:hover {
  background-color: #45a049;
}

.fleet-search {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fleet-search-label {
  font-size: 14px;
  color: #333;
}

.search-machines-input {
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 300px;
}

.search-machines-input:focus {
  outline: none;
  border-color: #4caf50;
}

.fleet-table-container {
  overflow-x: auto;
}

.fleet-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.fleet-table thead {
  background-color: #f8f9fa;
}

.fleet-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid #dee2e6;
}

.fleet-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.fleet-table th.sortable:hover {
  background-color: #e9ecef;
}

.fleet-th-edit {
  width: 36px;
}

.fleet-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.15s ease;
}

.fleet-table tbody tr:hover {
  background-color: #f8f9fa;
}

.fleet-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
}

/* ===== ТАБЛИЦА ДОЛЖНИКОВ ===== */
.debtors-section {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.debtors-section .section-header {
  margin-bottom: 24px;
}

.debtors-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.debtors-table-container {
  overflow-x: auto;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.debtors-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.debtors-table thead {
  background-color: #f8f9fa;
}

.debtors-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid #dee2e6;
}

.debtors-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.debtors-table .sort-arrows {
  font-size: 10px;
  color: #999;
  margin-left: 4px;
  display: inline-block;
}

.debtors-table th.sortable:hover {
  background-color: #e9ecef;
}

.debtors-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.15s ease;
}

.debtors-table tbody tr:hover {
  background-color: #f8f9fa;
}

.debtors-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  vertical-align: middle;
}

.debtors-table tfoot {
  background-color: #f8f9fa;
  font-weight: 600;
}

.debtors-table tfoot td {
  padding: 12px 16px;
  border-top: 2px solid #dee2e6;
}

.btn-edit-debtor {
  background-color: #ff9800;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-edit-debtor:hover {
  background-color: #f57c00;
}

.pagination-info {
  margin-top: 16px;
  font-size: 14px;
  color: #666;
}

/* ===== ТАБЛИЦА ТАРИФОВ НА ЗАРПЛАТУ ===== */
.salary-tariffs-section {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.salary-tariffs-section .section-header {
  margin-bottom: 24px;
}

.salary-tariffs-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.salary-tariffs-table-container {
  overflow-x: auto;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.salary-tariffs-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.salary-tariffs-table thead {
  background-color: #f8f9fa;
}

.salary-tariffs-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid #dee2e6;
}

.salary-tariffs-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.15s ease;
}

.salary-tariffs-table tbody tr:hover {
  background-color: #f8f9fa;
}

.salary-tariffs-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  vertical-align: middle;
}

.btn-edit-tariff {
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-edit-tariff:hover {
  background-color: #45a049;
}

/* Стили для списка водителей в форме редактирования тарифов */
.tariff-drivers-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  background-color: #f9f9f9;
  margin-top: 8px;
}

.tariff-driver-checkbox {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.tariff-driver-checkbox:last-child {
  border-bottom: none;
}

.tariff-driver-checkbox-input {
  margin-right: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.tariff-driver-checkbox-label {
  cursor: pointer;
  font-size: 14px;
  color: #333;
  user-select: none;
  flex: 1;
}

.tariff-driver-checkbox-label:hover {
  color: #4caf50;
}

/* ===== РАСЧЁТ ЗАРПЛАТЫ (АНАЛИТИКА И РАСЧЁТЫ → ЗАРПЛАТА) ===== */
.salary-report-section {
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.salary-report-section .section-header {
  margin-bottom: 24px;
}

.salary-report-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* ===== ЗАТРАТЫ (АНАЛИТИКА И РАСЧЁТЫ → ЗАТРАТЫ) ===== */
.costs-section {
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.costs-section .section-header {
  margin-bottom: 24px;
}

.costs-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.costs-content {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.costs-placeholder {
  color: #666;
  font-size: 15px;
  margin: 0;
  line-height: 1.5;
}

/* ===== АНАЛИТИКА (АНАЛИТИКА И РАСЧЁТЫ → АНАЛИТИКА) ===== */
.analytics-section {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.analytics-section .section-header {
  margin-bottom: 20px;
}

.analytics-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.analytics-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 20px;
}

.analytics-label {
  font-size: 14px;
  color: #333;
  white-space: nowrap;
}

.analytics-input-date {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  min-width: 140px;
}

.btn-analytics-ok {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: #4caf50;
  color: #fff;
}

.btn-analytics-ok:hover {
  background-color: #43a047;
}

.analytics-report-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 24px;
  text-align: center;
}

.analytics-charts {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.analytics-chart-wrap {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.analytics-chart-bars canvas {
  max-width: 100%;
  height: auto;
}

.analytics-chart-pie {
  max-width: 480px;
  margin: 0 auto;
}

.analytics-chart-pie canvas {
  max-width: 100%;
  height: auto;
}

/* ===== ЭКРАН ВХОДА ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
  text-align: center;
}

.login-logo {
  display: block;
  max-width: 220px;
  height: auto;
  margin: 0 auto 12px auto;
}

.login-subtitle {
  font-size: 14px;
  color: #666;
  margin: 0 0 24px 0;
  text-align: center;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-error {
  color: #c62828;
  font-size: 13px;
  margin-bottom: 12px;
}

.btn-login-submit {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}

.login-hint {
  font-size: 12px;
  color: #999;
  margin: 16px 0 0 0;
  text-align: center;
}

.login-success-msg {
  font-size: 14px;
  color: #2e7d32;
  margin-bottom: 12px;
  text-align: center;
}

.login-register-link {
  font-size: 14px;
  margin: 16px 0 0 0;
  text-align: center;
}

.login-register-link a {
  color: #1565c0;
  text-decoration: none;
}

.login-register-link a:hover {
  text-decoration: underline;
}

.register-card .register-form .form-group { margin-bottom: 14px; }

.register-email-notice {
  font-size: 13px;
  color: #555;
  margin: 0 0 16px 0;
  padding: 10px 12px;
  background: #f5f5f5;
  border-radius: 6px;
  border-left: 3px solid #1565c0;
}

.form-hint-inline {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.user-info-name { margin-right: 8px; }
.user-info-role { color: #666; font-size: 13px; margin-right: 12px; }
.user-logout { color: #0088cc; text-decoration: none; font-size: 14px; }
.user-logout:hover { text-decoration: underline; }

/* ===== Экспорт данных (Управление настройками → Экспорт данных) ===== */
.export-section {
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
}

.export-section .section-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
}

.export-description {
  color: #555;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.export-import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  max-width: 700px;
}

@media (max-width: 600px) {
  .export-import-grid {
    grid-template-columns: 1fr;
  }
}

.export-import-block {
  padding: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}

.export-import-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.export-orders-modal.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.export-orders-modal .modal-content {
  padding: 24px;
  min-width: 320px;
  max-width: 420px;
}

.export-orders-modal .modal-title {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.export-modal-desc {
  font-size: 13px;
  color: #555;
  margin-bottom: 16px;
  line-height: 1.4;
}

.export-orders-modal .export-period-inputs {
  margin-bottom: 20px;
}

.export-period-label-inline {
  display: inline-block;
  min-width: 28px;
  font-size: 13px;
  color: #555;
}

.export-orders-modal .export-date-input {
  margin-left: 4px;
  margin-right: 12px;
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.export-modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.export-modal-actions .btn-export {
  min-width: 120px;
}

.export-period-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.export-date-input {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-btn {
  align-self: flex-start;
  min-width: 240px;
  padding: 11px 22px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}

.btn-export {
  background-color: #ff9800;
  color: white;
}

.btn-export:hover {
  background-color: #f57c00;
}

.btn-import {
  background-color: #4caf50;
  color: white;
}

.btn-import:hover {
  background-color: #45a049;
}

/* ===== Пользователи (Управление настройками → Пользователи) ===== */
.users-section {
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.users-section .section-header {
  margin-bottom: 20px;
}

.users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.users-section .section-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.users-add-link {
  color: #4caf50;
  font-weight: 500;
  text-decoration: none;
}

.users-add-link:hover {
  text-decoration: underline;
}

.users-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.users-search-label { font-size: 14px; color: #333; }
.users-search-input {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  min-width: 220px;
}

.users-table-wrap { overflow-x: auto; margin-bottom: 16px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th,
.users-table td { border: 1px solid #dee2e6; padding: 10px 12px; text-align: left; }
.users-table th { background: #f8f9fa; font-weight: 600; color: #333; }
.users-table tbody tr:hover { background: #f8f9fa; }
.users-th-edit { width: 44px; }
.users-cell-edit { vertical-align: middle; }
.btn-users-edit {
  padding: 4px 8px;
  border: 1px solid #0088cc;
  background: #fff;
  color: #0088cc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.btn-users-edit:hover { background: #0088cc; color: #fff; }
.users-no-data { color: #666; text-align: center; padding: 24px !important; }
.users-pagination-info { font-size: 13px; color: #666; margin: 0; }

.user-form-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.user-form-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  position: relative;
}

.user-form-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: #f44336;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}

.user-form-modal-close:hover { background: #c62828; }
.user-form-modal-title { font-size: 18px; font-weight: 600; color: #333; margin: 0 0 20px 0; padding-right: 36px; }
.user-form .form-group { margin-bottom: 16px; }
.form-hint { font-size: 12px; color: #666; display: block; margin-top: 4px; }
.form-label-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.form-group-checkbox { margin-bottom: 8px; }
.user-form-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn-user-save { padding: 10px 20px; font-size: 14px; font-weight: 500; border: none; border-radius: 4px; cursor: pointer; background: #e91e63; color: #fff; }
.btn-user-save:hover { background: #c2185b; }
.btn-user-delete { padding: 10px 20px; font-size: 14px; font-weight: 500; border: 1px solid #0088cc; background: #fff; color: #0088cc; border-radius: 4px; cursor: pointer; }
.btn-user-delete:hover { background: #0088cc; color: #fff; }

.costs-filters {
  margin-bottom: 20px;
}

.costs-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.costs-filter-label {
  font-size: 14px;
  color: #333;
  white-space: nowrap;
}

.costs-input-date {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  min-width: 140px;
}

.costs-select-direction {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  min-width: 180px;
}

.btn-costs-ok,
.btn-costs-clear {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: #ff9800;
  color: #fff;
}

.btn-costs-ok:hover,
.btn-costs-clear:hover {
  background-color: #f57c00;
}

.btn-costs-add {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: #4caf50;
  color: #fff;
}

.btn-costs-add:hover {
  background-color: #43a047;
}

.costs-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.costs-input-search {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  min-width: 260px;
  flex: 1;
  max-width: 400px;
}

.costs-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.costs-table th,
.costs-table td {
  border: 1px solid #dee2e6;
  padding: 10px 12px;
  text-align: left;
}

.costs-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.costs-table tbody tr:hover {
  background: #f8f9fa;
}

.costs-th-edit {
  width: 90px;
}

.costs-cell-edit {
  vertical-align: middle;
}

.costs-cell-amount {
  text-align: right;
  white-space: nowrap;
}

.costs-no-data {
  color: #666;
  text-align: center;
  padding: 24px !important;
}

.btn-costs-edit {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #0088cc;
  background: #fff;
  color: #0088cc;
  border-radius: 4px;
  cursor: pointer;
}

.btn-costs-edit:hover {
  background: #0088cc;
  color: #fff;
}

/* Модальное окно добавления/редактирования затраты */
.costs-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.costs-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  position: relative;
  border: 2px solid #ff9800;
}

.costs-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f44336;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.costs-modal-close:hover {
  background: #c62828;
}

.costs-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 20px 0;
  padding-right: 36px;
}

.costs-expense-form .costs-form-row {
  margin-bottom: 16px;
}

.costs-expense-form .costs-form-row-inline {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.costs-expense-form .costs-form-group {
  flex: 1;
  min-width: 140px;
}

.costs-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.costs-form-label-required::after {
  content: ' *';
  color: #c62828;
}

.costs-form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.costs-form-input:focus {
  outline: none;
  border-color: #0088cc;
}

.costs-form-actions {
  margin-top: 24px;
}

.btn-costs-save {
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: #ff9800;
  color: #fff;
}

.btn-costs-save:hover {
  background-color: #f57c00;
}

.salary-report-controls {
  margin-bottom: 24px;
}

.salary-report-controls .form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.salary-report-controls .form-group {
  margin-bottom: 0;
}

.period-selectors {
  display: flex;
  gap: 8px;
}

.period-selectors .form-select {
  min-width: 140px;
}

.salary-report-controls .form-input[type="date"] {
  min-width: 160px;
}

.salary-report-controls #salary-report-driver {
  min-width: 220px;
}

.salary-report-message {
  color: #666;
  padding: 24px;
  text-align: center;
}

.salary-report-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 24px;
}

.salary-report-card-header {
  padding: 16px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.salary-report-header-info {
  flex: 1;
  min-width: 200px;
}

.salary-report-employee-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 4px 0;
}

.salary-report-period {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.salary-report-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-print {
  background-color: #666;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-print:hover {
  background-color: #555;
}

.salary-report-table-wrap {
  overflow-x: auto;
}

.salary-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.salary-report-table th,
.salary-report-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.salary-report-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.salary-report-number {
  text-align: right;
  white-space: nowrap;
}

.salary-report-total-row {
  background: #f0f4f0;
  font-weight: 500;
}

.salary-report-total-row td {
  border-bottom: 2px solid #dee2e6;
  padding-top: 12px;
  padding-bottom: 12px;
}

.salary-report-advance-row td,
.salary-report-bonus-row td {
  border-bottom: 1px solid #dee2e6;
  padding: 8px 10px;
  vertical-align: middle;
}

.salary-report-input-cell {
  text-align: right;
}

.salary-report-sum-input {
  width: 100%;
  max-width: 120px;
  padding: 6px 8px;
  font-size: 14px;
  text-align: right;
  border: 1px solid #ced4da;
  border-radius: 4px;
  box-sizing: border-box;
}

.salary-report-sum-input:focus {
  outline: none;
  border-color: #0088cc;
  box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.2);
}

.salary-report-final-total {
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  border-top: 2px solid #dee2e6;
  background: #f8f9fa;
}

/* Стили для печати */
@media print {
  body * {
    visibility: hidden;
  }
  
  .salary-report-card,
  .salary-report-card * {
    visibility: visible;
  }
  
  .salary-report-card {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  
  .salary-report-header-actions {
    display: none !important;
  }
  
  .salary-report-controls {
    display: none !important;
  }
  
  .top-menu {
    display: none !important;
  }
  
  .salary-report-table {
    font-size: 12px;
  }
  
  .salary-report-table th,
  .salary-report-table td {
    padding: 6px 8px;
  }
}

.machine-edit-cell {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.machine-edit-icon {
  cursor: pointer;
  color: #666;
  font-size: 16px;
  padding: 4px;
  display: inline-block;
}

.machine-edit-icon:hover {
  color: #ff9800;
}

.machine-name-cell,
.machine-plate-cell,
.machine-type-cell,
.machine-default-driver-cell {
  vertical-align: middle;
}

.machine-inactive .machine-name-cell,
.machine-inactive .machine-plate-cell,
.machine-inactive .machine-type-cell,
.machine-inactive .machine-default-driver-cell {
  text-decoration: line-through;
  color: #999;
}

.machine-actions-cell {
  text-align: right;
}

.machine-action-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.machine-action-btn.btn-delete {
  background-color: #f44336;
  color: white;
}

.machine-action-btn.btn-delete:hover {
  background-color: #d32f2f;
}

.machine-action-btn.btn-restore {
  background-color: #2196f3;
  color: white;
}

.machine-action-btn.btn-restore:hover {
  background-color: #1976d2;
}

.fleet-pagination {
  margin-top: 20px;
  font-size: 14px;
  color: #666;
}

.fleet-pagination-info {
  display: inline-block;
}

.machine-modal {
  max-width: 580px;
  min-width: 320px;
  overflow: visible;
  box-sizing: border-box;
}

.machine-form {
  padding: 24px;
  padding-right: 28px;
  overflow: visible;
  box-sizing: border-box;
}

.machine-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  overflow: visible;
}

.machine-form .form-group {
  overflow: visible;
  min-width: 0;
}

.machine-form .form-input {
  max-width: 100%;
  box-sizing: border-box;
}

/* Мобильные: без контейнеров с прокруткой — страница как простая HTML, скролл у всей страницы.
   min-width: 120vw у корня даёт контенту «запас» по ширине, чтобы iOS Safari разрешал отдаление (zoom out). */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    min-width: 120vw;
    overflow-x: auto;
    overflow-y: auto;
  }
  #app {
    width: 100%;
    min-width: 120vw;
  }
  .page-center {
    width: 100%;
    max-width: 100%;
    min-height: auto;
  }

  /* Контейнер таблицы заказов: без своей прокрутки, контент в общем потоке */
  .table-container {
    overflow: visible;
    max-height: none;
    min-height: auto;
  }

  /* Верхнее меню: без своей прокрутки, при широком контенте скроллится вся страница */
  .top-menu {
    flex-wrap: nowrap;
    overflow: visible;
    padding: 8px 10px;
    gap: 6px;
    justify-content: flex-start;
    min-width: 0;
  }
  .top-menu .logo {
    height: 36px;
    max-height: 36px;
    flex-shrink: 0;
  }
  .menu-buttons {
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 6px;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
  }
  .menu-buttons .menu-btn {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
  }
  .menu-dropdown-wrapper .menu-btn {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
  }
  .top-right {
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 8px;
  }
  .top-right .search-box {
    min-width: 0;
    max-width: 120px;
  }
  .top-right .search-input {
    max-width: 100px;
    font-size: 12px;
  }
  .top-right .user-info {
    font-size: 12px;
    white-space: nowrap;
  }

  /* Блок дат и фильтров: перенос строк, компактнее */
  .date-selector {
    padding: 10px 10px;
    gap: 10px;
    align-items: flex-start;
  }
  .date-range {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }
  .date-range label {
    font-size: 13px;
  }
  .date-input-display {
    width: 100px;
    padding: 6px 24px 6px 10px;
    font-size: 13px;
  }
  .date-btn {
    padding: 6px 14px;
    font-size: 13px;
  }
  .machine-type-filter {
    margin-top: 10px;
    padding-top: 10px;
    gap: 8px;
    justify-content: flex-start;
  }
  .machine-type-filter-label {
    font-size: 13px;
  }
  .machine-type-filter-list {
    gap: 8px;
  }
  .machine-type-filter-item {
    font-size: 13px;
  }

  .table-container {
    width: 100%;
    max-width: 100%;
  }

  /* На мобильном ничего не фиксируем при прокрутке: страница как обычный HTML, даты и шапка машин скроллятся вместе с таблицей */
  .main-table thead {
    position: static;
    top: auto;
  }
  .main-table .machine-header {
    position: static;
    top: auto;
  }
  .main-table .sub-header {
    position: static;
    top: auto;
  }
  .main-table .sub-header .date-header {
    position: static;
    top: auto;
    left: auto;
  }
  .main-table .date-header {
    position: static;
    top: auto;
    left: auto;
  }
  .main-table .date-cell,
  .main-table .date-cell.day-even,
  .main-table .date-cell.day-odd,
  .main-table .date-cell.today {
    position: static;
    left: auto;
  }

  /* Все контейнеры с прокруткой — показываем как обычный поток, скролл у страницы */
  .drivers-table-container,
  .fleet-table-container,
  .debtors-table-container,
  .salary-tariffs-table-container,
  .users-table-wrap,
  .costs-table-wrap,
  .salary-report-table-wrap {
    overflow: visible;
  }
  .drivers-section,
  .fleet-section,
  .debtors-section {
    overflow: visible;
  }
}
