/* Chainscope — web3 investigation desk workspace. All rules are scoped under .cs-app (the mount's child), never the bare
   .uwapp-chainscope class (it is on <body> too). Sky blue + fuchsia; light and dark themes via [data-theme] on .cs-app. */
.uwapp-root.uwapp-chainscope { background: #f3f6fa; }
.cs-app {
  --cs-accent: #0369a1;
  --cs-accent-hover: #075985;
  --cs-accent-soft: #e0f2fe;
  --cs-accent-text: #075985;
  --cs-on-accent: #ffffff;
  --cs-accent2: #a21caf;
  --cs-bg: #f3f6fa;
  --cs-panel: #ffffff;
  --cs-panel-2: #f6f8fb;
  --cs-ink: #0f1c2e;
  --cs-muted: #4b5a6e;
  --cs-line: #dde4ee;
  --cs-line-2: #c3cedb;
  --cs-control: #6b7a8f;
  --cs-focus: #b45309;
  --cs-crit: #b91c1c; --cs-crit-bg: #fee2e2;
  --cs-high: #c2410c; --cs-high-bg: #ffedd5;
  --cs-med: #a16207;  --cs-med-bg: #fef3c7;
  --cs-low: #1d4ed8;  --cs-low-bg: #dbeafe;
  --cs-info: #475569; --cs-info-bg: #eef2f7;
  --cs-pass: #15803d; --cs-pass-bg: #dcfce7;
  --cs-shadow: 0 10px 30px rgba(15, 28, 46, .16);
  --cs-radius: 12px;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: var(--cs-bg);
  color: var(--cs-ink);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', sans-serif;
}
.cs-app[data-theme='dark'] {
  --cs-accent: #38bdf8;
  --cs-accent-hover: #7dd3fc;
  --cs-accent-soft: #0c2f47;
  --cs-accent-text: #7dd3fc;
  --cs-on-accent: #04192a;
  --cs-accent2: #f0abfc;
  --cs-bg: #0a1220;
  --cs-panel: #111c2e;
  --cs-panel-2: #172437;
  --cs-ink: #e6edf6;
  --cs-muted: #a3b2c6;
  --cs-line: #263650;
  --cs-line-2: #36496a;
  --cs-control: #8497b3;
  --cs-focus: #fbbf24;
  --cs-crit: #fca5a5; --cs-crit-bg: #3b1219;
  --cs-high: #fdba74; --cs-high-bg: #3a1d0c;
  --cs-med: #fcd34d;  --cs-med-bg: #33260a;
  --cs-low: #93c5fd;  --cs-low-bg: #10223f;
  --cs-info: #cbd5e1; --cs-info-bg: #1f2638;
  --cs-pass: #86efac; --cs-pass-bg: #0f2c1b;
  --cs-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
.uwapp-root.uwapp-chainscope:has(.cs-app[data-theme='dark']) { background: #0a1220; }

/* resets against platform element styles (zero specificity on the scope, so .cs-* classes win) */
:where(.cs-app) button, :where(.cs-print-root) button { font: inherit; font-size: inherit; font-weight: inherit; width: auto; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; color: inherit; cursor: pointer; text-align: start; }
:where(.cs-app) button:hover { background: none; }
:where(.cs-app) input, :where(.cs-app) select, :where(.cs-app) textarea { font: inherit; color: inherit; }
:where(.cs-app) h2, :where(.cs-app) h3, :where(.cs-app) h4 { margin: 0; letter-spacing: 0; }
:where(.cs-app) p { margin: 0; }
:where(.cs-app) code, :where(.cs-app) kbd, :where(.cs-app) pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; color: inherit; }
:where(.cs-app) table { border-collapse: collapse; }
:where(.cs-app) th, :where(.cs-app) td { background: none; color: inherit; }
.cs-app [hidden] { display: none !important; }
.cs-app a { color: var(--cs-accent-text); text-underline-offset: 2px; }
.cs-app a:hover { color: var(--cs-accent-hover); }
.cs-app :focus-visible { outline: 3px solid var(--cs-focus); outline-offset: 2px; }
.cs-app .cs-input:focus-visible { outline-offset: 0; }
.cs-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cs-ico { flex: none; }
.cs-muted { color: var(--cs-muted); }
.cs-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------------------------------------------------------------- toolbar */
.cs-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 6px 10px; background: var(--cs-panel); border-bottom: 1px solid var(--cs-line); }
.cs-toolbar-start, .cs-toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.cs-toolbar-start { flex: 1 1 420px; }
.cs-menus { display: flex; flex-wrap: wrap; gap: 2px; }
.cs-menubtn { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 4px 9px; border-radius: 8px; font-weight: 600; }
.cs-menubtn:hover, .cs-menubtn[aria-expanded='true'] { background: var(--cs-accent-soft); color: var(--cs-accent-text); }
.cs-projname { flex: 1 1 200px; max-width: 360px; min-width: 160px; font-weight: 600; }
.cs-chipbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--cs-line-2); border-radius: 999px; color: var(--cs-ink); font-size: 13px; }
.cs-chipbtn:hover { border-color: var(--cs-accent); color: var(--cs-accent-text); }

