/* 🔔 alert feed (alert_feed.js) — the bell beside the run badge and its panel.
   Colour comes only from the app's tokens (styles.css, re-tinted by every skin): severity reads
   critical = --bear, warning = --amber (the run badge's own "warn"), info = --accent, each on its
   soft fill. No white-on-accent ink anywhere, so the skins' --on-accent sweep has nothing to twin.
   z-index 94: above the company view (45) and nav menus (60), under #tipbox (95) so the hover
   tips on chips and rule names still show over the panel. Corners follow the skins' shape tokens
   (--r-box panel, --r-ctl buttons, --r-pill chips; Matrix squares them, Cyberpunk zeroes them),
   with the plain look's radii as the fallbacks. */

/* ---------- the bell: same family as #theme-btn, travels with the run badge (order 2) ---------- */
.page-header #alert-bell { order: 2; }
#alert-bell {
  position: relative;
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; font-size: 12px; line-height: 1.2;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-ctl, 6px);
  padding: 3px 7px; cursor: pointer; white-space: nowrap;
}
#alert-bell:hover, #alert-bell[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
#alert-bell .af-count {
  font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 16px; padding: 0 5px; border-radius: var(--r-pill, 999px); text-align: center;
  color: var(--accent); background: var(--accent-soft);
}
#alert-bell .af-count[hidden] { display: none; }
#alert-bell[data-sev="critical"] .af-count { color: var(--bear); background: var(--bear-bg); }
#alert-bell[data-sev="warning"] .af-count { color: var(--amber); background: var(--amber-bg); }
#alert-bell[data-sev="critical"] { border-color: var(--bear); }

/* ---------- the panel ---------- */
#alert-pop {
  position: absolute; z-index: 94;
  display: flex; flex-direction: column;
  width: min(460px, calc(100vw - 16px));
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-box, 10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 12px; line-height: 1.4;
  overflow: hidden;
}
:root[data-theme="dark"] #alert-pop { box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6); }
#alert-pop[hidden] { display: none; }
#alert-pop:focus { outline: none; }
#alert-pop.af-full { border-radius: 0 0 var(--r-box, 10px) var(--r-box, 10px); border-left: 0; border-right: 0; }

.af-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 4px 12px; flex: none; }
/* the two tabs, Alerts · Earnings (2026-10-16): the picked one reads as the title, underlined in accent */
.af-tabs { display: flex; align-items: center; gap: 2px; margin-right: auto; min-width: 0; }
.af-tab {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--muted);
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 2px 6px 3px; cursor: pointer; white-space: nowrap;
}
.af-tab:first-child { padding-left: 0; }
.af-tab:hover { color: var(--accent); }
.af-tab[aria-selected="true"] { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.af-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.af-new {
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill, 999px); white-space: nowrap;
  color: var(--accent); background: var(--accent-soft);
}
.af-new[data-sev="critical"] { color: var(--bear); background: var(--bear-bg); }
.af-new[data-sev="warning"] { color: var(--amber); background: var(--amber-bg); }
.af-mark, .af-x {
  font: inherit; font-size: 11.5px; color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-ctl, 6px); padding: 2px 8px; white-space: nowrap;
}
.af-x { border-color: transparent; padding: 2px 6px; font-size: 13px; line-height: 1; }
.af-mark:hover:not(:disabled), .af-x:hover { color: var(--accent); border-color: var(--accent); }
.af-mark:disabled { opacity: 0.5; cursor: default; }
.af-sub { padding: 0 12px 7px; font-size: 11px; color: var(--muted); flex: none; }
.af-msg { padding: 14px 12px 16px; color: var(--muted); font-size: 12px; }

/* market chips (2026-10-19): one row above the rule chips that scrolls sideways inside the panel,
   so eighteen markets never wrap into a wall and a phone never gets a page-level scrollbar */
