/* ==========================================================================
   ELITE GROUP · views-alerts.css  (Alerts & notifications for the MD, My alerts)
   Colours come only from the CSS variables of app.css, so the dark theme works.
   ========================================================================== */

/* link from Settings & Backups */
.adm-alerts-link { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); color: var(--ink); text-decoration: none; }
.adm-alerts-link > svg.icon:first-child { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.adm-alerts-link .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-alerts-link > svg.icon:last-child { flex: none; color: var(--muted); }
[data-theme="dark"] .adm-alerts-link > svg.icon:first-child { color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* switches: the label beside the switch */
.al-switch { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; font-weight: 650; color: var(--ink); cursor: pointer; }
.al-switch input:disabled + span { color: var(--muted); }

/* ---- channel cards ---- */
.al-ch { padding: 0; overflow: hidden; }
.al-ch-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.al-ch-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--brand-3); }
[data-theme="dark"] .al-ch-icon { color: var(--accent); }
.al-ch-title { flex: 1 1 auto; min-width: 0; }
.al-ch-title .card-title { margin: 0; font-size: 17px; }
.al-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--sp-2); margin-top: 4px; }
.al-status .badge { flex: none; }
.al-status-text { font-size: 13.5px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.al-ch-switch { flex: none; margin-top: -4px; }
.al-ch-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.al-ch-body > .al-ch-foot:only-child { margin-top: 0; }
.al-form { gap: var(--sp-4); }
.al-ch-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-2); }
.al-na-text { margin: 0 0 var(--sp-3); color: var(--muted); }

/* write-only secrets */
.al-secret { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.al-secret-main { flex: 1 1 260px; min-width: 0; }
.al-secret-main .field-label { margin-bottom: 2px; }
.al-secret-val { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.al-secret-on { display: inline-flex; align-items: center; gap: 6px; color: var(--green-ink); }
[data-theme="dark"] .al-secret-on { color: var(--green); }
.al-secret-off { color: var(--muted); font-weight: 600; }
.al-secret .hint { margin-top: 4px; }
.al-secret-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-self: center; }
.al-file { position: relative; overflow: hidden; cursor: pointer; }
.al-file input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.al-file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* "Advanced": uncommon fields folded away */
.al-adv { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.al-adv > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-3); cursor: pointer; list-style: none; font-weight: 700; color: var(--ink); }
.al-adv > summary::-webkit-details-marker { display: none; }
.al-adv > summary::after { content: "+"; margin-left: auto; font-size: 18px; line-height: 1; color: var(--muted); transition: transform var(--dur-fast) var(--ease); }
.al-adv[open] > summary::after { transform: rotate(45deg); }
.al-adv-body { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-2) var(--sp-3) var(--sp-4); }
.al-sub .al-adv { margin-top: var(--sp-3); }

