/* ============================================
   THEME CONFIGURATION
   Измените эти переменные для настройки темы
   ============================================ */

:root {
  /* === ЦВЕТА === */
  /* Основные цвета */
  --accent-color: #2563eb;           /* Основной акцентный цвет (синий) */
  --accent-color-hover: #1d4ed8;     /* Акцентный цвет при наведении */
  --accent-light: #dbeafe;           /* Светлый акцентный фон */
  
  /* Цвета текста */
  --text-primary: #111827;           /* Основной текст */
  --text-secondary: #6b7280;         /* Вторичный текст */
  
  /* Цвета фона */
  --bg-white: #ffffff;               /* Белый фон */
  --bg-gray-50: #f9fafb;             /* Очень светло-серый */
  --bg-gray-100: #f3f4f6;            /* Светло-серый */
  
  /* Цвета состояний */
  --success-color: #10b981;          /* Успех (зеленый) */
  --danger-color: #ef4444;           /* Опасность (красный) */
  --warning-color: #f59e0b;          /* Предупреждение (оранжевый) */
  
  /* Границы и разделители */
  --border-color: #d1d5db;           /* Цвет границ */
  --hover-bg: #f3f4f6;               /* Фон при наведении */
  
  /* === РАЗМЕРЫ === */
  --sidebar-width: 256px;            /* Ширина боковой панели */
  --border-radius: 6px;              /* Радиус скругления */
  --transition-speed: 0.2s;          /* Скорость анимации */
  
  /* === ШРИФТЫ === */
  --font-family: 'Manrope', sans-serif;
  --font-size-base: 14px;
  --font-size-sm: 13px;
  --font-size-lg: 16px;
}


/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */

body, h1, h2, h3, h4, h5, h6, p, a, span, div, input, button, table {
  font-family: var(--font-family);
}

html, body {
  height: 100%;
  margin: 0;
  scroll-behavior: smooth;
}

.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  flex: 1;
}


/* ============================================
   КНОПКИ
   ============================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--border-radius);
  color: white;
  background-color: var(--accent-color);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed);
}

.btn-primary:hover {
  background-color: var(--accent-color-hover);
  text-decoration: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  background-color: var(--bg-white);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed);
}

.btn-secondary:hover {
  background-color: var(--bg-gray-50);
  text-decoration: none;
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--border-radius);
  color: white;
  background-color: var(--success-color);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed);
}

.btn-success:hover {
  background-color: #059669;
  text-decoration: none;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--border-radius);
  color: white;
  background-color: var(--danger-color);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed);
}

.btn-danger:hover {
  background-color: #dc2626;
  text-decoration: none;
}

/* Размеры кнопок */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--font-size-lg);
}


/* ============================================
   SIDEBAR (БОКОВАЯ ПАНЕЛЬ)
   ============================================ */

.sidebar-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  background-color: #f8f9fa;
}

.sidebar-header img {
  height: 45px;
  width: 45px;
  border-radius: 8px;
}

.sidebar-header span {
  margin-left: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--transition-speed) ease;
  cursor: pointer;
}

.nav-link:hover:not(.active) {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-color);
  background-color: var(--accent-light);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.nav-link[href*="logout"] {
  color: #dc2626a3 !important;
}

.nav-link[href*="logout"]:hover:not(.active) {
  background-color: #fee2e2;
}

.nav-link[href*="logout"].active {
  background-color: #fecaca;
}

.sidebar-user {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--hover-bg);
  flex-shrink: 0;
}

.user-avatar span {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.user-role {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-speed) ease;
  flex-shrink: 0;
}

.settings-btn:hover {
  color: var(--text-primary);
}

.settings-btn svg {
  width: 20px;
  height: 20px;
}

/* Desktop sidebar */
.sidebar-desktop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: #f8f9fa;
  overflow-y: auto;
  z-index: 40;
}

@media (min-width: 1024px) {
  .sidebar-desktop {
    display: flex;
  }
  body {
    margin-left: var(--sidebar-width);
  }
}

/* Mobile header */
.mobile-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 16px;
  background-color: #f8f9fa;
  /* border-bottom: 1px solid var(--border-color); */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); */
}

