/* ==========================================================================
   Initial Automatic Site Scan — UI
   Light by default; dark via prefers-color-scheme or the sidebar toggle
   (html[data-theme]). Apple-style: system type, hairline borders, solid
   content surfaces with translucent chrome only where content scrolls under
   it, and short ease-out motion on transform/opacity. Reduced motion,
   reduced transparency and higher contrast each get their own fallback at
   the bottom of this file.
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #e8e8ed;
  --border: #e5e5ea;
  --border-strong: #d1d1d6;
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #6e6e73;
  --faint: #aeaeb2;

  /* Apple systemIndigo, plus a cyan for the brand mark and progress ring. */
  --accent: #5856d6;
  --accent-hover: #4b49c4;
  --accent-fill: #5856d6;
  --accent-fill-hover: #4b49c4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(88, 86, 214, 0.1);
  --accent-ring: rgba(88, 86, 214, 0.32);
  --grad: linear-gradient(135deg, #5856d6 0%, #32ade6 100%);

  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, 0.12);
  --warn: #c25e00;
  --warn-soft: rgba(255, 149, 0, 0.13);
  --fail: #d70015;
  --fail-soft: rgba(255, 59, 48, 0.1);
  --info: #0066cc;
  --info-soft: rgba(0, 122, 255, 0.1);
  --neutral: #6e6e73;
  --neutral-soft: rgba(120, 120, 128, 0.12);

  --sev-critical: #c4001a;
  --sev-high: #d9480f;
  --sev-medium: #a86b00;
  --sev-low: #0066cc;
  --sev-info: #6e6e73;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px -6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 12px 32px -8px rgba(0, 0, 0, 0.2), 0 32px 64px -24px rgba(0, 0, 0, 0.18);

  /* Translucent chrome (top bar, tab bar, sticky header, toasts). */
  --material: rgba(250, 250, 252, 0.72);
  --material-edge: rgba(0, 0, 0, 0.08);

  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 240px;
  --view-pad: clamp(1rem, 3vw, 2.5rem);

  /* Motion. Strong ease-out for UI; nothing above 300ms except the
     progress ring, which is progress rather than UI response. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 120ms;
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 250ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0d;
    --surface: #1c1c1e;
    --surface-2: #242426;
    --surface-3: #2c2c2e;
    --border: #2f2f33;
    --border-strong: #3a3a3c;
    --text: #f5f5f7;
    --text-2: #d1d1d6;
    --muted: #98989d;
    --faint: #636366;
    --accent: #7d7aff;
    --accent-hover: #918eff;
    --accent-fill: #5e5ce6;
    --accent-fill-hover: #6f6dff;
    --accent-soft: rgba(125, 122, 255, 0.14);
    --accent-ring: rgba(125, 122, 255, 0.4);
    --ok: #30d158; --ok-soft: rgba(48, 209, 88, 0.14);
    --warn: #ff9f0a; --warn-soft: rgba(255, 159, 10, 0.14);
    --fail: #ff453a; --fail-soft: rgba(255, 69, 58, 0.14);
    --info: #409cff; --info-soft: rgba(64, 156, 255, 0.14);
    --neutral: #98989d; --neutral-soft: rgba(152, 152, 157, 0.16);
    --sev-critical: #ff6961; --sev-high: #ff8a3d; --sev-medium: #ffd60a; --sev-low: #409cff; --sev-info: #98989d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 24px 64px -12px rgba(0, 0, 0, 0.7);
    --material: rgba(28, 28, 30, 0.72);
    --material-edge: rgba(255, 255, 255, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --surface: #1c1c1e;
  --surface-2: #242426;
  --surface-3: #2c2c2e;
  --border: #2f2f33;
  --border-strong: #3a3a3c;
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #98989d;
  --faint: #636366;
  --accent: #7d7aff;
  --accent-hover: #918eff;
  --accent-fill: #5e5ce6;
  --accent-fill-hover: #6f6dff;
  --accent-soft: rgba(125, 122, 255, 0.14);
  --accent-ring: rgba(125, 122, 255, 0.4);
  --ok: #30d158; --ok-soft: rgba(48, 209, 88, 0.14);
  --warn: #ff9f0a; --warn-soft: rgba(255, 159, 10, 0.14);
  --fail: #ff453a; --fail-soft: rgba(255, 69, 58, 0.14);
  --info: #409cff; --info-soft: rgba(64, 156, 255, 0.14);
  --neutral: #98989d; --neutral-soft: rgba(152, 152, 157, 0.16);
  --sev-critical: #ff6961; --sev-high: #ff8a3d; --sev-medium: #ffd60a; --sev-low: #409cff; --sev-info: #98989d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 24px 64px -12px rgba(0, 0, 0, 0.7);
  --material: rgba(28, 28, 30, 0.72);
  --material-edge: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.006em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
button, a, label, [role="button"], [role="tab"], select { touch-action: manipulation; }
button, .btn, .chip, .tab, .nav-item, .sev-tile, .tl-row, .disclosure, .ph-chip, .switch { -webkit-user-select: none; user-select: none; }
code, pre, .mono { font-family: var(--mono); }
.hidden { display: none !important; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 8px; }

.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }

/* ---------- Shell ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1rem 0.75rem;
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.65rem; padding: 0.35rem 0.5rem; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--grad);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.12);
}
.brand-mark svg { width: 18px; height: 18px; fill: #fff; }
.brand-mark.lg { width: 60px; height: 60px; border-radius: 15px; }
.brand-mark.lg svg { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 650; font-size: 0.9rem; letter-spacing: -0.012em; }
.brand-sub { font-size: 0.72rem; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); padding: 1rem 0.65rem 0.3rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.65rem; border-radius: 8px;
  color: var(--text-2); font-weight: 500;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.nav-item .i { color: var(--muted); transition: color var(--dur-fast) ease; }
.nav-item:active { background: var(--surface-3); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active .i { color: var(--accent); }

.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 0.4rem; padding-top: 0.85rem; border-top: 1px solid var(--border); }
.me { flex: 1; display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 650; color: #fff; background: var(--grad); flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.66rem; }
.avatar[data-tip] { cursor: default; transition: box-shadow var(--dur-fast) ease; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-name { font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 0.72rem; color: var(--muted); text-transform: capitalize; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; flex-shrink: 0;
  border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.icon-btn:active { background: var(--surface-3); transform: scale(0.94); }

.view { min-width: 0; padding: 1.75rem var(--view-pad) 4rem; outline: none; }
/* No page-level transition: the title is there at once and the cards
   below settle in (.anim-in) — navigation happens many times a day. */
