/* ============================================================
   РАЗДЕЛ «СОТРУДНИКИ»
   ============================================================ */

.drivers {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* ---------- Заголовок ---------- */
.drivers__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.drivers__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--text);
  letter-spacing: -.01em;
}
.drivers__count {
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.drivers__actions {
  margin-left: auto;
  display: inline-flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ---------- Чипсы (общие стили, два ряда) ---------- */
.drivers-chips {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.drivers-chips::-webkit-scrollbar { display: none; }

.drivers-chips + .drivers-chips {
  margin-top: -6px;
}

.drivers-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.drivers-chip:hover { color: var(--text); }
.drivers-chip.is-active {
  background: var(--surface-3);
  color: var(--text);
}
.drivers-chip__icon { display: inline-flex; opacity: .85; }
.drivers-chip__icon svg { width: 14px; height: 14px; }
.drivers-chip.is-active .drivers-chip__icon { color: var(--accent-hi); opacity: 1; }
.drivers-chip__count {
  font-size: var(--fs-xs);
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  background: var(--surface-4);
  border-radius: var(--r-full);
}
.drivers-chip.is-active .drivers-chip__count {
  background: var(--surface-4);
  color: var(--text-2);
}

/* ---------- Фильтры ---------- */
.drivers-filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.drivers-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 200px;
}
.drivers-search__icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: inline-flex;
}
.drivers-search__icon svg { width: 15px; height: 15px; }
.drivers-search input {
  width: 100%;
  padding: 8px 11px 8px 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-md);
  transition: border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.drivers-search input::placeholder { color: var(--text-4); }
.drivers-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface-3);
}

.drivers-filters__group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.drivers-filters__group > label {
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.drivers-filters select.ui-select {
  min-width: 170px;
  padding-top: 7px; padding-bottom: 7px;
  font-size: var(--fs-sm);
}

.drivers-ac {
  position: relative;
  min-width: 180px;
}
.drivers-ac input {
  width: 100%;
  padding: 7px 26px 7px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.drivers-ac input::placeholder { color: var(--text-4); }
.drivers-ac input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface-3);
}
.drivers-ac__arrow {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: inline-flex;
}
.drivers-ac__arrow svg { width: 13px; height: 13px; }
.drivers-ac__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  z-index: 20;
  opacity: 0; transform: translateY(-3px);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  padding: 4px;
}
.drivers-ac.is-open .drivers-ac__list { opacity: 1; transform: none; pointer-events: auto; }
.drivers-ac__item {
  padding: 7px 9px;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  display: flex; align-items: center; gap: 8px;
}
.drivers-ac__item:hover,
.drivers-ac__item.is-active { background: var(--surface-4); }
.drivers-ac__item--clear { color: var(--text-3); }
.drivers-ac__empty {
  padding: 10px;
  color: var(--text-4);
  font-size: var(--fs-sm);
  text-align: center;
}
.drivers-filters__reset { margin-left: auto; }

/* ---------- Таблица ---------- */
.drivers-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.drivers-table-scroll { width: 100%; overflow-x: auto; }
.drivers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.drivers-table th,
.drivers-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* ФИО */
.drivers-table th:nth-child(1),
.drivers-table td:nth-child(1) {
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}
/* Гражданство */
.drivers-table th:nth-child(3),
.drivers-table td:nth-child(3) {
  max-width: 170px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}