@media (min-width: 1024px) {
  .mobile-header {
    display: none;
  }
}

@media (max-width: 1023px) {
  body {
    margin-top: 64px;
  }
}

.mobile-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color var(--transition-speed);
}

.mobile-menu-btn:hover {
  background-color: var(--bg-gray-100);
}

.mobile-menu-btn:active {
  background-color: var(--bg-gray-50);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

.mobile-header img {
  height: 40px;
  width: 40px;
  margin-left: 12px;
  border-radius: 8px;
}

.mobile-header .header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  margin-left: 10px;
}

.mobile-header .header-text span {
  line-height: 1.2;
}

/* Mobile sidebar overlay */
.sidebar-mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.sidebar-mobile-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile sidebar */
.sidebar-mobile {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background-color: #f8f9fa;
  overflow-y: auto;
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  display: flex;
}

.sidebar-mobile.open {
  transform: translateX(0);
}

@media (max-width: 1023px) {
  .sidebar-mobile {
    display: flex;
  }
}


/* Модальные окна */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  margin: auto 0;
}

.modal-content-sm {
  max-width: 400px;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 24px;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
}


/* ============================================
   ФОРМЫ И ФИЛЬТРЫ
   ============================================ */

.filters-form {
  display: grid;
  gap: 20px;
}

