/* admin_alerts.css — раздел админки «Оповещения» (разметка — admin_alerts.js).
   Только свои классы (.aa-*): раздел самодостаточен и переедет в новую навигацию
   админки целиком. Цвета — токены приложения (style.css :root). Телефон < 768:
   строки событий в столбик, кнопки, поля и галочки не меньше 44 точек, без горизонтальной
   прокрутки; поля по бокам задаёт карточка. Фокус с клавиатуры виден везде (общий style.css
   снимает outline у input — здесь он возвращён). */

.aa { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.aa-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px 22px; min-width: 0;
}
.aa-h {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-strong);
}
.aa-count { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-dim); margin-right: auto; }
.aa-hint { margin: 12px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-dim); max-width: 720px; }
.aa-empty { margin: 0; font-size: 13px; color: var(--text-dim); }
.aa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aa input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.aa input:not([type="checkbox"]):focus-visible, .aa select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.aa input[aria-invalid="true"] { border-color: var(--danger); background: rgba(var(--danger-rgb), .06); }
.aa [tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
/* Части экрана (admin_alerts.js перерисовывает их по отдельности) — без своей коробки:
   иначе липкая полоса «Сохранить» липла бы только внутри своей обёртки. */
[data-aa-part] { display: contents; }
/* Выключено — видно сразу: события и сводка приглушены, сверху плашка. */
.aa.aa-is-off [data-aa-part="events"] > .aa-card, .aa.aa-is-off [data-aa-part="digest"] > .aa-card { opacity: .5; }

/* Главный выключатель */
.aa-master { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-wash), transparent 70%), var(--bg-card); }
.aa-master-row { display: flex; align-items: center; gap: 16px; }
.aa-master-text { flex: 1; min-width: 0; }
.aa-title { font-size: 17px; font-weight: 700; color: var(--text-strong); }
.aa-sub { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--text-mid); }
.aa-warn {
    margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5;
    color: var(--warning); background: rgba(240, 185, 94, .08); border: 1px solid rgba(240, 185, 94, .25);
}
.aa-switch { position: relative; display: inline-flex; flex: none; width: 52px; height: 30px; cursor: pointer; }
.aa-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.aa-switch-ui {
    width: 52px; height: 30px; border-radius: var(--radius-pill); background: var(--border-strong);
    transition: background .15s; position: relative;
}
.aa-switch-ui::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--text); transition: transform .15s;
}
.aa-switch input:checked + .aa-switch-ui { background: var(--accent); }
.aa-switch input:checked + .aa-switch-ui::after { transform: translateX(22px); background: #fff; }
.aa-switch input:focus-visible + .aa-switch-ui { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Адреса */
.aa-recips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.aa-recip {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.aa-recip:last-child { border-bottom: none; }
.aa-recip-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.aa-addr { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.aa-recip-meta { grid-column: 1; font-size: 12px; color: var(--text-dim); }
.aa-recip-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.aa-danger:where(:not(:disabled)):hover { color: var(--danger); border-color: rgba(var(--danger-rgb), .5); }
.aa-add { display: flex; gap: 10px; margin-top: 14px; max-width: 560px; }
.aa-add[hidden] { display: none; }
.aa-add input { flex: 1; min-width: 0; }

/* Метки состояния */
.aa-chip {
    display: inline-flex; align-items: center; white-space: nowrap; padding: 3px 9px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em; color: var(--text-mid); background: var(--bg-elev);
    border: 1px solid var(--border);
}
.aa-chip-confirmed, .aa-chip-sent, .aa-chip-digested { color: var(--success); background: rgba(33, 208, 122, .1); border-color: rgba(33, 208, 122, .25); }
.aa-chip-pending, .aa-chip-digest, .aa-chip-throttled, .aa-chip-queued { color: var(--warning); background: rgba(240, 185, 94, .08); border-color: rgba(240, 185, 94, .25); }
.aa-chip-failed, .aa-chip-capped, .aa-chip-unsent, .aa-chip-unsubscribed { color: var(--danger); background: rgba(var(--danger-rgb), .08); border-color: rgba(var(--danger-rgb), .28); }

/* События */
.aa-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; }
.aa-group { min-width: 0; }
.aa-group-h {
    margin: 10px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text);
}
.aa-ev {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px;
    padding: 9px 0; border-bottom: 1px solid var(--border-soft);
}
.aa-ev:last-child { border-bottom: none; }
.aa-ev-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-width: 0; }
.aa-ev-check input { width: 18px; height: 18px; margin: 1px 0 0; padding: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.aa-ev-name { font-size: 13.5px; line-height: 1.4; color: var(--text); }
.aa-ev-desc { grid-column: 1 / -1; margin: -2px 0 0; padding-left: 28px; font-size: 12px; line-height: 1.45; color: var(--text-dim); }
.aa-ev-warn { grid-column: 1 / -1; margin: 0; padding-left: 28px; font-size: 12px; line-height: 1.45; color: var(--warning); }
.aa-ev-warn[hidden] { display: none; }
.aa-ev.off .aa-ev-name { color: var(--text-dim); }
.aa-ev.off .aa-seg, .aa-ev.off .aa-ev-th { opacity: .45; }
.aa-ev-th { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-left: 28px; }
.aa-th { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-mid); }
.aa-th input, .aa-inline input { width: 84px; padding: 6px 8px; font-size: 13px; border-radius: var(--radius-sm); }
.aa-th-note { font-size: 12px; color: var(--text-dim); }
.aa-seg {
    grid-column: 2; grid-row: 1; display: inline-flex; padding: 2px; border-radius: var(--radius-pill);
    background: var(--bg-elev); border: 1px solid var(--border);
}
.aa-seg-btn {
    background: transparent; border: 0; border-radius: var(--radius-pill); padding: 5px 11px; font: inherit;
    font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.aa-seg-btn.on { background: var(--accent-soft); color: var(--accent-strong); }
.aa-seg-btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }

/* Сводка и защита от потока */
.aa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.aa-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-mid); min-width: 0; }
.aa-field select { max-width: 140px; }
.aa-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-mid); }
.aa-tz-row { display: flex; gap: 8px; align-items: center; }
.aa-tz-row input { flex: 1; min-width: 0; }
.aa-tz-now { font-size: 12px; color: var(--text-dim); }