/* ---------------------------------------------------------------- buttons & inputs */
.cs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--cs-line-2); border-radius: 9px; background: var(--cs-panel); color: var(--cs-ink); font-weight: 600; line-height: 1.2; text-align: center; }
.cs-btn:hover { border-color: var(--cs-accent); color: var(--cs-accent-text); background: var(--cs-panel); }
.cs-btn:disabled, .cs-ibtn:disabled, .cs-btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; }
.cs-btn-primary { background: var(--cs-accent); border-color: var(--cs-accent); color: var(--cs-on-accent); }
.cs-btn-primary:hover { background: var(--cs-accent-hover); border-color: var(--cs-accent-hover); color: var(--cs-on-accent); }
.cs-btn-danger { background: var(--cs-crit); border-color: var(--cs-crit); color: var(--cs-panel); }
.cs-btn-danger:hover { background: var(--cs-crit); color: var(--cs-panel); filter: brightness(1.08); }
.cs-btn-quiet { border-color: transparent; background: transparent; color: var(--cs-accent-text); }
.cs-btn-quiet:hover { background: var(--cs-accent-soft); border-color: transparent; }
.cs-btn-tile { flex-direction: column; justify-content: flex-start; min-height: 74px; padding: 10px; font-weight: 600; font-size: 13px; }
.cs-ibtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--cs-ink); flex: none; }
.cs-ibtn:hover { background: var(--cs-accent-soft); color: var(--cs-accent-text); }
.cs-ibtn[aria-pressed='true'] { background: var(--cs-accent-soft); color: var(--cs-accent-text); }
.cs-linkbtn { color: var(--cs-accent-text); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.cs-input { width: 100%; min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid var(--cs-control); border-radius: 8px; background: var(--cs-panel); color: var(--cs-ink); }
textarea.cs-input { resize: vertical; line-height: 1.4; }
.cs-input[aria-invalid='true'] { border-color: var(--cs-crit); box-shadow: 0 0 0 1px var(--cs-crit); }
.cs-num { max-width: 12rem; }
.cs-input[type='date'] { max-width: 14rem; }
.cs-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cs-row > .cs-field { flex: 1 1 200px; }
.cs-field > label { font-weight: 600; font-size: 13px; }
.cs-field-inline { flex-direction: row; align-items: center; flex: 0 1 auto; gap: 8px; }
.cs-field-inline .cs-input { width: auto; }
.cs-help { color: var(--cs-muted); font-size: 12.5px; }
.cs-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.cs-form > .cs-btn, .cs-card > .cs-btn, .cs-files > .cs-btn { align-self: flex-start; }
.cs-check { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; cursor: pointer; }
.cs-check input { width: 18px; height: 18px; accent-color: var(--cs-accent); flex: none; margin: 0; }
.cs-fieldset { border: 1px solid var(--cs-line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.cs-fieldset legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.cs-fieldset.cs-inline { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.cs-checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 14px; }
.cs-more > summary { cursor: pointer; font-weight: 600; color: var(--cs-accent-text); min-height: 28px; display: flex; align-items: center; }
.cs-more[open] > summary { margin-bottom: 8px; }

/* ---------------------------------------------------------------- body layout */
.cs-body { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); min-height: 0; }
.cs-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 10px; background: var(--cs-panel); border-inline-end: 1px solid var(--cs-line); overflow: hidden; }
.cs-side-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cs-side-head h2 { font-size: 15px; min-width: 0; overflow-wrap: normal; word-break: keep-all; hyphens: auto; }
.cs-side-head { flex-wrap: wrap; }
.cs-addbtn { white-space: nowrap; flex: none; }
.cs-addbtn { background: var(--cs-accent); color: var(--cs-on-accent); padding: 4px 10px; }
.cs-addbtn:hover, .cs-addbtn[aria-expanded='true'] { background: var(--cs-accent-hover); color: var(--cs-on-accent); }
.cs-list { position: relative; overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 8px; }
.cs-listgroup { display: flex; align-items: center; gap: 6px; margin: 12px 4px 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--cs-muted); }
.cs-listgroup:first-child { margin-top: 2px; }
.cs-listitems { list-style: none; margin: 0; padding: 0; }
.cs-listitem { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 5px 8px; border-radius: 8px; }
.cs-listitem:hover { background: var(--cs-panel-2); }
.cs-listitem[aria-current='true'] { background: var(--cs-accent-soft); color: var(--cs-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--cs-accent); }
[dir='rtl'] .cs-listitem[aria-current='true'] { box-shadow: inset -3px 0 0 var(--cs-accent); }
.cs-listname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 2px solid var(--cs-line-2); }
.cs-dot-critical { background: var(--cs-crit); border-color: var(--cs-crit); }
.cs-dot-high { background: var(--cs-high); border-color: var(--cs-high); }
.cs-dot-medium { background: var(--cs-med); border-color: var(--cs-med); }
.cs-dot-low { background: var(--cs-low); border-color: var(--cs-low); }
.cs-dot-info { background: var(--cs-info); border-color: var(--cs-info); }
.cs-dot-pass { background: var(--cs-pass); border-color: var(--cs-pass); }
.cs-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cs-tabrow { display: flex; align-items: center; gap: 8px; padding: 6px 12px 0; border-bottom: 1px solid var(--cs-line); background: var(--cs-bg); }
.cs-listtoggle { display: none; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--cs-line-2); border-radius: 9px; font-weight: 600; flex: none; }
.cs-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.cs-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-bottom: 3px solid transparent; color: var(--cs-muted); font-weight: 600; white-space: nowrap; }
.cs-tab:hover { color: var(--cs-ink); }
.cs-tab:focus-visible { outline-offset: -3px; }
.cs-tab[aria-selected='true'] { color: var(--cs-accent-text); border-bottom-color: var(--cs-accent); }
.cs-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; background: var(--cs-accent-soft); color: var(--cs-ink); font-size: 13px; }
.cs-hint > span { flex: 1 1 280px; }
.cs-panel { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; outline: none; }
.cs-panel:focus-visible { outline: 3px solid var(--cs-focus); outline-offset: -3px; }

