/* ============================================================
   Раздел «Документы» — /documents
   ============================================================ */

#documentsSection {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
}

/* ---------- Шапка ---------- */
#documentsSection .dc-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
#documentsSection .dc-head h2 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0;
  flex: 1;
  color: var(--text);
}
#documentsSection .dc-head-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ---------- Сводка (плитки) ---------- */
#documentsSection .dc-summary {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}
#documentsSection .dc-summary-item {
  flex: 1 1 140px;
  min-width: 120px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  text-align: left;
  font-family: inherit;
}
#documentsSection .dc-summary-item:hover {
  border-color: var(--border-3);
  background: var(--surface-3);
}
#documentsSection .dc-summary-item.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}
#documentsSection .dc-summary-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  display: block;
  margin-bottom: 4px;
}
#documentsSection .dc-summary-value {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text);
  display: block;
}
#documentsSection .dc-summary-item[data-status="expired"] .dc-summary-value { color: #ef4444; }
#documentsSection .dc-summary-item[data-status="warning"] .dc-summary-value { color: #f59e0b; }
#documentsSection .dc-summary-item[data-status="missing"] .dc-summary-value { color: var(--text-3); }
#documentsSection .dc-summary-item[data-status="has_files"] .dc-summary-value { color: #3b82f6; }

/* ---------- Чипсы статусов ---------- */
#documentsSection .dc-chips {
  display: flex;
  gap: var(--s-1);
  flex-wrap: wrap;
}
#documentsSection .dc-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
}
#documentsSection .dc-chip:hover { border-color: var(--border-3); }
#documentsSection .dc-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Панель фильтров ---------- */
#documentsSection .dc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: flex-end;
  padding: var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
#documentsSection .dc-filters .ui-field {
  margin: 0;
  min-width: 160px;
}
#documentsSection .dc-filters .ui-field label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 4px;
  display: block;
}
#documentsSection .dc-filter-search {
  flex: 1;
  min-width: 200px;
}

/* ---------- Таблица ---------- */
#documentsSection .dc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
#documentsSection .dc-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
#documentsSection .dc-table th,
#documentsSection .dc-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
#documentsSection .dc-table th {
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
#documentsSection .dc-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}
#documentsSection .dc-table th[data-sort]:hover { color: var(--text); }
#documentsSection .dc-table th .sort-ind {
  display: inline-block;
  margin-left: 4px;
  opacity: .35;
  font-size: 10px;
}
#documentsSection .dc-table th.is-sorted .sort-ind {
  opacity: 1;
  color: var(--accent);
}
#documentsSection .dc-table tbody tr:hover {
  background: var(--surface-2);
}
#documentsSection .dc-table td.dc-obj { min-width: 200px; }
#documentsSection .dc-table td.dc-obj strong {
  color: var(--text);
  display: block;
}
#documentsSection .dc-table td.dc-obj small {
  color: var(--text-3);
  font-size: var(--fs-xs);
  display: block;
  margin-top: 2px;
}
#documentsSection .dc-table td.dc-status { white-space: nowrap; }

/* Цвета статусов */
#documentsSection .status-active    { color: #22c55e; }
#documentsSection .status-warning   { color: #f59e0b; }
#documentsSection .status-expired   { color: #ef4444; }
#documentsSection .status-missing   { color: #a1a1aa; }
#documentsSection .status-has-files { color: #3b82f6; }

/* Ссылка на файлы */
#documentsSection .dc-files-link {
  cursor: pointer;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
#documentsSection .dc-files-link:hover { text-decoration: underline; }
#documentsSection .dc-files-link--empty { color: var(--text-3); }

/* WhatsApp-ссылка */
#documentsSection .dc-whatsapp {
  color: #25d366;
  text-decoration: none;
  white-space: nowrap;
}
#documentsSection .dc-whatsapp:hover { text-decoration: underline; }

/* Кнопки действий */
#documentsSection .dc-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
#documentsSection .dc-actions .ui-btn {
  padding: 4px 8px;
  min-width: auto;
}

/* ---------- Мобильные карточки ---------- */
#documentsSection .dc-cards { display: none; }
#documentsSection .dc-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--s-2);
  overflow: hidden;
}
#documentsSection .dc-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  cursor: pointer;
}
#documentsSection .dc-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
#documentsSection .dc-card-main { flex: 1; min-width: 0; }
#documentsSection .dc-card-title {
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#documentsSection .dc-card-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#documentsSection .dc-card-status {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
#documentsSection .dc-card-arrow {
  color: var(--text-3);
  transition: transform var(--t-fast);
}
#documentsSection .dc-card.is-open .dc-card-arrow { transform: rotate(180deg); }
#documentsSection .dc-card-body {
  display: none;
  padding: 0 var(--s-3) var(--s-3);
  border-top: 1px solid var(--border);
}
#documentsSection .dc-card.is-open .dc-card-body { display: block; }
#documentsSection .dc-row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 6px 0;
  font-size: var(--fs-sm);
  border-bottom: 1px dashed var(--border);
}
#documentsSection .dc-row:last-of-type { border-bottom: none; }
#documentsSection .dc-row .k { color: var(--text-3); }
#documentsSection .dc-row .v { color: var(--text); text-align: right; }
#documentsSection .dc-card-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------- Пагинация ---------- */
#documentsSection .dc-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}
#documentsSection .dc-pager-info {
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ---------- Пикер объектов в модалке (permits) ---------- */
#documentsSection .dc-picker {
  position: relative;
}
#documentsSection .dc-picker-drop {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface-3);
  border: 1px solid var(--border-3);
  border-radius: var(--r-sm);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
#documentsSection .dc-picker-drop button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
#documentsSection .dc-picker-drop button:hover {
  background: var(--surface-4);
}

/* ---------- Мобильная адаптация ---------- */
@media (max-width: 860px) {
  #documentsSection { padding: var(--s-3); }
  #documentsSection .dc-table-wrap { display: none; }
  #documentsSection .dc-cards { display: block; }
  #documentsSection .dc-filters { flex-direction: column; align-items: stretch; }
  #documentsSection .dc-filters .ui-field { min-width: 0; }
  #documentsSection .dc-head h2 { width: 100%; }
  #documentsSection .dc-head-actions { width: 100%; }
  #documentsSection .dc-head-actions .ui-btn { flex: 1; }
  #documentsSection .dc-summary-item { flex: 1 1 45%; min-width: 0; }
}





/* ---------- Просмотр файла (модалка) ---------- */
.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); }


.dc-ms { position: relative; }
.dc-ms-btn {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; text-align: left; width: 100%;
  padding: 8px 12px;
}
.dc-ms-arrow { margin-left: 8px; opacity: .6; }
.dc-ms-drop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; margin-top: 4px;
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 4px;
}
.dc-ms-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  cursor: pointer; white-space: nowrap;
}
.dc-ms-item:hover { background: var(--surface-2); }
.dc-ms-empty { padding: 8px 10px; opacity: .6; font-size: 13px; }