.page { max-width: 1180px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0.15rem 0 0; font-family: var(--font-display); font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.022em; font-weight: 700; }
.page-head p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.92rem; }
.eyebrow { font-size: 0.72rem; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; display: inline-flex; gap: 0.35rem; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--accent); font-weight: 500; font-size: 0.86rem; margin-bottom: 0.5rem; }
.back .i { transition: transform var(--dur-fast) var(--ease-out); }

/* Scan page: the title and actions stay reachable while the page scrolls.
   The material only appears once content is actually underneath it. */
.stick-sentinel { height: 1px; margin-bottom: -1px; }
.sticky-head {
  position: sticky; top: 0; z-index: 10;
  margin-inline: calc(-1 * var(--view-pad)); padding: 0.75rem var(--view-pad);
  margin-top: -0.75rem; margin-bottom: 0.75rem;
}
.sticky-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--material-edge);
  opacity: 0; transition: opacity var(--dur) ease;
}
.sticky-head.stuck::before { opacity: 1; }

/* ---------- Cards & layout ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.25rem 1.35rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.95rem 1.35rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 0.98rem; font-weight: 650; letter-spacing: -0.012em; display: flex; align-items: center; gap: 0.5rem; }
.card-head h2 .i, .card-head h3 .i { color: var(--muted); }
.card-head .sub { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.stack > *, .grid-2 > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

/* Cards settle in on page load; a short stagger, never more than three steps. */
.anim-in { animation: fadeUp var(--dur-slow) var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 6) * 40ms); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 36px; padding: 0 0.9rem; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 0.86rem; letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.btn:active { transform: scale(0.97); background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { height: 30px; padding: 0 0.65rem; font-size: 0.8rem; border-radius: 8px; gap: 0.35rem; }
.btn-lg { height: 44px; padding: 0 1.25rem; font-size: 0.95rem; border-radius: 11px; }
.btn-primary { border-color: transparent; color: var(--accent-ink); background: var(--accent-fill); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0.5px 0 rgba(255, 255, 255, 0.2); }
.btn-primary:active { background: var(--accent-fill-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:active { background: var(--surface-3); }
.btn-danger { color: var(--fail); border-color: transparent; background: var(--fail-soft); box-shadow: none; }
.btn-danger:active { background: color-mix(in srgb, var(--fail) 18%, transparent); }
.btn .spin-i { animation: spin 0.8s linear infinite; }
.btn-primary .i:last-child:not(:first-child) { transition: transform var(--dur-fast) var(--ease-out); }

/* ---------- Inputs ---------- */

.field label, .label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.35rem; }
.input, .textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 0.55rem 0.75rem; font: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.textarea { font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; resize: vertical; min-height: 280px; }
.hint { font-size: 0.78rem; color: var(--muted); margin: 0.4rem 0 0; }

.url-bar {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.35rem 0.35rem 0.95rem;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow); transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.url-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.url-bar > .i { color: var(--muted); }
.url-bar input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: inherit; font-size: 1.05rem; color: var(--text); padding: 0.55rem 0; }
.url-bar input::placeholder { color: var(--faint); }

/* Switch — the thumb stretches while pressed, like iOS. */
.switch { position: relative; display: inline-flex; width: 42px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); transition: background-color var(--dur) ease, box-shadow var(--dur) ease; }
.switch-track::before {
  content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.2);
  transform-origin: left center;
  transition: transform var(--dur) var(--ease-out);
}
.switch input:active + .switch-track::before { transform: scaleX(1.18); }
.switch input:checked + .switch-track { background: var(--accent-fill); box-shadow: none; }
.switch input:checked + .switch-track::before { transform: translateX(16px); transform-origin: right center; }
.switch input:checked:active + .switch-track::before { transform: translateX(16px) scaleX(1.18); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-ring); }
.switch input:disabled + .switch-track { opacity: 0.55; }