/* Сохранить: пока правок нет — простая строка между карточками; есть правки — липнет к низу
   экрана, чтобы кнопка была под рукой, где бы ни была правка. Над нижней стопкой (вкладки, мини-плеер —
   --bottom-stack): прежние 76 точек были только у телефона, на iPad стоя полоса уходила под вкладки — «не
   сохранено» и «Сохранить» не было видно (смоук 24.10). */
.aa-savebar {
    display: flex; align-items: center; justify-content: flex-end; gap: 14px;
    padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid transparent;
}
.aa-savebar.dirty {
    position: sticky; bottom: calc(var(--bottom-stack, 0px) + 12px); z-index: 5; border-color: var(--accent-line);
    background: var(--bg-card); box-shadow: 0 -6px 24px rgba(0, 0, 0, .45);
}
.aa-savebar:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.aa-dirty { font-size: 13px; color: var(--warning); margin-right: auto; }

/* История */
.aa-history { list-style: none; margin: 12px 0 0; padding: 0; }
.aa-hrow {
    display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 2px 14px;
    padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.aa-hrow:last-child { border-bottom: none; }
.aa-hist-tools { display: inline-flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.aa-hist-tools select { padding: 5px 8px; font-size: 12px; max-width: 170px; }
.aa-htime { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.aa-hwhat { display: flex; flex-direction: column; min-width: 0; }
.aa-hev { font-size: 11.5px; color: var(--text-dim); }
.aa-hsubj { color: var(--text); overflow-wrap: anywhere; }
.aa-hnote { grid-column: 2 / -1; font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }

@media (max-width: 1099px) {
    .aa-groups { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .aa { gap: 12px; }
    .aa-card { padding: 14px; border-radius: var(--radius); }
    .aa-master-row { flex-wrap: wrap; gap: 12px; }
    .aa-master-text { flex: 1 1 calc(100% - 72px); }
    .aa-test { width: 100%; min-height: 44px; }
    .aa-switch { width: 52px; height: 44px; align-items: center; }
    .aa-recip { grid-template-columns: minmax(0, 1fr); }
    .aa-recip-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
    .aa-recip-actions .btn, .aa-add .btn, .aa-tz-row .btn, .aa-h .btn { min-height: 44px; }
    .aa-add input { min-height: 44px; font-size: 16px; }
    .aa-ev { grid-template-columns: minmax(0, 1fr); padding: 6px 0 12px; }
    .aa-ev-check { min-height: 44px; align-items: center; }
    .aa-ev-check input { width: 22px; height: 22px; margin: 0; }
    .aa-seg { grid-column: 1; grid-row: auto; justify-self: start; margin-left: 32px; }
    .aa-seg-btn { min-height: 44px; padding: 8px 16px; font-size: 13px; }
    .aa-ev-th, .aa-ev-desc, .aa-ev-warn { padding-left: 32px; }
    .aa-th input, .aa-inline input { min-height: 44px; font-size: 16px; }
    .aa-h { flex-wrap: wrap; }
    .aa-hist-tools select { min-height: 44px; font-size: 16px; }
    .aa-grid { grid-template-columns: minmax(0, 1fr); }
    .aa-field select, .aa-tz-row input { min-height: 44px; font-size: 16px; max-width: none; }
    .aa-savebar .btn { min-height: 44px; padding: 0 22px; }
    .aa-hrow { grid-template-columns: minmax(0, 1fr) auto; }
    .aa-htime { grid-column: 1 / -1; }
    .aa-hnote { grid-column: 1 / -1; }
}
