/*
 * Events application-theme bridge.
 *
 * Presentation only: event state, IntelliSense data, editor commands, save
 * endpoints, and generated event output remain owned by events-spa.js.
 */

body.ev-body {
    --ev-head-h: 54px;
    --ev-text: var(--pp-text, #0f172a);
    --ev-input: var(--pp-input-bg, #ffffff);
    --ev-raised: var(--pp-surface-raised, #ffffff);
    --ev-hover: var(--pp-surface-muted, #f8fafc);
    --ev-row-border: #f1f5f9;
    --ev-code-bg: #f8fafc;
    --ev-code-raised: #ffffff;
    --ev-code-soft: #f1f5f9;
    --ev-code-border: #dbe3ee;
    --ev-code-text: #1e293b;
    --ev-code-muted: #64748b;
    --ev-code-subtle: #94a3b8;
    --ev-code-accent: #7c3aed;
    --ev-code-selection: #dbeafe;
    --ev-code-scroll: #cbd5e1;
    --ev-code-shadow: rgba(15, 23, 42, .18);
    color-scheme: light;
}

html[data-pp-theme="dark"] body.ev-body {
    --ev-primary: var(--pp-accent, #60a5fa);
    --ev-border: var(--pp-border, #2b3a52);
    --ev-muted: var(--pp-text-muted, #9cabc1);
    --ev-bg: var(--pp-app-bg, #0b1120);
    --ev-surface: var(--pp-surface, #111827);
    --ev-text: var(--pp-text, #e7edf7);
    --ev-input: var(--pp-input-bg, #101827);
    --ev-raised: var(--pp-surface-raised, #172033);
    --ev-hover: var(--pp-surface-muted, #1e293b);
    --ev-row-border: var(--pp-border, #2b3a52);
    --ev-psoft: var(--pp-accent-soft, #172b4d);
    --ev-code-bg: var(--pp-input-bg, #101827);
    --ev-code-raised: var(--pp-surface-raised, #172033);
    --ev-code-soft: var(--pp-surface-muted, #1e293b);
    --ev-code-border: var(--pp-border, #2b3a52);
    --ev-code-text: var(--pp-text, #e7edf7);
    --ev-code-muted: var(--pp-text-muted, #9cabc1);
    --ev-code-subtle: color-mix(in srgb, var(--pp-text-muted, #9cabc1) 72%, transparent);
    --ev-code-accent: var(--pp-accent, #60a5fa);
    --ev-code-selection: color-mix(in srgb, var(--pp-accent, #60a5fa) 26%, var(--pp-input-bg, #101827));
    --ev-code-scroll: var(--pp-border-strong, #3b4b65);
    --ev-code-shadow: var(--pp-shadow-color, rgba(0, 0, 0, .52));
    color: var(--ev-text);
    color-scheme: dark;
}

/* One dependable toolbar rhythm across scope, event list, and editor. */
body.ev-body :is(.ev-tree-head, .ev-panel-head, .ev-rh) {
    box-sizing: border-box;
    height: var(--ev-head-h);
    min-height: var(--ev-head-h);
    max-height: var(--ev-head-h);
    border-color: var(--ev-border);
}
body.ev-body .ev-tree-head {
    display: block;
    padding: 5px 12px 4px;
}
body.ev-body .ev-tree-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
body.ev-body .ev-tree-head strong { line-height: 20px; }
body.ev-body .ev-tree-head small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 15px;
}
body.ev-body .ev-tree-head .ev-help-btn {
    padding: 2px 8px;
    font-size: 10.5px;
}
body.ev-body .ev-panel-head { padding: 7px 14px; }
body.ev-body .ev-rh { padding: 7px 16px; }

body.ev-body :is(.ev-tree, .ev-panel) {
    background: var(--ev-surface);
    border-color: var(--ev-border);
    color: var(--ev-text);
}
body.ev-body :is(.ev-node, .ev-tbl-child, .ev-row, .ev-sched-row, .ev-field-item) {
    color: var(--ev-text);
    border-color: var(--ev-row-border);
}
body.ev-body :is(.ev-node, .ev-tbl-child, .ev-row, .ev-sched-row, .ev-field-item):hover {
    background: var(--ev-hover);
    color: var(--ev-text);
}
body.ev-body :is(.ev-node, .ev-tbl-child, .ev-row, .ev-sched-row, .ev-field-item).active {
    background: var(--ev-psoft);
    color: var(--ev-primary);
}
body.ev-body .ev-panel-actions { border-color: var(--ev-border); }
body.ev-body .ev-resizer::after { background: var(--ev-border); }
body.ev-body .ev-row-tog {
    background: var(--ev-input);
    border-color: var(--ev-border);
}
body.ev-body .ev-btn {
    background: var(--ev-raised);
    border-color: var(--ev-border);
    color: var(--ev-text);
}
body.ev-body .ev-btn:hover {
    background: var(--ev-hover);
    border-color: var(--ev-primary);
    color: var(--ev-primary);
}
body.ev-body .ev-help-btn { box-shadow: none; }
html[data-pp-theme="dark"] body.ev-body .ev-help-btn {
    background: var(--pp-accent-soft);
    border-color: color-mix(in srgb, var(--pp-accent) 52%, var(--ev-border));
    color: var(--pp-accent);
}
html[data-pp-theme="dark"] body.ev-body .ev-help-btn:hover {
    background: var(--pp-accent);
    border-color: var(--pp-accent);
    color: #fff;
}
html[data-pp-theme="dark"] body.ev-body .ev-panel-head .ev-ph-icon {
    background: var(--ev-psoft) !important;
}

/* Compact, scalable scope tree. */
body.ev-body .ev-tree-group-toggle {
    width: calc(100% - 12px);
    min-height: 36px;
    margin: 6px 6px 3px;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--ev-raised);
    border: 1px solid var(--ev-border);
    border-radius: 8px;
    color: var(--ev-text);
    cursor: pointer;
    text-align: left;
}
body.ev-body .ev-tree-group-toggle:hover { background: var(--ev-hover); }
body.ev-body .ev-tree-group-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}
body.ev-body .ev-tree-group-title i { color: var(--ev-primary); }
body.ev-body .ev-tree-group-count,
body.ev-body .ev-table-total {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--ev-psoft);
    color: var(--ev-primary);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}
body.ev-body .ev-tree-group-chevron { color: var(--ev-muted); font-size: 10px; }
body.ev-body .ev-global-groups {
    border-left: 1px solid var(--ev-border);
    margin: 0 7px 6px;
    padding: 1px 0 3px;
}
body.ev-body .ev-global-groups .ev-section-hd { padding: 7px 10px 2px; }
body.ev-body .ev-global-groups .ev-node { padding-block: 6px; }

body.ev-body .ev-table-tools {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 5px 7px 6px;
    background: var(--ev-surface);
    border-bottom: 1px solid var(--ev-border);
}
body.ev-body .ev-table-tools-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 3px 5px;
    color: var(--ev-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
body.ev-body .ev-table-tools-head > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
body.ev-body .ev-table-search {
    height: 30px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    background: var(--ev-input);
    border: 1px solid var(--ev-border);
    border-radius: 7px;
    color: var(--ev-muted);
}
body.ev-body .ev-table-search:focus-within {
    border-color: var(--ev-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ev-primary) 14%, transparent);
}
body.ev-body .ev-table-search input {
    min-width: 0;
    width: 100%;
    height: 27px;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    outline: 0;
    color: var(--ev-text) !important;
    font-size: 11.5px;
}
body.ev-body .ev-table-search input::placeholder { color: var(--ev-muted) !important; }
body.ev-body .ev-table-entry[hidden],
body.ev-body .ev-table-empty[hidden] { display: none !important; }
body.ev-body .ev-table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 22px 10px;
    color: var(--ev-muted);
    font-size: 11px;
}
body.ev-body .ev-table-entry > .ev-node { padding-block: 6px; }

/* Editor chrome. These variables intentionally switch with the application UI. */
body.ev-body :is(.ev-content, .ev-empty, .ev-code-root) {
    background: var(--ev-code-bg);
    color: var(--ev-code-text);
}
body.ev-body :is(.ev-rh, .ev-toolbar, .ev-docs, .ev-sched-header) {
    background: var(--ev-code-raised);
    border-color: var(--ev-code-border);
    color: var(--ev-code-text);
}
body.ev-body :is(.ev-rh-scope, .ev-toolbar, .ev-tbtn, .ev-docs-toggle, .ev-docs-row .arg-desc) {
    color: var(--ev-code-muted);
}
body.ev-body :is(.ev-rh-group, .ev-docs-toggle:hover) { color: var(--ev-code-text); }
body.ev-body .ev-rh-event { color: var(--ev-code-accent); }
body.ev-body :is(.ev-rh-sep, .ev-status, .ev-kh, .ev-empty, .ev-empty p) {
    color: var(--ev-code-subtle);
}
body.ev-body .ev-toolbar { border-bottom-color: var(--ev-code-border); }
body.ev-body .ev-tbtn {
    background: transparent;
    border-color: var(--ev-code-border);
}
body.ev-body .ev-tbtn:hover {
    background: var(--ev-code-soft);
    border-color: var(--ev-code-scroll);
    color: var(--ev-code-text);
}
body.ev-body .ev-tbtn.primary {
    background: color-mix(in srgb, var(--ev-code-accent) 12%, var(--ev-code-raised));
    border-color: color-mix(in srgb, var(--ev-code-accent) 50%, var(--ev-code-border));
    color: var(--ev-code-accent);
}
body.ev-body kbd {
    background: var(--ev-code-soft);
    border-color: var(--ev-code-border);
    color: var(--ev-code-muted);
}
body.ev-body .ev-gutter {
    background: var(--ev-code-bg);
    border-color: var(--ev-code-border);
}
body.ev-body #evGutterLines { color: var(--ev-code-subtle); }
body.ev-body #evTa {
    background: var(--ev-code-bg) !important;
    color: var(--ev-code-text) !important;
    caret-color: var(--ev-code-accent);
    scrollbar-color: var(--ev-code-scroll) var(--ev-code-bg);
    color-scheme: inherit;
}
body.ev-body #evTa::placeholder { color: var(--ev-code-subtle) !important; }
body.ev-body #evTa::selection { background: var(--ev-code-selection); }
body.ev-body #evTa::-webkit-scrollbar-track { background: var(--ev-code-bg); }
body.ev-body #evTa::-webkit-scrollbar-thumb { background: var(--ev-code-scroll); }

/* IntelliSense is an editor surface, not a generated-app preview. */
body.ev-body .ev-intellisense {
    background: var(--ev-code-raised);
    border-color: var(--ev-code-scroll);
    box-shadow: 0 18px 44px var(--ev-code-shadow);
}
body.ev-body .ev-intellisense-list {
    scrollbar-color: var(--ev-code-scroll) var(--ev-code-raised);
}
body.ev-body .ev-intellisense-item { color: var(--ev-code-text); }
body.ev-body :is(.ev-intellisense-item:hover, .ev-intellisense-item.active) {
    background: var(--ev-code-soft);
}
body.ev-body .ev-intellisense-label { color: var(--ev-code-text); }
body.ev-body .ev-intellisense-copy-head { color: var(--ev-code-text); }
body.ev-body :is(.ev-intellisense-detail, .ev-intellisense-empty) { color: var(--ev-code-subtle); }
body.ev-body .ev-intellisense-doc {
    border-color: var(--ev-code-border);
    color: var(--ev-code-muted);
}
body.ev-body .ev-intellisense-doc code {
    background: var(--ev-code-bg);
    border-color: var(--ev-code-border);
    color: var(--ev-code-text);
}
body.ev-body .ev-intellisense-doc strong { color: var(--ev-code-text); }
body.ev-body .ev-doc-description { color: var(--ev-code-muted); }
body.ev-body .ev-intellisense-cat { color: var(--ev-code-subtle); background: var(--ev-code-soft); border-color: var(--ev-code-border); }
body.ev-body .ev-intellisense-item.active .ev-intellisense-cat { color: var(--ev-code-accent); }
body.ev-body .ev-doc-cat { color: var(--ev-code-accent); background: var(--ev-code-soft); }
body.ev-body .ev-doc-eg-label { color: var(--ev-code-subtle); }

body.ev-body .ev-docs { scrollbar-color: var(--ev-code-scroll) var(--ev-code-raised); }
body.ev-body .ev-docs-toggle:hover { background: var(--ev-code-bg); }
body.ev-body .ev-docs-body { scrollbar-color: var(--ev-code-scroll) var(--ev-code-raised); }
body.ev-body .ev-docs-section h4 { color: var(--ev-code-subtle); }
body.ev-body .ev-docs-example { border-color: var(--ev-code-border); }
body.ev-body .ev-docs-example pre {
    background: color-mix(in srgb, var(--ev-code-bg) 88%, #000);
    border-color: var(--ev-code-border);
    color: var(--ev-code-text);
}

body.ev-body .ev-sched-header label { color: var(--ev-code-subtle); }
body.ev-body .ev-sched-header :is(input, select) {
    background: var(--ev-code-bg) !important;
    border-color: var(--ev-code-border) !important;
    color: var(--ev-code-text) !important;
    color-scheme: inherit;
}
body.ev-body .ev-sched-header :is(input, select)::placeholder {
    color: var(--ev-code-subtle) !important;
}

/* Help/Guide modal follows the application theme while retaining code colors. */
body.ev-body .evh-modal {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    color: var(--ev-text);
}
body.ev-body .evh-head { border-color: var(--ev-border); }
body.ev-body .evh-toc {
    background: var(--ev-bg);
    border-color: var(--ev-border);
}
body.ev-body .evh-toc a { color: var(--ev-muted); }
body.ev-body .evh-toc a:hover,
body.ev-body .evh-toc a.active {
    background: var(--ev-psoft);
    color: var(--ev-primary);
}
body.ev-body .evh-content { color: var(--ev-text); }
body.ev-body .evh-content :is(h3, .evh-card h5) { color: var(--ev-text); }
body.ev-body .evh-content h4 { color: color-mix(in srgb, var(--ev-primary) 78%, var(--ev-text)); }
body.ev-body .evh-content :is(p, ul, ol, .evh-lead) { color: var(--ev-muted); }
body.ev-body .evh-content code {
    background: var(--ev-hover);
    color: color-mix(in srgb, var(--ev-code-accent) 80%, var(--ev-text));
}
body.ev-body .evh-content pre {
    background: var(--ev-code-bg);
    border-color: var(--ev-code-border);
    color: var(--ev-code-text);
}
body.ev-body .evh-content pre code { background: none; color: inherit; }
body.ev-body .evh-card {
    background: var(--ev-raised);
    border-color: var(--ev-border);
}
body.ev-body .evh-card p { color: var(--ev-muted); }
body.ev-body .evh-table th {
    background: var(--ev-hover);
    border-color: var(--ev-border);
    color: var(--ev-muted);
}
body.ev-body .evh-table td {
    border-color: var(--ev-border);
    color: var(--ev-text);
}
body.ev-body .evh-table tr:hover td { background: var(--ev-hover); }
body.ev-body .evh-content :is(hr, .evh-foot) { border-color: var(--ev-border); }
body.ev-body .evh-foot { color: var(--ev-muted); }

html[data-pp-theme="dark"] body.ev-body .evh-callout.tip { background:#102d26; color:#86efac; }
html[data-pp-theme="dark"] body.ev-body .evh-callout.warn { background:#302617; color:#fde68a; }
html[data-pp-theme="dark"] body.ev-body .evh-callout.info { background:#142845; color:#bfdbfe; }
html[data-pp-theme="dark"] body.ev-body .evh-callout.sec { background:#351c26; color:#fecdd3; }

@media (max-width: 760px) {
    body.ev-body { --ev-head-h: 52px; }
    body.ev-body .ev-rh { padding-inline: 10px; }
    body.ev-body .ev-shortcuts { display: none; }
}

/* ── Code checker: diagnostics strip + toolbar pill (Phase 1) ───────────── */
body.ev-body .ev-lintpill {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--ev-code-border); background: var(--ev-code-soft);
    color: var(--ev-code-muted); border-radius: 999px;
    padding: 2px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
    line-height: 1.6;
}
body.ev-body .ev-lintpill:hover { filter: brightness(0.98); }
body.ev-body .ev-lintpill.ok      { color: #16a34a; border-color: color-mix(in srgb, #16a34a 40%, var(--ev-code-border)); }
body.ev-body .ev-lintpill.warn    { color: #d97706; border-color: color-mix(in srgb, #d97706 45%, var(--ev-code-border)); background: color-mix(in srgb, #d97706 12%, var(--ev-code-soft)); }
body.ev-body .ev-lintpill.error   { color: #dc2626; border-color: color-mix(in srgb, #dc2626 45%, var(--ev-code-border)); background: color-mix(in srgb, #dc2626 12%, var(--ev-code-soft)); }
body.ev-body .ev-lintpill.checking { color: var(--ev-code-subtle); }

body.ev-body .ev-diag {
    border-top: 1px solid var(--ev-code-border);
    background: var(--ev-code-raised); color: var(--ev-code-text);
    max-height: 168px; display: flex; flex-direction: column;
    flex: 0 0 auto;
}
body.ev-body .ev-diag-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; border-bottom: 1px solid var(--ev-code-border);
    font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
    color: var(--ev-code-muted);
}
body.ev-body .ev-diag-title.has-error { color: #dc2626; }
body.ev-body .ev-diag-title.has-warn  { color: #d97706; }
body.ev-body .ev-diag-title.ok        { color: #16a34a; }
body.ev-body .ev-diag-hide {
    border: 0; background: transparent; color: var(--ev-code-subtle);
    font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px;
}
body.ev-body .ev-diag-hide:hover { color: var(--ev-code-text); }
body.ev-body .ev-diag-list { overflow-y: auto; }
body.ev-body .ev-diag-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 7px 12px; border-bottom: 1px solid color-mix(in srgb, var(--ev-code-border) 55%, transparent);
    font-size: 12.5px; line-height: 1.45; cursor: pointer;
}
body.ev-body .ev-diag-item:hover { background: var(--ev-code-soft); }
body.ev-body .ev-diag-ic { flex: 0 0 auto; margin-top: 1px; font-size: 13px; }
body.ev-body .ev-diag-item.error .ev-diag-ic { color: #dc2626; }
body.ev-body .ev-diag-item.warning .ev-diag-ic { color: #d97706; }
body.ev-body .ev-diag-item.info .ev-diag-ic { color: var(--ev-code-accent); }
body.ev-body .ev-diag-body { flex: 1 1 auto; min-width: 0; }
body.ev-body .ev-diag-msg { color: var(--ev-code-text); }
body.ev-body .ev-diag-loc {
    color: var(--ev-code-subtle); font-size: 11px; font-weight: 600;
    margin-right: 6px; white-space: nowrap;
}
body.ev-body .ev-diag-fix {
    flex: 0 0 auto; border: 1px solid var(--ev-code-border);
    background: var(--ev-code-soft); color: var(--ev-code-accent);
    border-radius: 6px; padding: 2px 9px; font-size: 11px; font-weight: 700; cursor: pointer;
}
body.ev-body .ev-diag-fix:hover { background: var(--ev-code-accent); color: #fff; border-color: var(--ev-code-accent); }

/* ── Code checker: squiggles + gutter markers (Phase 2) ─────────────────── */
.ev-squiggles { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.ev-squiggle { position: absolute; height: 3px; background-repeat: repeat-x; background-position: left bottom; }
.ev-squiggle.error   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='M0 2 Q1.5 0 3 2 T6 2' fill='none' stroke='%23dc2626' stroke-width='0.9'/></svg>"); }
.ev-squiggle.warning { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='M0 2 Q1.5 0 3 2 T6 2' fill='none' stroke='%23d97706' stroke-width='0.9'/></svg>"); }
.ev-squiggle.info    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='M0 2 Q1.5 0 3 2 T6 2' fill='none' stroke='%237c3aed' stroke-width='0.9'/></svg>"); }

/* Gutter line-number markers */
body.ev-body #evGutterLines > div { position: relative; }
body.ev-body #evGutterLines > div.ev-gline-error,
body.ev-body #evGutterLines > div.ev-gline-warning,
body.ev-body #evGutterLines > div.ev-gline-info { font-weight: 700; }
body.ev-body #evGutterLines > div.ev-gline-error   { color: #dc2626; }
body.ev-body #evGutterLines > div.ev-gline-warning { color: #d97706; }
body.ev-body #evGutterLines > div.ev-gline-info    { color: var(--ev-code-accent, #7c3aed); }
body.ev-body #evGutterLines > div.ev-gline-error::before,
body.ev-body #evGutterLines > div.ev-gline-warning::before,
body.ev-body #evGutterLines > div.ev-gline-info::before {
    content: ''; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}

/* ── Check-all events report (Phase 4) ──────────────────────────────────── */
body.ev-body .ev-head-actions { display: flex; gap: 6px; align-items: center; }
body.ev-body #evScanBtn { white-space: nowrap; }

.ev-scan-ov { position: fixed; inset: 0; z-index: 10080; display: flex; align-items: center; justify-content: center;
    background: rgba(8, 12, 20, .55); backdrop-filter: blur(3px); padding: 1rem; }
.ev-scan-ov[hidden] { display: none; }
.ev-scan-panel { width: min(720px, 100%); max-height: min(80vh, 760px); display: flex; flex-direction: column;
    background: var(--ev-code-raised, #fff); color: var(--ev-code-text, #1e293b);
    border: 1px solid var(--ev-code-border, #dbe3ee); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.ev-scan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.2rem; border-bottom: 1px solid var(--ev-code-border, #dbe3ee); }
.ev-scan-title { display: flex; gap: .8rem; align-items: center; }
.ev-scan-ic { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem;
    background: var(--ev-code-soft, #f1f5f9); color: var(--ev-code-muted, #64748b); }
.ev-scan-ic.ok { background: color-mix(in srgb, #16a34a 16%, transparent); color: #16a34a; }
.ev-scan-ic.warn { background: color-mix(in srgb, #d97706 16%, transparent); color: #d97706; }
.ev-scan-ic.error { background: color-mix(in srgb, #dc2626 16%, transparent); color: #dc2626; }
.ev-scan-ic.checking i { animation: evSpin 1s linear infinite; }
@keyframes evSpin { to { transform: rotate(360deg); } }
.ev-scan-head h2 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.ev-scan-head p { margin: .15rem 0 0; font-size: .82rem; color: var(--ev-code-muted, #64748b); }
.ev-scan-x { border: 0; background: transparent; color: var(--ev-code-subtle, #94a3b8); font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.ev-scan-x:hover { background: var(--ev-code-soft, #f1f5f9); color: var(--ev-code-text); }
.ev-scan-body { overflow-y: auto; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.ev-scan-empty { text-align: center; color: var(--ev-code-muted, #64748b); padding: 2.5rem 1rem; }
.ev-scan-empty i { font-size: 2rem; color: #16a34a; display: block; margin-bottom: .5rem; }
.ev-scan-card { border: 1px solid var(--ev-code-border, #dbe3ee); border-radius: 12px; overflow: hidden; }
.ev-scan-card-head { display: flex; align-items: center; gap: .55rem; padding: .6rem .8rem;
    background: var(--ev-code-soft, #f1f5f9); font-size: .9rem; }
.ev-scan-card-head b { font-weight: 700; }
.ev-scan-off { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ev-code-subtle, #94a3b8);
    border: 1px solid var(--ev-code-border); border-radius: 999px; padding: 1px 7px; }
.ev-scan-chips { margin-left: auto; display: flex; gap: 4px; }
.ev-scan-chip { min-width: 20px; text-align: center; border-radius: 999px; padding: 1px 7px; font-size: .72rem; font-weight: 700; color: #fff; }
.ev-scan-chip.error { background: #dc2626; } .ev-scan-chip.warning { background: #d97706; } .ev-scan-chip.info { background: #7c3aed; }
.ev-scan-diag { display: flex; align-items: flex-start; gap: 8px; padding: .5rem .8rem; font-size: .84rem; border-top: 1px solid color-mix(in srgb, var(--ev-code-border) 55%, transparent); }
.ev-scan-diag i { margin-top: 1px; }
.ev-scan-diag.error i { color: #dc2626; } .ev-scan-diag.warning i { color: #d97706; } .ev-scan-diag.info i { color: var(--ev-code-accent, #7c3aed); }
.ev-scan-loc { color: var(--ev-code-subtle, #94a3b8); font-size: .74rem; font-weight: 600; white-space: nowrap; }

/* ── Per-event info card (header) + foldable Idea footer (docs) ─────────── */
body.ev-body .ev-eventinfo {
    display: flex; align-items: flex-start; gap: 9px;
    margin: 0 14px 10px; padding: 9px 12px;
    background: color-mix(in srgb, var(--ev-code-accent, #7c3aed) 8%, var(--ev-code-raised, #fff));
    border: 1px solid color-mix(in srgb, var(--ev-code-accent, #7c3aed) 22%, var(--ev-code-border, #dbe3ee));
    border-radius: 10px; font-size: 12.5px; line-height: 1.5;
}
body.ev-body .ev-ei-icon { color: var(--ev-code-accent, #7c3aed); font-size: 14px; margin-top: 1px; flex: 0 0 auto; }
body.ev-body .ev-ei-text { min-width: 0; color: var(--ev-code-text, #1e293b); }
body.ev-body .ev-ei-desc { }
body.ev-body .ev-ei-ret {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
    background: var(--ev-code-soft, #f1f5f9); color: var(--ev-code-muted, #64748b);
    border: 1px solid var(--ev-code-border, #dbe3ee);
}
body.ev-body .ev-ei-ret code { background: transparent; }

body.ev-body .ev-idea {
    margin-top: 12px; border: 1px solid var(--ev-code-border, #dbe3ee);
    border-radius: 10px; overflow: hidden; background: var(--ev-code-soft, #f8fafc);
}
body.ev-body .ev-idea > summary {
    cursor: pointer; list-style: none; padding: 8px 12px; font-size: 12px; font-weight: 700;
    color: color-mix(in srgb, #d97706 82%, var(--ev-code-text)); display: flex; align-items: center; gap: 7px;
}
body.ev-body .ev-idea > summary::-webkit-details-marker { display: none; }
body.ev-body .ev-idea > summary i { color: #d97706; }
body.ev-body .ev-idea[open] > summary { border-bottom: 1px solid var(--ev-code-border, #dbe3ee); }
body.ev-body .ev-idea-body {
    padding: 10px 12px; font-size: 12px; line-height: 1.6; color: var(--ev-code-text, #334155);
}
body.ev-body .ev-idea-body code {
    background: var(--ev-code-raised, #fff); border: 1px solid var(--ev-code-border, #e2e8f0);
    border-radius: 5px; padding: 1px 5px; font-size: 11.5px;
}
