/* AA Hub - single hand-written stylesheet. Light and dark via prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1b1f27;
  --muted: #5b6472;
  --link: #1864ab;
  --accent: #1c7ed6;
  --accent-ink: #ffffff;
  --red: #c92a2a;
  --orange: #e8590c;
  --blue: #1c7ed6;
  --green: #2f9e44;
  --red-bg: #fdecec;
  --orange-bg: #fff0e6;
  --blue-bg: #e7f1fb;
  --green-bg: #e8f5ec;
  --code-bg: #eef0f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --surface: #181c23;
    --surface-2: #1f242d;
    --border: #2d333e;
    --text: #e6e9ee;
    --muted: #9aa3b0;
    --link: #74b0ee;
    --red: #ff6b6b;
    --orange: #ff922b;
    --blue: #4dabf7;
    --green: #51cf66;
    --red-bg: #3a1a1c;
    --orange-bg: #3b2414;
    --blue-bg: #16293d;
    --green-bg: #17301f;
    --code-bg: #232933;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color: var(--text); scrollbar-gutter: stable; }
/* Smooth same-origin page changes in Chromium: the old page stays until the new one is painted. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }
.topbar { view-transition-name: topbar; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; margin: 0 0 .25rem; }
p { margin: 0 0 .6rem; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; word-break: break-word; }
code.block { display: block; padding: .5rem .7rem; margin-top: .3rem; white-space: pre-wrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* layout */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand-lg { font-size: 1.5rem; margin-bottom: .5rem; }
.brand-mark { width: 1.1em; height: 1.1em; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--green)); display: inline-block; }
.topbar nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: .4rem .75rem; border-radius: 8px; font-weight: 500; }
.topbar nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.logout { margin: 0; }
.page { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page-head { margin-bottom: 1rem; }
.lead { color: var(--muted); margin: 0; }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.section-title { display: flex; align-items: center; gap: .5rem; margin: 1.5rem 0 .6rem; font-size: 1.1rem; }
.count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; font-size: .78rem; padding: 0 .55rem; color: var(--muted); font-weight: 600; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.15rem; margin-bottom: 1rem; }
.card.empty { text-align: center; color: var(--muted); padding: 1.75rem 1rem; }
.card.empty p { margin: 0; }
.login { max-width: 380px; margin: 12vh auto 0; }
.stack { display: flex; flex-direction: column; gap: .6rem; }

