/* Safety Alerts (migration #12, S1 T3).
 *
 * The monolith's pages carried their styling in inline style blocks and about 150 style attributes, which the Content Security
 * Policy refuses. This stylesheet replaces both, with the monolith's teal (#00a0c0) as the accent darkened to #007a93 for text
 * (4.9:1 on white) and its muted greys raised to at least 4.5:1. `.sa-wrap` is positioned so a visually hidden element always has a
 * positioned ancestor and cannot widen the document on a narrow screen.
 *
 * T8C: the focus outline is the shell's `--hs-aqua` (#0d5bb8, 6.5:1 on white, 6.0:1 on #f4f6fa) at the tool's 3px width; the amber
 * #ffbf47 it replaced measured 1.5:1 on those backgrounds (WCAG 1.4.11). Alert titles and feed names, which come from third parties,
 * wrap anywhere, so an unbreakable title cannot widen the page at 320px (WCAG 1.4.10).
 *
 * Post-migration polish (2026-11-03): the list page's "Stay up to date" is three compact columns, the notice is a full-width banner
 * (the shell caps `p` at a reading measure, which held it to half the width), and the table gives the source its own column width
 * so a feed name is one line where it fits. Presentation only; no element, route or behaviour changed.
 */
:root { --sa-accent: #007a93; --sa-accent-bg: #e8f7fb; --sa-head: #1a2a3b; --sa-text: #3d4a5c; --sa-muted: #5f6d84; --sa-border: #dde3e8; --sa-warn-bg: #fff8ec; --sa-warn: #7a4500; }
[hidden] { display: none !important; }
.sa-wrap { position: relative; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sa-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sa-ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -0.125em; margin-right: 6px; }
.sa-flip { transform: scaleX(-1); }
.sa-card { background: #fff; border: 1px solid var(--sa-border); border-radius: 10px; padding: 18px 20px; }
.sa-card-head { display: flex; align-items: center; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sa-head); margin: 0 0 12px; }
.sa-card-head .sa-ico { color: var(--sa-accent); }
.sa-muted { color: var(--sa-muted); }
.sa-hint { font-size: 13px; color: var(--sa-muted); margin: 8px 0 0; }
.sa-break { word-break: break-all; }

/* Page links */
.sa-nav { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--sa-border); overflow-x: auto; }
.sa-nav a { padding: 10px 14px; font-weight: 600; color: var(--sa-text); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.sa-nav a:hover { color: var(--sa-accent); }
.sa-nav a[aria-current="true"] { color: var(--sa-accent); border-bottom-color: var(--sa-accent); }
/* The strip scrolls sideways on a narrow screen, so an outline outside a link would be clipped: draw it inside. */
.sa-wrap .sa-nav a:focus-visible { outline-offset: -3px; }

/* Controls */
.sa-label { display: block; font-size: 12px; font-weight: 700; color: var(--sa-head); margin-bottom: 4px; }
.sa-input, .sa-select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid #b8c3cf; border-radius: 6px; font: inherit; font-size: 14px; color: var(--sa-head); background: #fff; }
.sa-btn { box-sizing: border-box; display: inline-flex; align-items: center; min-height: 38px; gap: 6px; padding: 8px 14px; border: 1px solid var(--sa-accent); border-radius: 6px; background: var(--sa-accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.sa-btn:hover { background: #00627a; }
.sa-btn-quiet { background: #fff; color: var(--sa-accent); }
.sa-btn-quiet:hover { background: var(--sa-accent-bg); }
.sa-btn-link { margin-top: 10px; }
.sa-input:focus-visible, .sa-select:focus-visible, .sa-btn:focus-visible, .sa-wrap a:focus-visible, .sa-table-wrap:focus-visible, .sa-textarea:focus-visible, .sa-check input:focus-visible { outline: 3px solid var(--hs-aqua, #0d5bb8); outline-offset: 2px; }

/* Third-party text that may hold an unbreakable string (a long URL or code in a title) */
.sa-detail-title, .sa-title, .sa-related a, .sa-digest-list li > a:first-child, .sa-source-name, .sa-group-head, .sa-check { overflow-wrap: anywhere; }

/* Stay up to date */
.sa-follow { padding: 14px 18px 16px; }
.sa-follow .sa-card-head { margin-bottom: 10px; }
.sa-follow-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.sa-follow-item { min-width: 0; padding: 0 20px; border-left: 1px solid #eef2f5; }
.sa-follow-item:first-child { padding-left: 0; border-left: 0; }
.sa-follow-item:last-child { padding-right: 0; }
.sa-follow .sa-hint { margin-top: 6px; }
.sa-follow .sa-btn-link { margin-top: 8px; }
.sa-rss-controls { display: grid; gap: 8px; }
.sa-col-head { font-size: 14px; color: var(--sa-head); margin: 0 0 6px; }
.sa-url-row { display: flex; gap: 8px; }
.sa-url-row .sa-input { font-family: ui-monospace, monospace; font-size: 12px; }
.sa-feed-links { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.sa-feed-links code { word-break: break-all; }

.sa-disclaimer { margin: 0; max-width: none; padding: 10px 16px; border: 1px solid #f0d9ae; border-left: 4px solid #e0a43a; background: var(--sa-warn-bg); color: var(--sa-warn); font-size: 13px; line-height: 1.5; border-radius: 8px; }
.sa-disclaimer a { color: var(--sa-warn); font-weight: 600; }

/* Search */
.sa-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px 18px; }
.sa-field { flex: 1 1 220px; min-width: 0; }
.sa-field-q { flex: 3 1 280px; }
.sa-field-source { flex: 1 1 220px; max-width: 320px; }
.sa-toolbar-actions { display: flex; align-items: center; gap: 12px; min-height: 38px; }
.sa-reset { color: var(--sa-accent); font-weight: 600; padding: 4px 2px; }
.sa-notice { display: flex; align-items: flex-start; margin: 0; padding: 10px 14px; border: 1px solid #b3dff5; background: #f0f9ff; border-radius: 8px; color: var(--sa-head); font-size: 14px; }
.sa-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; max-width: none; font-size: 14px; color: var(--sa-text); }
.sa-count strong { color: var(--sa-head); }
.sa-count-page { margin-left: auto; font-size: 13px; color: var(--sa-muted); }

/* Table */
.sa-table-wrap { padding: 0; overflow-x: auto; position: relative; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sa-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--sa-head); background: #f4f7fa; padding: 9px 16px; border-bottom: 1px solid var(--sa-border); white-space: nowrap; }
.sa-table td { padding: 11px 16px; border-bottom: 1px solid #eef2f5; vertical-align: top; color: var(--sa-text); }
.sa-table tbody tr:last-child td { border-bottom: 0; }
.sa-table tbody tr:hover td { background: #fafcfd; }
.sa-col-source { width: 17rem; }
.sa-col-date { width: 7.5rem; }
.sa-title { line-height: 1.45; }
.sa-title a { color: var(--sa-head); font-weight: 600; text-decoration: none; }
.sa-title a:hover { color: var(--sa-accent); text-decoration: underline; }
.sa-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sa-table .sa-links { width: 30px; padding-top: 7px; padding-bottom: 7px; text-align: right; }
/* A bordered rectangle rather than a pill: a long feed name may wrap, and the transparent border stays visible in forced colours. */
.sa-badge { display: inline-block; max-width: 100%; padding: 1px 8px; border: 1px solid transparent; border-radius: 6px; background: var(--sa-accent-bg); color: var(--sa-accent); font-size: 12px; font-weight: 600; line-height: 1.5; }
.sa-icon-link { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 30px; height: 30px; border: 1px solid var(--sa-border); border-radius: 6px; color: var(--sa-text); }
.sa-icon-link:hover { color: var(--sa-accent); border-color: var(--sa-accent); background: var(--sa-accent-bg); }
.sa-icon-link .sa-ico { margin: 0; }
.sa-pages { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sa-pages a, .sa-current { padding: 6px 11px; border: 1px solid var(--sa-border); border-radius: 6px; text-decoration: none; color: var(--sa-accent); font-weight: 600; }
.sa-current { background: var(--sa-accent); border-color: var(--sa-accent); color: #fff; }
.sa-empty { text-align: center; color: var(--sa-muted); padding: 32px 20px; }
.sa-empty-ico { display: block; width: 32px; height: 32px; margin: 0 auto 10px; }

/* Detail */
.sa-detail-title { font-size: 22px; line-height: 1.35; color: var(--sa-head); margin: 0 0 14px; }
.sa-meta { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0 0 16px; padding: 0 0 14px; border-bottom: 1px solid #eef2f5; }
.sa-meta dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--sa-muted); }
.sa-meta dd { margin: 4px 0 0; font-size: 14px; color: var(--sa-head); min-width: 0; }
.sa-body { font-size: 15px; line-height: 1.65; color: var(--sa-text); overflow-wrap: anywhere; }
.sa-body a { color: var(--sa-accent); }
.sa-nobody { font-size: 14px; }
.sa-original { margin-top: 16px; }
.sa-original .sa-ico { color: #fff; }
.sa-bottom { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }
.sa-source-name { font-weight: 700; color: var(--sa-head); margin: 0 0 6px; }
.sa-related { list-style: none; margin: 0; padding: 0; }
.sa-related li { padding: 8px 0; border-bottom: 1px solid #eef2f5; font-size: 14px; }
.sa-related li:last-child { border-bottom: 0; }
.sa-related time { display: block; font-size: 12px; margin-top: 2px; }
.sa-nudge { margin: 0; padding: 12px 16px; background: var(--sa-warn-bg); border-radius: 8px; color: var(--sa-warn); font-size: 14px; }
.sa-nudge a { color: var(--sa-warn); font-weight: 700; }

/* Digest */
.sa-week { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sa-week a { color: var(--sa-accent); font-weight: 600; text-decoration: none; }
.sa-week .sa-ico { margin: 0 4px; }
.sa-week-label { font-size: 17px; color: var(--sa-head); margin: 0; text-align: center; }
.sa-filter { margin: 0; }
.sa-filter legend { padding: 0; float: left; width: 100%; }
.sa-filter-grid { clear: both; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.sa-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--sa-text); }
.sa-filter-actions { display: flex; gap: 8px; margin-top: 12px; }
.sa-group-head { font-size: 15px; color: var(--sa-head); margin: 0 0 8px; padding-bottom: 8px; border-bottom: 2px solid var(--sa-accent-bg); }
.sa-digest-list { list-style: none; margin: 0; padding: 0; }
.sa-digest-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef2f5; font-size: 14px; }
.sa-digest-list li:last-child { border-bottom: 0; }
.sa-digest-list li > a:first-child { flex: 1 1 auto; min-width: 0; color: var(--sa-head); }
.sa-digest-list time { white-space: nowrap; font-size: 13px; }
.sa-textarea { display: block; width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #b8c3cf; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--sa-head); background: #fbfcfd; resize: vertical; margin-bottom: 10px; }
.sa-textarea-small { font-size: 11px; }

/* Stay up to date: the feed on its own row, then the digest and Excel side by side. */
@media (max-width: 1099px) {
  .sa-follow-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 0; }
  .sa-follow-rss { grid-column: 1 / -1; padding: 0 0 16px; border-bottom: 1px solid #eef2f5; }
  .sa-follow-rss .sa-rss-controls { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: end; }
  .sa-follow-item:nth-child(2) { padding-left: 0; border-left: 0; }
}

@media (max-width: 760px) {
  .sa-bottom { grid-template-columns: 1fr; }
  .sa-follow-grid, .sa-follow-rss .sa-rss-controls { grid-template-columns: minmax(0, 1fr); }
  .sa-follow-item, .sa-follow-item:nth-child(2) { padding: 0 0 14px; border-left: 0; border-bottom: 1px solid #eef2f5; }
  .sa-follow-item:last-child { padding-bottom: 0; border-bottom: 0; }
  .sa-field-source { max-width: none; }
  /* Each alert is a block: the title on its own line, then source, date and the original link on one line. */
  .sa-table thead { display: none; }
  .sa-table, .sa-table tbody { display: block; width: 100%; }
  .sa-table tr { display: grid; grid-template-columns: fit-content(62%) auto minmax(30px, 1fr); align-items: center; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid #eef2f5; }
  .sa-table tbody tr:last-child { border-bottom: 0; }
  .sa-table td, .sa-table .sa-links { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .sa-table tbody tr:hover td { background: none; }
  .sa-table td.sa-title { grid-column: 1 / -1; }
  .sa-table .sa-links { justify-self: end; }
  .sa-week { justify-content: center; }
  .sa-week-label { order: -1; width: 100%; }
}

/* Subscription (T4) */
.sa-form { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.sa-form .sa-btn { align-self: flex-start; }
.sa-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sa-error { margin: 0 0 10px; padding: 10px 14px; border: 1px solid #f1b8b8; background: #fdf1f1; border-radius: 8px; color: #8a1c1c; font-size: 14px; }

/* Export (T5) */
.sa-col-gap { margin-top: 16px; }
.sa-toolbar-plain { padding: 0; }
