/* ---------- «Рассылки» (broadcast.js): кому отправить + сообщение слева, предпросмотр и история справа ---------- */
.bc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.bc-main, .bc-side { display: grid; gap: 16px; min-width: 0; align-content: start; }
.bc-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  box-shadow: var(--shadow); min-width: 0; scroll-margin-top: 120px; }
.bc-h { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.bc-h svg { color: var(--accent-text); flex: none; }
.bc-link { padding: 0; border: 0; background: none; color: var(--accent-text); font-size: 13px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; box-shadow: none; }
.bc-link:hover { background: none; color: var(--text); }
.bc-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 4px; }

/* ---- кому отправить ---- */
.bc-aud { container: bca / inline-size; }
.bc-aud-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bc-aud-t { min-width: 0; flex: 1 1 220px; }
.bc-aud-t .bc-h { margin-bottom: 3px; }
.bc-aud-sum { color: var(--text-dim); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }

/* живой счётчик: сияние — только в рамке */
.bc-count-wrap { position: relative; flex: none; max-width: 100%; }
.bc-count { display: inline-flex; align-items: baseline; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap;
  border: 1px solid transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--aurora-grad) border-box;
  box-shadow: 0 8px 26px -14px color-mix(in srgb, var(--accent) 70%, transparent); transition: opacity .15s; }
button.bc-count:hover { background: linear-gradient(var(--panel-3), var(--panel-3)) padding-box, var(--aurora-grad) border-box; }
.bc-count b { font: 700 17px "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--accent-text); }
.bc-count-l { color: var(--text-dim); font-weight: 500; }
.bc-count.busy { opacity: .6; }
.bc-count.zero { align-items: center; color: var(--warn-text); background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--warn) 40%, transparent); box-shadow: none; }
.bc-count.err { align-items: center; color: var(--neg-text); background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  border-color: color-mix(in srgb, var(--danger) 40%, transparent); box-shadow: none; }
span.bc-count.busy { align-items: center; color: var(--text-dim); background: var(--panel-2); border-color: var(--border); box-shadow: none; opacity: 1; }
.bc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bcPulse .9s ease-in-out infinite alternate; }
.bc-sample { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: max-content; max-width: min(320px, calc(100vw - 48px));
  padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; color: var(--text);
  background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: none; overflow-wrap: anywhere; }
.bc-sample small { display: block; margin-top: 4px; color: var(--text-faint); font-size: 12px; }
.bc-count-wrap.open .bc-sample { display: block; }
.bc-count-wrap:has(.bc-count:focus-visible) .bc-sample { display: block; }  /* отдельно: без :has правило выше не пропадёт */
@media (hover: hover) { .bc-count-wrap:hover .bc-sample { display: block; } }

.bc-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.bc-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim); }
.bc-chip:hover { color: var(--text); background: var(--panel-3); border-color: var(--border-2); }
.bc-chip.on { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bc-chip.sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }
.bc-n { font: 600 11.5px "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--text-faint); }
.bc-chip.on .bc-n { color: var(--accent-text); }
.bc-more-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: transparent; border: 1px dashed var(--border-2); color: var(--text-dim); }
.bc-more-btn svg { transition: transform .15s; }
.bc-more-btn.open svg { transform: rotate(180deg); }
.bc-more-btn.custom { color: var(--accent-text); border-style: solid; border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft); }

/* «Точнее…»: все условия разом */
.bc-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 14px; padding-top: 16px;
  border-top: 1px solid var(--border); animation: bcIn .18s ease-out; }
.bc-more[hidden] { display: none; }
.bc-f { min-width: 0; }
.bc-f.wide { grid-column: 1 / -1; }
.bc-f label, .bc-fl { display: block; margin: 0 0 7px; color: var(--text-faint); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; }
.bc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-grp { margin: 8px 0 6px; color: var(--text-dim); font-size: 12px; font-weight: 600; }
.bc-grp:first-child { margin-top: 0; }
.bc-load, .bc-none { color: var(--text-faint); font-size: 13px; }
.bc-load { animation: bcPulse .9s ease-in-out infinite alternate; }
.bc-pair { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
.bc-pair select:only-child { grid-column: 1 / -1; }
.bc-more-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bc-more-foot .hint { margin: 0; }

/* ---- сообщение ---- */
.bc-form { container: bcf / inline-size; }
.bc-form > label { margin-top: 18px; }
.bc-editing { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 14px; padding: 10px 12px;
  border-radius: 12px; font-size: 13px; color: var(--text); background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.bc-editing svg { color: var(--warn-text); flex: none; }
.bc-editing span { flex: 1 1 auto; min-width: 0; }

.bc-btns { display: grid; gap: 8px; }
.bc-btns:empty { display: none; }
.bc-btn { display: grid; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--border); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.3fr) auto;
  grid-template-areas: "t k f x"; }
.bc-btn > input:first-child { grid-area: t; }
.bc-btn .bc-kind { grid-area: k; }
.bc-btn .bc-url, .bc-btn select { grid-area: f; min-width: 0; }
.bc-btn .bc-btn-x { grid-area: x; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.bc-kind { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-3); border: 1px solid var(--border); }
.bc-kind button { padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); white-space: nowrap; }
.bc-kind button:hover { background: var(--panel-4); color: var(--text); }
.bc-kind button.on { background: var(--panel); color: var(--accent-text); box-shadow: var(--shadow); }
.bc-add { margin-top: 8px; }