/* alerts */
.alert { border-radius: 8px; padding: .65rem .85rem; margin: 0 0 .8rem; border: 1px solid transparent; border-left-width: 4px; }
.alert-error { background: var(--red-bg); border-color: var(--red); }
.alert-warn { background: var(--orange-bg); border-color: var(--orange); }
.alert-info { background: var(--blue-bg); border-color: var(--blue); }
.alert-ok { background: var(--green-bg); border-color: var(--green); }
/* toasts: #flash is a fixed stack in the corner (app.js arms its messages: close button, success ones fade out) */
#flash { position: fixed; z-index: 40; right: 1rem; bottom: 1rem; width: min(30rem, calc(100vw - 2rem)); display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
#flash:empty { display: none; }
#flash > * { pointer-events: auto; margin: 0; position: relative; padding-right: 2.4rem; max-height: 45vh; overflow: auto; overflow-wrap: anywhere; background-color: var(--surface); background-image: linear-gradient(var(--green-bg), var(--green-bg)); box-shadow: 0 8px 28px rgba(0, 0, 0, .22); animation: toast-in .16s ease-out; }
#flash > .alert-error { background-image: linear-gradient(var(--red-bg), var(--red-bg)); }
#flash > * p { margin: 0 0 .2rem; }
.toast-close { position: absolute; top: .25rem; right: .3rem; width: 1.9rem; height: 1.9rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
@keyframes toast-in { from { transform: translateY(.5rem); opacity: 0; } }

/* badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .55rem; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; vertical-align: middle; }
.badge .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.st-blocked, .st-rollout_failed { color: var(--red); background: var(--red-bg); }
.st-decision_needed { color: var(--orange); background: var(--orange-bg); }
.st-applying { color: var(--blue); background: var(--blue-bg); }
.st-resolved { color: var(--green); background: var(--green-bg); }
.mode-enforce { color: var(--green); background: var(--green-bg); }
.mode-complain { color: var(--orange); background: var(--orange-bg); }
.mode-off { color: var(--muted); background: var(--surface-2); }
.kind-denied { color: var(--red); background: var(--red-bg); }
.kind-allowed { color: var(--blue); background: var(--blue-bg); }
.ro-pending { color: var(--blue); background: var(--blue-bg); }
.ro-waiting { color: var(--blue); background: var(--blue-bg); }
.xr-action { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.xr-status { margin: .5rem 0 0; }
.ro-applied { color: var(--green); background: var(--green-bg); }
.ro-failed { color: var(--red); background: var(--red-bg); }
.ro-rolled_back { color: var(--muted); background: var(--surface-2); }
.badge.cls, .badge.src { color: var(--muted); background: var(--surface-2); text-transform: none; letter-spacing: 0; font-weight: 600; }

/* lists / rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto auto; gap: .75rem 1.25rem; align-items: center; }
.rows .row.card { border-left: 4px solid var(--border); }
.st-edge-blocked, .st-edge-rollout_failed { border-left-color: var(--red) !important; }
.st-edge-decision_needed { border-left-color: var(--orange) !important; }
.st-edge-applying { border-left-color: var(--blue) !important; }
.row-title { font-weight: 650; font-size: 1.02rem; color: var(--text); }
a.row-title { text-decoration: none; color: var(--link); }
a.row-title:hover { text-decoration: underline; }
.hosts-line { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .1rem .5rem; font-size: .85rem; }
.counts { display: flex; gap: 1rem; margin: 0; }
.counts div { text-align: center; min-width: 3.2rem; }
.counts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.counts dd { margin: 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.counts .hot dd { color: var(--red); }
.resolved summary { cursor: pointer; font-weight: 600; }
.rows.compact { margin-top: .6rem; }
.rows.compact .row { padding: .5rem 0; border-top: 1px solid var(--border); }
.plain { margin: 0 0 .5rem; padding-left: 0; list-style: none; display: grid; gap: .4rem; }
.host-modes { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; }
.mode-box { margin-top: .5rem; }
.mode-box summary { cursor: pointer; color: var(--link); font-weight: 600; }
.mode-box form { margin-top: .75rem; max-width: 460px; }

/* help panel */
.help-panel { padding: 0; }
.help-panel summary { cursor: pointer; padding: .8rem 1.15rem; font-weight: 600; list-style-position: inside; }
.help-panel[open] summary { border-bottom: 1px solid var(--border); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.5rem; padding: 1rem 1.15rem 1.1rem; }
.help-grid p, .help-grid ul { margin: 0; color: var(--muted); font-size: .92rem; }
.help-grid ul { padding-left: 1.1rem; }
.help-grid li { margin-bottom: .2rem; }
.help { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: .72rem; font-weight: 700; cursor: help; position: relative; vertical-align: middle; margin-left: .2rem; }
.help:hover::after, .help:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; background: var(--text); color: var(--bg); padding: .5rem .65rem; border-radius: 8px; font-weight: 400; font-size: .82rem; line-height: 1.35; z-index: 20; text-align: left; box-shadow: var(--shadow); }