.filter-label {
  display: block;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.filter-label-small {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.filter-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.filter-checkbox span {
  font-size: var(--font-size-base);
  color: #374151;
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  background-color: white;
  box-sizing: border-box;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
  background-color: rgba(255, 255, 255, 0.9);
  width: 100%;
  padding: 5px;
  border: 1px solid #f2f2f2;
  border-radius: 2px;
  height: 36px;
}

/* Инпуты и селекты для форм */
.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.form-select {
  height: 42px;
  padding: 0 14px;
  background-color: white;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 6px;
}

/* Стили для автозаполненных полей */
.autofilled {
  background-color: #f0fdf4 !important;
  border-color: #86efac !important;
  transition: all 0.3s ease;
}

.autofilled-label::after {
  content: " ✓";
  color: #22c55e;
  font-size: 12px;
  margin-left: 4px;
}

/* Стили для обязательных полей с ошибкой */
.field-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  animation: shake 0.3s;
}

.field-error-label {
  color: #ef4444 !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Подсказка для обязательных полей */
.required-hint {
  color: #ef4444;
  font-size: 11px;
  margin-top: 4px;
  display: none;
}

.show-hint {
  display: block;
}


/* ============================================
   ТАБЛИЦЫ (СТАТУСЫ ЗАКАЗОВ И АВТОМОБИЛЕЙ)
   Эти стили НЕ ТРОГАЕМ - используются в таблицах
   ============================================ */

.headtable {
  background-color: #b3e5fc !important;
  padding: 10px 10px;
  border: 1px solid #33333324;
  border-radius: 3px;
  font-size: 15px;
  white-space: nowrap;
}

.bodytable {
  padding: 10px 5px;
  border-radius: 3px;
  text-decoration: none;
  font-weight: bold;
  color: #353535da;
  min-width: 100%;
}

/* Статусы заказов */
.cancel_table {
  background-color: #000000 !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

.done_table {
  background-color: #2196F3 !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

.pay_table {
  background-color: #388E3C !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

.wait_table {
  background-color: #FFA500 !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

.accepted_table {
  background-color: #658bab !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

.needmoney_table {
  background-color: #ff0000 !important;
  border: 1px solid #33333324;
  color: #FFFFFF;
  font-weight: bold;
  cursor: pointer;
}

/* Статусы автомобилей */
.wait_car {
  background-color: #adadada8 !important;
  border: 1px solid #33333324;
  color: #353535;
  font-weight: bold;
  cursor: pointer;
}

.cancel_car {
  background-color: #e43333a8 !important;
  border: 1px solid #33333324;
  color: #353535;
  font-weight: bold;
  cursor: pointer;
}

.work_car {
  background-color: #33e459a8 !important;
  border: 1px solid #33333324;
  color: #353535;
  font-weight: bold;
  cursor: pointer;
}

.sale_car {
  background-color: #7f33e4a8 !important;
  border: 1px solid #33333324;
  color: #353535;
  font-weight: bold;
  cursor: pointer;
}

td, th {
  padding: 10px 5px;
  display: table-cell;
  text-align: left;
  vertical-align: middle;
  border-radius: 2px;
}


/* ============================================
   СОВРЕМЕННЫЕ ТАБЛИЦЫ (для employees, partners и т.д.)
   ============================================ */

.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table thead tr {
  border-bottom: 1px solid #e5e7eb;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: #6b7280;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background-color: #f9fafb;
}

.data-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background-color 0.15s;
}

.data-table tbody tr:hover {
  background-color: #f9fafb;
}

.data-table td {
  padding: 16px;
  color: #6b7280;
  font-size: 14px;
}

.data-table td.primary-text {
  color: #111827;
  font-weight: 500;
}

.data-table td.link-text {
  color: #4f46e5;
  font-weight: 500;
}

.data-table td.empty-state {
  padding: 32px;
  text-align: center;
  color: #6b7280;
}

/* Бейджи статусов */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.new {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.active {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.completed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.payed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.cancelled {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-badge.unpaid {
  background-color: #fef3c7;
  color: #92400e;
}

/* Прогресс бар для выполнения плана */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar-fill.success {
  background-color: #10b981;
}

.progress-bar-fill.warning {
  background-color: #f59e0b;
}

.progress-bar-fill.danger {
  background-color: #ef4444;
}

.progress-percent {
  font-size: 13px;
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}

.progress-percent.success {
  color: #10b981;
}

.progress-percent.warning {
  color: #f59e0b;
}

.progress-percent.danger {
  color: #ef4444;
}


/* ============================================
   УТИЛИТЫ И ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ
   ============================================ */

.flex_box {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 15px;
}

.disabled-link {
  pointer-events: none;
  color: rgba(0, 0, 0, 0.42) !important;
}

.table-money {
  min-width: 15vw;
}

#scrollToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  transition: opacity 0.5s;
  display: none;
}

.icon-block {
  padding: 0 15px;
}

.selectmin {
  position: relative;
  max-width: 140px;
  padding-left: 10px;
}

.datepicker-delivery {
  font-size: 0.8rem;
  color: #9e9e9e;
  display: block;
}

.margin-right15 {
  margin-right: 15px;
}

.margin-left-10 {
  margin-left: -10px;
}

.margin-left15 {
  margin-left: 15px;
}

#currentOrderStatus {
  margin-right: 15px;
  margin-left: auto;
}

.dropdown-content {
  min-width: 150px;
  max-height: 40vh;
}

.centered-text {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
}


/* ============================================
   LAYOUT КЛАССЫ (для страниц)
   ============================================ */

/* Body с фоном */
body.app-body {
  background-color: #f8f9fa;
  margin: 0;
  padding: 0;
}

/* Основной контейнер с flex */
.page-container {
  display: flex;
  min-height: 100vh;
}

/* Основной контент справа от sidebar */
.main-content {
  flex: 1;
  margin-left: 256px;
  width: calc(100% - 256px);
}

/* Внутренний padding для main */
.main-padding {
  padding: 32px 24px;
}

/* Белая карточка */
.card {
  background-color: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-sm {
  padding: 16px;
}

.card-lg {
  padding: 32px;
}

/* Хлебные крошки */
.breadcrumb {
  margin-bottom: 24px;
}

.breadcrumb a {
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
}

.breadcrumb a:hover {
  color: #111827;
}

/* Заголовок страницы */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}


/* Заголовок с границей снизу */
.header-with-border {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

/* Секция контента */
.content-section {
  margin-bottom: 32px;
}

.content-section h2,
.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.content-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 12px;
}

/* Grid для полей */
.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.field-full {
  grid-column: 1 / -1;
}

/* Поле с лейблом и значением */
.field-item {
  /* Контейнер для одного поля */
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-value {
  font-size: 16px;
  color: #111827;
  margin: 0;
}

.field-value-sm {
  font-size: 14px;
}

/* Группа кнопок */
.button-group {
  display: flex;
  gap: 12px;
}

/* Поисковая строка */
.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

/* Текстовые утилиты */
.text-primary {
  color: #111827;
}

.text-secondary {
  color: #6b7280;
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 12px;
}

.text-lg {
  font-size: 16px;
}

.text-xl {
  font-size: 18px;
}

.text-2xl {
  font-size: 20px;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* Spacing утилиты */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }

/* Flex утилиты */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

/* Изображения для документов */
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.image-preview-item {
  text-align: center;
}

.image-preview-box {
  width: 150px;
  height: 100px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  overflow: hidden;
}

.image-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Ссылки */
.link {
  color: #4f46e5;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}


/* ============================================
   СКРОЛЛБАР
   ============================================ */

::-webkit-scrollbar {
  width: 5px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 6px;
}

::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}


/* ============================================
   MATERIAL ICONS
   ============================================ */

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v142/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}


/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 600px) {
  .flex_box {
    flex-direction: column;
    align-items: stretch;
  }

  .button_green {
    width: 100%;
    margin-bottom: 10px;
  }

  .search-field,
  .input-field {
    width: 100%;
  }

  .content-mobile {
    margin-left: -18px;
    min-width: 107%;
    padding: 0 10px;
  }

  .container-mobile {
    margin-left: -20px;
    padding: 0 10px;
    min-width: 110%;
  }
}

@media only screen and (max-width: 992px) {
  .modal {
    width: 100%;
    font-size: 13px;
  }

  .select-wrapper {
    font-size: 3px;
  }
}

@media (max-width: 1549px) {
  .fixed-nav {
    display: none;
  }
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ============================================ */

@media (max-width: 1023px) {
  /* Убираем отступ от sidebar */
  .main-content,
  .main-content-wrapper,
  div[style*="margin-left: 256px"] {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Отступ сверху под мобильный header - 60px */
  .main-padding,
  .main-content-padding,
  main {
    margin-top: 60px !important;
  }
  
  /* Информация о приложении - одна колонка на мобильных */
  .app-info-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  /* Фильтры сотрудников - вертикальная раскладка */
  .employees-filters {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  
  .employees-filters > * {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Блок с кнопками - делаем вертикальным */
  .page-header,
  .header-with-border,
  .flex.items-center.justify-between.mb-6 {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  
  /* Ряд кнопок - переносим на новую строку если не помещаются */
  .button-group,
  .flex.gap-3.items-center {
    flex-wrap: wrap !important;
  }
  
  /* Пагинация и селектор - в одну строку */
  .pagination,
  .pagination-wrapper {
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  
  .per-page-selector span {
    display: none !important;
  }
  
  #pagination {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Grid на мобильных - одна колонка */
  .field-grid,
  .field-grid-3 {
    grid-template-columns: 1fr !important;
  }
}


/* ============================================
   LEGACY STYLES (СТАРЫЕ СТИЛИ)
   Оставлены для совместимости
   ============================================ */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0px;
}

.header .btn-group {
  display: flex;
  gap: 10px;
}

.left-table {
  width: 30%;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.left-table table {
  width: 100%;
  border-collapse: collapse;
}

.left-table th,
.left-table td {
  padding: 10px;
  border-bottom: 1px solid #ccc;
  text-align: left;
}

.left-table tr.highlight-row {
  background-color: #ffeb99;
}

.right-details {
  width: 65%;
}

.right-details h5 {
  margin-top: 0;
}

.details-section {
  margin-bottom: 20px;
}

.details-section table {
  width: 100%;
  border-collapse: collapse;
}

.details-section th,
.details-section td {
  padding: 8px;
  border-bottom: 1px solid #ccc;
  text-align: left;
}

.details-section .no-border td {
  border-bottom: none;
}

.details-section td.result {
  text-align: right;
}

.details-section td.ndfl {
  color: green;
  font-weight: bold;
}

.fixed-nav {
  position: fixed;
  top: 205px;
  left: 10px;
  width: 250px;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10;
  transition: top 0.3s ease, width 0.3s ease;
}

@media (min-width: 769px) {
  .fixed-nav {
    flex-shrink: 0;
    margin-right: 20px;
  }

  .main-content {
    flex-grow: 1;
  }
}

.nav-faq a {
  display: block;
  margin: 10px 0;
  text-decoration: none;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.nav-faq a:hover {
  text-decoration: underline;
}

.nav-faq span {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
}

.navp {
  font-size: 13px;
  padding-left: 15px;
  color: #666;
}

div#modal_delete {
  padding: 1px;
  max-width: 30%;
  margin-top: 10%;
}

/* Общие стили для карточек событий и истории */
.event-card,
.history-item {
  padding: 16px;
  background: var(--bg-gray-50);
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  border-left: 3px solid #ededed;
  transition: all var(--transition-speed);
  cursor: pointer;
}

.event-card:hover,
.history-item:hover {
  background: var(--bg-gray-100);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.event-card.expanded {
  background: white;
  border-left-width: 4px;
}

.history-item {
  border-left-color: #ededed;
}

.history-item:last-child {
  margin-bottom: 0;
}

/* Заголовки */
.event-header,
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-header {
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 10px;
}

.history-user {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-base);
}

.history-time,
.event-time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Типы действий */
.event-action,
.history-action {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.event-action.created,
.history-action.created {
  background: #dcfce7;
  color: #166534;
}

.event-action.updated,
.history-action.updated {
  background: #dbeafe;
  color: #1e40af;
}

.event-action.status_changed,
.history-action.status_changed {
  background: #fef3c7;
  color: #92400e;
}

.event-action.invoice_created,
.history-action.invoice_created {
  background: #f3e8ff;
  color: #7c3aed;
}

.event-action.act_created,
.history-action.act_created {
  background: #ede9fe;
  color: #6d28d9;
}

.event-action.invoice_status_changed,
.history-action.invoice_status_changed {
  background: #dcfce7;
  color: #166534;
}

.event-action.act_status_changed,
.history-action.act_status_changed {
  background: #fef9c3;
  color: #854d0e;
}

/* Стили для событий контрагентов */
.event-card.partner-event {
  border-left-color: #10b981;
}

.event-card.partner-event:hover {
  border-left-color: #059669;
}

.event-action.partner_created,
.event-action.partner_updated,
.event-action.partner_deleted {
  background: #d1fae5;
  color: #065f46;
}

/* Стили для событий компаний */
.event-card.company-event {
  border-left-color: #8b5cf6;
}

.event-card.company-event:hover {
  border-left-color: #7c3aed;
}

.event-action.company_created,
.event-action.company_updated,
.event-action.company_deleted {
  background: #ede9fe;
  color: #5b21b6;
}

.history-action {
  margin-bottom: 10px;
}

/* Детали изменений */
.event-details {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.event-details.show {
  display: block;
}

.change-item,
.history-change-item {
  padding: 8px 0;
  font-size: var(--font-size-sm);
  color: #374151;
  border-bottom: 1px solid var(--bg-gray-100);
}

.change-item:last-child,
.history-change-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.change-field,
.history-field {
  font-weight: 600;
  color: #4b5563;
  display: inline-block;
  min-width: 140px;
}

.history-value {
  color: var(--text-primary);
}

.change-old,
.history-old {
  text-decoration: line-through;
  color: var(--danger-color);
  opacity: 0.8;
}

.change-new,
.history-new {
  color: var(--success-color);
  font-weight: 600;
}

.history-arrow {
  color: #9ca3af;
  margin: 0 6px;
}

.history-changes {
  font-size: var(--font-size-sm);
  color: #374151;
}

/* Кнопка переключения истории */
#toggleHistoryBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-gray-50);
  border: none;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: #374151;
  width: 100%;
  transition: background var(--transition-speed);
}

#toggleHistoryBtn:hover {
  background: var(--bg-gray-100) !important;
}

#historyIcon {
  font-size: 16px;
}

#historyArrow {
  margin-left: auto;
  transition: transform var(--transition-speed);
  color: #9ca3af;
}

#historyPanel {
  display: none;
  background: white;
}

#historyContent {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

/* Кнопки фильтров на странице событий */
#resetFilters:hover {
  background-color: var(--bg-gray-50);
}

#prevPage:disabled,
#nextPage:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