/* Паспорт */
.drivers-table th:nth-child(6),
.drivers-table td:nth-child(6) {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Примечание */
.drivers-table th:nth-child(8),
.drivers-table td:nth-child(8) {
  max-width: 190px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.drivers-table th {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: .05em;
  user-select: none;
  position: sticky; top: 0; z-index: 1;
}
.drivers-table th.is-sortable { cursor: pointer; }
.drivers-table th.is-sortable:hover { color: var(--text-2); }
.drivers-table th .th-sort {
  display: inline-flex;
  margin-left: 4px;
  opacity: .3;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.drivers-table th .th-sort svg { width: 12px; height: 12px; }
.drivers-table th.is-sorted-asc  .th-sort { opacity: 1; }
.drivers-table th.is-sorted-desc .th-sort { opacity: 1; transform: rotate(180deg); }

.drivers-table tbody tr { transition: background var(--t-fast) var(--ease); }
.drivers-table tbody tr:hover { background: var(--surface-2); }
.drivers-table tbody tr:last-child td { border-bottom: none; }

.drivers-table td.col-actions { width: 48px; text-align: right; padding-right: 10px; }

/* ячейки */
.drivers-table .tcell--name {
  color: var(--text);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
}
.drivers-table .tcell--pin,
.drivers-table .tcell--passport {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-2);
  letter-spacing: .02em;
}
.drivers-table .tcell--phone {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.drivers-table .tcell--muted { color: var(--text-3); }

/* WhatsApp-ссылка */
.wa-link {
  color: var(--success);
  text-decoration: none;
  border-bottom: 1px dashed var(--success);
  transition: color var(--t-fast) var(--ease);
}
.wa-link:hover { color: #6ee7a1; }

/* Статусы */
.ui-badge--drv-work     { background: var(--success-soft); color: #a7f3c4; }
.ui-badge--drv-fired    { background: var(--danger-soft);  color: #f8b4b4; }
.ui-badge--drv-vacation { background: var(--warning-soft); color: #f5d9a3; }
.ui-badge--drv-other    { background: var(--surface-3);    color: var(--text-2); }

/* Иконка вместо аватара */
.drivers-user-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.drivers-user-icon svg { width: 18px; height: 18px; }

/* ---------- Мобильные карточки ---------- */
.drivers-cards {
  display: none;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
}
.dcard {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease);
}
.dcard:hover { border-color: var(--border-2); }

.dcard__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.dcard__head:hover { background: var(--surface-3); }

.dcard__info { flex: 1; min-width: 0; }
.dcard__name {
  font-weight: var(--fw-semi);
  font-size: var(--fs-md);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dcard__sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dcard__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dcard__arrow {
  color: var(--text-4);
  transition: transform var(--t-base) var(--ease);
  display: inline-flex;
}
.dcard__arrow svg { width: 16px; height: 16px; }
.dcard.is-open .dcard__arrow { transform: rotate(180deg); }

.dcard__body {
  display: none;
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  animation: fade-in var(--t-base) var(--ease);
}
.dcard.is-open .dcard__body { display: block; }

.drow {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.drow:last-of-type { border-bottom: none; }
.drow__label {
  flex: 0 0 110px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-top: 1px;
}
.drow__value {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}

.dcard__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.dcard__actions .ui-btn { flex: 0 0 auto; }

/* ---------- Форма ---------- */
.dform {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
}
.dform__full { grid-column: 1 / -1; }
.dform .ui-field { display: flex; flex-direction: column; }

@media (max-width: 620px) {
  .dform { grid-template-columns: 1fr; }
  .dform__full { grid-column: auto; }
}

/* ---------- Права и обучение ---------- */
.doc-sec {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
}
.doc-sec:last-of-type { border-bottom: none; }
.doc-sec__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.doc-sec__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  color: var(--text);
  margin: 0;
}
.doc-sec__status {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-3);
}
.doc-sec__status.is-ok      { background: var(--success-soft); color: #a7f3c4; }
.doc-sec__status.is-warning { background: var(--warning-soft); color: #f5d9a3; }
.doc-sec__status.is-danger  { background: var(--danger-soft);  color: #f8b4b4; }
.doc-sec__actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}
.doc-sec__empty {
  padding: var(--s-4);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-3);
  border-radius: var(--r-md);
}
.doc-sec__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
  padding: var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.doc-sec__form .ui-field { display: flex; flex-direction: column; }
.doc-sec__form .dform__full { grid-column: 1 / -1; }
@media (max-width: 620px) {
  .doc-sec__form { grid-template-columns: 1fr; }
  .doc-sec__form .dform__full { grid-column: auto; }
}

/* ---------- Файлы в модалке ---------- */
.tfiles {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.tfiles__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}
.tfiles__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast) var(--ease);
}
.tfiles__row:hover { border-color: var(--border-2); }
.tfiles__icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.tfiles__icon img { width: 100%; height: 100%; object-fit: cover; }
.tfiles__info { flex: 1; min-width: 0; }
.tfiles__name {
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: var(--fw-medium);
}
.tfiles__meta {
  color: var(--text-4);
  font-size: var(--fs-xs);
  margin-top: 2px;
}
.tfiles__actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.tfiles__empty {
  padding: var(--s-6);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.tfiles__drop {
  border: 1px dashed var(--border-3);
  border-radius: var(--r-md);
  padding: var(--s-4);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tfiles__drop:hover,
.tfiles__drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Просмотр файла ---------- */
.fpv { display: flex; flex-direction: column; gap: var(--s-3); }
.fpv__stage {
  width: 100%;
  height: min(72vh, 720px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fpv__stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.fpv__stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.fpv__meta { display: flex; flex-direction: column; gap: 2px; }
.fpv__name {
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  word-break: break-word;
}
.fpv__sub { color: var(--text-3); font-size: var(--fs-xs); }
.fpv__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--s-6);
  color: var(--text-3);
  text-align: center;
}
.fpv__ph-icon { color: var(--text-4); }
.fpv__ph-title { color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-medium); word-break: break-word; }
.fpv__ph-hint { font-size: var(--fs-sm); }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .drivers-table-scroll { display: none; }
  .drivers-cards { display: flex; }
}
@media (max-width: 560px) {
  .drivers__title { font-size: var(--fs-lg); }
  .drivers__actions { width: 100%; }
  .drivers__actions .ui-btn { flex: 1 1 auto; justify-content: center; }
  .drivers-filters { padding: 10px; }
  .drivers-search { flex: 1 1 100%; }
  .drivers-filters__group { flex: 1 1 calc(50% - 4px); }
  .drivers-filters select.ui-select { min-width: 0; width: 100%; }
  .drivers-ac { width: 100%; min-width: 0; flex: 1 1 100%; }
  .drivers-filters__reset { flex: 1 1 100%; }

  .drivers-table th:nth-child(1),
  .drivers-table td:nth-child(1),
  .drivers-table th:nth-child(3),
  .drivers-table td:nth-child(3),
  .drivers-table th:nth-child(8),
  .drivers-table td:nth-child(8) {
    max-width: 140px;
  }
}