/* «Рассылка» (broadcast.js): composer with a live phone preview, audience
   tiles with a reach meter, planned queue and history. Brand tokens only —
   seasonal moods recolour it through the same variables. */

.bc-head { align-items: flex-end; flex-wrap: wrap; }
.bc-lead { color: var(--subtle); margin-top: 6px; font-size: 14px; }
.bc-tabs button { white-space: nowrap; }
.bc-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
}
.bc-loading { color: var(--subtle); padding: 40px 0; text-align: center; }
.bc-legacy {
  background: var(--amber-weak); color: var(--ink); border-radius: var(--r-md);
  padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; line-height: 1.45;
}
.bc-mini { font-size: 12.5px; color: var(--subtle); line-height: 1.45; }

/* KPI strip */
.bc-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg); overflow: hidden;
}
.bc-kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  background: transparent; padding: 14px 16px;
  box-shadow: inset -1px 0 0 var(--divider), inset 0 -1px 0 var(--divider);
}
.bc-kpi-ic { display: none; }
.bc-kpi > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bc-kpi b { font-family: var(--font-ui); font-weight: 700; font-size: 26px; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bc-kpi span { font-size: 13px; font-weight: 500; color: var(--ink-2); line-height: 1.35; }

/* Layout: steps left, sticky phone right */
.bc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.bc-compose { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bc-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

.bc-step {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.bc-step > header { display: flex; align-items: center; gap: 10px; }
.bc-step h3 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--ink); }
.bc-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700;
}
.bc-editing {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--blue-weak); color: var(--ink); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px;
}

/* Audience tiles */
.bc-aud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bc-aud-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-width: 0;
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: var(--r-md);
  padding: 10px 12px; cursor: pointer; color: var(--ink); font: inherit;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.bc-aud-tile:hover { border-color: var(--field-border); background: var(--surface); }
.bc-aud-tile:active { transform: scale(.98); }
.bc-aud-tile.on { border-color: var(--accent); background: var(--accent-weak); }
.bc-aud-tile:disabled { opacity: .4; cursor: not-allowed; }
.bc-aud-ic { font-size: 20px; line-height: 1.2; }
.bc-aud-l { font-weight: 600; font-size: 13.5px; }
.bc-aud-s { font-size: 11.5px; color: var(--subtle); line-height: 1.3; }
.bc-pick { margin-top: -2px; }
.bc-countries { display: flex; flex-wrap: wrap; gap: 6px; }

