/* ==========================================================================
   Counterparties (/counterparties/) — redesign overlay
   Scoped to body.wb-shell-redesign .wb-counterparties-page.
   ========================================================================== */

body.wb-shell-redesign .wb-counterparties-page {
  padding: 24px;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--font-ui);
  color: var(--text);
}

/* ---------- Header ---------- */
body.wb-shell-redesign .wb-counterparties-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
body.wb-shell-redesign .wb-counterparties-head__left { min-width: 0; flex: 1 1 auto; }
body.wb-shell-redesign .wb-counterparties-head__title {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}
body.wb-shell-redesign .wb-counterparties-head__sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}
body.wb-shell-redesign .wb-counterparties-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Filter section ---------- */
body.wb-shell-redesign .wb-counterparties-page .filter-section {
  background: var(--surface-2) !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 0 !important;
}
body.wb-shell-redesign .wb-counterparties-page .filter-section .form-label {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-muted) !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.wb-shell-redesign .wb-counterparties-page .filter-section .form-control,
body.wb-shell-redesign .wb-counterparties-page .filter-section .form-select {
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
}
body.wb-shell-redesign .wb-counterparties-page .filter-section .form-control:focus,
body.wb-shell-redesign .wb-counterparties-page .filter-section .form-select:focus {
  border-color: var(--amber);
  box-shadow: var(--ring);
}

/* ---------- Contractor cards ---------- */
body.wb-shell-redesign .wb-counterparties-page #contractorsContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card.card {
  margin-bottom: 0 !important;
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card.card:hover {
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow-sm);
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card .card-body {
  padding: 12px 14px !important;
}
/* Цветная полоска статуса слева — через токены */
body.wb-shell-redesign .wb-counterparties-page .contractor-card[style*="rgb(25, 135, 84)"],
body.wb-shell-redesign .wb-counterparties-page .contractor-card[style*="#198754"] {
  border-left: 3px solid var(--mint) !important;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card[style*="rgb(220, 53, 69)"],
body.wb-shell-redesign .wb-counterparties-page .contractor-card[style*="#dc3545"] {
  border-left: 3px solid var(--coral) !important;
}

/* Field labels внутри карточек */
body.wb-shell-redesign .wb-counterparties-page .contractor-card .field-label {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 2px !important;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card .field-value {
  font-size: 13.5px !important;
  color: var(--text);
  line-height: 1.3;
  font-weight: 500;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card .fw-semibold {
  font-weight: 700 !important;
  font-size: 14.5px;
  color: var(--text);
  letter-spacing: -0.01em;
}
/* Иконки статуса */
body.wb-shell-redesign .wb-counterparties-page .contractor-card .mdi-check-circle.text-success {
  color: var(--mint) !important;
  font-size: 18px;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card .mdi-close-circle.text-danger {
  color: var(--coral) !important;
  font-size: 18px;
}
/* Группа кнопок справа */
body.wb-shell-redesign .wb-counterparties-page .contractor-card .btn-group .btn {
  height: 32px !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}
body.wb-shell-redesign .wb-counterparties-page .contractor-card .btn-group .btn .mdi {
  font-size: 16px;
}

/* Empty state */
body.wb-shell-redesign .wb-counterparties-page #emptyMessage {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 36px 18px !important;
  color: var(--text-muted) !important;
  font-size: 14px;
}

/* ---------- DaData dropdown ---------- */
body.wb-shell-redesign .dadata-search-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow-md) !important;
  margin-top: 4px !important;
}
body.wb-shell-redesign .dadata-search-item {
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 12px !important;
  border-radius: 6px;
  margin: 2px 4px;
  transition: background 0.12s ease;
}
body.wb-shell-redesign .dadata-search-item.active,
body.wb-shell-redesign .dadata-search-item:hover {
  background: var(--surface-2) !important;
}
body.wb-shell-redesign .dadata-search-item-name {
  color: var(--text) !important;
  font-family: var(--font-ui);
}
body.wb-shell-redesign .dadata-search-item-details {
  color: var(--text-muted) !important;
}
body.wb-shell-redesign .dadata-search-spinner {
  border-color: var(--border) !important;
  border-top-color: var(--amber) !important;
}

/* ---------- Counterparty modal (#contractorModal) ---------- */
body.wb-shell-redesign #contractorModal .modal-content,
body.wb-shell-redesign #confirmDeleteModal .modal-content {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
body.wb-shell-redesign #contractorModal .modal-header,
body.wb-shell-redesign #confirmDeleteModal .modal-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
body.wb-shell-redesign #contractorModal .modal-title,
body.wb-shell-redesign #confirmDeleteModal .modal-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
body.wb-shell-redesign #contractorModal .modal-body,
body.wb-shell-redesign #confirmDeleteModal .modal-body {
  color: var(--text);
}
body.wb-shell-redesign #contractorModal .modal-body .form-control,
body.wb-shell-redesign #contractorModal .modal-body .form-select {
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
}
body.wb-shell-redesign #contractorModal .modal-body .form-control:focus,
body.wb-shell-redesign #contractorModal .modal-body .form-select:focus {
  border-color: var(--amber);
  box-shadow: var(--ring);
}
body.wb-shell-redesign #contractorModal .modal-body .form-label {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
body.wb-shell-redesign #contractorModal .modal-footer,
body.wb-shell-redesign #confirmDeleteModal .modal-footer {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  gap: 8px;
}
/* Кнопки в модалке — re-skin как в event-form modal-overlay */
body.wb-shell-redesign :is(#contractorModal, #confirmDeleteModal) .btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  border-radius: 10px;
  padding: 8px 14px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-width: 1px;
}
body.wb-shell-redesign :is(#contractorModal, #confirmDeleteModal) .btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}
body.wb-shell-redesign :is(#contractorModal, #confirmDeleteModal) .btn-primary:hover {
  background: color-mix(in oklch, var(--amber) 88%, var(--hover-mix));
  border-color: color-mix(in oklch, var(--amber) 88%, var(--hover-mix));
}
body.wb-shell-redesign :is(#contractorModal, #confirmDeleteModal) .btn-secondary {
  background: var(--surface-2);
  border-color: var(--surface-2);
  color: var(--text);
}
body.wb-shell-redesign :is(#contractorModal, #confirmDeleteModal) .btn-danger {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  body.wb-shell-redesign .wb-counterparties-page { padding: 12px; gap: 12px; }
  body.wb-shell-redesign .wb-counterparties-head__title { font-size: 24px; }
  body.wb-shell-redesign .wb-counterparties-page .filter-section .row > .col-auto {
    width: 100%;
  }
  body.wb-shell-redesign .wb-counterparties-page .filter-section input[id="contractorSearch"],
  body.wb-shell-redesign .wb-counterparties-page .filter-section select[id="contractorFilterSelect"] {
    width: 100% !important;
  }
}