.bc-send { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.bc-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bc-acts .spacer { flex: 1; }
.bc-now { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.bc-send button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.bc-sched label { margin: 14px 0 7px; }
.bc-sched-row { display: flex; gap: 8px; align-items: center; }
.bc-sched-row input { flex: 1 1 220px; min-width: 0; max-width: 280px; }
.bc-block:empty { display: none; }
.bc-block { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45;
  color: var(--warn-text); background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

/* ---- история ---- */
.bc-list { display: grid; gap: 10px; }
.bc-item { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); min-width: 0;
  animation: bcIn .2s ease-out; }
.bc-item-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bc-item-head .spacer { flex: 1; }
.bc-status { flex: none; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  color: var(--text-dim); background: var(--panel-3); }
.bc-status.s-done { color: var(--pos-text); background: color-mix(in srgb, var(--pos) 13%, transparent); }
.bc-status.s-scheduled { color: var(--accent-text); background: var(--accent-soft); }
.bc-status.s-pending, .bc-status.s-running { color: var(--info-text); background: color-mix(in srgb, var(--info) 14%, transparent); }
.bc-status.s-draft { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.bc-status.s-error { color: var(--neg-text); background: color-mix(in srgb, var(--neg) 13%, transparent); }
/* номер рассылки — его называет подпись «не нажали в рассылке №37 от 12.10» */
.bc-num { flex: none; color: var(--text-dim); font: 600 11.5px "IBM Plex Mono", ui-monospace, monospace; }
.bc-when { min-width: 0; color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-ib { flex: none; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
.bc-aud-l { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; color: var(--text-dim); font-size: 12.5px;
  font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.bc-aud-l svg { flex: none; margin-top: 1px; color: var(--text-faint); }
.bc-item-text { margin: 4px 0 0; color: var(--text); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.bc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 10px 0 0; }
.bc-stats > div { padding: 7px 9px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); min-width: 0; }
.bc-stats dt { color: var(--text-faint); font-size: 11px; font-weight: 600; }
.bc-stats dd { margin: 2px 0 0; font: 600 15px "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-stats dd small { font-size: 11px; color: var(--text-faint); }
.bc-stats dd.neg { color: var(--neg-text); }
.bc-prog, .bc-bar { height: 6px; margin-top: 10px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.bc-prog i, .bc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--aurora-grad); transition: width .3s ease; }
.bc-ctr { margin-top: 10px; }
.bc-ctr-t { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.bc-ctr-t b { font: 700 15px "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--text); }
.bc-pct { margin-left: auto; font: 600 13px "IBM Plex Mono", ui-monospace, monospace; color: var(--accent-text); }
.bc-ctr .bc-bar { margin-top: 6px; }
.bc-note { display: block; margin-top: 6px; color: var(--text-faint); font-size: 11.5px; }
.bc-repeat { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 40px; margin-top: 10px;
  font-size: 13px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.bc-repeat:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.bc-repeat:disabled { opacity: .55; cursor: default; color: var(--text-dim); background: var(--panel-3); border-color: var(--border); transform: none; }
.bc-nobtn { margin-top: 8px; color: var(--text-faint); font-size: 11.5px; }
.bc-hempty, .bc-empty { padding: 18px; text-align: center; color: var(--text-faint); font-size: 13.5px; line-height: 1.5;
  border: 1px dashed var(--border-2); border-radius: 12px; }
.bc-empty { display: grid; justify-items: center; gap: 8px; padding: 32px 18px; }
.bc-empty b { color: var(--text); font-size: 15px; }

@keyframes bcPulse { to { opacity: .45; } }
@keyframes bcIn { from { opacity: 0; transform: translateY(4px); } }

/* узкие колонки (контейнер, а не окно) */
@container bca (max-width: 520px) {
  .bc-more { grid-template-columns: minmax(0, 1fr); }
  .bc-pair { grid-template-columns: minmax(0, 1fr); }
}
@container bcf (max-width: 560px) {
  .bc-btn { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "t t x" "k f f"; }
  .bc-acts .spacer { display: none; }
  .bc-acts > button { flex: 1 1 calc(50% - 4px); }
  .bc-acts > .bc-now { order: -1; flex-basis: 100%; min-height: 46px; }
  .bc-sched-row { flex-wrap: wrap; }
  .bc-sched-row input { max-width: none; flex-basis: 100%; }
  .bc-sched-row button { flex: 1 1 100%; }
}
@media (max-width: 1000px) { .bc-grid { grid-template-columns: minmax(0, 1fr); } }
/* телефон: поля 16px (иначе iOS увеличивает страницу), цели нажатия от 40px */
@media (max-width: 820px) {
  .bc-card { padding: 14px; border-radius: 14px; }
  .bc-screen input, .bc-screen select, .bc-screen .richtext { font-size: 16px; }
  .bc-aud-head { flex-direction: column; align-items: stretch; }
  .bc-aud-t { flex-basis: auto; }  /* в колонке basis 220px становился высотой — пустая дыра под заголовком */
  .bc-count-wrap .bc-count { width: 100%; justify-content: center; }
  .bc-sample { left: 0; right: auto; }
}
@media (hover: none), (pointer: coarse) {
  .bc-chip, .bc-chip.sm, .bc-more-btn, .bc-kind button, .bc-send button, .bc-ib, .bc-link { min-height: 40px; }
  .bc-ib { width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .bc-dot, .bc-load, .bc-more, .bc-item { animation: none; }
  .bc-prog i, .bc-bar i, .bc-more-btn svg { transition: none; }
}
