/* DiagnoSEO — Site Audit tool styles.
 * Reuses ecosystem global classes (.button, .form-field, .progress, .pop-up,
 * .overlay). Palette: primary #039669, error #e11d48, warning #f59e0b,
 * link #3e6fe8. Design language matches rank-tracker / uptime-monitoring. */
:root {
	--sa-error: #e11d48; --sa-warning: #f59e0b; --sa-notice: #64748b;
	--sa-good: #039669; --sa-avg: #f59e0b; --sa-poor: #e11d48;
	--sa-border: #e5e7eb; --sa-soft: #f3f4f6; --sa-ink: #0f172a; --sa-muted: #6b7280;
}

/* spinner + loading */
.sa-spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid #e2e8f0; border-top-color: var(--sa-good); border-radius: 50%; animation: sa-spin .8s linear infinite; vertical-align: middle; }
@keyframes sa-spin { to { transform: rotate(360deg); } }
.sa-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 56px 20px; color: var(--sa-muted); }

/* button loading state (modal save / run) */
.button.has-loader { position: relative; color: transparent !important; pointer-events: none; }
.button.has-loader::after { content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid rgba(255,255,255,.55); border-top-color: #fff; border-radius: 50%; animation: sa-spin .8s linear infinite; }

/* top progress bar */
.sa-progress .progress-bar { height: 6px; border-radius: 4px; background-color: var(--sa-soft); background-image: linear-gradient(to right, #039669, #57b16c); background-repeat: no-repeat; background-size: 0% 100%; transition: background-size .4s ease; }
.sa-progress.hidden { display: none; }

/* toolbar */
.sa-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 14px; }
.sa-subtitle { margin: 0; color: #454f63; font-size: 15px; max-width: 70ch; }
.sa-toolbar__right { flex-shrink: 0; }
.sa-login-note { font-size: 15px; color: #454f63; margin: 18px 0 12px; max-width: 70ch; }

/* messages / toasts */
.messages { margin: 10px 0; }
.msg { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; font-size: 14px; position: relative; }
.msg p { margin: 0; }
.msg.error { background: #fee2e2; color: #991b1b; }
.msg.check { background: #d1fae5; color: #065f46; }
.msg.info { background: #e0ecff; color: #1e40af; }
.msg .dismiss { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); text-decoration: none; font-size: 18px; line-height: 1; color: inherit; opacity: .6; }

/* list head */
.sa-list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 12px; }
.sa-list-head h2 { margin: 0; }
.sa-plan-pill { font-size: 13px; color: #4f596c; background: var(--sa-soft); border: 1px solid var(--sa-border); padding: 4px 12px; border-radius: 99px; white-space: nowrap; }

/* empty state */
.sa-empty { text-align: center; padding: 48px 20px; border: 1px dashed #d6dae1; border-radius: 14px; background: #fafbfc; }
.sa-empty__icon { font-size: 44px; margin-bottom: 10px; }
.sa-empty h3 { margin: 0 0 6px; font-size: 18px; color: var(--sa-ink); }
.sa-empty p { color: var(--sa-muted); margin: 0 auto 16px; max-width: 52ch; }
.sa-empty--inline { color: var(--sa-muted); padding: 14px 0; }

/* project cards */
.sa-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 14px; }
@media (min-width: 1280px) { .sa-cards { grid-template-columns: 1fr; } }
.sa-card { display: flex; align-items: center; gap: 18px; background: #fff; border: 1px solid var(--sa-border); border-radius: 12px; padding: 16px 18px; cursor: pointer; transition: box-shadow .2s, border-color .2s, transform .05s; }
.sa-card:hover { border-color: #cdd3da; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.sa-card.is-running { border-color: #bfdbfe; }
.sa-mini-gauge { flex-shrink: 0; width: 50px; height: 50px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 700 18px/1 var(--secondary-font, "Syne"), sans-serif; color: #fff; background: #9ca3af; }
.sa-mini-gauge.good { background: var(--sa-good); }
.sa-mini-gauge.avg { background: var(--sa-avg); }
.sa-mini-gauge.poor { background: var(--sa-poor); }
.sa-project-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sa-project-name { font-weight: 600; font-size: 15px; color: var(--sa-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-project-url { font-size: 13px; color: var(--sa-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-project-time { font-size: 12px; color: #9ca3af; }
.sa-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.sa-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 5px; background: var(--sa-soft); color: #4f596c; }
.sa-badge.proxy { background: #e0ecff; color: #1d4ed8; }
.sa-badge.ai { background: #ede9fe; color: #6d28d9; }
.sa-badge.sched { background: #d1fae5; color: #047857; }
.sa-badge.run { background: #dbeafe; color: #1e40af; }
.sa-project-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.sa-project-actions .button { padding: 7px 13px; font-size: 13px; }
.button.is-destructible { color: var(--sa-error); }
.button.is-destructible:hover { background: #fee2e2; border-color: #fecaca; }

/* detail view */
.sa-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.sa-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sa-detail-title { margin-bottom: 16px; }
.sa-detail-title h2 { margin: 0 0 2px; font: 700 24px var(--secondary-font, "Syne"), sans-serif; word-break: break-word; }
.sa-detail-url { font-size: 14px; }
.sa-running-card { border: 1px solid #bfdbfe; background: #f5f9ff; border-radius: 12px; padding: 28px; text-align: center; }
.sa-running-card .sa-loading { padding: 12px; }
.sa-note { color: var(--sa-muted); font-size: 13px; margin: 8px 0 0; }

/* result header: gauge + stats */
.sa-result-header { display: flex; gap: 28px; align-items: center; padding: 22px; border: 1px solid var(--sa-border); border-radius: 14px; background: #fff; flex-wrap: wrap; }
.sa-gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sa-gauge-holder, .sa-gauge { width: 132px; height: 132px; }
.sa-gauge .bg { fill: none; stroke: #eceef1; stroke-width: 10; }
.sa-gauge .fg { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.sa-gauge.good .fg { stroke: var(--sa-good); }
.sa-gauge.avg .fg { stroke: var(--sa-avg); }
.sa-gauge.poor .fg { stroke: var(--sa-poor); }
.sa-gauge .num { font: 700 32px var(--secondary-font, "Syne"), sans-serif; fill: var(--sa-ink); }
.sa-gauge .den { font: 400 12px "Open Sans", sans-serif; fill: #9ca3af; }
.sa-gauge-label { font-size: 13px; color: var(--sa-muted); }
.sa-header-right { flex: 1; min-width: 260px; }
.sa-result-meta { font-size: 13px; color: var(--sa-muted); margin: 12px 0 0; }
.sa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.sa-stat { background: #fff; border: 1px solid var(--sa-border); border-radius: 10px; padding: 12px 14px; border-left: 3px solid #cbd5e1; }
.sa-stat-num { display: block; font: 700 24px var(--secondary-font, "Syne"), sans-serif; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sa-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--sa-muted); font-weight: 600; margin-top: 2px; }
.sa-stat.errors { border-left-color: var(--sa-error); } .sa-stat.errors .sa-stat-num { color: var(--sa-error); }
.sa-stat.warnings { border-left-color: var(--sa-warning); } .sa-stat.warnings .sa-stat-num { color: var(--sa-warning); }
.sa-stat.notices { border-left-color: var(--sa-notice); } .sa-stat.notices .sa-stat-num { color: var(--sa-notice); }
.sa-stat.pages { border-left-color: var(--sa-good); } .sa-stat.pages .sa-stat-num { color: var(--sa-good); }

.sa-section-title { margin: 28px 0 12px; font-size: 16px; font-weight: 600; }

/* AI */
.sa-ai-summary { margin-top: 16px; }
.sa-ai-box { border: 1px solid #e6defb; background: linear-gradient(180deg, #faf8ff, #fff); border-radius: 12px; padding: 16px 18px; }
.sa-ai-box.pending { display: flex; align-items: center; gap: 8px; color: #6d28d9; }
.sa-ai-title { font-weight: 600; color: #6d28d9; }
.sa-ai-text { margin: 8px 0 0; line-height: 1.6em; }

/* categories */
.sa-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sa-cat { border: 1px solid var(--sa-border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.sa-cat-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sa-cat-name { font-weight: 600; font-size: 14px; }
.sa-cat-count { font-size: 13px; color: var(--sa-muted); }
.sa-cat-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--sa-soft); }
.sa-cat-bar .seg.error { background: var(--sa-error); }
.sa-cat-bar .seg.warning { background: var(--sa-warning); }
.sa-cat-bar .seg.notice { background: var(--sa-notice); }

/* issues accordion */
.sa-issues { border: 1px solid var(--sa-border); border-radius: 12px; overflow: hidden; background: #fff; }
.sa-issue + .sa-issue { border-top: 1px solid var(--sa-border); }
.sa-issue-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background .15s; }
.sa-issue-head:hover { background: var(--sa-soft); }
.sa-sev { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 5px; color: #fff; flex-shrink: 0; }
.sa-sev.error { background: var(--sa-error); }
.sa-sev.warning { background: var(--sa-warning); }
.sa-sev.notice { background: var(--sa-notice); }
.sa-issue-label { flex: 1; font-weight: 500; }
.sa-issue-count { background: var(--sa-soft); border-radius: 99px; padding: 1px 10px; font-size: 13px; font-weight: 600; color: #4f596c; }
.sa-issue-chevron { color: #9ca3af; transition: transform .2s; }
.sa-issue.open .sa-issue-chevron { transform: rotate(180deg); }
.sa-issue-body { display: none; padding: 12px 16px 14px; }
.sa-issue.open .sa-issue-body { display: block; }
.sa-issue-ai { display: flex; gap: 10px; background: #faf8ff; border: 1px solid #ece6fb; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.sa-issue-ai p { margin: 0 0 4px; font-size: 14px; line-height: 1.5em; }
.sa-ai-chip { flex-shrink: 0; height: 20px; font-size: 11px; font-weight: 700; color: #fff; background: #7c3aed; border-radius: 4px; padding: 2px 7px; }
.sa-affected { display: block; font-size: 12px; color: var(--sa-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.sa-issue-pages { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.sa-issue-pages li { padding: 3px 0; border-bottom: 1px dashed #eee; }
.sa-issue-pages a { font-size: 13px; word-break: break-all; }

/* tables */
.sa-table { width: 100%; overflow-x: auto; border: 1px solid var(--sa-border); border-radius: 12px; background: #fff; }
.sa-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sa-table th, .sa-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #f0f1f3; }
.sa-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--sa-muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.sa-table th.sortable { cursor: pointer; }
.sa-table th.sort-up::after { content: ' ▲'; color: #9aa4b2; font-size: 10px; }
.sa-table th.sort-down::after { content: ' ▼'; color: #9aa4b2; font-size: 10px; }
.sa-table tbody tr:last-child td { border-bottom: 0; }
.sa-page-row { cursor: pointer; }
.sa-page-row:hover td { background: #f7fbf9; }
.sa-page-url { word-break: break-all; }
.sa-status { display: inline-block; min-width: 38px; text-align: center; font-weight: 600; font-size: 13px; padding: 1px 8px; border-radius: 5px; }
.sa-status.ok { background: #d1fae5; color: #047857; }
.sa-status.warn { background: #fef3c7; color: #92400e; }
.sa-status.bad { background: #fee2e2; color: #b91c1c; }
.sa-pages td.has-err { color: var(--sa-error); font-weight: 600; }
.sa-pages td.has-warn { color: var(--sa-warning); font-weight: 600; }

/* per-page drawer */
.sa-drawer-overlay { align-items: stretch; justify-content: flex-end; padding: 0; }
.sa-drawer { position: relative; width: min(560px, 100%); height: 100%; background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.15); overflow-y: auto; padding: 22px; box-sizing: border-box; margin: 0; }
.sa-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sa-drawer-url { font-weight: 600; word-break: break-all; }
.sa-drawer-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sa-kv { display: flex; flex-direction: column; background: var(--sa-soft); border-radius: 8px; padding: 8px 12px; min-width: 70px; }
.sa-kv .k { font-size: 11px; color: var(--sa-muted); text-transform: uppercase; }
.sa-kv .v { font-weight: 600; }
.sa-drawer-issues { list-style: none; margin: 0; padding: 0; }
.sa-drawer-issues li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.sa-issue-ctx { font-size: 12px; color: var(--sa-muted); word-break: break-all; width: 100%; padding-left: 2px; }

/* modal form */
.sa-modal__close { position: absolute; right: 14px; top: 12px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: #9ca3af; cursor: pointer; }
.sa-modal__inner h2 { margin: 0 0 16px; font-size: 20px; }
.sa-form .form-field { margin: 0 0 14px; }
.sa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.sa-grid--2 { grid-template-columns: 1fr 1fr; }
/* reserve ~2 lines for every grid label so single- and two-line labels (e.g. the
   long "Near-duplicate sensitivity (SimHash)") keep their inputs on one baseline */
.sa-grid > .form-field > label { display: block; min-height: 2.6em; line-height: 1.25; margin-bottom: 4px; }
.sa-pages-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px; flex-wrap: wrap; }
.sa-pages-head .sa-section-title { margin: 0; }
.sa-adv { margin: 6px 0 4px; border: 1px solid var(--sa-border); border-radius: 10px; padding: 4px 12px; }
.sa-adv > summary { cursor: pointer; font-weight: 600; padding: 8px 4px; color: #3e6fe8; list-style: revert; }
.sa-adv__body { padding: 4px 2px 6px; }
.sa-adv-heading { margin: 16px 0 10px; font-size: 14px; font-weight: 600; color: #4f596c; }
.sa-form__error { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 4px 0 12px; }
.sa-form__actions { display: flex; gap: 10px; margin-top: 8px; }
.form-field.has-tooltip { position: relative; opacity: .75; }

/* history reuses .sa-table */
.sa-history table { font-size: 13px; }

@media (max-width: 768px) {
	.sa-card { flex-wrap: wrap; }
	.sa-project-actions { width: 100%; }
	.sa-result-header { gap: 16px; }
	.sa-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) { .sa-grid { grid-template-columns: 1fr; } }

/* --- per-check description (issue accordion) --- */
.sa-issue-desc { margin: 0 0 10px; color: var(--sa-muted, #667085); font-size: 13px; line-height: 1.5; }

/* --- pages table: truncated text cells --- */
.sa-cell-text { max-width: 320px; }
.sa-cell-text span, .sa-cell-text a { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* --- pagination --- */
.sa-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.sa-pager .button[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.sa-pager-info { color: var(--sa-muted, #667085); font-size: 13px; min-width: 110px; text-align: center; }

/* ===== round 3 additions ===== */
/* delete project (danger zone in settings modal) */
.sa-form__danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid #f1d6d6; text-align: center; }
.sa-delete-link { color: #dc2626; font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; }
.sa-delete-link:hover { text-decoration: underline; }

/* per-issue detail table */
.sa-issue-table { margin: 10px 0 4px; }
.sa-issue-table table { width: 100%; }
.sa-issue-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #667085; }
.sa-issue-table td { font-size: 13px; vertical-align: top; }

/* on-demand AI fix */
.sa-issue-aifix { margin-top: 10px; }
.sa-aifix-btn { font-size: 13px; }
.sa-issue-ai--ondemand { margin-top: 10px; }

/* changes since last audit */
.sa-changes { border: 1px solid #e6e8ee; border-radius: 12px; padding: 12px 14px; margin: 14px 0; background: #fafbfc; }
.sa-changes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sa-changes-title { font-weight: 600; }
.sa-change-score { font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: #eef0f4; color: #475467; }
.sa-change-score.up { background: #e7f6ee; color: #027a48; }
.sa-change-score.down { background: #fdeceb; color: #b42318; }
.sa-change-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.sa-change-label { font-size: 12px; font-weight: 600; color: #475467; margin-right: 4px; }
.sa-change-group.fixed .sa-chip { background: #e7f6ee; color: #027a48; }
.sa-change-group.new .sa-chip { background: #fdeceb; color: #b42318; }
.sa-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef0f4; color: #344054; }

/* score trend sparkline */
.sa-trend { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.sa-trend-label { font-size: 12px; font-weight: 600; color: #475467; white-space: nowrap; }
.sa-trend-chart { flex: 1; max-width: 360px; }
.sa-spark { display: block; }

/* drawer: corner close + full meta */
.sa-drawer-head { position: relative; }
.sa-drawer-x { position: absolute; top: 0; right: 0; }
.sa-drawer-meta { margin: 12px 0; }
.sa-drawer-field { margin-bottom: 10px; }
.sa-drawer-field .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #667085; margin-bottom: 2px; }
.sa-drawer-field .v { margin: 0; font-size: 13px; line-height: 1.5; word-break: break-word; }

/* pages table: wider URL column */
.sa-pages th:first-child, .sa-pages td:first-child { min-width: 280px; }
.sa-page-url { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* run-again busy state keeps the inline spinner visible */
.sa-run.is-busy { opacity: .9; }

/* --- spinner spacing in buttons/badges --- */
.sa-run.is-busy { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.sa-badge.run { display: inline-flex; align-items: center; gap: 5px; }

/* --- passed checks (collapsed) --- */
details.sa-passed { margin: 12px 0 4px; border: 1px solid var(--sa-border); border-radius: 10px; padding: 2px 12px; }
.sa-passed > summary { cursor: pointer; font-weight: 600; padding: 9px 4px; color: #16794f; list-style: revert; }
.sa-issues--passed { margin: 6px 0 10px; }
.sa-issue--passed { border-left: 3px solid var(--sa-good); }
.sa-issue--passed .sa-issue-label { color: #334155; }
.sa-sev.passed { background: var(--sa-good); color: #fff; }
.sa-issue--passed .sa-issue-count { color: var(--sa-good); font-weight: 700; }

/* ---- free mode + advanced lock --------------------------------------- */
.sa-adv__fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.sa-adv__body.is-locked .sa-adv__fieldset { opacity: .9; }
.sa-adv__body.is-locked .form-field > label::after { content: " \01F512"; opacity: .5; font-size: .85em; }
.sa-adv-locked { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 8px 12px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; color: #9a3412; font-size: 13px; position: relative; }
.sa-lock { opacity: .7; }
.sa-free-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; color: #1e3a8a; font-size: 14px; }
.sa-free-note .button { white-space: nowrap; }
.sa-free-landing { padding: 40px 24px; text-align: center; }
.sa-free-landing h2 { margin: 0 0 8px; }
.sa-free-landing .sa-note { margin: 0 auto 16px; max-width: 560px; color: #6b7280; }
.sa-url-text { word-break: break-all; color: #374151; }

/* ---- Phase A: expanded-issue spacing, summary, filters, clusters ----- */
.sa-issue-desc { margin: 2px 0 12px; color: #6b7280; line-height: 1.55; }
.sa-issue-desc:last-child { margin-bottom: 0; }
.sa-aifix-btn.is-locked { opacity: .75; }

.sa-summary { margin: 18px 0 6px; }
.sa-summary-table table { width: 100%; border-collapse: collapse; }
.sa-summary-table th, .sa-summary-table td { padding: 8px 12px; border-bottom: 1px solid var(--sa-border); text-align: left; font-size: 14px; }
.sa-summary-table th { background: var(--sa-soft); font-weight: 600; }
.sa-summary-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.sa-pages-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.sa-pages-search { flex: 1; min-width: 200px; max-width: 360px; padding: 8px 12px; border: 1px solid var(--sa-border); border-radius: 8px; font-size: 14px; }
.sa-copy-urls { white-space: nowrap; }

.sa-sev-filter { display: flex; width: max-content; max-width: 100%; margin: 0 0 14px; border: 1px solid var(--sa-border); border-radius: 8px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; background: #fff; scrollbar-width: thin; }
.sa-sev-filter::-webkit-scrollbar { height: 4px; }
.sa-sev-filter::-webkit-scrollbar-thumb { background: var(--sa-border); border-radius: 4px; }
.sa-sevbtn { appearance: none; -webkit-appearance: none; background: #fff; border: 0; border-right: 1px solid var(--sa-border); color: #475569; padding: 8px 18px; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; flex: 0 0 auto; }
.sa-sevbtn:last-child { border-right: 0; }
.sa-sevbtn:hover { background: #f3f4f6; }
.sa-sevbtn.active { background: #039669; color: #fff; }
.sa-sevbtn.active:hover { background: #02855c; }
.sa-issues.filter-error .sa-issue:not(.sev-error) { display: none; }
.sa-issues.filter-warning .sa-issue:not(.sev-warning) { display: none; }
.sa-issues.filter-notice .sa-issue:not(.sev-notice) { display: none; }

.sa-nearclusters { display: flex; flex-direction: column; gap: 12px; }
.sa-nearcluster { border: 1px solid var(--sa-border); border-radius: 8px; overflow: hidden; }
.sa-nearcluster-head { background: var(--sa-soft); padding: 8px 12px; font-weight: 600; font-size: 13px; }

/* ---- Phase B: live crawl panel --------------------------------------- */
.sa-live-card { border: 1px solid var(--sa-border); border-radius: 12px; padding: 18px 20px; margin: 8px 0 16px; background: #fff; }
.sa-live-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sa-live-phase { font-weight: 600; }
.sa-live-count { color: #6b7280; font-variant-numeric: tabular-nums; }
.sa-live-stop { margin-left: auto; }
.sa-live-bar { height: 10px; background: #e8ebee; border-radius: 99px; overflow: hidden; }
.sa-live-bar-fill { height: 100%; width: 8%; border-radius: inherit; background-color: #039669; background-image: linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%, transparent); background-size: 1rem 1rem; animation: sa-stripes .9s linear infinite; transition: width .4s ease; will-change: background-position; }
@media (prefers-reduced-motion: reduce) { .sa-live-bar-fill { animation: none; } }
.sa-live-barrow { text-align: right; }
.sa-live-pct { font-size: 12px; color: #6b7280; font-variant-numeric: tabular-nums; }
.sa-live-url { margin: 8px 0 4px; font-size: 13px; color: #4f596c; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 18px; }
.sa-live-tallies { margin: 12px 0; }
.sa-live-issues { display: flex; flex-direction: column; gap: 6px; }
.sa-live-issue { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--sa-border); }
.sa-live-issue-label { flex: 1; font-size: 14px; }

/* ---- paused crawl banner (Stop -> partial, with Continue) ------------ */
.sa-paused-note { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 12px 16px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; color: #9a3412; }
.sa-paused-ic { font-size: 16px; }
.sa-paused-text { flex: 1; font-size: 14px; font-weight: 500; }
.sa-paused-note .button { margin-left: auto; }

/* ---- Phase C: charts -------------------------------------------------- */
.sa-charts-wrap { margin: 4px 0; }
.sa-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sa-chart-card { border: 1px solid var(--sa-border); border-radius: 12px; padding: 14px 16px; background: #fff; }
.sa-chart-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.sa-chart-svg svg { display: block; }

/* ---- Phase C: print / PDF (window.print) ----------------------------- */
.sa-print-only { display: none; }
@media print {
  /* hide app chrome + interactive controls */
  .site-header, .breadcrumbs, .sidebar, .tool-list, .site-footer, .main-menu,
  .magic-line, .sa-progress, .sa-detail-actions, .sa-pages-tools, .sa-sev-filter,
  .sa-paused-note, .sa-live-card, #sa-form-project, .sa-modal, .button { display: none !important; }
  /* print only the audit report — drop page marketing, FAQ, comparison cards, toolbar */
  .tool-description, .desc-cards, .desc-table-wrap, .faq, .sa-toolbar, .sa-free-note,
  .user-plan-info, .page-title, .messages,
  .main > h2, .main > h3, .main > p, .main > ul { display: none !important; }
  .sa-print-only { display: block !important; }
  .sa-print-head { margin: 0 0 16px; padding: 0 0 10px; border-bottom: 2px solid #039669; }
  .sa-print-brand { font-size: 20px; font-weight: 700; color: #039669; display: block; }
  .sa-print-meta { font-size: 12px; color: #475569; }
  .page-content, .main, .sa-app { display: block !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; }
  /* expand all accordions so everything prints */
  .sa-issue-body { display: block !important; }
  .sa-issue-chevron, .sa-passed > summary::-webkit-details-marker { display: none !important; }
  details.sa-passed[open], details.sa-passed { display: block !important; }
  /* keep blocks together across pages */
  .sa-issue, .sa-chart-card, .sa-cat, .sa-result-header, tr { break-inside: avoid; page-break-inside: avoid; }
  .sa-section-title { break-after: avoid; page-break-after: avoid; }
  .sa-charts { grid-template-columns: 1fr 1fr; }
  /* force colors to print */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; }
}

/* ---- duplicate clusters (h1/title/desc grouped by shared value) ------- */
.sa-nearcluster-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sa-dup-val { font-weight: 600; color: #1f2937; word-break: break-word; }
.sa-dup-count { font-size: 12px; color: #6b7280; }

/* ---- page-limit pause banner (more prominent than a normal pause) ----- */
.sa-paused-note.sa-limit-note { background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; align-items: flex-start; }
.sa-limit-note .sa-paused-text { font-weight: 600; }
.sa-paused-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 560px) { .sa-paused-actions { margin-left: 0; width: 100%; } }

/* ---------------------- log file analysis (Pro) ------------------------ */
.sa-modal__inner--wide { max-width: 860px; width: 94vw; }
.sa-modal__hint { margin: -6px 0 14px; color: var(--sa-muted); font-size: 13px; line-height: 1.5; }
.sa-logs-input .sa-field { margin: 0 0 12px; }
.sa-logs-input label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin: 0 0 4px; }
.sa-logs-input input[type=file] { font-size: 13px; }
.sa-logs-input textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; border: 1px solid var(--sa-border); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.sa-logs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.sa-logs-actions .sa-logs-botlabel { margin: 0; font-size: 13px; }
.sa-logs-actions select { border: 1px solid var(--sa-border); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff; }
.sa-logs-results { margin-top: 16px; }
.sa-log-summary { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; padding: 12px 14px; background: var(--sa-soft); border: 1px solid var(--sa-border); border-radius: 10px; font-size: 13px; color: #475569; margin-bottom: 14px; }
.sa-log-summary b { font-size: 18px; color: var(--sa-ink); }
.sa-log-block { margin: 0 0 18px; }
.sa-log-block h4 { margin: 0 0 8px; font-size: 14px; color: var(--sa-ink); }
.sa-logbars { display: flex; flex-direction: column; gap: 4px; }
.sa-logbar-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 10px; font-size: 12px; }
.sa-logbar-label { color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-logbar-track { background: #eef2f7; border-radius: 6px; height: 14px; overflow: hidden; }
.sa-logbar-fill { display: block; height: 100%; background: #94a3b8; border-radius: 6px; }
.sa-logbar-fill.green { background: #039669; }
.sa-logbar-fill.amber { background: #f59e0b; }
.sa-logbar-fill.red { background: #dc2626; }
.sa-logbar-val { text-align: right; color: #475569; font-variant-numeric: tabular-nums; }
.sa-cell-text { max-width: 460px; word-break: break-all; font-size: 12px; }
.sa-st { display: inline-block; min-width: 34px; text-align: center; padding: 1px 7px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.sa-st-ok { background: #dcfce7; color: #166534; }
.sa-st-warn { background: #fef3c7; color: #92400e; }
.sa-st-err { background: #fee2e2; color: #991b1b; }

/* ----------------------- Google Search Console (Pro) ------------------- */
.sa-gsc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sa-gsc-acct { font-size: 13px; color: #475569; }
.sa-gsc-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.sa-gsc-controls select { border: 1px solid var(--sa-border); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff; max-width: 100%; }
.sa-gsc-site { min-width: 220px; }
.sa-gsc-redirect { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--sa-soft); border: 1px solid var(--sa-border); border-radius: 8px; padding: 8px 10px; word-break: break-all; color: #475569; }
.sa-gsc-results { margin-top: 4px; }

/* ----------------------- internal link structure ---------------------- */
.sa-link-structure { margin: 18px 0; }
.sa-link-structure .sa-log-block { margin-bottom: 14px; }

/* crawl × logs cross-reference highlight */
.sa-xr h4 { color: #039669; }

/* back-to-projects row spacing in the live crawling view */
.sa-live-top { margin-bottom: 10px; }

/* Google spam-policy risk panel */
.sa-spam-risk .sa-risk-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-weight: 600; }
.sa-risk-badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; color: #fff; font-size: .85em; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.sa-risk-low { background: #16a34a; } .sa-risk-medium { background: var(--sa-warning); } .sa-risk-high { background: var(--sa-error); }
.sa-risk-flag { font-weight: 600; } .sa-risk-flag-error { color: var(--sa-error); } .sa-risk-flag-warning { color: var(--sa-warning); } .sa-risk-flag-notice { color: var(--sa-notice); }
.sa-risk-ok { color: #16a34a; font-weight: 600; }
.sa-risk-upsell .button { margin-top: .5rem; }
.sa-scaled h4, .sa-recovery h4 { margin: 0; }
.sa-recovery ol { margin: .5rem 0 0 1.2rem; padding: 0; }
.sa-recovery li { margin: .3rem 0; }
.sa-decision { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .85em; font-weight: 600; color: #fff; }
.sa-decision-keep { background: #16a34a; } .sa-decision-improve { background: var(--sa-warning); } .sa-decision-merge { background: #2563eb; } .sa-decision-remove { background: var(--sa-error); }
.sa-fixes { margin: 0; padding-left: 1rem; } .sa-fixes li { margin: .15rem 0; }
.sa-ai-review .button { margin: .25rem 0 .5rem; }
.sa-page-extra h4 { margin: .9rem 0 .3rem; font-size: .95em; }
.sa-hops, .sa-from { margin: 0; padding-left: 1.1rem; } .sa-hops li, .sa-from li { margin: .15rem 0; }
.sa-chips { display: flex; flex-wrap: wrap; gap: .4rem; } .sa-chip-btn { cursor: pointer; border: 1px solid var(--sa-border, #d1d5db); background: transparent; }
.sa-tree { list-style: none; margin: 0; padding-left: 1rem; } .sa-tree-root { padding-left: 0; } .sa-tree summary { cursor: pointer; } .sa-tree-leaf { padding: .1rem 0; }
.sa-score-risk { font-size: .8em; margin-top: .3rem; padding: .15rem .5rem; border-radius: 999px; display: inline-block; background: #e5e7eb; }
.sa-score-risk-medium { background: var(--sa-warning); color: #fff; } .sa-score-risk-high { background: var(--sa-error); color: #fff; }
.sa-graph-canvas { width: 100%; max-width: 1100px; height: auto; border: 1px solid var(--sa-border, #e5e7eb); border-radius: 8px; background: #fff; cursor: grab; display: block; }
.sa-graph-legend { display: flex; flex-wrap: wrap; gap: .6rem; margin: .4rem 0; font-size: .85em; } .sa-graph-key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.sa-graph-info { margin-top: .3rem; }

/* ---------------------------------------------------------------- RTL ----
   Applied only inside [dir="rtl"], which index.php puts on the blocks the
   tool owns (he, fa, ar, ur). Two separate jobs here:
   1. mirror the directional spacing and borders;
   2. keep technical strings that are NOT Hebrew/Arabic - URLs, HTTP headers,
      tag names, numbers with units - rendered left-to-right. Without the
      isolation below, "og:image" or "https://..." inside an RTL paragraph gets
      reordered by the bidi algorithm and reads as nonsense. */
[dir="rtl"] .sa-kv,
[dir="rtl"] .sa-note,
[dir="rtl"] .sa-issue,
[dir="rtl"] .sa-live-issues > * { border-left: 0; border-right: 3px solid var(--sa-accent, #039669); }
[dir="rtl"] .sa-toolbar__left { margin-left: 0; margin-right: auto; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .sa-modal__inner { text-align: right; }

/* URLs and any code-like cell stay LTR and stay glued together. */
[dir="rtl"] .sa-cell-text,
[dir="rtl"] .sa-url,
[dir="rtl"] code,
[dir="rtl"] pre { direction: ltr; text-align: left; unicode-bidi: bidi-override; }

/* Inline technical terms inside running text: isolate so the bidi algorithm
   treats each as one neutral run instead of reshuffling it into the sentence. */
[dir="rtl"] .tool-description code,
[dir="rtl"] .tool-description strong { unicode-bidi: isolate; }

/* Charts and bars grow from the right. */
[dir="rtl"] .sa-bar-track, [dir="rtl"] .sa-logbars { transform: scaleX(-1); }
[dir="rtl"] .sa-bar-track > *, [dir="rtl"] .sa-logbars > * { transform: scaleX(-1); }

/* ---- agent brief ---------------------------------------------------------- */
.sa-agent { border:1px solid #e2e8f0; border-left:4px solid #7c3aed; border-radius:10px; padding:14px 16px; margin:22px 0 0; background:#fff; }
.sa-agent h3 { margin:0 0 6px; font-size:16px; }
.sa-agent .sa-muted { margin:0 0 10px; font-size:13px; line-height:1.5; }
.sa-agent-prompt { width:100%; box-sizing:border-box; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px;
  line-height:1.5; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; padding:10px 12px; resize:vertical; direction:ltr; }
.sa-agent-actions { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0 0; }
.sa-badge--partial { background:#fef3c7; color:#92400e; border:1px solid #fde68a; border-radius:99px;
  padding:1px 8px; font-size:11px; margin-left:8px; vertical-align:middle; }
ul.summary.sa-usage { list-style:none; display:flex; gap:18px; flex-wrap:wrap; margin:0 0 14px; padding:0; font-size:13px; color:#475569; }
ul.summary.sa-usage li { margin:0; } ul.summary.sa-usage b { color:#0f172a; font-weight:600; }
.sa-ai-box--locked { opacity:.95; border-style:dashed; }
.sa-ai-box--locked .sa-ai-title { opacity:.7; }
.sa-ai-actions { margin:10px 0 0; }

/* ---- report tabs ---------------------------------------------------------
   One tab per question instead of one long page. The bar scrolls sideways on
   narrow screens rather than wrapping into a second row. */
.sa-tabset { margin-top: 18px; }
.sa-tabs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--sa-border); scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.sa-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; margin: 0 0 -1px; padding: 11px 14px 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--sa-muted); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; border-radius: 8px 8px 0 0; }
.sa-tab:hover { color: var(--sa-ink); background: var(--sa-soft); }
.sa-tab.is-active { color: var(--sa-ink); border-bottom-color: var(--sa-good); }
.sa-tab:focus-visible { outline: 2px solid #3e6fe8; outline-offset: -2px; }
.sa-tab-count { font-size: 12px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 99px; background: var(--sa-soft); color: #4f596c; font-variant-numeric: tabular-nums; }
.sa-tab.is-active .sa-tab-count { background: #e7f6ee; color: #027a48; }
.sa-tab-count.is-critical, .sa-tab.is-active .sa-tab-count.is-critical { background: var(--sa-error); color: #fff; }
.sa-tabpanel { padding-top: 6px; }
.sa-tabpanel:focus-visible { outline: 2px solid #3e6fe8; outline-offset: 4px; border-radius: 6px; }
.sa-tabpanel > .sa-section-title:first-of-type, .sa-tabpanel > :nth-child(2) > .sa-section-title:first-child { margin-top: 18px; }

/* stat boxes in the header open their part of the report */
.sa-stat.is-link { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sa-stat.is-link:hover { box-shadow: 0 1px 6px rgba(15, 23, 42, .08); border-color: #cbd5e1; }
.sa-stat.is-link:focus-visible { outline: 2px solid #3e6fe8; outline-offset: 2px; }

/* overview: issues to fix first */
.sa-top-issues { display: flex; flex-direction: column; border: 1px solid var(--sa-border); border-radius: 12px; overflow: hidden; background: #fff; }
.sa-top-issue { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; background: #fff; font: inherit; text-align: start; cursor: pointer; }
.sa-top-issue + .sa-top-issue { border-top: 1px solid var(--sa-border); }
.sa-top-issue:hover { background: var(--sa-soft); }
.sa-top-issue:focus-visible { outline: 2px solid #3e6fe8; outline-offset: -2px; }
.sa-top-issue-label { flex: 1; font-weight: 500; color: var(--sa-ink); }
.sa-top-more { margin: 10px 0 0; }

/* ---- change tracking ---------------------------------------------------- */
.sa-chg-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 14px 0 0; padding: 10px 14px; border: 1px solid #fde68a; border-inline-start: 4px solid var(--sa-warning); border-radius: 10px; background: #fffbeb; font-size: 14px; }
.sa-chg-strip.is-critical { border-color: #fecdd3; border-inline-start-color: var(--sa-error); background: #fff1f2; }
.sa-chg-strip-title { font-weight: 700; color: var(--sa-ink); }
.sa-chg-strip-items { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.sa-chg-pill { font-size: 13px; padding: 2px 9px; border-radius: 99px; background: #fff; border: 1px solid var(--sa-border); color: #344054; }
.sa-chg-pill.is-bad { border-color: #fecdd3; color: #b42318; font-weight: 600; }
.sa-chg-strip-btn { margin-inline-start: auto; }

.sa-chg-basis { margin: 16px 0 6px; font-size: 14px; color: var(--sa-ink); }
.sa-chg-note { margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: #eff6ff; color: #1e3a8a; font-size: 13px; line-height: 1.5; }
.sa-chg-empty { margin: 18px 0; padding: 22px; border: 1px dashed var(--sa-border); border-radius: 12px; background: #fafbfc; }
.sa-chg-empty h3 { margin: 0 0 6px; font-size: 16px; }
.sa-chg-empty p { margin: 0; line-height: 1.55; }
.sa-chg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.sa-chg-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border: 1px solid var(--sa-border); border-radius: 10px; background: #fff; font: inherit; text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sa-chg-card:hover { border-color: #cbd5e1; box-shadow: 0 1px 6px rgba(15, 23, 42, .06); }
.sa-chg-card:focus-visible { outline: 2px solid #3e6fe8; outline-offset: 2px; }
.sa-chg-card.is-active { border-color: var(--sa-good); box-shadow: inset 0 0 0 1px var(--sa-good); }
.sa-chg-card-n { font: 700 22px var(--secondary-font, "Syne"), sans-serif; line-height: 1.1; color: var(--sa-ink); font-variant-numeric: tabular-nums; }
.sa-chg-card.is-bad .sa-chg-card-n { color: var(--sa-error); }
.sa-chg-card.is-zero .sa-chg-card-n { color: #cbd5e1; }
.sa-chg-card-label { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--sa-muted); }
.sa-chg-card-sub { font-size: 12px; color: #b42318; }
.sa-chg-growth .sa-section-title { margin-top: 22px; }
.sa-chg-growth td.num, .sa-chg-table td.num, .sa-chg-growth th:not(:first-child) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sa-plus { color: #027a48; }
.sa-minus { color: #b42318; }
.sa-chg-growth tr.is-zero td { color: #9ca3af; }
.sa-chg-growth tr.is-zero td.sa-plus, .sa-chg-growth tr.is-zero td.sa-minus { color: #9ca3af; }
.sa-chg-growth tr.sa-total td { font-weight: 700; border-top: 2px solid var(--sa-border); }
.sa-chg-block { margin-top: 8px; }
.sa-chg-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sa-chg-block-head .sa-section-title { margin: 22px 0 10px; }
.sa-chg-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sa-chg-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #344054; cursor: pointer; }
.sa-chg-table td { vertical-align: top; }
.sa-chg-table td.sa-chg-old { color: #6b7280; }
.sa-chg-table td .sa-chip { display: inline-block; margin: 0 4px 4px 0; white-space: nowrap; }
.sa-chg-table td.sa-chg-headings { min-width: 180px; font-size: 13px; line-height: 1.45; word-break: normal; overflow-wrap: anywhere; }
.sa-chg-table td.sa-chg-headings > div + div { margin-top: 3px; }
.sa-chg-sev { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eef0f4; color: #475467; white-space: nowrap; }
.sa-chg-sev.is-bad { background: #fdeceb; color: #b42318; }
.sa-chg-sev.is-good { background: #e7f6ee; color: #027a48; }
.sa-chg-more { margin: 10px 0 0; }
.sa-chg-more .button[hidden] { display: none; }
.sa-chg-locked { margin-top: 18px; }

/* RTL: signed numbers keep their sign in front ("+44", not "44+") */
[dir="rtl"] .sa-chg-growth td.num, [dir="rtl"] .sa-chg-table td.num { direction: ltr; unicode-bidi: isolate; text-align: left; }
[dir="rtl"] .sa-chg-growth th:not(:first-child) { text-align: left; }
[dir="rtl"] .sa-chg-table td.sa-chg-headings > div { unicode-bidi: plaintext; }

/* project list: what changed in the latest audit */
.sa-badge--changes { border: 0; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: #fffbeb; color: #92400e; }
.sa-badge--changes.is-critical { background: #fff1f2; color: #b42318; }
.sa-badge--changes:hover { text-decoration: underline; }

/* settings modal: alerts */
.sa-alert-cats { border: 0; margin: 4px 0 0; padding: 0; min-inline-size: 0; }
.sa-alert-cats > legend { padding: 0; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: #4f596c; }

@media (max-width: 600px) {
	.sa-tab { padding: 10px 11px 9px; font-size: 13px; }
	.sa-chg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	/* stacked: title, then the counts at full width, then the button */
	.sa-chg-strip { flex-direction: column; align-items: flex-start; }
	.sa-chg-strip-items { width: 100%; }
	.sa-chg-pill { border-radius: 8px; }
	.sa-chg-strip-btn { margin-inline-start: 0; }
}
@media print {
	.sa-tabs { display: none !important; }
	.sa-tabpanel[hidden] { display: block !important; }
	.sa-tabpanel { break-before: page; page-break-before: always; padding-top: 0; }
	.sa-tabpanel:first-child { break-before: auto; page-break-before: auto; }
	.sa-tabpanel-title { display: block !important; margin: 0 0 8px; font-size: 18px; }
	.sa-chg-card, .sa-chg-growth { break-inside: avoid; page-break-inside: avoid; }
}
