/* ============================================================
   РАЗДЕЛ «ТЕХНИКА»
   ============================================================ */

.trucks {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* ---------- Заголовок раздела ---------- */
.trucks__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.trucks__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--text);
  letter-spacing: -.01em;
}
.trucks__count {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
}
.trucks__actions {
  margin-left: auto;
  display: inline-flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ---------- Чипсы категорий ---------- */
.trucks-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;
}
.trucks-chips::-webkit-scrollbar { display: none; }

.trucks-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);
}
.trucks-chip:hover { color: var(--text); }
.trucks-chip.is-active {
  background: var(--surface-3);
  color: var(--text);
}
.trucks-chip__icon { display: inline-flex; opacity: .85; }
.trucks-chip__icon svg { width: 14px; height: 14px; }
.trucks-chip.is-active .trucks-chip__icon { color: var(--accent-hi); opacity: 1; }
.trucks-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);
}
.trucks-chip.is-active .trucks-chip__count {
  background: var(--surface-4);
  color: var(--text-2);
}

/* ---------- Панель фильтров ---------- */
.trucks-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);
}

.trucks-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 200px;
}
.trucks-search__icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: inline-flex;
}
.trucks-search__icon svg { width: 15px; height: 15px; }
.trucks-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);
}
.trucks-search input::placeholder { color: var(--text-4); }
.trucks-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface-3);
}

.trucks-filters__group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.trucks-filters__group > label {
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.trucks-filters select.ui-select {
  min-width: 130px;
  padding-top: 7px; padding-bottom: 7px;
  font-size: var(--fs-sm);
}

.trucks-ac {
  position: relative;
  min-width: 150px;
}
.trucks-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);
}
.trucks-ac input::placeholder { color: var(--text-4); }
.trucks-ac input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface-3);
}
.trucks-ac__arrow {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: inline-flex;
}
.trucks-ac__arrow svg { width: 13px; height: 13px; }
.trucks-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;
}
.trucks-ac.is-open .trucks-ac__list { opacity: 1; transform: none; pointer-events: auto; }
.trucks-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;
}
.trucks-ac__item:hover,
.trucks-ac__item.is-active { background: var(--surface-4); }
.trucks-ac__item--clear { color: var(--text-3); }
.trucks-ac__empty {
  padding: 10px;
  color: var(--text-4);
  font-size: var(--fs-sm);
  text-align: center;
}

.trucks-filters__reset {
  margin-left: auto;
}

/* ---------- Таблица ---------- */
.trucks-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.trucks-table-scroll {
  width: 100%;
  overflow-x: auto;
}
.trucks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.trucks-table th,
.trucks-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* Колонки с длинным текстом — переносим, ограничиваем ширину */
.trucks-table th:nth-child(4),
.trucks-table td:nth-child(4),
.trucks-table th:nth-child(10),
.trucks-table td:nth-child(10),
.trucks-table th:nth-child(11),
.trucks-table td:nth-child(11) {
  max-width: 200px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.trucks-table th:nth-child(4),
.trucks-table td:nth-child(4) {
  max-width: 170px;
}

.trucks-table th:nth-child(11),
.trucks-table td:nth-child(11) {
  max-width: 170px;
  font-size: var(--fs-sm);
}

.trucks-table th:nth-child(12),
.trucks-table td:nth-child(12) {
  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);
}

.trucks-table th:nth-child(5),
.trucks-table td:nth-child(5) {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trucks-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;
}
.trucks-table th.is-sortable { cursor: pointer; }
.trucks-table th.is-sortable:hover { color: var(--text-2); }
.trucks-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);
}
.trucks-table th .th-sort svg { width: 12px; height: 12px; }
.trucks-table th.is-sorted-asc  .th-sort { opacity: 1; }
.trucks-table th.is-sorted-desc .th-sort { opacity: 1; transform: rotate(180deg); }

.trucks-table tbody tr {
  transition: background var(--t-fast) var(--ease);
}
.trucks-table tbody tr:hover { background: var(--surface-2); }
.trucks-table tbody tr:last-child td { border-bottom: none; }