/* ---------------------------------------------------------------- cards */
.cs-card { background: var(--cs-panel); border: 1px solid var(--cs-line); border-radius: var(--cs-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cs-card > h2, .cs-cardhead h2 { font-size: 16px; }
.cs-card h3 { font-size: 14px; }
.cs-cardhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.cs-bench-head { display: flex; align-items: center; gap: 12px; }
.cs-kindbadge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--cs-accent-soft); color: var(--cs-accent-text); flex: none; }
.cs-bench-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cs-title-input { font-size: 17px; font-weight: 700; border-color: transparent; padding-inline: 6px; }
.cs-title-input:hover { border-color: var(--cs-line-2); }
.cs-bench-tools { display: flex; gap: 2px; }
.cs-form { display: flex; flex-direction: column; gap: 12px; }

/* actions */
.cs-actionbar { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.cs-action { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cs-where { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--cs-muted); }
.cs-busy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--cs-panel-2); }
.cs-busy progress { width: 160px; accent-color: var(--cs-accent); }
.cs-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--cs-line-2); border-top-color: var(--cs-accent); flex: none; }
.cs-spinner-sm { width: 12px; height: 12px; }
@media (prefers-reduced-motion: no-preference) { .cs-spinner { animation: cs-spin .8s linear infinite; } }
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--cs-crit-bg); color: var(--cs-ink); border: 1px solid var(--cs-crit); }
.cs-error > span { flex: 1 1 260px; }
.cs-error-text { color: var(--cs-crit); }