/* onboarding */
.onboarding h2 { font-size: 1.25rem; }
.checklist { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.checklist li { display: flex; gap: .9rem; align-items: flex-start; }
.checklist p { margin: .1rem 0 0; color: var(--muted); }
.check { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--accent); color: var(--accent); }
.checklist .done .check { background: var(--green); border-color: var(--green); color: #fff; }

/* findings */
.group { padding: .6rem 1rem; }
.group-head { display: flex; justify-content: space-between; gap: .4rem 1.5rem; flex-wrap: wrap; align-items: center; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.group-head .path { font-size: .95rem; }
.group-title { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; min-width: 0; flex: 1 1 18rem; overflow-wrap: anywhere; }
.group-title .net-head { margin: 0; }
/* file bundles of a long list (_bundles.html): one collapsed section on top */
.bundles > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; }
.bundles[open] > summary { margin-bottom: .4rem; }
.bundles-intro { font-size: .9rem; }
.bundle-path { font-size: .9rem; overflow-wrap: anywhere; flex: 1 1 100%; background: transparent; padding: 0; font-weight: 600; }
.bundle-rows .finding-row:last-child { border-bottom: 0; }
.per-host { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .85rem; }
.finding { padding: .55rem 0; border-bottom: 1px solid var(--border); }
.finding:last-child { border-bottom: 0; padding-bottom: .1rem; }
.finding.decided { background: var(--green-bg); border-radius: 8px; padding: .6rem 1rem; margin-top: .4rem; border-bottom: 0; }
.finding.decided p { margin: 0 0 .2rem; }
.finding-meta { display: flex; flex-wrap: wrap; gap: .15rem .9rem; align-items: center; margin-bottom: .35rem; font-size: .9rem; }
.finding-row .finding-meta { margin-bottom: 0; }
.findings-more { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.ellip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: .4rem; font-size: .92rem; }
.ladder { display: grid; gap: .3rem; margin-bottom: .4rem; }
.cand { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: .3rem .7rem; cursor: pointer; background: var(--surface); font-weight: 400; }
.cand:hover { border-color: var(--accent); }
.cand:has(input:checked) { border-color: var(--accent); background: var(--blue-bg); }
.cand input { margin-top: .25rem; accent-color: var(--accent); }
.cand-body { display: grid; min-width: 0; flex: 1; }
.cand-top { display: flex; gap: .2rem .5rem; align-items: center; flex-wrap: wrap; }
.cand-top code { background: transparent; padding: 0; font-size: .88rem; font-weight: 600; }
.cand-expl { display: none; color: var(--muted); font-size: .85rem; }
.cand input:checked ~ .cand-body .cand-expl { display: block; }
.badge.src, .badge.rec { font-size: .66rem; padding: .05rem .45rem; }
.badge.rec { color: var(--green); background: var(--green-bg); }
.more { display: flex; flex-wrap: wrap; gap: .1rem 1.25rem; }
.opt { flex: 0 1 auto; }
.opt[open] { flex: 1 1 100%; }
.opt summary { cursor: pointer; color: var(--link); font-size: .86rem; font-weight: 600; padding: .1rem 0; }
.cand-list { display: grid; gap: .3rem; margin: .25rem 0; }
.cand.blocked { cursor: not-allowed; opacity: .75; background: var(--surface-2); border-style: dashed; }
.cand.blocked:hover { border-color: var(--border); }
.cand-reason { color: var(--red); font-size: .82rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.toolbar .targets { display: flex; flex-wrap: wrap; gap: .1rem .8rem; align-items: center; font-size: .9rem; flex: 1 1 auto; }
.check-row { display: flex; gap: .4rem; align-items: center; padding: .1rem 0; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.actions .btn { min-height: 2.2rem; padding: .3rem .85rem; }

/* forms / buttons */
label { font-weight: 600; font-size: .92rem; }
input[type="text"], input[type="password"], input:not([type]) { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; min-height: 2.5rem; }
input[type="text"]:focus, input[type="password"]:focus, input:not([type]):focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.inline-form { display: flex; gap: .75rem 1rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { min-width: 180px; }
.inline-form label { display: block; margin-bottom: .25rem; }
.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .5rem 1rem; min-height: 2.5rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #1971c2; border-color: #1971c2; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-warn { color: var(--orange); border-color: var(--orange); }
.btn-warn:hover { background: var(--orange-bg); border-color: var(--orange); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.htmx-request.btn, .htmx-request .btn { opacity: .6; }

/* hosts */
.host { grid-template-columns: 1fr; gap: .5rem; align-items: start; }
.host-head { display: flex; gap: .6rem 1rem; align-items: center; flex-wrap: wrap; }
.facts { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; margin: 0; }
.facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: 0; }
.profiles { list-style: none; margin: .25rem 0; padding: 0; display: grid; gap: .35rem; }
.profiles li { display: flex; gap: .4rem .75rem; align-items: center; flex-wrap: wrap; }
.suggest { color: var(--green); font-weight: 600; font-size: .88rem; }
.host-actions { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .4rem; }
.token-box { background: var(--green-bg); border: 1px solid var(--green); border-radius: 10px; padding: .9rem 1rem; margin-top: 1rem; }
.oneliner { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; margin: .5rem 0; }
.upd-current { color: var(--muted); background: var(--surface-2); }
.upd-update_available { color: var(--blue); background: var(--blue-bg); }
.upd-helper_update_required { color: var(--orange); background: var(--orange-bg); }
.upd-unknown { color: var(--muted); background: var(--surface-2); border-style: dashed; }
.update-box { background: var(--orange-bg); border: 1px solid var(--orange); border-left-width: 4px; border-radius: 8px; padding: .6rem .85rem; }
.update-box p { margin: .2rem 0; }
.update-note { margin: 0; font-size: .9rem; }
.profile-summary { margin: .1rem 0 0; font-weight: 600; font-size: .92rem; }
.inactive { border: 1px dashed var(--border); border-radius: 8px; padding: .45rem .75rem; }
.isolation-box p { margin: .2rem 0; font-size: .9rem; }
.isolation-box.isolation-on { background: var(--orange-bg); border: 1px solid var(--orange); border-left-width: 4px; border-radius: 8px; padding: .6rem .85rem; }
.isolate-form summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.egress-list { list-style: none; padding: 0; margin: .3rem 0; }
.egress-item { border: 1px solid var(--border); border-radius: 8px; padding: .45rem .75rem; margin: .35rem 0; }
.egress-item.egress-on { background: var(--orange-bg); border-color: var(--orange); border-left-width: 4px; }
.egress-item p { margin: .15rem 0; font-size: .9rem; }
.egress-form summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.egress-form textarea { display: block; margin-top: .25rem; width: 100%; max-width: 480px; font-family: var(--mono); font-size: .85rem; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; }
.egress-form fieldset.ttl { border: 0; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.egress-host { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; margin: .25rem 0; }
.egress-hint { margin: .3rem 0; font-size: .88rem; }
.isolate-form textarea { display: block; margin-top: .25rem; width: 100%; max-width: 420px; font-family: var(--mono); font-size: .85rem; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; }
.isolate-form fieldset.ttl { border: 0; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.isolate-form fieldset.ttl legend { font-size: .9rem; padding: 0; }
.inactive summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.inactive[open] summary { margin-bottom: .4rem; }
.inactive p { margin: 0 0 .5rem; font-size: .88rem; }
input.inactive-filter { width: 100%; max-width: 320px; font: inherit; font-size: .9rem; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; margin-bottom: .5rem; }
input.inactive-filter:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.inactive-list { list-style: none; margin: 0 0 .25rem; padding: 0; columns: 12rem auto; column-gap: 1.5rem; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.inactive-list li { break-inside: avoid; overflow-wrap: anywhere; padding: .05rem 0; }
.inactive-list li[hidden], .inactive-none[hidden] { display: none; }
.nav-count { display: inline-block; margin-left: .35rem; min-width: 1.25rem; padding: 0 .35rem; border-radius: 99px; background: var(--orange); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.25rem; text-align: center; vertical-align: 1px; }
.nav-count[hidden] { display: none; }
.oneliner code { flex: 1 1 320px; background: var(--surface); border: 1px solid var(--border); padding: .6rem .75rem; font-size: .88rem; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .65rem .85rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .detail { background: transparent; padding: 0; color: var(--muted); }
.error-explain { margin: .4rem 0 .2rem; color: var(--red); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .35rem .85rem; border-radius: 99px; border: 1px solid var(--border); text-decoration: none; color: var(--muted); background: var(--surface); font-weight: 600; font-size: .88rem; }
.tabs a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* header: open-findings badge + live indicator */
.live-wrap { display: flex; align-items: center; gap: .6rem; }
.open-badge { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; color: var(--muted); font-size: .85rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.open-badge:hover { color: var(--text); border-color: var(--muted); }
.open-count { min-width: 1.35rem; text-align: center; padding: 0 .35rem; border-radius: 99px; background: var(--orange); color: #fff; font-variant-numeric: tabular-nums; }
.open-count.zero { background: var(--green); }
.live { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.live-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.live[data-state="reconnecting"] { color: var(--orange); }
.live[data-state="paused"] .live-dot { background: var(--muted); box-shadow: 0 0 0 3px var(--surface-2); }
.live[data-state="reconnecting"] .live-dot { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-bg); animation: live-pulse 1.2s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }

/* confirmation dialog (never rendered until opened, whatever the UA stylesheet says) */
dialog:not([open]) { display: none !important; }
.confirm-dialog { width: min(48rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.confirm-dialog::backdrop { background: rgba(10, 14, 20, .55); }
.confirm-form { margin: 0; padding: 1.25rem 1.35rem 1.1rem; }
.confirm-form h2 { font-size: 1.15rem; margin-bottom: .6rem; }
.confirm-body { overflow-wrap: anywhere; }
.confirm-body p { margin: 0 0 .6rem; overflow-wrap: anywhere; }
.confirm-body code { font-size: .9em; }
.confirm-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.confirm-actions .btn { min-width: 7rem; }
.confirm-actions .btn-danger { background: #c92a2a; border-color: #c92a2a; color: #fff; }
.confirm-actions .btn-danger:hover { background: #b02525; border-color: #b02525; }

/* protect page */
.nav-count { display: inline-block; min-width: 1.2rem; text-align: center; margin-left: .15rem; padding: 0 .3rem; border-radius: 99px; background: var(--orange); color: #fff; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-count.zero { display: none; }
.protect-intro .plain-steps { margin: .25rem 0 .75rem; padding-left: 1.25rem; display: grid; gap: .3rem; }
.protect-host { margin-bottom: 1.25rem; }
.protect-host .host-head h2 { margin: 0; font-size: 1.15rem; }
.protect-host .host-refresh { margin-left: auto; }
.page-refresh { float: right; margin-left: 1rem; }
.sub-title { font-size: .95rem; margin: 1rem 0 .5rem; }
.protect-table code.path { overflow-wrap: anywhere; }
.protect-table .ellip { max-width: 28rem; }
.protect-action { min-width: 9rem; }
.protect-action p { margin: .35rem 0 0; font-size: .88rem; }
.snippet-row td { background: var(--green-bg); }
.snippet-row p { margin: 0 0 .4rem; }
pre.snippet { flex: 1 1 320px; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem; overflow-x: auto; }
.oneliner pre.snippet code { display: block; flex: none; background: transparent; border: 0; padding: 0; white-space: pre; font-size: .88rem; }
.protected { margin-top: 1rem; }
.protected summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.waiting { margin: .5rem 0 0; }

/* responsive */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .row { grid-template-columns: 1fr; }
  .counts { justify-content: space-between; }
  .topbar-inner { gap: .25rem .5rem; }
  .brand { margin-right: auto; }
  .topbar nav { order: 3; flex: 1 1 100%; }
  .topbar nav a { padding: .3rem .6rem; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; }
  .btn-row .btn { flex: 1; }
  .live-wrap { order: 1; gap: .45rem; }
  .logout { order: 2; }
  .live-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .confirm-dialog { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; border-bottom: 0; }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; min-height: 2.9rem; }
  .protect-table thead { display: none; }
  .protect-table tr { display: block; border-bottom: 1px solid var(--border); padding: .4rem 0; }
  .protect-table td { display: block; border: 0; padding: .2rem .85rem; }
  .protect-table .nowrap { white-space: normal; }
  .protect-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85em; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  #flash > * { animation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Claude's suggestions (MCP) and API tokens */
.suggestion { border: 1px solid var(--blue); border-left-width: 4px; border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0 .7rem; background: var(--blue-bg); }
.suggestion p { margin: .2rem 0; overflow-wrap: anywhere; }
.suggestion-label { font-weight: 600; color: var(--muted); }
.suggestion-actions { display: flex; gap: .5rem; margin-top: .45rem; flex-wrap: wrap; }
.conf-high { border-color: var(--green); color: var(--green); }
.conf-medium { border-color: var(--orange); color: var(--orange); }
.conf-low { color: var(--muted); }
.claude-chip { margin-left: .4rem; }
/* Claude's suggestions on top of a service's findings (_suggestion_groups.html) */
.sugg-section { margin: .4rem 0 1rem; }
.sugg-title { margin: .2rem 0; font-size: 1.05rem; }
.sugg-intro { margin: 0 0 .4rem; }
.sugg-cards { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.sugg-card { margin: 0; min-width: 0; }
.sugg-card .suggestion-head { margin: 0 0 .2rem; font-size: 1rem; overflow-wrap: anywhere; }
.sugg-card details > summary { cursor: pointer; }
.sugg-findings { margin: .3rem 0 0; padding-left: 1.1rem; max-height: 14rem; overflow-y: auto; }
.sugg-findings li { overflow-wrap: anywhere; font-size: .9rem; }
.sugg-hidden-note { margin: .2rem 0 .8rem; color: var(--muted); }
.sugg-result { margin: 0 0 .6rem; }
/* one card per batch of suggestions (DECISIONS 58) */
.sugg-batch { margin: 0 0 .6rem; }
.batch-items { margin: .3rem 0; padding-left: 1.4rem; max-height: 28rem; overflow-y: auto; }
.batch-item { margin: .3rem 0; overflow-wrap: anywhere; font-size: .92rem; }
.batch-item .suggestion-why { font-size: .88rem; }
.batch-individual li { margin: .25rem 0; }
.batch-single { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; }
.batch-single-what { flex: 1 1 20rem; min-width: 0; overflow-wrap: anywhere; }
.batch-single-actions { display: flex; gap: .4rem; flex: 0 0 auto; margin-left: auto; }
.badge.batch-tag { white-space: normal; overflow-wrap: anywhere; text-align: left; max-width: 100%; text-transform: none; letter-spacing: 0; }
.confirm-items { max-height: 18rem; overflow-y: auto; padding-left: 1.2rem; }
.confirm-items li { overflow-wrap: anywhere; margin: .2rem 0; }
.scopes .check-row { align-items: flex-start; margin: .35rem 0; }
.scopes .alert { margin-top: .5rem; }
.token-box .oneliner code { overflow-wrap: anywhere; }
/* OAuth consent page */
.consent { max-width: 560px; margin: 6vh auto 0; }
.consent-facts dt { font-weight: 600; }
.consent-facts dd { margin: 0 0 .6rem; overflow-wrap: anywhere; }
/* MCP page */
#advanced-tokens > summary { cursor: pointer; list-style-position: inside; }
.inline-h { display: inline; font-size: 1.1rem; margin: 0; }
.steps li { margin-bottom: .4rem; }

/* Decided findings (service page) and the /decided page */
.decided-list { margin-top: 1rem; }
.decided-list > summary { cursor: pointer; font-weight: 600; }
.decided-rows { margin: .5rem 0 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.decided-row { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; border-top: 1px solid var(--border); padding-top: .5rem; }
.decided-row .decided-what { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.decided-row .decided-note { flex: 1 1 100%; margin: 0; font-size: .9rem; }
.decided-row form { margin: 0; }

/* Safety warnings (they never block), strict mode, Change decision, Compose info, events without a rule */
.btn-small { min-height: 2rem; padding: .25rem .6rem; font-size: .9rem; }
.btn:disabled { background: var(--surface-2); border-style: dashed; color: var(--muted); }
.badge.sev-info { color: var(--muted); background: var(--surface-2); }
.badge.sev-warn { color: var(--orange); background: var(--orange-bg); }
.badge.sev-danger { color: var(--red); background: var(--red-bg); }
.cand-warnings { display: flex; flex-direction: column; gap: .15rem; margin-top: .25rem; }
.warning { font-size: .86rem; }
.warning.sev-danger { color: var(--red); font-weight: 600; }
.cand.has-danger { border-left: 4px solid var(--red); }
.cand.has-warn { border-left: 4px solid var(--orange); }
.danger-panel { display: none; margin-top: .4rem; padding: .5rem .7rem; border: 2px solid var(--red); border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: .9rem; }
.cand:has(input:checked) .danger-panel { display: block; }
.confirm-warnings { margin: .3rem 0 0; padding-left: 1.2rem; }
.confirm-warnings .sev-danger { color: var(--red); font-weight: 600; }
.no-rule { border: 1px dashed var(--border); border-radius: 8px; padding: .5rem .8rem; }
.no-rule p { margin: 0 0 .3rem; }
.strict-cmd code, .compose-file code { overflow-wrap: anywhere; }
.compose-info { margin-top: .2rem; }
.compose-file { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .2rem; }
.revoke-form { margin-top: .5rem; }
/* Hosts: collapsed "Event pipeline" box (agent_stats) */
.pipeline { border: 1px dashed var(--border); border-radius: 8px; padding: .45rem .75rem; margin-top: .5rem; }
.pipeline summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.pipeline .table { font-size: .88rem; margin: .4rem 0; }
.pipeline-samples code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; margin: .2rem 0; }

/* Network destination headline (finding cards, suggestion cards) */
.net-head { font-weight: 600; margin: .2rem 0; overflow-wrap: anywhere; }
.rule-note { display: block; margin: .15rem 0 0; font-size: .8rem; color: var(--muted, #6b7280); overflow-wrap: anywhere; }
.sugg-dest { font-size: .9rem; margin: .2rem 0; overflow-wrap: anywhere; }
.custom-rule { display: block; margin: .5rem 0; }
.custom-rule input { width: 100%; }