.trucks-table td.col-actions { width: 48px; text-align: right; padding-right: 10px; }

/* ячейки */
.tcell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.tcell__main {
  color: var(--text);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  white-space: nowrap;
}
.tcell__sub {
  color: var(--text-3);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.tcell--plate .tcell__main {
  font-family: var(--font-mono);
  letter-spacing: .02em;
  font-size: var(--fs-md);
}
.tcell--muted { color: var(--text-3); }

.ui-badge--cat-тягач     { background: var(--accent-soft);   color: var(--accent-hi); }
.ui-badge--cat-служебное { background: var(--warning-soft);  color: #f5d9a3; }
.ui-badge--cat-легковое  { background: var(--info-soft);     color: #b3d4f8; }

.ui-badge--status-active   { background: var(--success-soft); color: #a7f3c4; }
.ui-badge--status-repair   { background: var(--warning-soft); color: #f5d9a3; }
.ui-badge--status-written  { background: var(--danger-soft);  color: #f8b4b4; }
.ui-badge--status-other    { background: var(--surface-3);    color: var(--text-2); }

/* ---------- Мобильные карточки ---------- */
.trucks-cards {
  display: none;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
}
.tcard {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease);
}
.tcard:hover { border-color: var(--border-2); }

.tcard__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.tcard__head:hover { background: var(--surface-3); }

.tcard__info { flex: 1; min-width: 0; }
.tcard__plate {
  font-family: var(--font-mono);
  font-weight: var(--fw-semi);
  font-size: var(--fs-md);
  color: var(--text);
  letter-spacing: .02em;
}
.tcard__model {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tcard__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tcard__arrow {
  color: var(--text-4);
  transition: transform var(--t-base) var(--ease);
  display: inline-flex;
}
.tcard__arrow svg { width: 16px; height: 16px; }
.tcard.is-open .tcard__arrow { transform: rotate(180deg); }

.tcard__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);
}
.tcard.is-open .tcard__body { display: block; }

.trow {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.trow:last-of-type { border-bottom: none; }
.trow__label {
  flex: 0 0 96px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-top: 1px;
}
.trow__value {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}

.tcard__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.tcard__actions .ui-btn { flex: 0 0 auto; }

/* ---------- Модалка аватара ---------- */
.ava-modal {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.ava-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 60vh;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ava-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.ava-preview__ph {
  color: var(--text-4);
  font-size: 64px;
  line-height: 1;
}
.ava-preview__busy {
  position: absolute;
  inset: 0;
  background: rgba(11,11,15,.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ava-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}
.ava-actions .ui-btn { width: 100%; }

@media (max-width: 480px) {
  .ava-actions { grid-template-columns: 1fr; }
}

/* ---------- Форма ---------- */
.tform {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
}
.tform__full { grid-column: 1 / -1; }
.tform .ui-field { display: flex; flex-direction: column; }

@media (max-width: 620px) {
  .tform { grid-template-columns: 1fr; }
  .tform__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);
}

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .trucks-table-scroll { display: none; }
  .trucks-cards { display: flex; }
}
@media (max-width: 560px) {
  .trucks__title { font-size: var(--fs-lg); }
  .trucks__actions { width: 100%; }
  .trucks__actions .ui-btn { flex: 1 1 auto; justify-content: center; }
  .trucks-filters { padding: 10px; }
  .trucks-search { flex: 1 1 100%; }
  .trucks-filters__group { flex: 1 1 calc(50% - 4px); }
  .trucks-filters select.ui-select { min-width: 0; width: 100%; }
  .trucks-ac { width: 100%; min-width: 0; flex: 1 1 100%; }
  .trucks-filters__reset { flex: 1 1 100%; }

  .trucks-table th:nth-child(4),
  .trucks-table td:nth-child(4),
  .trucks-table th:nth-child(11),
  .trucks-table td:nth-child(11),
  .trucks-table th:nth-child(12),
  .trucks-table td:nth-child(12) {
    max-width: 140px;
  }
}


/* ---------- Просмотр файла (модалка) ---------- */
.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); }