/* Screener alerts (screener-alerts.js): home feed, header bell, toasts. Theme-aware, light + dark. */
.sms-alerts, .sa-bell-wrap, .sa-toasts { --sa-up: var(--bullish, #15803d); --sa-dn: var(--bearish, #dc2626); --sa-ac: var(--primary, #4b44c8); --sa-mono: var(--pl-mono, ui-monospace, SFMono-Regular, Menlo, monospace); --sa-ease: cubic-bezier(.22, 1, .36, 1); }

/* ---- home section */
.sms-alerts { position: relative; background: var(--card); border-radius: 22px; box-shadow: var(--sms-shadow, 0 0 0 1px var(--border)); border: 1px solid transparent; padding: 20px 22px 18px; }
html:not([data-theme="smartmoney"]) .sms-alerts { border-color: var(--border); border-radius: 14px; }
.sa-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.sa-eyebrow { font-family: var(--sa-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }
.sa-live { width: 7px; height: 7px; border-radius: 50%; background: var(--sa-ac); animation: sa-pulse 2.2s ease-out infinite; }
@keyframes sa-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sa-ac) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.sa-title { font-family: var(--pl-serif, Georgia, serif); font-weight: 400; font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.05; margin: 6px 0 4px; color: var(--foreground); }
.sa-meta { font-size: 12.5px; color: var(--muted-foreground); }
main button.sa-link, .sa-link { background: none; border: 0; color: var(--sa-ac); font-size: 12.5px; cursor: pointer; padding: 4px 2px; border-radius: 6px; }
.sa-link:hover { text-decoration: underline; }

.sa-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: thin; }
.sms-alerts .sa-chips button { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--foreground); cursor: pointer; transition: background .2s, border-color .2s; white-space: nowrap; }
.sms-alerts .sa-chips button i { font-style: normal; font-family: var(--sa-mono); font-size: 11px; min-width: 18px; text-align: center; padding: 0 5px; border-radius: 99px; background: var(--secondary); color: var(--muted-foreground); }
.sms-alerts .sa-chips button:hover { border-color: color-mix(in srgb, var(--foreground) 35%, transparent); }
.sms-alerts .sa-chips button.on { background: var(--foreground); color: var(--card); border-color: var(--foreground); }
.sms-alerts .sa-chips button.on i { background: color-mix(in srgb, var(--card) 22%, transparent); color: var(--card); }

.sa-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sa-grid .sa-item { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }

/* ---- shared item */
.sa-item { position: relative; cursor: pointer; background: var(--card); transition: transform .2s var(--sa-ease), border-color .2s, box-shadow .2s; list-style: none; min-width: 0; }
.sa-grid .sa-item:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--foreground) 30%, transparent); box-shadow: 0 8px 22px -14px rgba(0, 0, 0, .45); }
.sa-item:focus-visible { outline: 2px solid var(--sa-ac); outline-offset: 2px; }
.sa-item.unread::before { content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sa-ac); }
.sa-grid .sa-item.unread { animation: sa-in .5s var(--sa-ease) both; }
@keyframes sa-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sa-row1 { display: flex; align-items: center; gap: 8px; }
.sa-row1 b { font-family: var(--sa-mono); font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-row1 time { margin-left: auto; font-size: 10.5px; color: var(--muted-foreground); white-space: nowrap; }
.sa-chg { font-family: var(--sa-mono); font-size: 11.5px; font-weight: 600; }
.sa-chg.up { color: var(--sa-up); } .sa-chg.dn { color: var(--sa-dn); }
.sa-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-family: var(--sa-mono); font-size: 12px; color: var(--foreground); }
main button.sa-tag, .sa-tag { font-family: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; padding: 2px 8px; border-radius: 6px; border: 0; cursor: pointer; background: color-mix(in srgb, var(--sa-ac) 12%, transparent); color: var(--sa-ac); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
html.dark .sa-tag { background: color-mix(in srgb, var(--sa-ac) 26%, transparent); color: color-mix(in srgb, var(--sa-ac) 40%, #fff); }
.sa-tag:hover { text-decoration: underline; }
.sa-item p { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-item.sa-sum { cursor: pointer; }
.sa-item.sa-sum time { display: block; font-size: 10.5px; color: var(--muted-foreground); margin-top: 4px; }
.sa-empty { grid-column: 1 / -1; list-style: none; padding: 22px; text-align: center; font-size: 13px; color: var(--muted-foreground); border: 1px dashed var(--border); border-radius: 14px; }

/* ---- header bell + panel */
.sa-bell-wrap { position: relative; }
button.sa-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); cursor: pointer; transition: color .2s, background .2s; }
button.sa-bell:hover, button.sa-bell[aria-expanded="true"] { color: var(--foreground); background: var(--secondary); }
.sa-bell svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform-origin: 50% 10%; }
.sa-bell.ring svg { animation: sa-ring .9s var(--sa-ease); }
@keyframes sa-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.sa-badge { position: absolute; top: -6px; right: -7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--sa-dn); color: #fff; font: 700 10px/17px var(--sa-mono); text-align: center; box-shadow: 0 0 0 2px var(--card); }
.sa-badge[hidden] { display: none; }
.sa-panel { position: absolute; right: 0; top: 40px; width: min(380px, 92vw); max-height: min(560px, 75vh); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .45); z-index: 60; overflow: hidden; animation: sa-drop .22s var(--sa-ease); }
.sa-panel[hidden] { display: none; }
@keyframes sa-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.sa-panel-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--foreground); }
.sa-panel-h button { background: none; border: 0; color: var(--sa-ac); font-size: 12px; cursor: pointer; }
.sa-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; }
.sa-list .sa-item { padding: 9px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.sa-list .sa-item:hover { background: var(--secondary); }
.sa-list .sa-item.unread::before { top: 10px; bottom: 10px; left: 0; }
.sa-list .sa-empty { margin: 12px; }
.sms-alerts .sa-chips button.muted { opacity: .5; text-decoration: line-through; text-decoration-thickness: 1px; }
.sa-mute { border-top: 1px solid var(--border); font-size: 12px; color: var(--foreground); }
.sa-mute summary { padding: 10px 14px; cursor: pointer; }
.sa-mute > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 0 14px 12px; max-height: 160px; overflow-y: auto; }
.sa-mute label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; cursor: pointer; }
.sa-desk { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--foreground); cursor: pointer; }
.sa-desk em { font-style: normal; color: var(--muted-foreground); font-size: 11px; display: block; }

/* ---- toasts */
.sa-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.sa-toast { pointer-events: auto; cursor: pointer; width: min(340px, 90vw); padding: 11px 14px 11px 16px; border-radius: 14px; background: var(--card); color: var(--foreground); border: 1px solid var(--border); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .5); position: relative; overflow: hidden; animation: sa-toast-in .45s var(--sa-ease) both; transition: opacity .35s, transform .35s; }
.sa-toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sa-ac); }
.sa-toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; background: var(--sa-ac); opacity: .5; animation: sa-timer 9s linear both; }
.sa-toast b { display: block; font-size: 13px; }
.sa-toast b em { font-style: normal; font-weight: 400; color: var(--muted-foreground); }
.sa-toast span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-toast.out { opacity: 0; transform: translateX(20px); }
@keyframes sa-toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sa-timer { from { width: 100%; } to { width: 0; } }

@media (prefers-reduced-motion: reduce) { .sms-alerts *, .sa-bell-wrap *, .sa-toasts * { animation: none !important; transition: none !important; } }