/* Reach meter */
.bc-reach { background: var(--paper-2); border-radius: var(--r-md); padding: 14px 16px; }
.bc-reach-empty { color: var(--subtle); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.bc-reach-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bc-reach-big { display: flex; align-items: baseline; gap: 8px; }
.bc-reach-big b { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--accent-ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bc-reach-big span { font-size: 14px; color: var(--ink-2); }
.bc-reach-of { font-size: 12.5px; color: var(--subtle); }
.bc-bar { display: flex; height: 10px; border-radius: var(--r-pill); background: var(--elevated); overflow: hidden; gap: 2px; }
.bc-bar.sm { height: 6px; }
.bc-bar i { display: block; height: 100%; border-radius: var(--r-pill); transition: width .35s ease; }
.bc-bar .ok, .bc-legend i.ok { background: var(--green); }
.bc-bar .opt, .bc-legend i.opt { background: var(--amber); }
.bc-bar .none, .bc-legend i.none { background: #c4c7d2; }
.bc-bar .bad { background: var(--red); }
.bc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.bc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bc-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.bc-spin {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--elevated); border-top-color: var(--accent); animation: bc-spin .8s linear infinite;
}
@keyframes bc-spin { to { transform: rotate(360deg); } }

/* Chips */
.bc-templates, .bc-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper-2); border: 1px solid var(--stroke); color: var(--ink);
  border-radius: var(--r-pill); padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.bc-chip:hover { background: var(--surface); border-color: var(--field-border); }
.bc-chip.on { background: var(--accent-weak); border-color: var(--accent); }
.bc-chip b { font-weight: 700; color: var(--accent-ink); }
.bc-counter { margin-left: auto; font-weight: 500; color: var(--subtle); font-variant-numeric: tabular-nums; }
.bc-counter.warn { color: var(--amber); }
.bc-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.bc-name-chip { font-weight: 600; }
.bc-emoji { display: flex; flex-wrap: wrap; gap: 2px; }
.bc-emoji button {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: none; cursor: pointer; font-size: 16px;
  transition: background .1s ease, transform .1s ease;
}
.bc-emoji button:hover { background: var(--elevated); transform: scale(1.15); }
.bc-fallback { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.bc-fallback input { width: 160px; }

/* Tap & category */
.bc-seg { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.bc-seg button:disabled { opacity: .45; cursor: not-allowed; }
.bc-tap-help { margin: 0; }
.bc-cats-wrap { display: flex; flex-direction: column; gap: 8px; }
.bc-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-cat-pill {
  border: 1.5px solid var(--stroke); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-pill); padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.bc-cat-pill:hover { border-color: var(--field-border); color: var(--ink); }
.bc-cat-pill.on { border-color: var(--ink); background: var(--ink); color: #fff; }

/* When */
.bc-when-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bc-when-row input[type="datetime-local"] { width: auto; max-width: 100%; }
.bc-warn { background: var(--amber-weak); border-radius: var(--r-md); padding: 9px 12px; font-size: 13px; color: var(--ink); }

/* Actions */
.bc-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(6px);
  padding: 12px 0;
}
.bc-actions .bc-go { margin-left: auto; padding: 12px 22px; font-size: 15px; box-shadow: 0 8px 20px -10px var(--accent); }
.bc-done {
  display: flex; align-items: center; gap: 14px;
  background: var(--green-weak); border-radius: var(--r-lg); padding: 14px 18px; animation: bc-pop .35s ease;
}
.bc-done-ic { font-size: 28px; }
@keyframes bc-pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Phone preview ── */
.bc-pv-seg { align-self: center; }
.bc-phone {
  align-self: center; width: 300px; max-width: 100%; aspect-ratio: 300 / 600;
  border-radius: 46px; padding: 10px; background: #1b1e27;
  box-shadow: 0 0 0 2px #3a3f4d inset, 0 30px 60px -28px rgba(20, 24, 40, .55);
}
.bc-ph-screen {
  position: relative; height: 100%; border-radius: 37px; overflow: hidden;
  padding: 12px 12px 18px; display: flex; flex-direction: column; gap: 10px;
  color: #fff;
  background:
    radial-gradient(120% 70% at 80% 0%, rgba(255, 183, 120, .85), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(232, 118, 63, .55), transparent 70%),
    linear-gradient(170deg, #2b3655 0%, #4a4f7a 45%, #c76a45 100%);
}
.bc-ph-screen.open { background: linear-gradient(180deg, rgba(20,24,40,.25), rgba(20,24,40,.55)), linear-gradient(170deg, #2b3655 0%, #4a4f7a 45%, #c76a45 100%); }
.bc-ph-screen::after {   /* mountains */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none;
  background: linear-gradient(to top, rgba(22, 26, 44, .55), transparent);
  clip-path: polygon(0 60%, 18% 30%, 30% 48%, 48% 12%, 62% 40%, 74% 26%, 100% 55%, 100% 100%, 0 100%);
}
.bc-ph-island { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 92px; height: 26px; background: #0b0c10; border-radius: 20px; }
.bc-ph-status { display: flex; justify-content: space-between; padding: 2px 14px 0; font-size: 12px; font-weight: 600; min-height: 20px; }
.bc-ph-icons { letter-spacing: 2px; font-size: 10px; opacity: .9; }
.bc-ph-clock { text-align: center; margin: 14px 0 8px; text-shadow: 0 1px 10px rgba(0,0,0,.15); }
.bc-ph-date { font-size: 14px; font-weight: 500; opacity: .92; }
.bc-ph-time { font-family: var(--font-display); font-size: 62px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.bc-ph-notif {
  position: relative; z-index: 1;
  background: rgba(245, 242, 238, .78); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  color: #111; border-radius: 20px; padding: 11px 13px 12px; box-shadow: 0 4px 18px rgba(0,0,0,.12);
  animation: bc-pop .3s ease;
}
.bc-ph-notif.empty .bc-ph-title, .bc-ph-notif.empty .bc-ph-body { color: rgba(0,0,0,.38); }
.bc-ph-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.bc-ph-app {
  width: 20px; height: 20px; border-radius: 5px; background: var(--accent); color: #fff;
  font-size: 7.5px; font-weight: 800; display: grid; place-items: center; letter-spacing: .02em; flex: none;
}
.bc-ph-appname { font-size: 12px; font-weight: 600; color: rgba(0,0,0,.6); text-transform: uppercase; letter-spacing: .02em; }
.bc-ph-ago { margin-left: auto; font-size: 11.5px; color: rgba(0,0,0,.45); }
.bc-ph-title { font-weight: 650; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-ph-body {
  font-size: 13.5px; line-height: 1.33; margin-top: 1px; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.bc-ph-screen.open .bc-ph-notif { margin-top: 36px; }
.bc-ph-screen.open .bc-ph-title { white-space: normal; }
.bc-ph-screen.open .bc-ph-body { -webkit-line-clamp: unset; display: block; max-height: 360px; overflow: auto; }
.bc-ph-bottom { margin-top: auto; display: flex; justify-content: space-between; padding: 0 22px; position: relative; z-index: 1; }
.bc-ph-bottom span { width: 42px; height: 42px; border-radius: 50%; background: rgba(20,24,40,.35); backdrop-filter: blur(8px); display: grid; place-items: center; font-size: 16px; }

.bc-tap-note {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 10px 12px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px;
}
.bc-ready { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 10px 12px; }
.bc-ready-h { font-size: 12px; font-weight: 600; color: var(--subtle); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.bc-ready-list { list-style: none; text-align: left; align-items: stretch; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--subtle); }
.bc-ready-list li { display: flex; gap: 8px; align-items: baseline; }
.bc-ready-list li span { width: 16px; text-align: center; font-weight: 700; }
.bc-ready-list li.ok { color: var(--ink-2); }
.bc-ready-list li.ok span { color: var(--green); }

/* Confirm modal */
.bc-confirm { display: flex; flex-direction: column; gap: 14px; }
.bc-confirm-pv {
  border-radius: var(--r-lg); padding: 16px;
  background: linear-gradient(160deg, #2b3655 0%, #4a4f7a 55%, #c76a45 100%);
}
.bc-confirm-pv .bc-ph-title { white-space: normal; }
.bc-confirm-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.bc-confirm-dl dt { color: var(--subtle); }
.bc-confirm-dl dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.bc-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.bc-confirm-actions .btn-primary { margin-top: 0; }

/* ── Planned & history ── */
.bc-list-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.bc-list { display: flex; flex-direction: column; gap: 10px; }
.bc-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 210px auto; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--stroke); border-left: 4px solid var(--stroke);
  border-radius: var(--r-lg); padding: 14px 16px;
}
.bc-item.st-ok { border-left-color: var(--green); }
.bc-item.st-sch { border-left-color: var(--blue); }
.bc-item.st-bad { border-left-color: var(--red); }
.bc-item.st-off { opacity: .65; }
.bc-item.st-test { border-left-color: var(--subtle); border-style: dashed; border-left-style: solid; }
.bc-item-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bc-item-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 2px; }
.bc-status { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); background: var(--elevated); color: var(--ink-2); }
.bc-status.ok { background: var(--green-weak); color: var(--green); }
.bc-status.sch { background: var(--blue-weak); color: var(--blue); }
.bc-status.bad { background: var(--red-weak); color: var(--red); }
.bc-status.q { background: var(--amber-weak); color: var(--amber); }
.bc-tag { font-size: 11.5px; color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--divider); border-radius: var(--r-pill); padding: 2px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-item-title { font-weight: 650; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.bc-item-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bc-item-meta { font-size: 12px; color: var(--subtle); }
.bc-err { color: var(--red); }
.bc-item-stats { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bc-item-big { display: flex; align-items: baseline; gap: 6px; }
.bc-item-big b { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bc-item-big span { font-size: 12.5px; color: var(--subtle); }
.bc-item-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.bc-empty {
  text-align: center; color: var(--subtle); padding: 46px 20px; background: var(--surface);
  border: 1px dashed var(--field-border); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.bc-empty-ic { font-size: 34px; }

/* ── Narrow screens ── */
/* Tap → «Новость в ленте»: pick a published item (0108) */
.bc-news-mode { margin-bottom: 10px; flex-wrap: wrap; }
.bc-news-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px;
  max-height: 264px; overflow-y: auto; padding: 2px;
}
.bc-news-opt {
  display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; font: inherit; color: var(--ink);
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: var(--r-md); padding: 7px 10px 7px 7px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.bc-news-opt:hover { background: var(--surface); border-color: var(--field-border); }
.bc-news-opt.on { background: var(--accent-weak); border-color: var(--accent); }
.bc-news-opt img, .bc-news-ph {
  flex: none; width: 52px; height: 40px; border-radius: 8px; object-fit: cover; display: grid; place-items: center;
  background: var(--elevated); font-size: 18px;
}
.bc-news-txt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.bc-news-txt b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-news-txt span { font-size: 12px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-news-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.bc-news-empty {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--paper-2); border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; color: var(--ink-2);
}

@media (max-width: 1180px) {
  .bc-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .bc-aud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .bc-grid { grid-template-columns: minmax(0, 1fr); }
  .bc-side { position: static; order: -1; }
  .bc-phone { width: 260px; }
  .bc-item { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bc-item-actions { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .bc-kpi { padding: 10px 12px; }
  .bc-kpi-ic { display: none; }
  .bc-kpi b { font-size: 22px; }
  .bc-phone { width: 230px; }
  .bc-ready { display: none; }
  .bc-step { padding: 14px; }
  .bc-aud-tile { padding: 9px 10px; }
  .bc-tabs { width: 100%; overflow-x: auto; }
  .bc-seg button { padding: 7px 10px; font-size: 12.5px; }
  .bc-actions .bc-go { width: 100%; margin-left: 0; }
  .bc-ph-time { font-size: 52px; }
}