.option { display: flex; align-items: flex-start; gap: 0.8rem; padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.option > .i { color: var(--muted); margin-top: 2px; }
.option-title { display: block; font-weight: 600; font-size: 0.88rem; }
.option-text { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem; }

/* Collapsible: the grid-rows trick animates height without measuring.
   One of the few layout animations allowed — kept short. */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.collapse > div { overflow: hidden; opacity: 0; transition: opacity var(--dur) ease; }
.collapse.open { grid-template-rows: 1fr; }
.collapse.open > div { opacity: 1; }
.disclosure { display: inline-flex; align-items: center; gap: 0.35rem; background: none; border: 0; padding: 0.3rem 0; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.disclosure .i { transition: transform var(--dur) var(--ease-out); }
.disclosure[aria-expanded="true"] .i:last-child { transform: rotate(180deg); }
.card-head .disclosure { color: var(--text); font-size: 0.98rem; font-weight: 650; }
.card-head .disclosure .i:first-child { color: var(--muted); }

/* ---------- Chips / pills / badges ---------- */

.badge { display: inline-flex; align-items: center; gap: 0.3rem; height: 22px; padding: 0 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.env-badge { vertical-align: middle; margin-left: 0.25rem; }
.badge.fail { background: var(--fail-soft); color: var(--fail); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; height: 24px; padding: 0 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; background: var(--neutral-soft); color: var(--neutral); }
.pill .dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.running, .pill.pending { color: var(--accent); background: var(--accent-soft); }
.pill.running .dot::after, .pill.pending .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ping 1.6s var(--ease-out) infinite; }
.pill.done { color: var(--ok); background: var(--ok-soft); }
.pill.error { color: var(--fail); background: var(--fail-soft); }
.pill.cancelled { color: var(--neutral); background: var(--neutral-soft); }

/* Check selection chips */
.check-group + .check-group { margin-top: 1.1rem; }
.check-group-head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.55rem; flex-wrap: wrap; }
.check-group-head h4 { margin: 0; font-size: 0.82rem; font-weight: 650; }
.check-group-head span { font-size: 0.75rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.75rem 0.4rem 0.5rem; border-radius: 17px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-size: 0.82rem; font-weight: 500;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.chip:active { transform: scale(0.97); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .tick { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease; }
.chip .tick .i { width: 11px; height: 11px; stroke-width: 3; color: #fff; opacity: 0; transform: scale(0.6); transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast) ease; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.chip:has(input:checked) .tick { background: var(--accent-fill); border-color: var(--accent-fill); }
.chip:has(input:checked) .tick .i { opacity: 1; transform: none; }
.chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-ring); }
.chip .tag { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface-3); border-radius: 5px; padding: 0.05rem 0.35rem; }

/* ---------- New scan hero ---------- */

.hero { position: relative; overflow: hidden; padding: clamp(1.5rem, 4vw, 2.75rem); }
.hero-inner { position: relative; z-index: 1; max-width: 760px; }
.hero h1 { margin: 0.5rem 0 0.5rem; font-family: var(--font-display); font-size: clamp(1.75rem, 3.2vw, 2.4rem); letter-spacing: -0.028em; font-weight: 700; line-height: 1.1; text-wrap: balance; }
.hero h1 .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin: 0 0 1.4rem; color: var(--muted); font-size: 1rem; line-height: 1.5; max-width: 560px; }
.hero .url-bar { margin-bottom: 0.9rem; }
.hero-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.7rem; }

/* Soft, static colour behind the hero and sign-in card. No drift: slow
   looping motion behind content is a vestibular trigger and a distraction. */
.orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orbs span { position: absolute; border-radius: 50%; filter: blur(70px); }
.orbs span:nth-child(1) { width: 420px; height: 420px; background: #5856d6; top: -200px; right: -120px; opacity: 0.35; }
.orbs span:nth-child(2) { width: 320px; height: 320px; background: #32ade6; bottom: -200px; right: 20%; opacity: 0.3; }
.orbs span:nth-child(3) { width: 240px; height: 240px; background: #af52de; top: 25%; right: 32%; opacity: 0.18; }
.hero .orbs span:nth-child(1) { opacity: 0.14; }
.hero .orbs span:nth-child(2) { opacity: 0.1; }
.hero .orbs span:nth-child(3) { opacity: 0.06; }

/* ---------- Scan detail ---------- */

.scan-title { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.scan-title h1 { word-break: break-all; }
.scan-url { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; word-break: break-all; }
.actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.progress-card { display: flex; align-items: center; gap: 1.5rem; padding: 1.25rem 1.4rem; position: relative; overflow: hidden; }
.ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease-out); }
.ring.done .bar { stroke: var(--ok); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 0.7rem; color: var(--muted); font-weight: 600; margin-top: 0.25rem; }
.stats { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.stat { padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.stat .k { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .v { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }
/* Indeterminate activity while checks run — status, not decoration. */
.progress-card .scanline { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--grad); transform-origin: left; animation: scan 2s var(--ease-in-out) infinite; opacity: 0.7; }

.banner { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text-2); font-size: 0.85rem; }
.banner > .i { color: var(--accent); margin-top: 1px; }
.banner-warn { background: var(--warn-soft); }
.banner-warn > .i { color: var(--warn); }
.banner > div { min-width: 0; }
.banner b { color: var(--text); }
.wp-phases { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.wp-phase { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.wp-phase em { font-style: normal; font-weight: 500; color: var(--muted); text-transform: none; }
.wp-phase .i { width: 12px; height: 12px; color: var(--accent); margin: 0; animation: spin 0.8s linear infinite; }
.wp-phase.ph-running { border-color: var(--accent-ring); }
.wp-phase.ph-done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.wp-phase.ph-done em { color: var(--ok); }
.wp-phase.ph-blocked em, .wp-phase.ph-failed em { color: var(--fail); }
.wp-block { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.45rem; color: var(--warn); font-weight: 600; }
.wp-block .i { color: var(--warn); margin: 0; }
.txt-crit { color: var(--sev-critical); }

/* WPScan options (new scan → Advanced) */
.wp-opts { margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 0.75rem; max-width: 720px; }
.opt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-weight: 650; font-size: 0.88rem; }
.opt-head .i { color: var(--muted); }
.opt-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); align-items: center; gap: 0.6rem; }
.opt-row .label { margin: 0; }
#wpOptsError { color: var(--fail); margin: 0; }
#wpOptsError:empty { display: none; }
@media (max-width: 600px) { .opt-row { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0.4rem 0; position: relative; }
.tl-item { position: relative; }
.tl-item + .tl-item::before { content: ""; position: absolute; left: calc(1.35rem + 13px); top: -10px; height: 18px; width: 2px; border-radius: 1px; background: var(--border); transition: background-color var(--dur-slow) ease; }
.tl-item.st-done + .tl-item::before, .tl-item.st-pass + .tl-item::before { background: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.tl-row {
  width: 100%; display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 1.35rem; margin: 2px 0;
  background: transparent; border: 0; text-align: left; cursor: default;
  transition: background-color var(--dur-fast) ease;
}
.tl-item.expandable .tl-row { cursor: pointer; }
.tl-item.expandable .tl-row:active { background: var(--surface-3); }
.tl-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--neutral-soft); color: var(--neutral); position: relative; transition: background-color var(--dur-slow) ease, color var(--dur-slow) ease; }
.tl-icon .i { width: 15px; height: 15px; stroke-width: 2.4; }
/* The moment a check lands: a short settle, no overshoot — nothing was thrown. */
.tl-icon.pop { animation: land var(--dur-slow) var(--ease-out); }
.tl-main { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; font-size: 0.88rem; display: block; }
.tl-sub { font-size: 0.76rem; color: var(--muted); display: block; margin-top: 1px; }
.tl-meta { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.tl-chev { color: var(--faint); transition: transform var(--dur) var(--ease-out), color var(--dur-fast) ease; display: grid; }
.tl-item:not(.expandable) .tl-chev { visibility: hidden; }
.tl-item.open .tl-chev { transform: rotate(180deg); color: var(--text); }
.tl-item.st-running .tl-row { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.tl-item.st-running .tl-icon { background: var(--accent-fill); color: #fff; }
.tl-item.st-running .tl-icon::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; border-bottom-color: transparent; animation: spin 0.9s linear infinite; }
.tl-item.st-pending { opacity: 0.55; }
.tl-item.st-pass .tl-icon { background: var(--ok-soft); color: var(--ok); }
.tl-item.st-warn .tl-icon { background: var(--warn-soft); color: var(--warn); }
.tl-item.st-fail .tl-icon, .tl-item.st-error .tl-icon { background: var(--fail-soft); color: var(--fail); }
.tl-item.st-deferred .tl-icon { background: var(--info-soft); color: var(--info); }
.tl-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.tl-detail > div { overflow: hidden; }
.tl-item.open .tl-detail { grid-template-rows: 1fr; }
.tl-detail-inner { padding: 0.2rem 1.35rem 1rem calc(1.35rem + 28px + 0.85rem); display: flex; flex-direction: column; gap: 0.5rem; }
.note { font-size: 0.8rem; color: var(--text-2); padding-left: 0.85rem; position: relative; }
.note::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.error-line { font-size: 0.8rem; color: var(--fail); background: var(--fail-soft); border-radius: 8px; padding: 0.5rem 0.7rem; }

/* Findings */
.sev-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; padding: 1rem 1.1rem 0.4rem; }
.sev-tile {
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface-2); padding: 0.55rem 0.3rem; text-align: center; cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.sev-tile:active { transform: scale(0.96); }
.sev-tile b { display: block; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; line-height: 1.2; }
.sev-tile span { font-size: 0.66rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sev-tile.zero { cursor: default; }
.sev-tile.zero:active { transform: none; }
.sev-tile.zero b { color: var(--faint); }
.sev-tile.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.sev-tile.dim { opacity: 0.45; }
.findings { list-style: none; margin: 0; padding: 0.6rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; }
.finding {
  position: relative; border-radius: var(--radius-sm); background: var(--surface-2);
  padding: 0.7rem 0.85rem 0.7rem 1.05rem; cursor: pointer; transition: background-color var(--dur-fast) ease;
}
.finding::before { content: ""; position: absolute; left: 0.4rem; top: 0.7rem; bottom: 0.7rem; width: 3px; border-radius: 2px; background: var(--c); }
.finding:active { background: var(--surface-3); }
.finding-top { display: flex; align-items: flex-start; gap: 0.5rem; }
.finding-title { flex: 1; font-weight: 600; font-size: 0.84rem; line-height: 1.4; }
.sev { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); border-radius: 5px; padding: 0.15rem 0.4rem; flex-shrink: 0; }
.finding-src { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.ver-src { white-space: normal; text-align: left; line-height: 1.35; }
.ver-table { font-size: 0.78rem; margin-top: 0.6rem; }
.ver-table summary { cursor: pointer; color: var(--text-2); }
.ver-table table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; }
.ver-table th, .ver-table td { text-align: left; padding: 0.3rem 0.5rem 0.3rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.ver-table th { color: var(--muted); font-weight: 500; }
.ver-table td:first-child { word-break: break-word; }
.finding-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.finding-more > div { overflow: hidden; }
.finding.open .finding-more { grid-template-rows: 1fr; }
.finding-more p { margin: 0.55rem 0 0; font-size: 0.8rem; color: var(--text-2); word-break: break-word; }
.finding-more p b { color: var(--text); }
.tl-detail .finding { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
[data-sev="critical"] { --c: var(--sev-critical); }
[data-sev="high"] { --c: var(--sev-high); }
[data-sev="medium"] { --c: var(--sev-medium); }
[data-sev="low"] { --c: var(--sev-low); }
[data-sev="info"] { --c: var(--sev-info); }

.empty { padding: 2.25rem 1.25rem; text-align: center; color: var(--muted); font-size: 0.86rem; }
.empty .i { width: 30px; height: 30px; color: var(--faint); margin-bottom: 0.4rem; }

.log { margin: 0; max-height: 380px; overflow: auto; overscroll-behavior: contain; padding: 1rem 1.2rem; font-size: 0.74rem; line-height: 1.65; color: #d1d1d6; background: #121214; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); white-space: pre-wrap; word-break: break-word; }
.log .lv-warn { color: #ffb340; }
.log .lv-error { color: #ff6961; }
.log .ts { color: #636366; }
.log .ck { color: #a5a3ff; }

/* ---------- Tables / lists ---------- */

.toolbar { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .sub { color: var(--muted); font-size: 0.8rem; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .i { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 2.15rem; height: 34px; background: var(--surface-2); border-color: transparent; }
.search .input:focus { background: var(--surface); }
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 0.6rem 1.1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.85rem; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-fast) ease; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:active { background: var(--surface-3); }
.site-cell { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.site-cell b { display: block; font-weight: 600; }
.site-cell small { color: var(--muted); font-size: 0.75rem; }
.favicon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 0.78rem; color: var(--accent); background: var(--accent-soft); flex-shrink: 0; }
.favicon img { width: 20px; height: 20px; object-fit: contain; }
.favicon:has(img) { background: #fff; box-shadow: inset 0 0 0 1px var(--border); }
.by-cell { width: 1%; }
.table td.when { white-space: nowrap; }
.when span { display: block; font-variant-numeric: tabular-nums; }
.when small { color: var(--muted); font-size: 0.72rem; }
.row-actions { text-align: right; white-space: nowrap; }
.select { height: 34px; padding: 0 2rem 0 0.7rem; width: auto; min-width: 0; appearance: none; cursor: pointer; font-size: 0.82rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5-5 5 5M7 14l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 14px; }
.select:disabled { opacity: 0.55; cursor: not-allowed; }
.people-table td { white-space: nowrap; }
.people-table td:first-child { white-space: normal; min-width: 200px; }
.sevbar { display: flex; height: 6px; width: 120px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 1px; }
.sevbar i { display: block; height: 100%; background: var(--c); }
.sevbar-wrap { display: flex; align-items: center; gap: 0.5rem; font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.sevbar { flex-shrink: 0; }

/* Tooltip: a short delay before the first one, then instant while moving
   between neighbours (JS adds .instant). Grows from its trigger. */
.tip {
  position: fixed; z-index: 1000; pointer-events: none; top: 0; left: 0;
  padding: 0.3rem 0.6rem; border-radius: 7px; max-width: 320px;
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--surface);
  font-size: 0.75rem; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  opacity: 0; transform: scale(0.97); transform-origin: var(--tip-origin, bottom center);
  transition: opacity 125ms var(--ease-out), transform 125ms var(--ease-out);
}
.tip.show { opacity: 1; transform: none; }
.tip.instant { transition-duration: 0ms; }

.woo-retry-head { display: flex; gap: 0.7rem; align-items: flex-start; }
.woo-retry-head > .i { color: var(--warn); flex-shrink: 0; margin-top: 2px; }
.banner > .spin-i { animation: spin 0.8s linear infinite; }

/* Segmented control */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); margin-bottom: 1.1rem; }
.tab { border: 0; background: transparent; padding: 0.38rem 0.95rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.84rem; color: var(--text-2); transition: background-color var(--dur) ease, color var(--dur) ease, box-shadow var(--dur) ease; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }

.placeholders { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0.9rem; }
.ph-chip { border: 1px dashed var(--border-strong); background: var(--surface-2); border-radius: 8px; padding: 0.3rem 0.55rem; font-family: var(--mono); font-size: 0.74rem; color: var(--accent); cursor: pointer; transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out); }
.ph-chip:active { transform: scale(0.97); }

.skeleton { border-radius: 8px; background: var(--surface-3); animation: breathe 1.4s ease-in-out infinite alternate; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.setting-row > div { min-width: 0; }
.setting-row .option-title, .setting-row .option-text { display: block; }
.setting-row .select { flex-shrink: 0; min-width: 130px; }
@media (max-width: 600px) { .setting-row { flex-direction: column; align-items: flex-start; } }
#blockedBanner:empty, #wpscanBanner:empty, #wooRetry:empty { display: none; }

/* ---------- Login ---------- */

.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); overflow: hidden; padding: 1rem; }
.login-card {
  position: relative; z-index: 1; width: min(400px, 100%); text-align: center; padding: 2.5rem 2rem 2rem; border-radius: 24px;
  background: var(--material); border: 1px solid var(--material-edge); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  animation: materialize 400ms var(--ease-out) both;
}
.login-card .brand-mark { margin: 0 auto; }
.login-card h1 { margin: 1.1rem 0 0.35rem; font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -0.024em; line-height: 1.15; }
.login-card .login-sub { margin: 0 0 0.9rem; font-weight: 600; color: var(--text-2); }
.login-card p { margin: 0 0 1.6rem; color: var(--muted); }
.btn-ms { height: 46px; width: 100%; font-size: 0.92rem; }
.ms-logo { display: grid; grid-template-columns: repeat(2, 8px); gap: 2px; }
.ms-logo i { width: 8px; height: 8px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }

/* ---------- Dialog & toasts ---------- */

/* Modal: centred, so it scales from the centre. Exit is quicker than entry
   and runs because overlay/display are transitioned discretely. */
.dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100% - 2rem));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  opacity: 1; transform: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), overlay var(--dur) allow-discrete, display var(--dur) allow-discrete;
}
.dialog:not([open]) { opacity: 0; transform: scale(0.96); transition-duration: var(--dur-fast); }
@starting-style { .dialog[open] { opacity: 0; transform: scale(0.96); } }
.dialog::backdrop { background: rgba(0, 0, 0, 0); transition: background-color var(--dur) ease, overlay var(--dur) allow-discrete, display var(--dur) allow-discrete; }
.dialog[open]::backdrop { background: rgba(0, 0, 0, 0.35); }
@starting-style { .dialog[open]::backdrop { background: rgba(0, 0, 0, 0); } }
.dialog-body { padding: 1.4rem 1.4rem 1rem; }
.dialog-body h3 { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.015em; }
.dialog-body p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.9rem 1.4rem 1.2rem; }

/* Toasts rise from the bottom and leave the way they came. Transitions,
   not keyframes, so a toast dismissed mid-entry reverses smoothly. */
.toasts { position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; cursor: default;
  display: flex; align-items: center; gap: 0.6rem; max-width: 420px; padding: 0.7rem 1rem; border-radius: 14px;
  background: color-mix(in srgb, var(--text) 90%, transparent); color: var(--bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  font-size: 0.85rem; font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
  opacity: 1; transform: none;
  transition: opacity 350ms ease, transform 350ms ease;
}
@starting-style { .toast { opacity: 0; transform: translateY(100%); } }
.toast.out { opacity: 0; transform: translateY(100%); transition-duration: 250ms; }
.toast .i { flex-shrink: 0; }
.toast.ok .i { color: var(--ok); }
.toast.err .i { color: var(--fail); }

/* Theme switch: a quick crossfade instead of a hard brightness jump. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 250ms; animation-timing-function: ease; }

/* ---------- Pointer hover (mouse/trackpad only — touch would stick) ---------- */

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .brand:hover, .nav-item:hover, .btn:hover, .back:hover, .icon-btn:hover, .sev-tile:hover { text-decoration: none; }
  .nav-item:hover { background: var(--surface-3); color: var(--text); }
  .nav-item.active:hover { background: var(--accent-soft); color: var(--accent); }
  .icon-btn:hover { background: var(--surface-3); color: var(--text); }
  .btn:hover { background: var(--surface-2); }
  .btn-primary:hover { background: var(--accent-fill-hover); }
  .btn-primary:hover .i:last-child:not(:first-child) { transform: translateX(2px); }
  .btn-ghost:hover { background: var(--surface-3); }
  .btn-danger:hover { background: color-mix(in srgb, var(--fail) 16%, transparent); }
  .btn:disabled:hover { background: var(--surface); }
  .btn-primary:disabled:hover { background: var(--accent-fill); }
  .back:hover .i { transform: translateX(-2px); }
  .chip:hover { border-color: var(--faint); }
  .chip:has(input:checked):hover { border-color: transparent; background: color-mix(in srgb, var(--accent) 15%, transparent); }
  .tl-item.expandable .tl-row:hover { background: var(--surface-2); }
  .sev-tile:not(.zero):hover { border-color: var(--border-strong); }
  .sev-tile.active:hover { border-color: var(--c); }
  .finding:hover { background: var(--surface-3); }
  .tl-detail .finding:hover { background: var(--surface); }
  .table tbody tr.clickable:hover { background: var(--surface-2); }
  .avatar[data-tip]:hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-ring); }
  .tab:not(.active):hover { color: var(--text); }
  .ph-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
  .disclosure:hover { opacity: 0.8; }
}

/* ---------- Keyframes ---------- */


@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes materialize { from { opacity: 0; transform: scale(0.97); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { from { transform: scale(1); opacity: 0.55; } to { transform: scale(2.6); opacity: 0; } }
@keyframes land { from { transform: scale(0.85); opacity: 0.5; } }
@keyframes scan { 0% { transform: scaleX(0); opacity: 1; } 80% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes breathe { from { opacity: 1; } to { opacity: 0.5; } }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Phone/tablet: a translucent top bar for identity and a bottom tab bar for
   the main destinations, both padded out of the notch and home indicator.
   The material sits on ::before so .sidebar never becomes the containing
   block of the fixed tab bar inside it. */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 0.5rem;
    padding: calc(0.55rem + env(safe-area-inset-top, 0px)) max(0.9rem, env(safe-area-inset-right, 0px)) 0.55rem max(0.9rem, env(safe-area-inset-left, 0px));
    background: none; border-right: 0;
  }
  .sidebar::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: var(--material); box-shadow: 0 1px 0 var(--material-edge);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
  .brand { padding: 0; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark svg { width: 16px; height: 16px; }
  .brand-name { font-size: 0.86rem; }
  .brand-sub, .nav-section, .me-text { display: none; }

  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 0.3rem max(0.5rem, env(safe-area-inset-right, 0px)) calc(0.3rem + env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-left, 0px));
    background: var(--material); box-shadow: 0 -1px 0 var(--material-edge);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
  .nav-item {
    flex: 1 1 0; max-width: 120px; min-width: 0;
    flex-direction: column; gap: 0.15rem; padding: 0.35rem 0.25rem;
    font-size: 0.66rem; font-weight: 500; color: var(--muted); border-radius: 10px;
    transition: color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
  }
  .nav-item > span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-item .i { width: 23px; height: 23px; }
  .nav-item:active { background: none; transform: scale(0.94); }
  .nav-item.active { background: none; color: var(--accent); font-weight: 600; }

  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; gap: 0.25rem; }
  .me { flex: none; }
  .view { padding-top: 1.25rem; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .toasts { left: 1rem; right: 1rem; align-items: center; bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)); }

  .sticky-head { position: static; margin: 0 0 1.25rem; padding: 0; }
  .sticky-head::before { display: none; }
  .page-head h1 { font-size: 1.6rem; }
  .tl-row { flex-wrap: wrap; row-gap: 0.35rem; padding: 0.7rem 1rem; }
  .tl-meta { order: 3; width: 100%; padding-left: calc(28px + 0.85rem); flex-wrap: wrap; }
  .tl-detail-inner { padding-left: 1rem; padding-right: 1rem; }
  .tl-item + .tl-item::before { left: calc(1rem + 13px); }
  .card-head { padding: 0.85rem 1rem; }
  .card-head .sub { display: none; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
  .stat { padding: 0.6rem 0.7rem; }
  .progress-card { flex-direction: column; align-items: stretch; gap: 1rem; }
  .ring { align-self: center; width: 92px; height: 92px; }
  .ring-label b { font-size: 1.25rem; }
  .sev-tiles { padding-inline: 1rem; gap: 0.3rem; }
  .findings { padding-inline: 1rem; }
}

/* Scan lists become a stacked list on phones instead of a sideways-
   scrolling table: site and status, then who/when and the row actions. */
@media (max-width: 640px) {
  .scan-table thead { display: none; }
  .scan-table, .scan-table tbody { display: block; }
  .scan-table tr {
    display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center;
    column-gap: 0.6rem; row-gap: 0.45rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
  }
  .scan-table tr:last-child { border-bottom: 0; }
  .scan-table td { padding: 0; border: 0; }
  .scan-table .td-site { grid-column: 1 / 3; grid-row: 1; }
  .scan-table .td-status { grid-column: 3; grid-row: 1; justify-self: end; }
  .scan-table .td-by { grid-column: 1; grid-row: 2; width: auto; }
  .scan-table .td-when { grid-column: 2; grid-row: 2; display: flex; gap: 0.4rem; align-items: baseline; min-width: 0; overflow: hidden; }
  .scan-table .td-when span { display: inline; font-size: 0.8rem; }
  .scan-table .td-when small::before { content: "· "; }
  .scan-table .td-actions { grid-column: 3; grid-row: 2; justify-self: end; }
  .scan-table .td-findings { grid-column: 2 / 4; grid-row: 3; }
  .scan-table .td-findings:has(.muted) { display: none; }
  .search { max-width: none; }
}

/* iOS zooms into any focused field under 16px. */
@media (pointer: coarse) {
  .input, .textarea, .select, .url-bar input { font-size: 16px; }
  .btn-sm { height: 34px; }
}

/* ---------- Accessibility preferences ---------- */

/* Reduced motion: fewer, gentler animations — cross-fades stay, anything
   that moves, scales or slides is dropped. Spinners stay: they're status. */
@media (prefers-reduced-motion: reduce) {
  .anim-in, .login-card { animation-name: fade; }
  .tl-icon.pop, .skeleton, .pill .dot::after, .progress-card .scanline { animation: none; }
  .progress-card .scanline { display: none; }
  .btn:active, .chip:active, .sev-tile:active, .icon-btn:active, .ph-chip:active, .nav-item:active { transform: none; }
  .switch input:active + .switch-track::before { transform: none; }
  .switch input:checked:active + .switch-track::before { transform: translateX(16px); }
  .dialog, .dialog:not([open]), .tip { transform: none; }
  @starting-style { .dialog[open] { transform: none; } }
  .toast, .toast.out { transform: none; }
  @starting-style { .toast { transform: none; } }
  .collapse, .tl-detail, .finding-more, .tl-chev, .disclosure .i { transition-duration: 0ms; }
  .btn-primary:hover .i:last-child:not(:first-child), .back:hover .i { transform: none; }
}

/* Reduced transparency: frosted chrome becomes solid. */
@media (prefers-reduced-transparency: reduce) {
  .sticky-head::before, .sidebar::before, .nav, .login-card, .toast {
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .sticky-head::before, .sidebar::before, .nav, .login-card { background: var(--surface); }
  .toast { background: var(--text); }
}

/* Higher contrast: firmer separators and text. */
@media (prefers-contrast: more) {
  /* Same specificity as the dark-theme blocks above, and later, so it wins in both themes. */
  :root:not([data-theme="none"]), :root[data-theme] { --border: var(--border-strong); --muted: var(--text-2); --material-edge: var(--border-strong); }
  .card, .btn, .chip, .sev-tile, .finding { border: 1px solid var(--border-strong); }
}

/* ---------- Report editor (#/report/<id>) ---------- */

.page:has(.re-split) { max-width: none; }
.re-head { margin-bottom: 1rem; }
#reBanner { display: grid; gap: 0.6rem; margin-bottom: 0.9rem; }
#reBanner:empty { display: none; }
#reBanner ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.re-banner-err { background: var(--fail-soft); }
.re-banner-err > .i { color: var(--fail); }
/* Two halves: the markdown on the left, the rendered report on the right. */
.re-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; height: calc(100dvh - 13.5rem); min-height: 520px; }
.re-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.re-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.re-bar .tabs { margin: 0; }
.re-bar .tab { padding: 0.32rem 0.75rem; }
.re-bar-actions { display: flex; align-items: center; gap: 0.35rem; }
.re-bar-title { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.86rem; }
.re-dirty { font-style: normal; color: var(--accent); margin-left: 0.25rem; }
.re-hint { margin: 0; padding: 0.45rem 0.85rem; border-bottom: 1px solid var(--border); }
.re-text { flex: 1; min-height: 0; resize: none; border: 0; border-radius: 0; padding: 0.85rem 1rem; tab-size: 2; white-space: pre; overflow: auto; }
.re-text:focus { box-shadow: none; }
.re-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.re-issues { max-height: 40%; overflow: auto; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; background: var(--surface-2); }
.re-issue-group + .re-issue-group { margin-top: 0.6rem; }
.re-issue-group ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.re-issue-group li { margin: 0.15rem 0; word-break: break-word; }
.re-issue-group.err b { color: var(--fail); }
.re-issue-group.warn b { color: var(--warn); }
#reIssuesBtn.re-has-errors { color: var(--fail); }
#reUploadLbl { cursor: pointer; }
@media (max-width: 960px) {
  .re-split { grid-template-columns: minmax(0, 1fr); height: auto; }
  .re-pane { height: 75dvh; }
}
#reState .pill { text-transform: none; }

/* Report editor: shared links */
#reLinks:empty { display: none; }
.re-links { margin-bottom: 0.9rem; }
.re-link-list { list-style: none; margin: 0; padding: 0 1.1rem 0.6rem; }
.re-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.re-link:first-child { border-top: 0; }
.re-link .pill { text-transform: none; flex-shrink: 0; }
.re-link-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; font-size: 0.84rem; }
.re-link-main a, .re-link-main > span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.re-link-main .muted { font-size: 0.76rem; }
.re-link.deleted .re-link-main > span:first-child, .re-link.expired .re-link-main > span:first-child { color: var(--muted); text-decoration: line-through; }
.re-link-err { font-size: 0.76rem; color: var(--fail); }
.re-link-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.re-banner-warn { background: var(--warn-soft); }
.re-banner-warn > .i { color: var(--warn); }
.re-check { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; font-weight: 600; font-size: 0.86rem; }
@media (max-width: 640px) { .re-link { flex-wrap: wrap; } .re-link-actions { width: 100%; justify-content: flex-end; } }

/* A scan row's own link: the keyboard (and "open in new tab") way into a scan. */
.row-link { color: inherit; text-decoration: none; }
.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.tech-detail { font-size: 0.76rem; color: var(--muted); margin-top: 0.3rem; }
.tech-detail summary { cursor: pointer; }
.tech-detail > div { margin-top: 0.3rem; word-break: break-word; }
label.btn.disabled { opacity: 0.5; pointer-events: none; }