/* push card parts */
.al-sub { padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.al-sub:first-child { padding-top: 0; border-top: 0; }
.al-sub-title { margin: 0 0 var(--sp-2); font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); }
.al-okline { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0 0 var(--sp-2); color: var(--ink); }
.al-okline svg.icon { flex: none; margin-top: 3px; color: var(--green); }
.al-sounds { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.al-sounds[hidden] { display: none; }
.al-sound-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 200px) auto; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.al-sound-label { display: flex; flex-direction: column; min-width: 0; }
.al-sound-row select { width: 100%; }
.al-devs { display: flex; flex-direction: column; gap: var(--sp-3); }
.al-dev-person { display: flex; flex-direction: column; gap: var(--sp-1); }
.al-dev { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.al-dev.is-off { opacity: .7; }
.al-dev-icon { flex: none; color: var(--muted); display: grid; }
.al-dev-main { flex: 1 1 auto; min-width: 0; }
.al-dev-name { font-weight: 650; overflow-wrap: anywhere; }
.al-dev .btn { flex: none; }

/* test result */
.al-test-result:empty { display: none; }
.al-test-result { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.al-results { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.al-reply > summary { cursor: pointer; font-weight: 650; min-height: 36px; display: flex; align-items: center; }
.al-reply pre { margin: var(--sp-2) 0 0; padding: var(--sp-2) var(--sp-3); max-height: 200px; overflow: auto; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); white-space: pre-wrap; }

/* ---- who gets what ---- */
.al-legend { display: flex; flex-direction: column; gap: var(--sp-3); }
.al-legend-text { color: var(--muted); line-height: 1.5; }
.al-legend-keys { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.al-key { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 650; color: var(--ink); }
.al-key svg.icon { width: 14px; height: 14px; }
.al-key.must { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .al-key.must { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }
.al-rules-tools { gap: var(--sp-2); }

.al-grid-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.al-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.al-grid th, .al-grid td { padding: 6px 3px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; }
.al-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 750; white-space: nowrap; }
.al-grid .al-gh-type { position: sticky; left: 0; z-index: 1; min-width: 150px; max-width: 190px; padding-left: 8px; text-align: left; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.al-grid thead .al-gh-type { z-index: 3; background: var(--surface-2); }
.al-grid tr.al-grp th { position: sticky; left: 0; text-align: left; background: var(--surface-3); color: var(--ink); font-family: var(--font-display); font-size: 13px; letter-spacing: .02em; padding: 8px 10px; }
.al-grid tbody tr:hover td, .al-grid tbody tr:hover .al-gh-type { background: var(--surface-2); }
.al-col-btn, .al-row-btn { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 8px; padding: 4px 6px; }
.al-col-btn { display: inline-flex; align-items: center; gap: 2px; font-weight: 750; }
.al-col-btn svg.icon { width: 14px; height: 14px; color: var(--muted); }
.al-row-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; }
.al-col-btn:hover, .al-row-btn:hover { background: var(--surface-3); }
.al-type-name { font-weight: 700; color: var(--ink); line-height: 1.3; }
.al-type-name .badge { font-size: 10.5px; padding: 0 6px; vertical-align: 1px; }
.al-type-desc { font-size: 12px; color: var(--muted); line-height: 1.35; font-weight: 500; }
.al-cell { display: inline-flex; align-items: center; gap: 1px; }
.al-cell-na { font-size: 11.5px; color: var(--muted); max-width: 100px; line-height: 1.25; }
.al-tg, .al-lock {
  display: inline-grid; place-items: center; width: 22px; height: 28px; padding: 0; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--faint);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.al-tg svg.icon, .al-lock svg.icon { width: 14px; height: 14px; }
.al-tg[aria-pressed="true"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
[data-theme="dark"] .al-tg[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.al-tg.ch-off[aria-pressed="true"] { opacity: .5; }
.al-tg:hover, .al-lock:hover:not(:disabled) { border-color: var(--accent); }
.al-lock { margin-left: 3px; border-style: dashed; }
.al-lock[aria-pressed="true"] { border-style: solid; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.al-lock:disabled { opacity: .35; cursor: not-allowed; }
.al-tg:focus-visible, .al-lock:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* phones: one role at a time */
.al-bulk-phone { align-self: flex-start; margin: 0 0 var(--sp-2); }
.al-grp-title { margin: var(--sp-4) 0 var(--sp-2); font-family: var(--font-display); font-size: 15px; color: var(--ink); }
.al-plist { display: flex; flex-direction: column; gap: var(--sp-2); }
.al-prow { padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: flex; flex-direction: column; gap: var(--sp-2); }
.al-prow-head { display: flex; flex-direction: column; gap: 2px; }
.al-prow-tgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.al-tg.big, .al-lock.big { width: auto; height: 44px; display: inline-flex; justify-content: flex-start; gap: 8px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 650; margin: 0; color: var(--muted); }
.al-tg.big[aria-pressed="true"] { color: #fff; }
[data-theme="dark"] .al-tg.big[aria-pressed="true"] { color: var(--accent-ink); }
.al-lock.big { grid-column: 1 / -1; }
.al-lock.big[aria-pressed="true"] { color: var(--accent-ink); }

/* save bar */
.al-rules-bar { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.al-rules-count { flex: 1 1 auto; font-weight: 650; color: var(--muted); }
.al-rules-bar.is-dirty .al-rules-count { color: var(--amber-ink); }
[data-theme="dark"] .al-rules-bar.is-dirty .al-rules-count { color: var(--amber); }

/* ---- wording ---- */
.al-w-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-4); align-items: start; }
.al-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.al-chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px dashed var(--field-border); background: var(--surface-2); color: var(--ink); font: inherit; font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px; cursor: pointer; }
.al-chip:hover { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.al-chip:active { transform: scale(.96); }
.al-w-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.al-preview { position: sticky; top: calc(var(--topbar-h) + 12px); }
.al-pv-mail { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.al-pv-subj { padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 700; overflow-wrap: anywhere; }
.al-pv-text { padding: var(--sp-3); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.al-pv-chat { padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--surface-3); }
.al-pv-bubble { max-width: 92%; padding: var(--sp-2) var(--sp-3); border-radius: 12px 12px 12px 4px; background: var(--surface); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; box-shadow: var(--shadow-sm); }
.al-pv-bubble.wa { background: var(--green-bg); color: var(--ink); }

/* ---- timing ---- */
.al-time-head { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.al-time-head .card-title { margin: 0; font-size: 17px; }
.al-what { margin: 2px 0 0; color: var(--muted); line-height: 1.45; }
.al-time-fields { margin-top: var(--sp-2); }
.al-time > .field + .field, .al-time > .grid2 + .field, .al-time > .field + .field + .field { margin-top: var(--sp-3); }
.al-field-switch { justify-content: flex-end; }

/* ---- sent messages ---- */
.al-counts .al-count { text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); }
.al-counts .al-count:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.al-lock-mini { display: inline-grid; vertical-align: -2px; color: var(--accent-ink); }
[data-theme="dark"] .al-lock-mini { color: var(--accent); }

/* ---- my alerts ---- */
.al-my-chs { display: flex; flex-direction: column; }
.al-my-ch { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.al-my-ch:last-child { border-bottom: 0; }
.al-my-ch-main { flex: 1 1 auto; min-width: 0; }
.al-my-ch .al-switch { flex: none; }
.al-my-ch .al-switch span, .al-ch-switch span { min-width: 3.4em; }
.al-must { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--ink); }
[data-theme="dark"] .al-must { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.al-must-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 750; }
.al-must-list { margin: var(--sp-2) 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.al-push-line { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0 0 var(--sp-3); line-height: 1.45; }
.al-push-line svg.icon { flex: none; margin-top: 3px; color: var(--muted); }
.al-told { display: flex; flex-direction: column; }
.al-told-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.al-told-row:last-child { border-bottom: 0; }
.al-told-name { font-weight: 650; min-width: 0; }
.al-told-chs { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- phones ---- */
@media (max-width: 1180px) {
  .al-w-grid { grid-template-columns: minmax(0, 1fr); }
  .al-preview { position: static; }
}
@media (max-width: 720px) {
  .al-ch-head { padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
  .al-ch-title { flex-basis: calc(100% - 140px); }
  .al-ch-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
  .al-ch-foot .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .al-sound-row { grid-template-columns: minmax(0, 1fr) auto; }
  .al-sound-label { grid-column: 1 / -1; }
  .al-dev { flex-wrap: wrap; }
  .al-dev .btn { margin-left: auto; }
  .al-secret-acts { width: 100%; }
  .al-secret-acts .btn, .al-secret-acts .al-file { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .al-rules-bar { flex-wrap: nowrap; }
  .al-rules-bar:not(.is-dirty) { display: none; }
  .al-rules-count { min-width: 0; font-size: 13px; line-height: 1.25; }
  .al-rules-bar .btn { flex: none; padding-left: 12px; padding-right: 12px; }
  .al-w-acts .btn { flex: 1 1 auto; justify-content: center; }
  .al-legend-keys .al-key { font-size: 12px; }
  .al-field-switch { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .al-tg, .al-lock, .al-adv > summary::after { transition: none; }
}
.al-ch-foot:empty { display: none; }
/* dark theme: an "on" way is filled amber, so the lock that is on is drawn as an amber ring instead */
[data-theme="dark"] .al-lock[aria-pressed="true"] { background: var(--surface); color: var(--accent); border: 2px solid var(--accent); }
