/* Раскладка справочников we:Hub v2: Подрядчики, Полезные контакты, Полезности. Контролы, листы и чипы — UI Kit;
   строки, панели, заголовок и ряд чипов — hub.css (hub-row, hub-list, hub-panel, hub-title, hub-choices). Размеры кратны 4. */
.app-dir h1, .app-dir h2, .app-dir h3, .app-dir p, .app-dir-form p, .app-dir-popup p { margin: 0; overflow-wrap: anywhere; }
.app-dir [hidden], .app-dir-popup [hidden] { display: none !important; }

/* экран */
.app-dir { box-sizing: border-box; }
.app-dir-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.app-dir-title { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ui-btn.app-dir-add { box-sizing: border-box; flex: none; width: 48px; height: 48px; min-width: 48px; padding: 0; border-radius: 50%; justify-content: center; }
.app-dir-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; align-content: start; }
.app-dir .app-dir-search { box-sizing: border-box; width: 100%; min-height: 48px; padding: 0 20px; border-radius: 24px; background: var(--ui-surface); font-size: 16px; }
.app-dir-choices-host { min-height: 48px; }
.app-dir-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; align-content: start; }

/* строка: ссылка растянута на строку, кнопки и выбор — выше неё */
.app-dir-row { text-decoration: none; color: var(--ui-text); }
.app-dir .hub-row__title { white-space: normal; overflow-wrap: anywhere; }
.app-dir .hub-row__meta { white-space: normal; overflow-wrap: anywhere; }
.app-dir-name { color: inherit; text-decoration: none; }
.app-dir-name::after { content: ''; position: absolute; inset: 0; }
.app-dir-row .hub-row__acts { position: relative; z-index: 1; }
.app-dir-row .hub-row__acts .ui-btn, .app-dir-row .hub-row__acts .ui-select { min-height: 44px; border-radius: 22px; padding: 0 18px; font-weight: 600; letter-spacing: 0; gap: 8px; }
.app-dir-row .hub-row__acts .ui-select { padding-right: 36px; }
.app-dir-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-dir-phone { font-variant-numeric: tabular-nums; color: var(--ui-text); }
.app-dir-ic { display: inline-flex; }

/* профиль в листе */
.app-dir-profile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.app-dir-category { font-size: 15px; color: var(--ui-muted); }
.app-dir-card { display: grid; gap: 8px; padding: 16px 18px; }
.app-dir-label { font: 600 14px/1.2 var(--ui-font); color: var(--ui-muted); }
.app-dir-note { white-space: pre-wrap; font-size: 16px; line-height: 1.45; }
.app-dir-muted { color: var(--ui-muted); }
.app-dir-popup-actions { display: flex; gap: 8px; }
.app-dir-popup-actions .ui-btn { flex: 1 1 0; min-width: 0; min-height: 52px; border-radius: 26px; justify-content: center; gap: 8px; font: 600 17px/1.2 var(--ui-font); letter-spacing: 0; }
.app-dir-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-dir-links .ui-btn { min-height: 44px; border-radius: 22px; padding: 0 18px; gap: 8px; letter-spacing: 0; }
.app-dir-sub { font: 600 15px/1.2 var(--ui-font); color: var(--ui-muted); margin: 8px 0 8px; }
.app-dir-candidates { display: grid; gap: 12px; }
.app-dir-state { height: 28px; padding: 0 12px; font-size: 13px; letter-spacing: 0; align-self: center; }
.app-dir-state--contacted { --ui-chip-tone: var(--ui-warning); }
.app-dir-state--appointed { --ui-chip-tone: var(--ui-success); }
.app-dir-state--declined { --ui-chip-tone: var(--ui-muted); }
.app-dir-pick, .app-dir-profile > .ui-btn { min-height: 44px; border-radius: 22px; justify-content: center; letter-spacing: 0; }

/* пустые состояния и ошибки */
.app-dir-empty { display: grid; justify-items: start; gap: 8px; padding: 16px 18px; border-radius: var(--hub-r-row, 18px); }
.app-dir-empty h2 { font: 600 17px/1.3 var(--ui-font); }
.app-dir-error { color: var(--ui-danger); font-size: 14px; }
.app-dir-error:empty, .app-dir-options:empty, .app-dir-form[hidden] { display: none; }
.app-dir-results > .ui-btn { min-height: 44px; border-radius: 22px; justify-self: start; letter-spacing: 0; }

/* формы добавления и правки (окно ui-kit) */
.app-dir-form, .app-dir-options { display: grid; gap: 12px; min-width: 0; }
.app-dir-field { display: grid; gap: 4px; width: 100%; min-width: 0; }
.app-dir-form .ui-btn { min-height: 44px; max-width: 100%; }
.app-dir-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.app-dir-form .ui-input, .app-dir-form .ui-select { box-sizing: border-box; min-width: 0; min-height: 44px; width: 100%; font-size: 16px; }
.app-dir-form textarea { resize: vertical; }
.app-dir-match { display: grid; justify-items: start; gap: 8px; min-width: 0; padding: 16px; }

@media (min-width: 1024px) {
  .app-dir-body { max-width: 1040px; }
  .app-dir .app-dir-search { max-width: 480px; }
  /* на компьютере строки списка — отдельные карточки в две колонки */
  .app-dir-results .hub-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; background: none; border: 0; border-radius: 0; overflow: visible; }
  .app-dir-results .hub-list > .hub-row { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--hub-r-row, 18px); }
  .app-dir-results .hub-list > .hub-row::before { display: none; }
}
