/* /alerts: your alerts, where they're sent, recent notifications.
   App look of /listings: #1C1C1C panels on #212121. Buttons, inputs and the toggle group come
   from alert_modal.css (am-*), so both stay the same. */

body.alerts-page {
  display: block;
  height: auto;
  min-height: 100dvh;
}

.al-main {
  box-sizing: border-box;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(var(--nav-height, 50px) + 34px) 30px 10px;
  color: var(--text-2-color, #A3A3A3);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
.al-main *, .al-main *::before, .al-main *::after { box-sizing: border-box; }
.al-main :where(h1, h2, h3, p, ul, ol, li) { margin: 0; padding: 0; }
.al-main :where(ul, ol) { list-style: none; }
.al-main [hidden] { display: none !important; }
.al-main strong { color: var(--text-1-color, #C2C2C2); font-weight: 600; }

/* ===== Header ===== */
.al-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 26px;
}
.al-title {
  color: #f2f2f2;
  font-size: clamp(26px, 1.1rem + 1vw, 32px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.al-lead { max-width: 40em; margin-top: 8px; font-size: 15px; }

/* ===== Preview bar (only without backend) ===== */
.al-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin-bottom: 26px;
  padding: 12px 16px;
  border: 1px dashed #424242;
  border-radius: 12px;
  font-size: 13px;
}
.al-preview p { max-width: 46em; }
.al-preview-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.al-preview .am-seg-opt span { height: 26px; padding: 0 10px; font-size: 13px; }

.al-loading { padding: 40px 0; color: #8a8a8a; text-align: center; }
.al-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(239, 83, 80, 0.08);
  color: #EF5350;
}

/* ===== Layout ===== */
/* minmax(0, 1fr) everywhere: long webhook URLs must shrink with an ellipsis, not widen the page */
.al-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1024px) {
  .al-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 30px; }
}
.al-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; }

.al-panel {
  padding: 24px 26px;
  border-radius: var(--border-radius, 18px);
  background: var(--body-color, #1C1C1C);
}
.al-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.al-h2 { color: var(--text-1-color, #C2C2C2); font-size: 16px; font-weight: 600; }
.al-h2:focus { outline: none; }
.al-panel-sub { margin-top: 4px; color: #8a8a8a; font-size: 13px; }
.al-count { color: #8a8a8a; font-size: 13px; font-variant-numeric: tabular-nums; }
.al-muted { padding: 14px 0 4px; color: #8a8a8a; }

/* ===== Alerts ===== */
.al-list > li + li { border-top: 1px solid var(--background-color, #212121); }
.al-group {
  padding: 18px 0 2px;
  color: #8a8a8a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.al-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 16px;
  padding: 18px 0;
}
.al-alert.is-paused .al-alert-main { opacity: 0.55; }

.al-switch {
  all: unset;
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin-top: 1px;
  border-radius: 10px;
  background: #363636;
  cursor: pointer;
  transition: background-color 0.15s;
}
.al-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8a8a8a;
  transition: transform 0.15s, background-color 0.15s;
}
.al-switch[aria-checked="true"] { background: #26A69A99; }
.al-switch[aria-checked="true"] span { background: #f2f2f2; transform: translateX(14px); }
.al-switch:focus-visible { outline: 2px solid #8fb4e6; outline-offset: 2px; }

.al-alert-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.al-alert-name {
  color: #f2f2f2;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.al-tag {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--background-color, #212121);
  color: var(--text-2-color, #A3A3A3);
  font-size: 12px;
  line-height: 18px;
}
.al-tag--paused { border: 1px dashed #4a4a4a; background: none; color: #8a8a8a; }

.al-conds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.al-cond {
  display: inline-flex;
  gap: 5px;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--background-color, #212121);
  color: var(--text-1-color, #C2C2C2);
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
.al-cond-k { flex: none; color: #8a8a8a; }
.al-cond--main { color: #f2f2f2; }

.al-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 10px;
  color: #8a8a8a;
  font-size: 13px;
}
.al-ch { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2-color, #A3A3A3); }
.al-ch svg { width: 14px; height: 14px; color: #8a8a8a; }
.al-ch--none, .al-ch--none svg { color: #d9b25a; }
.al-dot { flex: none; width: 3px; height: 3px; border-radius: 50%; background: #5c5c5c; }

.al-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px; }
.al-act {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--text-2-color, #A3A3A3);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.al-act:hover { background: var(--background-color, #212121); color: #f2f2f2; }
.al-act--danger:hover { background: rgba(239, 83, 80, 0.1); color: #EF5350; }
.al-act--confirm { background: rgba(239, 83, 80, 0.14); color: #EF5350; font-weight: 600; }
.al-act--confirm:hover { background: rgba(239, 83, 80, 0.22); color: #EF5350; }
.al-act:disabled { opacity: 0.5; cursor: default; }
.al-act:focus-visible { outline: 2px solid #8fb4e6; }
.al-confirm-q { margin-right: 4px; color: var(--text-1-color, #C2C2C2); font-size: 13px; }

@media (max-width: 720px) {
  .al-alert { grid-template-columns: auto minmax(0, 1fr); }
  .al-alert > .al-actions { grid-column: 2; justify-content: flex-start; margin-left: -9px; }
}

.al-empty { padding: 34px 8px 18px; text-align: center; }
.al-empty-title { color: #f2f2f2; font-size: 18px; font-weight: 700; }
.al-empty-text { max-width: 30em; margin: 8px auto 22px; }

/* ===== Channels ===== */
.al-chan { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--background-color, #212121); }
.al-chan:first-of-type { margin-top: 16px; }
.al-chan-head { display: flex; align-items: center; gap: 10px; }
.al-chan-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--background-color, #212121);
  color: var(--text-2-color, #A3A3A3);
}
.al-h3 { color: var(--text-1-color, #C2C2C2); font-size: 15px; font-weight: 600; }
.al-status {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--background-color, #212121);
  color: #8a8a8a;
  font-size: 12px;
  white-space: nowrap;
}
.al-status--ok { background: rgba(38, 166, 154, 0.12); color: #26A69A; }
.al-status--bad { background: rgba(239, 83, 80, 0.12); color: #EF5350; }
.al-chan-text { margin-top: 10px; overflow-wrap: anywhere; }
.al-chan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.al-hooks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 14px; }
.al-hook {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 8px 12px;
  border-radius: 10px;
  background: var(--background-color, #212121);
}
.al-hook-main { flex: 1; min-width: 0; }
.al-hook-name {
  overflow: hidden;
  color: var(--text-1-color, #C2C2C2);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.al-hook-sub {
  overflow: hidden;
  color: #8a8a8a;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.al-hook .al-actions { flex-wrap: nowrap; }
.al-hook .al-act:hover { background: #2e2e2e; }
.al-hook .al-act--danger:hover { background: rgba(239, 83, 80, 0.12); }

.al-hook-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 16px; }
.al-hook-form-title { color: var(--text-1-color, #C2C2C2); font-size: 13px; font-weight: 600; }
.al-hook-row { display: flex; gap: 8px; }
.al-hook-row .am-input { flex: 1; min-width: 0; }
.al-hook-form .am-hint { margin: 0; }

/* ===== Recent notifications ===== */
.al-history > li + li { border-top: 1px solid var(--background-color, #212121); }
.al-hist {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 13px 0;
  color: inherit;
  text-decoration: none;
}
a.al-hist:hover .al-hist-item { color: #f2f2f2; text-decoration: underline; text-underline-offset: 3px; }
a.al-hist:focus-visible { outline: 2px solid #8fb4e6; outline-offset: 2px; border-radius: 6px; }
.al-hist-time { padding-top: 1px; color: #8a8a8a; font-size: 13px; white-space: nowrap; }
.al-hist-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; }
.al-hist-item { color: var(--text-1-color, #C2C2C2); font-weight: 500; overflow-wrap: anywhere; }
.al-hist-facts { font-size: 13px; font-variant-numeric: tabular-nums; }
.al-hist-alert { color: #8a8a8a; font-size: 12px; }
.al-hist-ch { position: relative; display: flex; gap: 6px; padding-top: 2px; color: #8a8a8a; }
.al-hist-ch svg { width: 14px; height: 14px; }

/* every notification: alert name + count, then one linked row per listing (1 or many, same look) */
.al-hist-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.al-hist-name { color: var(--text-1-color, #C2C2C2); font-weight: 500; overflow-wrap: anywhere; }
.al-hist-count { color: #8a8a8a; font-size: 12px; font-variant-numeric: tabular-nums; }
.al-hist-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 8px; }
.al-hist-sub {
  display: flex;
  align-items: baseline;
  gap: 4px 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--background-color, #212121);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s;
}
.al-hist-sub .al-hist-item {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.al-hist-sub .al-hist-facts { flex: none; color: #8a8a8a; font-size: 12px; white-space: nowrap; }
a.al-hist-sub:hover { background: #2a2a2a; }
a.al-hist-sub:hover .al-hist-item { color: #f2f2f2; }
a.al-hist-sub:focus-visible { outline: 2px solid #8fb4e6; outline-offset: 1px; }

.al-hist-more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-2-color, #A3A3A3);
  font-size: 13px;
  list-style: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.al-hist-more summary::-webkit-details-marker { display: none; }
.al-hist-more summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.al-hist-more[open] summary::before { transform: rotate(45deg); }
.al-hist-more summary:hover { background: var(--background-color, #212121); color: #f2f2f2; }
.al-hist-more summary:focus-visible { outline: 2px solid #8fb4e6; }
.al-hist-more .al-hist-list { margin-top: 4px; }
.al-hist > .al-hist-main > .al-hist-facts { margin-top: 4px; color: #8a8a8a; font-size: 12px; }

/* ===== Login / Pro gate ===== */
.al-gate {
  max-width: 600px;
  margin: 24px auto 0;
  padding: 44px 32px 38px;
  border-radius: var(--border-radius, 18px);
  background: var(--body-color, #1C1C1C);
  text-align: center;
}
.al-gate[data-reason="guest"] [data-for="free"],
.al-gate[data-reason="free"] [data-for="guest"] { display: none; }
.al-gate-icon {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--background-color, #212121);
  color: #5b9bd0;
}
.al-gate-title { color: #f2f2f2; font-size: clamp(22px, 1rem + 1vw, 28px); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.al-gate-text { max-width: 30em; margin: 12px auto 0; font-size: 15px; line-height: 1.5; }
.al-gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

/* ===== Phones ===== */
@media (max-width: 1023px) {
  .al-main { padding: calc(var(--nav-height, 50px) + 22px) 12px 10px; }
  .al-panel { padding: 20px 18px; border-radius: 14px; }
  .al-gate { padding: 36px 20px 30px; }
}
@media (max-width: 480px) {
  .al-head .am-btn { width: 100%; }
  .al-hist { grid-template-columns: minmax(0, 1fr) auto; }
  .al-hist-time { grid-column: 1 / -1; padding: 0; }
  .al-hist-sub { flex-wrap: wrap; }
  .al-hist-sub .al-hist-item { flex-basis: 100%; white-space: normal; }
  .al-hist-sub .al-hist-facts { white-space: normal; }
}