/* Кнопка «Банки» + модалка выбора банков подбора.
   Общий модуль для /chat, главной и посадочных /ipoteka. Дизайн — handoff
   «Bank Selector» (Ipoteka.Center DS). Только --ic-* токены. Пара с
   assets/js/bank-filter.js (тот инжектит разметку модалки и вешает логику). */

/* ── Бейдж на кнопке «Банки» — всегда виден, показывает N/total ── */
.ch-banks-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 22px; padding: 0 8px; box-sizing: border-box;
  background: var(--ic-purple); color: #fff; border-radius: var(--ic-r-pill);
  font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.ch-banks-badge[hidden] { display: none; }

/* ── Модалка ── */
@keyframes ch-banks-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ch-banks-pop  { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.ch-banks-modal {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 32px; box-sizing: border-box;
  background: rgba(9, 40, 82, .32); backdrop-filter: blur(2px);
  animation: ch-banks-fade var(--ic-dur) var(--ic-ease);
}
.ch-banks-modal[hidden] { display: none; }

.ch-banks-modal__card {
  position: relative; width: 680px; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ic-surface); border-radius: var(--ic-r-xl);
  box-shadow: var(--ic-shadow-3);
  animation: ch-banks-pop var(--ic-dur-slow) var(--ic-ease);
  font-family: var(--ic-font-body); color: var(--ic-fg);
}

.ch-banks-modal__x {
  position: absolute; top: 28px; right: 28px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 0; cursor: pointer;
  background: var(--ic-bg-alt); color: var(--ic-fg-muted);
  border-radius: var(--ic-r-pill);
  transition: background var(--ic-dur) var(--ic-ease);
}
.ch-banks-modal__x:hover { background: var(--ic-border); }

.ch-banks-modal__head { padding: 40px 40px 20px; display: flex; flex-direction: column; gap: 12px; }
.ch-banks-modal__title {
  margin: 0; font-family: var(--ic-font-display); font-size: 34px; font-weight: 700;
  line-height: 1.1; letter-spacing: -.01em; color: var(--ic-fg);
}
.ch-banks-modal__sub { margin: 0; max-width: 480px; font-size: 17px; line-height: 1.45; color: var(--ic-fg-muted); }

.ch-banks-modal__tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.ch-banks-modal__toolbtns { display: flex; align-items: center; gap: 22px; }
.ch-banks-modal__all {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  font-family: var(--ic-font-body); font-size: 17px; font-weight: 600; color: var(--ic-purple);
}
.ch-banks-modal__all:hover { color: var(--ic-purple-600); }
.ch-banks-modal__count { font-size: 16px; color: var(--ic-fg-muted); font-variant-numeric: tabular-nums; }

.ch-banks-modal__body { padding: 4px 40px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ch-banks-sec__title {
  font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ic-fg-soft); padding: 12px 0 6px;
}
.ch-banks-sec:nth-child(2) .ch-banks-sec__title { padding-top: 18px; }
.ch-banks-sec__grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; row-gap: 2px; }

/* строка-банк: скрытый нативный чекбокс (a11y/клавиатура) + кастомная коробка */
.ch-banks-item { display: flex; align-items: center; gap: 14px; padding: 9px 0; cursor: pointer; user-select: none; }
.ch-banks-item input {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
.ch-banks-box {
  position: relative; flex: none; width: 24px; height: 24px; box-sizing: border-box;
  border: 2px solid var(--ic-border-strong); border-radius: var(--ic-r-sm); background: #fff;
  transition: background var(--ic-dur) var(--ic-ease), border-color var(--ic-dur) var(--ic-ease);
}
.ch-banks-box::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
  opacity: 0; transition: opacity var(--ic-dur) var(--ic-ease);
}
.ch-banks-item input:checked ~ .ch-banks-box { background: var(--ic-purple); border-color: var(--ic-purple); }
.ch-banks-item input:checked ~ .ch-banks-box::after { opacity: 1; }
.ch-banks-item input:focus-visible ~ .ch-banks-box { outline: 2px solid var(--ic-purple); outline-offset: 2px; }
.ch-banks-name { font-size: 19px; line-height: 1.25; color: var(--ic-fg); }

.ch-banks-modal__foot {
  margin-top: auto; padding: 20px 40px; border-top: 1px solid var(--ic-border);
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
}
.ch-banks-btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 13px 30px;
  border: 1px solid transparent; border-radius: var(--ic-r-pill); cursor: pointer;
  background: var(--ic-purple); color: #fff;
  font-family: var(--ic-font-display); font-size: 17px; font-weight: 600;
  transition: background var(--ic-dur) var(--ic-ease);
}
.ch-banks-btn:hover { background: var(--ic-purple-600); }
.ch-banks-btn:active { background: var(--ic-purple-700); }
.ch-banks-btn--ghost { padding: 13px 26px; background: transparent; color: var(--ic-fg); border-color: var(--ic-border-strong); }
.ch-banks-btn--ghost:hover { background: var(--ic-bg-alt); }

@media (max-width: 560px) {
  .ch-banks-modal { padding: 0; align-items: flex-end; }
  .ch-banks-modal__card { max-height: 92vh; border-radius: var(--ic-r-xl) var(--ic-r-xl) 0 0; }
  .ch-banks-modal__head { padding: 28px 24px 16px; }
  .ch-banks-modal__title { font-size: 27px; }
  .ch-banks-modal__body { padding: 4px 24px 8px; }
  .ch-banks-modal__foot { padding: 16px 24px; }
  .ch-banks-sec__grid { grid-template-columns: 1fr; }
  .ch-banks-modal__x { top: 20px; right: 20px; }
}