.af-mchips {
  position: relative; flex: none;
  display: flex; flex-wrap: nowrap; gap: 4px; padding: 0 12px 6px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.af-mchips .af-chip { flex: none; }

/* rule chips with counts */
.af-chips {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 8px 12px; flex: none;
  border-bottom: 1px solid var(--border);
}
.af-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 11px; color: var(--muted); background: var(--panel); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-pill, 999px); padding: 1px 8px; white-space: nowrap;
}
.af-chip b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.af-chip:hover { border-color: var(--accent); color: var(--accent); }
.af-chip[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.af-chip[aria-pressed="true"] b { color: var(--accent); }

/* severity dots */
.af-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.af-dot[data-sev="critical"] { background: var(--bear); }
.af-dot[data-sev="warning"] { background: var(--amber); }

/* the list, grouped by session */
.af-list { overflow: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.af-day {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 12px 4px; background: var(--thead); border-bottom: 1px solid var(--row-border);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.af-day b { margin-left: auto; font-variant-numeric: tabular-nums; }
.af-day .af-latest {
  font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 0 6px; border-radius: var(--r-pill, 999px);
}
.af-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 12px 6px 12px; border-bottom: 1px solid var(--row-border); cursor: pointer;
  border-left: 3px solid transparent; padding-left: 9px;
}
.af-item:hover { background: var(--hover); }
.af-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.af-item.af-unread { border-left-color: var(--accent); }
.af-item .af-dot { margin-top: 5px; }
.af-main { min-width: 0; flex: 1 1 auto; }
.af-l1 { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.af-sym {
  flex: none; font-weight: 700; color: var(--text); text-decoration: none;
  font-variant-numeric: tabular-nums; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.af-unread .af-sym { color: var(--accent); }
.af-sym:hover { text-decoration: underline; color: var(--accent); }
.af-name { min-width: 0; flex: 0 1 auto; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-rule {
  margin-left: auto; flex: none; font-size: 10.5px; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--r-pill, 999px); padding: 0 6px;
}
.af-ev { color: var(--text); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.af-meta { display: none; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.af-item.af-open .af-ev { white-space: normal; overflow-wrap: anywhere; }
.af-item.af-open .af-meta { display: block; }
.af-foot { flex: none; padding: 7px 12px 9px; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--border); }

/* the Earnings tab: a lead line, then one row per report date — symbol, name, timing / source / ⚠ tags */
.af-lead { flex: none; padding: 0 12px 2px; font-size: 12px; font-weight: 600; color: var(--text); }
.af-elist { border-top: 1px solid var(--border); }
.af-erow {
  display: flex; align-items: baseline; gap: 6px; min-width: 0;
  padding: 5px 12px; border-bottom: 1px solid var(--row-border);
}
.af-erow:hover { background: var(--hover); }
.af-erow .af-sym { max-width: 42%; }
.af-etags { margin-left: auto; flex: none; display: inline-flex; align-items: baseline; gap: 4px; }
.af-etag {
  font-size: 10.5px; line-height: 1.35; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--r-pill, 999px); padding: 0 6px;
}
.af-etag.af-warn { color: var(--amber); background: var(--amber-bg); border-color: transparent; font-weight: 600; }
/* M-026 expected move (2026-10-19): grey on purpose — a size, not a direction, so never bull/bear */
.af-etag.af-move {
  color: var(--grey-chip); background: var(--grey-chip-bg); border-color: transparent;
  font-variant-numeric: tabular-nums;
}
.af-mline { flex: none; padding: 0 12px 1px; font-size: 11px; color: var(--muted); }
.af-mline .af-nw { white-space: nowrap; }

/* a phone: the panel spans the screen (alert_feed.js adds .af-full below 561px); the bell stays icon + count */
@media (prefers-reduced-motion: no-preference) {
  #alert-bell[data-sev="critical"] .af-count { animation: af-pulse 1.6s ease-in-out 3; }
}
@keyframes af-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