/* results */
.cs-run { border: 1px solid var(--cs-line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--cs-panel-2); }
.cs-run-failed { border-color: var(--cs-crit); }
.cs-run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.cs-run-head h3 { font-size: 14px; }
.cs-run-summary { font-weight: 600; overflow-wrap: anywhere; }
.cs-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.cs-metrics > div { padding: 6px 10px; border-radius: 8px; background: var(--cs-panel); border: 1px solid var(--cs-line); min-width: 0; max-width: 100%; }
.cs-metrics dt { font-size: 11.5px; color: var(--cs-muted); }
.cs-metrics dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cs-findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cs-finding { display: flex; align-items: flex-start; gap: 10px; }
.cs-finding-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.cs-findings-wide .cs-finding { padding: 8px 10px; border-radius: 9px; background: var(--cs-panel-2); }
.cs-sev { display: inline-flex; align-items: center; gap: 4px; flex: none; min-width: 6.25rem; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.cs-sev-critical { background: var(--cs-crit-bg); color: var(--cs-crit); }
.cs-sev-high { background: var(--cs-high-bg); color: var(--cs-high); }
.cs-sev-medium { background: var(--cs-med-bg); color: var(--cs-med); }
.cs-sev-low { background: var(--cs-low-bg); color: var(--cs-low); }
.cs-sev-info { background: var(--cs-info-bg); color: var(--cs-info); }
.cs-sev-pass { background: var(--cs-pass-bg); color: var(--cs-pass); }
.cs-app:not([data-theme='dark']) .cs-sev-critical { color: #991b1b; }
.cs-app:not([data-theme='dark']) .cs-sev-high { color: #9a3412; }
.cs-app:not([data-theme='dark']) .cs-sev-medium { color: #854d0e; }
.cs-app:not([data-theme='dark']) .cs-sev-pass { color: #166534; }
.cs-pre { margin: 0; padding: 10px; max-height: 320px; overflow: auto; border-radius: 8px; background: var(--cs-panel-2); border: 1px solid var(--cs-line); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.cs-present { display: flex; flex-direction: column; gap: 10px; }
.cs-codeblock { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cs-codeblock .cs-pre { align-self: stretch; }
.cs-callout { padding: 8px 12px; border-radius: 9px; background: var(--cs-info-bg); border-inline-start: 4px solid var(--cs-info); }
.cs-callout-warning { background: var(--cs-med-bg); border-color: var(--cs-med); }
.cs-callout-good { background: var(--cs-pass-bg); border-color: var(--cs-pass); }
.cs-notes { margin: 0; padding-inline-start: 20px; color: var(--cs-muted); }
.cs-figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cs-figure img, .cs-figure svg { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--cs-line); background: #fff; }
.cs-figure figcaption { color: var(--cs-muted); font-size: 12.5px; }
.cs-tablewrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--cs-line); border-radius: 9px; }
.cs-table { width: 100%; font-size: 13px; }
.cs-table th { text-align: start; font-weight: 700; padding: 7px 10px; background: var(--cs-panel-2); border-bottom: 1px solid var(--cs-line); white-space: nowrap; }
.cs-table td { padding: 6px 10px; border-bottom: 1px solid var(--cs-line); vertical-align: top; overflow-wrap: break-word; }
.cs-table tr:last-child td { border-bottom: 0; }
.cs-table code { white-space: nowrap; font-size: 12px; }
.cs-table kbd, .cs-app kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--cs-line-2); border-bottom-width: 2px; border-radius: 6px; font-size: 12px; background: var(--cs-panel-2); }

/* welcome */
.cs-welcome > p { max-width: 70ch; }
.cs-templates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cs-template { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 12px; border: 1px solid var(--cs-line); border-radius: 10px; background: var(--cs-panel-2); }
.cs-template:hover { border-color: var(--cs-accent); }
.cs-template strong { color: var(--cs-accent-text); }
.cs-template span { color: var(--cs-muted); font-size: 13px; }
.cs-addgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cs-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cs-recent li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

/* dashboard */
.cs-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cs-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--cs-line); background: var(--cs-panel-2); }
.cs-kpi[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--cs-accent); }
.cs-kpi-n { font-size: 24px; font-weight: 800; line-height: 1.1; }
.cs-kpi-l { font-size: 12.5px; font-weight: 600; color: var(--cs-muted); }
.cs-kpi-critical .cs-kpi-n { color: var(--cs-crit); }
.cs-kpi-high .cs-kpi-n { color: var(--cs-high); }
.cs-kpi-medium .cs-kpi-n { color: var(--cs-med); }
.cs-kpi-low .cs-kpi-n { color: var(--cs-low); }
.cs-kpi-info .cs-kpi-n { color: var(--cs-info); }
.cs-kpi-pass .cs-kpi-n { color: var(--cs-pass); }
.cs-app:not([data-theme='dark']) .cs-kpi-medium .cs-kpi-n { color: #854d0e; }

/* compare + history */
.cs-summary { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.cs-change { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--cs-info-bg); color: var(--cs-info); }
.cs-change-gained { background: var(--cs-pass-bg); color: var(--cs-pass); }
.cs-change-lost { background: var(--cs-crit-bg); color: var(--cs-crit); }
.cs-change-changed { background: var(--cs-med-bg); color: var(--cs-med); }
.cs-app:not([data-theme='dark']) .cs-change-gained { color: #166534; }
.cs-app:not([data-theme='dark']) .cs-change-lost { color: #991b1b; }
.cs-app:not([data-theme='dark']) .cs-change-changed { color: #854d0e; }
.cs-diff { font-weight: 700; color: var(--cs-accent-text); }
.cs-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.cs-timeline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cs-hist { padding: 10px 12px; border-inline-start: 3px solid var(--cs-accent); background: var(--cs-panel-2); border-radius: 0 9px 9px 0; display: flex; flex-direction: column; gap: 6px; }
[dir='rtl'] .cs-hist { border-radius: 9px 0 0 9px; }
.cs-hist-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.cs-changes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.cs-chg-tag { display: inline-block; min-width: 72px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--cs-info-bg); color: var(--cs-info); }
.cs-chg-new .cs-chg-tag { background: var(--cs-crit-bg); color: var(--cs-crit); }
.cs-chg-resolved .cs-chg-tag { background: var(--cs-pass-bg); color: var(--cs-pass); }
.cs-app:not([data-theme='dark']) .cs-chg-new .cs-chg-tag { color: #991b1b; }
.cs-app:not([data-theme='dark']) .cs-chg-resolved .cs-chg-tag { color: #166534; }

/* report */
.cs-report { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.cs-report-head { display: flex; gap: 12px; align-items: center; }
.cs-report h2 { font-size: 19px; }
.cs-report h3 { font-size: 15px; margin-top: 8px; }
.cs-report-sum { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cs-report-sum strong { font-size: 18px; }

/* ---------------------------------------------------------------- status bar, menus, toasts, dialogs */
.cs-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 30px; padding: 3px 12px; background: var(--cs-panel); border-top: 1px solid var(--cs-line); font-size: 12.5px; color: var(--cs-muted); }
.cs-status-msg { flex: 1 1 300px; min-width: 0; color: var(--cs-ink); }
.cs-status-error { color: var(--cs-crit); font-weight: 600; }
.cs-status-right { margin-inline-start: auto; }
.cs-menu { z-index: 50; min-width: 220px; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; border-radius: 10px; border: 1px solid var(--cs-line-2); background: var(--cs-panel); color: var(--cs-ink); box-shadow: var(--cs-shadow); }
.cs-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: 7px; }
.cs-menu-item:hover, .cs-menu-item:focus { background: var(--cs-accent-soft); color: var(--cs-ink); outline: none; }
.cs-menu-item:focus-visible { outline: 2px solid var(--cs-focus); outline-offset: -2px; }
.cs-menu-item:disabled { opacity: .55; cursor: default; }
.cs-menu-item[aria-checked='true']::before { content: '✓'; margin-inline-end: -10px; font-weight: 700; color: var(--cs-accent-text); }
.cs-menu-hint { color: var(--cs-muted); font-size: 12px; }
.cs-menu-sep { height: 1px; margin: 5px 4px; background: var(--cs-line); }
.cs-menu-heading { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--cs-muted); }
.cs-toasts { position: fixed; inset-block-end: 40px; inset-inline-end: 16px; z-index: 80; display: flex; flex-direction: column; gap: 6px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.cs-toast { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--cs-ink); color: var(--cs-panel); box-shadow: var(--cs-shadow); font-size: 13px; }
.cs-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--cs-line-2); border-radius: 14px; background: var(--cs-panel); color: var(--cs-ink); box-shadow: var(--cs-shadow); }
.cs-dialog-wide { width: min(900px, calc(100vw - 24px)); }
.cs-dialog-narrow { width: min(520px, calc(100vw - 24px)); }
.cs-dialog::backdrop { background: rgba(6, 14, 26, .58); }
.cs-dialog[open] { display: flex; flex-direction: column; }
.cs-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--cs-line); }
.cs-dialog-head h2 { font-size: 17px; }
.cs-dialog-body { padding: 14px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cs-dialog-body ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.cs-dialog-body ul.cs-templates, .cs-dialog-body ul.cs-recent { padding: 0; }
.cs-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.cs-drop { box-shadow: inset 0 0 0 4px var(--cs-accent); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .cs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .cs-body { grid-template-columns: minmax(0, 1fr); position: relative; }
  .cs-listtoggle { display: inline-flex; }
  .cs-side { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 30; width: min(320px, 88vw); box-shadow: var(--cs-shadow); visibility: hidden; transform: translateX(-102%); }
  [dir='rtl'] .cs-side { transform: translateX(102%); }
  .cs-list-open .cs-side { visibility: visible; transform: none; }
  @media (prefers-reduced-motion: no-preference) { .cs-side { transition: transform .18s ease, visibility .18s; } }
  .cs-projname { max-width: none; }
}
@media (max-width: 560px) {
  .cs-toolbar { padding: 6px; }
  .cs-toolbar-start { flex-basis: 100%; }
  .cs-menus { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
  .cs-menubtn { padding: 4px 6px; flex: none; }
  .cs-hint { margin: 8px 10px 0; padding: 6px 10px; }
  .cs-runall-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .cs-runall { padding: 6px 10px; }
  .cs-chipbtn span { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cs-panel { padding: 10px; }
  .cs-card { padding: 12px; }
  .cs-tab span { font-size: 13px; }
  .cs-tab { padding: 6px 8px; }
  .cs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-status-right { margin-inline-start: 0; }
  .cs-sev { min-width: 0; }
  .cs-finding { flex-direction: column; gap: 4px; }
}

/* ---------------------------------------------------------------- print (report, share cards) */
.cs-print-root { display: none; }
@media print {
  html.cs-printing, html.cs-printing body { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  html.cs-printing body > :not(.cs-print-root) { display: none !important; }
  .cs-print-root .cs-report { max-width: none; }
  html.cs-printing .cs-print-root { padding: 0 6px; }
  html.cs-printing .cs-print-root { display: block; color: #111; background: #fff; font: 12px/1.45 system-ui, sans-serif; --cs-ink: #111; --cs-muted: #444; --cs-line: #ccc; --cs-panel: #fff; --cs-panel-2: #f6f6f6; --cs-crit: #991b1b; --cs-pass: #166534; --cs-med: #854d0e; --cs-high: #9a3412; --cs-low: #1d4ed8; --cs-info: #333; }
  .cs-print-root .cs-tablewrap { overflow: visible; border: 0; }
  .cs-print-root .cs-table { border-collapse: collapse; width: 100%; }
  .cs-print-root .cs-table th, .cs-print-root .cs-table td { border: 1px solid #bbb; padding: 4px 6px; text-align: start; vertical-align: top; }
  .cs-print-root h2 { font-size: 18px; margin: 0 0 4px; }
  .cs-print-root h3 { font-size: 14px; margin: 14px 0 6px; }
  .cs-print-root .cs-report-head { display: flex; gap: 10px; align-items: center; }
  .cs-print-root .cs-report-sum { list-style: none; padding: 0; display: flex; gap: 16px; }
  .cs-print-root figure { margin: 0; break-inside: avoid; }
  .cs-print-root svg { max-width: 100%; height: auto; }
  .cs-print-root .cs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.cs-report-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Chainscope additions */
.cs-kindbadge.cs-g-tx { background: #e0f2fe; color: #075985; }
.cs-kindbadge.cs-g-contracts { background: #ede9fe; color: #4c1d95; }
.cs-kindbadge.cs-g-wallets { background: #fae8ff; color: #86198f; }
.cs-kindbadge.cs-g-governance { background: #dcfce7; color: #166534; }
.cs-kindbadge.cs-g-markets { background: #fef3c7; color: #854d0e; }
.cs-app[data-theme='dark'] .cs-kindbadge.cs-g-tx { background: #0c2f47; color: #7dd3fc; }
.cs-app[data-theme='dark'] .cs-kindbadge.cs-g-contracts { background: #2a2154; color: #c4b5fd; }
.cs-app[data-theme='dark'] .cs-kindbadge.cs-g-wallets { background: #3b1340; color: #f0abfc; }
.cs-app[data-theme='dark'] .cs-kindbadge.cs-g-governance { background: #0f2c1b; color: #86efac; }
.cs-app[data-theme='dark'] .cs-kindbadge.cs-g-markets { background: #33260a; color: #fcd34d; }
.cs-listitem .cs-mini { width: 8px; height: 8px; border-radius: 2px; flex: none; transform: rotate(45deg); background: var(--cs-med); }
.cs-mini-failed { background: var(--cs-crit) !important; }
.cs-mini-changed { background: var(--cs-low) !important; }
.cs-state { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--cs-info-bg); color: var(--cs-info); }
.cs-state-fresh { background: var(--cs-pass-bg); color: var(--cs-pass); }
.cs-state-stale, .cs-state-changed { background: var(--cs-med-bg); color: var(--cs-med); }
.cs-state-failed { background: var(--cs-crit-bg); color: var(--cs-crit); }
.cs-app:not([data-theme='dark']) .cs-state-fresh { color: #166534; }
.cs-app:not([data-theme='dark']) .cs-state-stale, .cs-app:not([data-theme='dark']) .cs-state-changed { color: #854d0e; }
.cs-app:not([data-theme='dark']) .cs-state-failed { color: #991b1b; }
.cs-hints { margin: 0; padding-inline-start: 20px; color: var(--cs-muted); font-size: 13px; }
.cs-finding-text { display: flex; flex-direction: column; gap: 2px; }
.cs-finding-subject { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--cs-muted); }
.cs-goto { padding: 2px 6px; font-weight: 600; text-align: start; white-space: normal; }
.cs-linkbtn { padding: 0 2px; min-height: 24px; }
.cs-finding-text .cs-goto { align-self: flex-start; padding: 0 2px; min-height: 24px; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.cs-nexts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cs-next { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--cs-accent); background: color-mix(in srgb, var(--cs-accent) 5%, var(--cs-panel)); }
.cs-next > .cs-ico { color: var(--cs-accent-text); margin-top: 2px; }
[dir='rtl'] .cs-next > .cs-ico { transform: scaleX(-1); }
.cs-next-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.cs-cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.cs-cols-2 > .cs-card { min-width: 0; }
.cs-empty { flex-direction: row; flex-wrap: wrap; align-items: center; }
.cs-empty > p { flex: 1 1 260px; }
.cs-rowtools { display: flex; flex-wrap: nowrap; gap: 2px; align-items: center; }
.cs-entities td { vertical-align: middle; }
.cs-rowtools .cs-btn { min-height: 30px; padding: 2px 8px; font-size: 12.5px; }
.cs-entities .cs-input { min-width: 9rem; }
.cs-flag { max-width: 10rem; }
.cs-pick { margin-top: 2px; }
.cs-sparks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 6px 16px; }
.cs-sparks li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px; padding: 6px 10px; border-radius: 8px; background: var(--cs-panel-2); }
.cs-sparks .cs-spark-label { grid-column: 1 / -1; }
.cs-sparks .cs-spark-val { justify-self: end; }
.cs-spark { color: var(--cs-accent); flex: none; }
.cs-spark-label { font-size: 12.5px; color: var(--cs-muted); overflow-wrap: anywhere; }
.cs-spark-val { font-weight: 700; font-size: 13px; }
.cs-hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cs-diff-up { color: var(--cs-low); }
.cs-diff-down { color: var(--cs-high); }
.cs-cmpside { padding: 10px 12px; border-radius: 10px; background: var(--cs-panel-2); border: 1px solid var(--cs-line); display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
/* graph */
.cs-graphbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 14px; }
.cs-graphbar .cs-row { align-items: center; gap: 4px; }
.cs-graphwrap { position: relative; overflow: auto; max-height: min(70vh, 720px); border: 1px solid var(--cs-line); border-radius: 10px; background: var(--cs-panel-2); }
.cs-graph { display: block; font-family: system-ui, sans-serif; }
.cs-graph-fit { width: 100%; height: auto; }
/* addresses and labels in the graph are drawn left to right in every language */
.cs-graph text { direction: ltr; unicode-bidi: isolate; }
/* a halo in the canvas colour keeps labels readable where they cross edges */
.cs-graph .cs-g-label, .cs-graph .cs-g-elabel { paint-order: stroke; stroke: var(--cs-panel-2); stroke-width: 4px; stroke-linejoin: round; }
.cs-g-edge { stroke: var(--cs-line-2); }
.cs-g-hl { stroke: var(--cs-accent); }
.cs-g-arrow { fill: var(--cs-control); }
.cs-g-elabel { font-size: 10px; fill: var(--cs-muted); }
.cs-g-label { font-size: 11px; fill: var(--cs-ink); paint-order: stroke; stroke: var(--cs-panel-2); stroke-width: 3px; }
.cs-g-node { cursor: pointer; }
.cs-g-dot { stroke: var(--cs-panel-2); stroke-width: 2; }
.cs-g-ring { fill: none; stroke: var(--cs-focus); stroke-width: 3; }
.cs-g-sel .cs-g-label { font-weight: 700; }
.cs-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--cs-muted); }
.cs-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cs-swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: #52525b; }
.cs-swatch[data-c='suspect'] { background: #b91c1c; } .cs-swatch[data-c='victim'] { background: #c2410c; } .cs-swatch[data-c='trusted'] { background: #15803d; } .cs-swatch[data-c='watch'] { background: #a16207; }
.cs-swatch[data-c='contract'] { background: #0369a1; } .cs-swatch[data-c='implementation'] { background: #4338ca; } .cs-swatch[data-c='wallet'] { background: #a21caf; } .cs-swatch[data-c='transaction'] { background: #475569; } .cs-swatch[data-c='bridge'] { background: #0f766e; }
.cs-nodebox { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; border: 1px solid var(--cs-accent); background: var(--cs-panel-2); overflow-wrap: anywhere; }
.cs-nodebox code { word-break: break-all; }
/* timeline + journal */
.cs-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cs-tl-day { margin-top: 10px; font-weight: 800; font-size: 13px; color: var(--cs-muted); text-transform: uppercase; letter-spacing: .04em; }
.cs-tl-day:first-child { margin-top: 0; }
.cs-tl-now { margin: 10px 0 2px; padding: 3px 10px; align-self: flex-start; border-radius: 999px; background: var(--cs-accent); color: var(--cs-on-accent); font-weight: 700; font-size: 12px; }
.cs-tl-item { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 10px; padding: 6px 10px; border-inline-start: 3px solid var(--cs-line-2); background: var(--cs-panel-2); border-radius: 0 8px 8px 0; }
[dir='rtl'] .cs-tl-item { border-radius: 8px 0 0 8px; }
.cs-tl-review { border-inline-start-color: var(--cs-med); }
.cs-tl-journal { border-inline-start-color: var(--cs-accent2); }
.cs-tl-future { border-inline-start-color: var(--cs-accent); background: color-mix(in srgb, var(--cs-accent) 6%, var(--cs-panel)); }
.cs-tl-time { font-variant-numeric: tabular-nums; color: var(--cs-muted); font-size: 12.5px; padding-top: 1px; }
.cs-tl-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; overflow-wrap: anywhere; }
.cs-tl-body .cs-linkbtn { font-size: 12.5px; }
.cs-tl-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cs-tl-mini li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 4px 8px; border-inline-start: 3px solid var(--cs-line-2); overflow-wrap: anywhere; }
.cs-tl-mini .cs-tone-warning { border-inline-start-color: var(--cs-med); }
.cs-tl-mini .cs-tone-bad, .cs-tl-mini .cs-tone-danger { border-inline-start-color: var(--cs-crit); }
.cs-tl-mini .cs-tone-good { border-inline-start-color: var(--cs-pass); }
.cs-journal { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cs-journal li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 6px 8px; border-radius: 8px; background: var(--cs-panel-2); overflow-wrap: anywhere; }
/* dialogs: add check, import */
.cs-addgroup { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-top: 4px; }
.cs-dialog-body ul.cs-addgrid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; }
.cs-import-results { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; position: relative; }
.cs-imp-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 3px 0; border-bottom: 1px solid var(--cs-line); }
.cs-imp-row code { font-size: 12px; word-break: break-all; }
.cs-imp-type { width: auto; min-height: 30px; padding: 2px 6px; }
.cs-output[open] { padding-bottom: 4px; }
.cs-report-foot { margin-top: 10px; font-size: 12px; }
.cs-report-head img { flex: none; }
@media (max-width: 560px) {
  .cs-tl-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cs-journal li { grid-template-columns: minmax(0, 1fr) auto; }
  .cs-journal li > :first-child { grid-column: 1 / -1; }
  .cs-findings-wide .cs-goto { max-width: none; }
  .cs-next { flex-wrap: wrap; }
}
@media print {
  .cs-print-root .cs-findings { list-style: none; padding: 0; }
  .cs-print-root .cs-finding { display: flex; gap: 8px; padding: 3px 0; break-inside: avoid; }
  .cs-print-root .cs-sev { border: 1px solid #999; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; min-width: 64px; }
  .cs-print-root .cs-ico { display: none; }
  .cs-print-root .cs-figure img { max-width: 100%; border: 1px solid #ccc; }
  .cs-print-root .cs-journal { list-style: none; padding: 0; }
  .cs-print-root .cs-journal li { display: flex; gap: 10px; }
}
