/* Process Canvas: design tokens, light and dark. */
:root {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --surface-2: #f0f0ec;
    --text: #1d1f23;
    --text-muted: #62656c;
    --border: #d9d9d3;
    --accent: #2f6fdf;
    --accent-ink: #ffffff;
    --accent-soft: #e4edfc;
    --danger: #c23b3b;
    --ok: #247a4d;
    --ok-soft: #e3f3ea;
    --danger-soft: #fbe7e7;
    --canvas: #fbfbfa;
    --grid: #ecece8;
    --shape-fill: #ffffff;
    --shape-stroke: #2c2f36;
    --band-shade: #d9dadd;
    --select: #2f6fdf;
    --radius: 8px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #16171a;
        --surface: #1e2024;
        --surface-2: #26282d;
        --text: #e8e9ec;
        --text-muted: #a0a3aa;
        --border: #363941;
        --accent: #6b9cf5;
        --accent-ink: #0d1422;
        --accent-soft: #1f2d48;
        --danger: #ef7a7a;
        --ok: #6cc89a;
        --ok-soft: #18321f;
        --danger-soft: #3a1c1c;
        --canvas: #1a1b1f;
        --grid: #24262b;
        --shape-fill: #22252a;
        --shape-stroke: #d6d8dd;
        --band-shade: #3a3d44;
        --select: #6b9cf5;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-dot { fill: none; stroke: var(--accent); stroke-width: 2; }
.brand-box { fill: none; stroke: var(--text); stroke-width: 2; }
.brand-line { stroke: var(--text); stroke-width: 2; }
.topnav { display: flex; gap: 16px; }
.topnav a { color: var(--text-muted); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user form { margin: 0; }
.lang-select { font: inherit; font-size: 13px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit; }

/* Layout */
.page { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 20px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions form { margin: 0; }
.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-top: 24px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.empty { color: var(--text-muted); padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.9rem; }
/* The model's name at the end of the editor's breadcrumb; Editors click it to rename the model */
.crumbs .model-name { font: inherit; font-weight: 600; color: var(--text); background: none; border: 1px solid transparent; border-radius: 6px;
    padding: 2px 6px; margin: -3px 0; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs button.model-name { cursor: text; }
.crumbs button.model-name:hover, .crumbs button.model-name:focus-visible { border-color: var(--border); background: var(--surface); }
.crumbs button.model-name:hover::after { content: ' ✎'; color: var(--text-muted); font-weight: 400; }
.crumbs input.model-name-input { font: inherit; font-weight: 600; padding: 2px 6px; margin: -3px 0; border: 1px solid var(--accent); border-radius: 6px;
    max-width: 60vw; background: var(--surface); color: var(--text); }
.crumbs input.model-name-input.invalid { border-color: var(--danger); }
.crumb-sep { color: var(--text-muted); }

/* Forms and buttons */
input[type=text], input[type=email], input[type=password], input[type=url], select {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.narrow { max-width: 420px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.inline-form input[type=text], .inline-form input[type=email] { flex: 1 1 200px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 550; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn:disabled { opacity: 0.45; cursor: default; }

details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-body {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 340px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
    box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
}

/* Notices */
.flash-area:empty { display: none; }
.notice { padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--ok-soft); color: var(--ok); }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.table form { margin: 0; }
.panel .table { margin-bottom: 16px; }

/* Badges */
.badge { display: inline-block; white-space: nowrap; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.badge-owner { background: var(--accent-soft); color: var(--accent); }
.badge-editor { background: var(--ok-soft); color: var(--ok); }
/* an agent member (AI agent with its own credentials), wherever its name appears */
.badge-agent { background: var(--accent-soft); color: var(--accent); font-size: 0.68rem; padding: 1px 6px; vertical-align: middle; }

/* Cards */
.card-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.card-link { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.card-title { font-size: 1.05rem; }

/* Node icons (pure CSS, no inline styles) */
/* Icons of workspaces, folders and models (fragments :: nodeIcon) */
.node-icon { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: -4px; fill: none; stroke: currentColor;
    stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; color: var(--text-muted); }
.node-icon .thin { stroke-width: 1.1; }
.node-icon-workspace { color: var(--accent); }
.node-icon-folder { color: #b7791f; }
.node-icon-folder path { fill: color-mix(in srgb, currentColor 16%, transparent); }
.node-icon-process, .node-icon-collaboration, .node-icon-choreography, .node-icon-conversation { color: var(--ok); }
.node-icon-dmn { color: #7c4dce; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .node-icon-folder { color: #e2b55a; } :root:not([data-theme="light"]) .node-icon-dmn { color: #b08ef0; } }
:root[data-theme="dark"] .node-icon-folder { color: #e2b55a; }
:root[data-theme="dark"] .node-icon-dmn { color: #b08ef0; }
@media (max-width: 560px) { .table .col-type { display: none; } } /* the icon shows the kind */
.node-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 550; }

/* Auth pages */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 16px; }

/* ---------- Editor ---------- */
.editor-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.editor-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.editor-actions { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.sync-status { font-size: 0.85rem; color: var(--text-muted); }
.sync-status.is-error { color: var(--danger); }
.editor { flex: 1; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) var(--side-w, 340px); }
@media (max-width: 800px) { .editor { grid-template-columns: auto 1fr; } .side { display: none; } }

.palette {
    /* Columns, top to bottom: as many as the editor's height needs (palette.js sets the width). */
    display: flex; flex-flow: column wrap; align-content: flex-start; row-gap: 2px; column-gap: 4px; padding: 6px 5px;
    overflow: hidden; min-height: 0; box-sizing: border-box;
    background: var(--surface); border-right: 1px solid var(--border);
}
.palette-sep { height: 1px; width: 38px; background: var(--border); margin: 4px 0; flex: none; }
.palette [hidden] { display: none; }
.tool {
    width: 38px; height: 34px; flex: none; display: grid; place-items: center; cursor: pointer;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text);
}
.tool svg { width: 22px; height: 22px; fill: var(--text); }
.tool svg .stroke { fill: none; stroke: var(--text); stroke-width: 1.6; }
.tool svg .stroke.thick { stroke-width: 3; }
.tool:hover { background: var(--surface-2); }
.tool.active { background: var(--accent-soft); border-color: var(--accent); }

.canvas-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--canvas); }
.canvas { width: 100%; height: 100%; display: block; outline: none; user-select: none; -webkit-user-select: none; touch-action: none; }
.canvas.tool-create { cursor: crosshair; }
.canvas.tool-connect { cursor: alias; }
.canvas.panning { cursor: grabbing; }
.grid-dot { fill: var(--grid); }

/* Diagram elements */
.el-shape .body { fill: var(--shape-fill); stroke: var(--shape-stroke); stroke-width: 1.6; }
.el-shape.type-endEvent .body { stroke-width: 4; }
.el-shape .marker { fill: none; stroke: var(--shape-stroke); stroke-width: 2.4; stroke-linecap: round; }
.el-shape .label, .el-flow .label { fill: var(--text); font: 12px/1.2 var(--font); pointer-events: none; }
.el-shape .called-label { fill: var(--accent); font: 10px/1.2 var(--font); }
.el-shape .called-label.missing { fill: var(--text-muted); font-style: italic; }
.el-shape .hit { fill: transparent; }
.el-shape { cursor: move; }
.el-shape.selected .body { stroke: var(--select); stroke-width: 2.4; }
.el-shape.type-endEvent.selected .body { stroke-width: 4; }
.el-shape.connect-target .body { stroke: var(--ok); stroke-width: 2.6; }
/* a sequence flow a data object is about to be attached to */
.el-flow.connect-target .line { stroke: var(--ok); stroke-width: 2.6; }
.el-flow .line { fill: none; stroke: var(--shape-stroke); stroke-width: 1.5; }
.el-flow .hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.el-flow.selected .line { stroke: var(--select); stroke-width: 2.2; }
.arrowhead { fill: var(--shape-stroke); }
.arrowhead-selected { fill: var(--select); }
.preview-line { fill: none; stroke: var(--select); stroke-width: 1.5; stroke-dasharray: 5 4; }
.lasso { fill: var(--accent-soft); fill-opacity: 0.5; stroke: var(--select); stroke-dasharray: 4 3; }
.canvas.read-only .el-shape { cursor: default; }

/* Context pad and inline label editor */
.context-pad {
    position: absolute; display: grid; grid-template-columns: repeat(3, 28px); gap: 2px; padding: 3px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}
.context-pad button {
    width: 28px; height: 28px; display: grid; place-items: center; padding: 0; cursor: pointer;
    background: transparent; border: none; border-radius: 6px; color: var(--text);
}
.context-pad button:hover { background: var(--surface-2); }
.context-pad svg { width: 18px; height: 18px; }
.context-pad svg .stroke { fill: none; stroke: var(--text); stroke-width: 1.6; }
.context-pad svg .stroke.thick { stroke-width: 3; }
.context-pad svg .danger { fill: none; stroke: var(--danger); stroke-width: 1.8; }
.label-editor {
    position: absolute; z-index: 5; text-align: center; resize: none; overflow: hidden; box-sizing: border-box;
    font-family: var(--font) !important; line-height: 1.2 !important; padding: 2px 4px !important; margin: 0;
    min-height: 0; background: var(--surface); color: var(--text);
    border: 1.5px solid var(--select) !important; border-radius: 4px; box-shadow: 0 2px 10px rgb(0 0 0 / .15);
}

/* Properties panel */
.side { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; position: relative; min-width: 0; }
.side-tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; }
.side-tabs button {
    flex: 1; font: inherit; font-weight: 550; padding: 10px; background: transparent; border: none;
    border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer;
}
.side-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.side-tabs .count:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; }
.side-tabs button.has-new::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--danger, #c92a2a); vertical-align: top; }
.props { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.props .field { font-weight: 550; font-size: 0.85rem; margin-bottom: 12px; }
.props .field select, .props .field textarea, .props .field input[type=text] { font-weight: 400; width: 100%; box-sizing: border-box; }
.props .field input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.props .called-by ul { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; }
.props h3 { font-size: 0.85rem; margin: 16px 0 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.props .check { font-size: 0.9rem; margin-bottom: 10px; }
.props h2 { font-size: 0.95rem; }
.props dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0; font-size: 0.9rem; }
.props dt { color: var(--text-muted); }
.props dd { margin: 0; word-break: break-all; }
.props textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.shortcuts { font-size: 0.8rem; color: var(--text-muted); margin-top: 24px; }
.shortcuts kbd { font: 0.75rem var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-2); }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
    background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; max-width: min(90vw, 520px);
}
.toast-action { margin-left: 8px; font: inherit; font-weight: 600; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 6px; padding: 2px 10px; cursor: pointer; }

/* BPMN notation details */
.dashed { stroke-dasharray: 4 3; }
.tool svg .stroke.dashed { stroke-dasharray: 3 2; }
.el-shape .inner { fill: none; stroke: var(--shape-stroke); stroke-width: 1.2; }
.el-shape .body.thick { stroke-width: 3.5; }
.el-shape .icon { fill: none; stroke: var(--shape-stroke); stroke-width: 1.4; stroke-linejoin: round; }
.el-shape .icon.icon-filled { fill: var(--shape-stroke); }
.el-shape .icon.icon-cut { stroke: var(--shape-fill); }
.el-shape .icon.thin { stroke-width: 1; }
.el-shape .icon.thick { stroke-width: 2.4; }
.el-shape .marker-line { fill: none; stroke: var(--shape-stroke); stroke-width: 1.4; }
.el-shape .marker.thin { stroke-width: 1.4; }
.el-shape .annotation-bg { fill: transparent; }
.el-shape .body.open { fill: none; }
.family-annotation .label { font-size: 12px; }
.group-body { fill: none !important; stroke-dasharray: 8 4 2 4; }
.family-group .hit-border, .family-participant .hit-border, .family-lane .hit-border { fill: none; stroke: transparent; stroke-width: 10; pointer-events: stroke; }
.family-participant, .family-lane, .family-group { cursor: default; }
.family-participant .swim-body, .family-lane .swim-body { fill: var(--shape-fill); pointer-events: none; }
.family-lane .swim-body { fill: transparent; }
.family-participant .swim-line, .family-lane .swim-line { stroke: var(--shape-stroke); stroke-width: 1.6; }
.family-lane .swim-body { stroke-width: 1.2; }
.hit-band { fill: transparent; cursor: move; }
/* Expanded sub-processes contain other shapes: only the border and title band are hit targets. */
.el-shape .body.container-body { pointer-events: none; }
.el-shape .hit-border { fill: none; stroke: transparent; stroke-width: 10; pointer-events: stroke; }
.el-shape .body.dotted { stroke-dasharray: 2 3; }
.el-shape .inner.open { fill: none; }
.swim-label { font-weight: 600; }
/* the name of a long pool, repeated at the top of its visible part (renderer.drawPoolNames) */
.pool-name-repeat { fill: var(--text-muted); opacity: 0.6; font-weight: 600; pointer-events: none; user-select: none; }
.family-participant.selected .swim-body, .family-lane.selected .swim-body, .family-group.selected .group-body { stroke: var(--select); stroke-width: 2.4; }
.el-flow.type-messageFlow .line { stroke-dasharray: 7 5; }
.el-flow.type-association .line, .el-flow.type-dataAssociation .line { stroke-dasharray: 2 4; stroke-linecap: round; }
.arrow-open { fill: none; stroke: var(--shape-stroke); stroke-width: 1.4; }
.arrow-hollow { fill: var(--shape-fill); stroke: var(--shape-stroke); stroke-width: 1.3; }
.el-flow .default-mark { marker: none; stroke-dasharray: none; }

/* Comment badges and resize handle */
.comment-badge { cursor: pointer; }
.badge-bubble { fill: var(--accent); stroke: var(--shape-fill); stroke-width: 1.5; }
.badge-text { fill: var(--accent-ink); font: 600 11px var(--font); pointer-events: none; }
.resize-handle { fill: var(--shape-fill); stroke: var(--select); stroke-width: 1.5; cursor: nwse-resize; }
.divider-handle { fill: var(--select); fill-opacity: 0.15; stroke: var(--select); stroke-width: 1; stroke-dasharray: 3 3; cursor: row-resize; }

/* Comments panel */
.comments-panel h2 { margin-bottom: 8px; }
.threads { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.thread { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.thread.resolved { opacity: 0.65; }
.thread.fresh { border-color: var(--accent); background: var(--accent-soft); animation: thread-fresh 0.6s ease-out; }
@keyframes thread-fresh { from { transform: translateX(-4px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .thread.fresh { animation: none; } }
.comment + .comment { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.comment-meta { font-size: 0.8rem; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.comment-meta .link-button { margin-left: auto; }
.comment-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; }
.thread-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.composer, .reply { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.reply { margin-top: 8px; }
.composer textarea, .reply textarea { width: 100%; font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.link-button { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.link-button.danger { color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 0.85rem; }

/* Import notices on the editor page */
.editor-notice { margin: 0; border-radius: 0; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.editor-notice ul { margin: 4px 0 0; padding-left: 18px; font-size: 0.9rem; }
.notice-warn { background: #fdf3dc; color: #7a5300; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice-warn { background: #3a2e12; color: #f3cf7a; } }
.import-form .file-label { flex: 1 1 220px; font-weight: 400; }
.import-form input[type=file] { font: inherit; font-size: 0.85rem; }

/* Drill-down into collapsed sub-processes */

.plane-crumbs { position: absolute; top: 10px; left: 12px; z-index: 5; display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap; max-width: calc(100% - 24px); padding: 6px 10px; background: var(--surface, #fff);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); font-size: 14px; }
.plane-crumbs[hidden] { display: none; }
.plane-crumbs .crumb { background: none; border: 0; padding: 2px 4px; color: var(--accent); cursor: pointer; font: inherit; border-radius: 4px; }
.plane-crumbs button.crumb:hover { background: var(--surface-2); text-decoration: underline; }
.plane-crumbs .crumb.current { color: inherit; font-weight: 600; cursor: default; }
.plane-crumbs .crumb-sep { color: var(--text-muted); }
.el-shape .drill { fill: transparent; cursor: pointer; }
.el-shape .drill:hover { fill: var(--select); fill-opacity: .15; }

.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding-left: 8px; padding-right: 8px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon svg .stroke { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Hand-drawn routes */
.bend-handle { fill: var(--shape-fill); stroke: var(--select); stroke-width: 1.5; cursor: move; }
.bend-add { fill: var(--select); fill-opacity: .35; stroke: var(--select); stroke-width: 1; cursor: copy; }
.bend-add:hover, .bend-handle:hover { fill: var(--select); fill-opacity: .8; }

/* Reconnecting, guides, inserting into flows */
.end-handle { fill: var(--select); fill-opacity: .25; stroke: var(--select); stroke-width: 1.5; cursor: crosshair; }
.end-handle:hover { fill-opacity: .7; }
.guide { stroke: #e0457b; stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; vector-effect: non-scaling-stroke; }
.el-flow.insert-target .line { stroke: var(--ok); stroke-width: 3; }
.replace-menu { position: absolute; z-index: 20; min-width: 260px; max-height: 420px; overflow: auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, .15); padding: 6px; }
.replace-menu[hidden] { display: none; }
.replace-menu input { width: 100%; box-sizing: border-box; margin-bottom: 4px; padding: 6px 8px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit; }
.replace-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 4px 8px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; }
.replace-menu .replace-label { flex: 1; min-width: 0; }
.replace-menu .type-icon { width: 30px; height: 26px; flex: none; overflow: visible; pointer-events: none; }
.replace-group { margin: 8px 8px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.replace-group:first-child { margin-top: 2px; }
.replace-menu button:hover, .replace-menu button.active { background: var(--surface-2); }
.replace-menu button.current { font-weight: 600; }
.replace-menu button.current::after { content: ' ✓'; color: var(--ok); }
.arrange { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 14px; }
.arrange button { display: inline-flex; align-items: center; justify-content: center; padding: 6px; }
.arrange svg { width: 22px; height: 22px; }
.arrange svg .stroke { fill: none; stroke: currentColor; stroke-width: 1.6; }
.arrange svg .fill { fill: currentColor; opacity: .35; }

/* Space tool, lasso, labels on the canvas */
.canvas.tool-space { cursor: col-resize; }
.canvas.tool-lasso { cursor: crosshair; }
.space-line { stroke: var(--select); stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.space-band { fill: var(--ok); fill-opacity: .12; pointer-events: none; }
.space-band.closing { fill: var(--danger); fill-opacity: .12; }
.lasso-free { fill-rule: evenodd; }
.canvas:not(.read-only) .el-shape .label[data-label-for], .canvas:not(.read-only) .el-flow .label[data-label-for] { pointer-events: auto; cursor: move; }
.label-editing .label, .label-editing .swim-label { visibility: hidden; }
.el-shape.search-hit .body, .el-shape.search-hit .swim-body { stroke: #e5a100; stroke-width: 3; }
.el-flow.search-hit .line { stroke: #e5a100; stroke-width: 3; }

/* Search */
.search-panel { position: absolute; z-index: 15; top: 10px; right: 10px; width: 320px; max-width: calc(100% - 20px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / .15); padding: 8px; }
.search-panel[hidden] { display: none; }
.search-panel input { width: 100%; box-sizing: border-box; padding: 7px 9px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit; }
.search-count { display: block; font-size: 12px; color: var(--text-muted); margin: 4px 2px; min-height: 1em; }
.search-count:empty { display: none; }
.search-results { max-height: 320px; overflow: auto; }
.search-hit-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0;
    padding: 6px 8px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; gap: 1px; }
.search-hit-row:hover, .search-hit-row.active { background: var(--surface-2); }
.hit-name { font-weight: 550; overflow-wrap: anywhere; }
.hit-meta { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }

/* Overview */
.minimap { position: absolute; z-index: 4; right: 12px; bottom: 12px; width: 220px; height: 140px; box-sizing: content-box;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgb(0 0 0 / .12); overflow: hidden; }
.minimap[hidden] { display: none; }
.minimap-svg { display: block; cursor: pointer; touch-action: none; }
.minimap .mm { fill: var(--shape-fill); stroke: var(--text-muted); stroke-width: .8; }
.minimap .mm-participant, .minimap .mm-lane { fill: none; stroke: var(--border); }
.minimap .mm-group { fill: none; stroke-dasharray: 2 2; }
.minimap .mm-activity { fill: var(--accent-soft); stroke: var(--accent); }
.minimap .mm-flow { fill: none; stroke: var(--text-muted); stroke-width: .6; opacity: .7; }
.minimap .mm-flow.mm-message { stroke-dasharray: 2 2; }
.minimap-view { fill: var(--select); fill-opacity: .08; stroke: var(--select); stroke-width: 1.5; }
@media (max-width: 700px) { .minimap { display: none; } }

/* Choreographies and conversations */
.el-shape .band { fill: var(--shape-fill); stroke: var(--shape-stroke); stroke-width: 1.2; }
.el-shape .band-shaded { fill: var(--band-shade); }
.el-shape .outline { fill: none; stroke: var(--shape-stroke); stroke-width: 1.6; pointer-events: none; }
.el-shape .outline.thick { stroke-width: 4; }
.el-shape.selected .outline { stroke: var(--select); stroke-width: 2.4; }
.el-shape .band-label { font-size: 11px; }
.el-shape .envelope { fill: var(--shape-fill); stroke: var(--shape-stroke); stroke-width: 1.2; }
.el-shape .envelope.band-shaded { fill: var(--band-shade); }
.el-shape .envelope-flap { fill: none; stroke: var(--shape-stroke); stroke-width: 1.2; }
.el-shape .message-link { fill: none; stroke: var(--shape-stroke); stroke-width: 1.2; stroke-dasharray: 2 3; }
.el-shape .message-label { font-size: 11px; }
.el-flow .conversation-link { stroke-width: 5; }
.el-flow .conversation-gap { fill: none; stroke: var(--canvas); stroke-width: 1.8; }
.el-flow.selected .conversation-link { stroke: var(--select); }
.bands { margin: 10px 0 14px; }
.band-row { border: 1px solid var(--border); border-radius: 6px; padding: 6px; margin-bottom: 6px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.band-row > * { min-width: 0; max-width: 100%; }
.band-row.initiating { border-color: var(--accent); }
.band-head { display: flex; gap: 4px; align-items: center; }
.band-head select { flex: 1; min-width: 0; }
.band-row input[type="text"] { width: 100%; box-sizing: border-box; }
.btn-small { padding: 2px 7px; min-width: 26px; }

/* Dropdown menus (Refactoring) */
.menu-wrap { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; width: 320px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / .15); padding: 6px; }
.dropdown-menu[hidden] { display: none; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: none; border: 0;
    padding: 7px 9px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--surface-2); }
.menu-item:disabled { cursor: default; color: var(--text-muted); }
.dropdown-menu .menu-heading { font-size: 0.72rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 8px 12px 2px; }
.menu-note { font-size: 12px; color: var(--text-muted); }

/* The data object filter (toolbar): a checkbox per data object, like the filter of a spreadsheet column */
.data-filter-menu { width: 260px; left: 0; right: auto; }
.data-filter-menu .menu-note { padding: 4px 12px 8px; margin: 0; }
.data-filter-search { width: 100%; box-sizing: border-box; margin: 6px 0; }
.data-filter-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 4px 0; }
.data-filter-item { display: flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; padding: 3px 9px; cursor: pointer; font-size: 13px; }
.data-filter-item[hidden] { display: none; }
.data-filter-item:hover { background: var(--surface-2); }
.data-filter-all { border-bottom: 1px solid var(--border); padding-bottom: 5px; margin-bottom: 3px; }
.data-filter-none { font-style: italic; }
.data-filter-count { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.data-filter-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
#btn-data-filter.filter-active { color: var(--accent); background: var(--surface-2); }
#btn-data-filter.filter-active .filter-funnel { fill: currentColor; }

/* Messages, signals, errors and escalations in the process panel */
.props .definition-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; }
.props .definition-add { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 12px; }
.el-flow .message-envelope rect, .el-flow .message-envelope path { fill: var(--surface); stroke: var(--text); stroke-width: 1.2; }
.el-flow .message-envelope path { fill: none; }
/* a message that answers (non-initiating): a grey envelope */
.el-flow .message-envelope.message-non-initiating rect { fill: var(--text-muted); }
.el-flow .message-envelope.message-non-initiating path { stroke: var(--surface); }
.el-flow .message-name { font-style: italic; }

/* AI settings */
.ai-provider h2 { display: flex; align-items: center; gap: 8px; }
.ai-provider label .small { display: block; margin-top: 4px; font-weight: 400; }
.ai-provider .row { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-models { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { font-size: 0.8rem; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ai-provider label input { font-weight: 400; }

/* Comments table: a pane over the lower part of the canvas */
.comments-table { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; height: 40%; min-height: 120px;
    display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 18px rgb(0 0 0 / .10); }
.comments-table[hidden] { display: none; }
body.comments-table-open .minimap { display: none; }
.comments-table .ct-resize { height: 6px; cursor: ns-resize; flex: none; margin-top: -3px; }
.comments-table .ct-toolbar { display: flex; align-items: center; gap: 10px; padding: 4px 12px 8px; flex-wrap: wrap; flex: none; }
.comments-table .ct-toolbar h2 { font-size: 0.95rem; margin: 0; }
.comments-table .ct-toolbar input[type=search] { flex: 0 1 260px; font: inherit; font-size: 0.85rem; padding: 4px 8px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.comments-table .ct-toolbar .btn:last-child { margin-left: auto; }
.comments-table .ct-scroll { overflow: auto; flex: 1; min-height: 0; padding: 0 12px 8px; }
.ct-table { width: 100%; font-size: 0.85rem; }
.ct-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.ct-table .ct-sort { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.ct-table tbody tr { cursor: pointer; }
.ct-table tbody tr:hover, .ct-table tbody tr:focus-visible { background: var(--surface-2); }
.ct-table .ct-body { max-width: 480px; white-space: pre-wrap; }
.ct-table .ct-reply .ct-body { padding-left: 20px; }
.ct-table .ct-resolved { color: var(--text-muted); }
.ct-table .ct-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; word-break: break-all; }
.ct-table .ct-time { white-space: nowrap; }
.ct-empty { padding: 0 12px; }
.ct-table th, .ct-table td { padding: 6px 10px; }
.document-badge { cursor: pointer; }
.document-badge .doc-badge-bg { fill: var(--surface); stroke: var(--border); }
.document-badge .doc-badge-clip { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }

/* Documents panel */
.documents-panel h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 18px 0 6px; }
.doc-upload { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; }
.doc-upload.drop { border-color: var(--accent); background: var(--accent-soft); }
.doc-upload .doc-file { font: inherit; font-size: 0.8rem; max-width: 100%; }
.doc-upload select, .doc-upload input[type=text] { font-size: 0.85rem; }
.doc-upload .btn { align-self: flex-start; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.doc .doc-name { font-weight: 600; word-break: break-word; }
.doc-audio { display: block; width: 100%; margin-top: 6px; }
.doc-transcribe-hint:empty { display: none; }
.doc-transcribe-hint { margin: 0; }
.doc-transcript-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.doc-transcript-line.ts-failed .doc-transcript-toggle { color: var(--danger); }
.ts-spinner { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
    animation: ts-spin 0.9s linear infinite; display: inline-block; margin-right: 4px; }
@keyframes ts-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ts-spinner { animation: none; } }
.doc-transcript-body { margin-top: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; }
.doc-transcript-body p { margin: 0 0 6px; }
.doc-transcript-text { white-space: pre-wrap; max-height: 320px; overflow: auto; font-size: 13px; line-height: 1.5; margin-bottom: 6px; }
.doc-transcript-edit { width: 100%; font: inherit; font-size: 13px; line-height: 1.5; resize: vertical; }
.ext-link::after { content: "\2197"; margin-left: 3px; font-size: .85em; opacity: .7; }
.doc-link-form { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.doc-link-form .doc-link-hint { margin: 0; }
.doc-url { color: var(--text-muted); word-break: break-all; }
.doc-edit { display: grid; gap: 6px; margin-top: 6px; }
.doc .doc-desc { margin: 0; font-size: 0.85rem; white-space: pre-wrap; }
.doc .doc-links { display: flex; flex-wrap: wrap; gap: 4px; }
.doc .doc-links .chip { font-family: inherit; display: inline-flex; align-items: center; gap: 2px; }
.doc .doc-links .chip.missing { opacity: .6; }
.doc .chip-x { border: 0; background: none; cursor: pointer; color: var(--text-muted); padding: 0 2px; font-size: 0.9rem; }
.doc .doc-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.side-tabs button { padding: 10px 6px; }

/* Assistant */
.side-tabs button { padding: 10px 2px; font-size: 0.8rem; min-width: 0; }
.side-tabs .count:not(:empty) { margin-left: 2px; }
.side { min-width: 0; }
.assistant-panel { display: flex; flex-direction: column; gap: 10px; }
.ai-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ai-head h2 { margin: 0; }
.ai-head > span.muted { margin-right: auto; }
.ai-head .btn { margin-left: 0; }
.ai-suggestions { display: flex; flex-direction: column; gap: 6px; }
.chip-button { text-align: left; font: inherit; font-size: 0.85rem; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); cursor: pointer; }
.chip-button:hover { border-color: var(--accent); }
.ai-log { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 80px; }
.ai-msg { padding: 8px 10px; border-radius: 10px; font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.ai-user { align-self: flex-end; max-width: 90%; background: var(--accent-soft); white-space: pre-wrap; }
.ai-bot { align-self: stretch; background: var(--surface-2); }
.ai-bot .ai-reply { white-space: pre-wrap; }
.ai-bot .link-button { font-weight: 550; }
.ai-error { background: var(--danger-soft); color: var(--danger); }
.ai-typing { animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .ai-typing { animation: none; } }
.ai-proposal { margin-top: 8px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.ai-proposal.open { border-color: var(--accent); }
.ai-changes { margin: 0 0 6px; padding-left: 20px; font-size: 0.85rem; }
.ai-changes li { margin: 2px 0; }
.ai-changes li.ai-failed { color: var(--text-muted); text-decoration: line-through; }
.ai-changes li.ai-failed div { text-decoration: none; color: var(--danger); display: block; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.ai-actions .btn { overflow-wrap: normal; }
.ai-compose { display: flex; flex-direction: column; gap: 6px; flex: none; }
.ai-compose textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.ai-compose .btn { align-self: flex-end; }
/* On the canvas while a proposal is shown */
.el-shape.ai-added .body, .el-shape.ai-added .swim-body { stroke: var(--ok); stroke-width: 3; }
.el-flow.ai-added .line { stroke: var(--ok); stroke-width: 2.5; }
.el-shape.ai-changed .body, .el-shape.ai-changed .swim-body { stroke: var(--accent); stroke-width: 3; }
.el-flow.ai-changed .line { stroke: var(--accent); stroke-width: 2.5; }
.ai-removed rect, .ai-removed line { fill: none; stroke: var(--danger); stroke-width: 2; stroke-dasharray: 6 4; }
.ai-removed text { fill: var(--danger); font-size: 11px; text-decoration: line-through; }
.ai-derive-start { align-self: flex-start; }
.ai-derive { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 0.85rem; flex: none; }
.ai-derive span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ai-picker h3 { margin: 0 0 6px; font-size: 1rem; }
.ai-picker h4 { margin: 12px 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.ai-doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-doc-list label { overflow-wrap: anywhere; }
.ai-questions { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ai-questions .chip-button { margin-top: 4px; font-size: 0.8rem; padding: 3px 8px; }
.ai-check { display: flex; flex-direction: column; gap: 8px; }
.ai-summary { margin: 0; }
.ai-stale { margin: 0; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); border-left: 3px solid var(--accent); }
.ai-sev { margin: 10px 0 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ai-sev-high { color: var(--danger); }
.ai-sev-medium { color: var(--text); }
.ai-sev-low { color: var(--text-muted); }
.ai-finding { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.ai-finding:hover, .ai-finding:focus-within, .ai-finding:focus { border-color: var(--accent); outline: none; }
.ai-finding.dismissed { opacity: .6; }
.ai-finding p { margin: 0; }
.ai-finding-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ai-finding .doc-links { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-finding .chip { font-family: inherit; cursor: pointer; }
.ai-finding .chip.missing { opacity: .6; text-decoration: line-through; cursor: default; }
.ai-finding blockquote { margin: 0; padding: 4px 8px; border-left: 3px solid var(--border); color: var(--text); font-style: italic; }
.ai-finding blockquote footer { font-style: normal; color: var(--text-muted); margin-top: 2px; }
.ai-finding blockquote.unverified { border-left-color: var(--danger); }
.ai-unverified { color: var(--danger); }

/* Roles and My processes */
.role-chips { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.role-chips.inline { display: inline-flex; margin: 0 6px; vertical-align: middle; }
.role-chips .chip { font-family: inherit; }
.role-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 0.8rem; padding: 1px 4px 1px 8px; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--border); margin: 0; }
.role-chip .chip-x { border: 0; background: none; cursor: pointer; color: var(--text-muted); padding: 0 2px; font-size: 0.9rem; }
.role-add { display: flex; gap: 4px; margin: 0; }
.role-add input[type=text] { min-width: 0; width: 12em; }
.roles-cell { min-width: 16em; }
.match-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }

/* Screen recordings */
.doc-upload-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-recording h3 { margin: 0; font-size: 0.95rem; }
.doc-recording progress { width: 100%; }
.doc-video { width: 100%; max-height: 240px; border-radius: 6px; background: #000; margin: 4px 0; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e0312f; vertical-align: middle; }
.rec-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.rec-bar .rec-dot { animation: rec-pulse 1.4s ease-in-out infinite; }
.rec-bar.paused .rec-dot { animation: none; background: var(--text-muted); }
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-bar .rec-dot { animation: none; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-self { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); }

/* AI usage */
.usage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.usage-months { display: flex; align-items: center; gap: 8px; }
.usage-months strong { min-width: 9.5em; text-align: center; }
.btn.disabled { opacity: 0.4; pointer-events: none; }
.usage-filter label, .usage-currency label { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.usage-filter select, .usage-currency select { font: inherit; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.usage-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.usage-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.usage-number { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.usage-chart { width: 100%; min-width: 540px; height: auto; display: block; }
.usage-grid line { stroke: var(--grid); stroke-width: 1; }
.usage-grid line.usage-baseline { stroke: var(--border); }
.usage-axis { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.usage-bar-mark { fill: var(--accent); pointer-events: none; }
.usage-hit { fill: transparent; }
.usage-day:hover .usage-hit { fill: var(--accent-soft); }
.usage-table-view { margin-top: 8px; }
.usage-table-view summary { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-currency { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.usage-prices input { width: 7em; font: inherit; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.panel .table-scroll, .usage-scroll { overflow-x: auto; }

/* Process portal */
.portal-search { display: flex; gap: 8px; margin: 0 0 24px; }
.portal-search input { flex: 1; font: inherit; font-size: 1.05rem; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); min-width: 0; }
.portal-section { margin-bottom: 28px; }
.portal-section h2 { font-size: 1.1rem; margin: 0 0 8px; }
.portal-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.portal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex;
    flex-direction: column; gap: 4px; min-width: 0; }
.portal-card-name { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
.portal-card .badge { align-self: flex-start; }
.portal-card-note { color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.portal-card .role-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.portal-group { margin-bottom: 10px; }
.portal-group summary { cursor: pointer; padding: 6px 0; }
.portal-group .portal-list { margin-top: 6px; }
.portal-note h2.small-heading { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 4px; }
.portal-note p { margin: 0; white-space: pre-wrap; }
.portal-confirm { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.portal-confirm form { margin: 0; }
.portal-diagram-section { margin: 16px 0 24px; }
.portal-diagram { height: min(60vh, 560px); min-height: 300px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.portal-diagram .canvas { flex: 1; min-height: 0; cursor: grab; touch-action: none; }
.portal-diagram .canvas .el-shape, .portal-diagram .canvas .el-flow { cursor: pointer; }
.portal-diagram-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.portal-planes { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.portal-hint { margin-left: auto; }
.portal-noscript { position: absolute; left: 12px; top: 12px; margin: 0; }
.portal-steps-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.portal-steps-head h2 { margin: 0 0 8px; }
.portal-lane-filter { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.portal-lane-filter select { font: inherit; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.portal-pool-title { font-size: 1rem; margin: 20px 0 8px; color: var(--text-muted); }
.portal-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
    scroll-margin-top: 80px; }
.portal-step.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.portal-step-head { display: flex; align-items: flex-start; gap: 12px; }
.portal-step-title { flex: 1; min-width: 0; }
.portal-step-title h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.portal-step-no { flex: none; min-width: 2.2em; height: 2.2em; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center;
    justify-content: center; font-weight: 600; font-size: 0.85rem; background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums; }
.portal-step.kind-event .portal-step-no { border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.portal-step.kind-gateway .portal-step-no { border-radius: 4px; background: var(--surface-2); color: var(--text); }
.portal-lane { font-family: inherit; }
.portal-doc { white-space: pre-wrap; margin: 8px 0 0; overflow-wrap: anywhere; }
.portal-messages, .portal-docs { margin: 8px 0 0; padding-left: 1.2em; }
.portal-docs video { display: block; max-width: 100%; margin-top: 6px; border-radius: 6px; background: #000; }
.portal-inner { margin: 10px 0 0 12px; padding-left: 12px; border-left: 2px solid var(--border); }
.portal-inner .portal-step { background: var(--bg); }
.portal-next { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.portal-feedback { margin-top: 8px; }
.portal-feedback summary { cursor: pointer; color: var(--accent); }
.portal-feedback form { margin-top: 8px; }
.portal textarea, .portal-manage textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
    color: var(--text); width: 100%; }
.portal-feedback-list { list-style: none; margin: 0; padding: 0; }
.portal-feedback-list li { border-bottom: 1px solid var(--border); padding: 10px 0; }
.portal-feedback-list li:last-child { border-bottom: 0; }
.portal-feedback-list li.done { opacity: 0.65; }
.portal-feedback-list form { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.portal-confirmations { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.portal-confirmations h3 { font-size: 0.95rem; margin: 0 0 6px; }
.portal-confirmations ul { margin: 0; padding-left: 1.2em; }
.portal-count { margin-left: 6px; background: var(--accent); color: var(--accent-ink); }
.portal-print-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.portal-handbook .portal-step { break-inside: avoid; }
@media print {
    .portal-print-bar, .topbar { display: none; }
    body.portal-print { background: #fff; color: #000; }
    .portal-handbook .portal-step { border-color: #bbb; background: #fff; }
    .portal-handbook a { color: inherit; text-decoration: none; }
    .page.portal-handbook { max-width: none; padding: 0; }
}
@media (max-width: 640px) {
    .portal-hint { display: none; }
    .portal-diagram { height: 50vh; }
    .portal-search .btn { padding-left: 12px; padding-right: 12px; }
    .portal-step-head { flex-wrap: wrap; }
    .portal-show { order: 3; flex-basis: 100%; justify-content: flex-start; text-align: left; padding: 0 0 0 calc(2.2em + 12px); border: 0; }
    .portal-inner { margin-left: 4px; padding-left: 8px; }
}

/* Approval designer (takes the side panel's place while open) */
.editor.designing { grid-template-columns: auto minmax(0, 1fr) 460px; }
.approval-designer-open { margin-top: 8px; }
.approval-panel { display: flex; flex-direction: column; padding: 0; }
.approval-panel[hidden] { display: none; }
.ad-head { padding: 14px 16px 8px; border-bottom: 1px solid var(--border); flex: none; }
.ad-title { display: flex; align-items: center; gap: 8px; }
.ad-title h2 { margin: 0; font-size: 1rem; }
.ad-title .btn { margin-left: auto; }
.ad-head p { margin: 4px 0 8px; }
.ad-steps { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.ad-steps li { flex: 1; min-width: 0; }
.ad-steps button { width: 100%; font: inherit; font-size: 0.75rem; padding: 5px 2px; border: none; border-bottom: 3px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-steps li.done button { border-bottom-color: var(--accent-soft); color: var(--text); }
.ad-steps li.current button { border-bottom-color: var(--accent); color: var(--text); font-weight: 650; }
.ad-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; font-size: 0.9rem; }
.ad-body > p:first-child { margin-top: 0; }
.ad-body .field { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 0.85rem; margin-bottom: 14px; }
.ad-body .field input, .ad-body .field select { font-weight: 400; width: 100%; box-sizing: border-box; }
.ad-body h3 { font-size: 0.8rem; margin: 16px 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ad-nav { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); flex: none; }
.ad-nav .btn:first-child { margin-right: auto; }
.ad-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ad-approver { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; gap: 6px; margin-bottom: 6px; }
.ad-approver input { font-weight: 400; min-width: 0; }
.ad-approver-head { margin: 4px 0 2px; font-weight: 500; }
.ad-question { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 4px; margin: 0 0 10px; }
.ad-question legend { font-weight: 600; padding: 0 4px; }
.ad-question .check { margin: 5px 0; font-size: 0.88rem; align-items: flex-start; }
.ad-forces { margin-bottom: 4px; }
.ad-category { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 10px; }
.ad-category > p { margin: 0 0 6px; }
.ad-off { font-style: italic; }
.ad-addons { margin: 8px 0 4px; }
.ad-option { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; background: var(--surface); }
.ad-option.chosen { border-color: var(--accent); background: var(--accent-soft); }
.ad-option.unsuitable:not(.chosen) { opacity: 0.7; }
.ad-choice { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ad-name { font-weight: 600; flex: 1; }
.ad-verdict { font-size: 0.7rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.ad-verdict.recommended { background: var(--ok-soft); color: var(--ok); }
.ad-verdict.unsuitable { background: var(--danger-soft); color: var(--danger); }
.ad-more summary { cursor: pointer; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.ad-reasons { list-style: none; padding: 0; margin: 6px 0; font-size: 0.83rem; }
.ad-reasons li { display: flex; gap: 6px; margin-bottom: 3px; }
.ad-sign { width: 14px; flex: none; font-weight: 700; text-align: center; }
.ad-reasons .pro .ad-sign { color: var(--ok); }
.ad-reasons .con .ad-sign { color: var(--danger); }
.ad-pattern { font-size: 0.83rem; border-left: 3px solid var(--border); padding-left: 8px; margin: 6px 0 2px; }
.ad-pattern p { margin: 3px 0; }
.ad-problems { list-style: none; padding: 0; margin: 12px 0; font-size: 0.85rem; }
.ad-problems li, .ad-problems span { display: block; padding: 6px 10px; border-radius: 6px; margin-bottom: 6px; }
.ad-problems .error { background: var(--danger-soft); color: var(--danger); }
.ad-problems .warning { background: var(--surface-2); color: var(--text); border-left: 3px solid #d08a1a; }
.ad-ok { color: var(--ok); margin: 12px 0; }
.ad-chosen, .ad-tasks { margin: 0 0 8px; padding-left: 18px; }
@media (max-width: 1100px) { .editor.designing { grid-template-columns: auto minmax(0, 1fr) 380px; } }
.ad-body input[type=radio], .ad-body input[type=checkbox] { width: auto; margin: 0; flex: none; }
.ad-choice { flex-direction: row; text-align: left; font-weight: 400; margin: 0; }
.ad-question .check input { margin-right: 4px; }

/* The error handling assistant's dialog (the steps look like the side panel's designers) */
.eh-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.eh-dialog[open] { display: flex; flex-direction: column; }
.eh-dialog::backdrop { background: rgb(0 0 0 / .35); }
.eh-dialog .ad-body { min-height: 180px; }
.eh-ways { display: grid; gap: 10px; margin: 12px 0; }
.eh-way { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); cursor: pointer; }
.eh-way:hover, .eh-way:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.eh-current { padding: 6px 10px; border-radius: 6px; background: var(--surface-2); }
.eh-one { padding: 10px 14px 8px; }
.eh-one legend { font-size: 1rem; }
.eh-hint { display: block; margin-top: 2px; font-weight: 400; }
.eh-output, .eh-property { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-weight: 400; }
.eh-output input, .eh-property input { margin-top: 3px; }

/* Error handling marks on activities (toolbar toggle) */
.error-mark { cursor: pointer; }
.error-mark .eh-bg { stroke-width: 1.2; }
.error-mark .eh-bolt { stroke: none; }
.error-mark .eh-strike { stroke: var(--text-muted); stroke-width: 1.6; stroke-linecap: round; }
.eh-handled .eh-bg { fill: var(--ok-soft); stroke: var(--ok); }
.eh-handled .eh-bolt { fill: var(--ok); }
.eh-ignored .eh-bg { fill: var(--surface-2); stroke: var(--border); }
.eh-ignored .eh-bolt { fill: var(--text-muted); }
.eh-open .eh-bg { fill: #fff3dc; stroke: #c27a00; }
.eh-open .eh-bolt { fill: #c27a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eh-open .eh-bg { fill: #3a2c10; stroke: #f0b54a; } :root:not([data-theme="light"]) .eh-open .eh-bolt { fill: #f0b54a; } :root:not([data-theme="light"]) .eh-state.open { background: #3a2c10; color: #f3cf7a; } }
.eh-overview ul { list-style: none; padding: 0; margin: 6px 0 10px; font-size: 0.88rem; }
.eh-overview li { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.eh-overview li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eh-state { font-size: 0.7rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.eh-state.handled { background: var(--ok-soft); color: var(--ok); }
.eh-state.ignored { background: var(--surface-2); color: var(--text-muted); }
.eh-state.open { background: #fff3dc; color: #8a5600; }
.eh-overview .btn { padding: 1px 8px; font-size: 0.8rem; }
.eh-summary { margin: 4px 0 10px; }
.props .eh-open { margin-bottom: 14px; }

/* Live co-editing: people in the model, their selections, locks and drags, following */
.presence { display: flex; align-items: center; gap: 0; margin-left: 4px; }
.presence.is-offline { opacity: 0.55; }
.presence .avatar { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; color: #fff;
    font: 650 0.72rem var(--font); display: inline-grid; place-items: center; cursor: pointer; padding: 0; position: relative; }
.presence .avatar:first-child { margin-left: 0; }
.presence .avatar.is-editing::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%;
    background: var(--ok); border: 2px solid var(--surface); }
.presence .avatar.is-following { outline: 2px solid var(--text); outline-offset: 1px; z-index: 1; }
/* an AI agent (MCP client) working in the model: a rounded square with a small "AI" badge */
.presence .avatar.is-agent { border-radius: 7px; }
.presence .avatar.is-agent::before { content: "AI"; position: absolute; left: -3px; top: -5px; padding: 0 3px; border-radius: 4px;
    background: var(--text); color: var(--surface); font-size: 8px; font-weight: 700; line-height: 11px; letter-spacing: .02em; }
.follow-banner .follow-status { color: var(--text-muted); font-style: italic; }
.presence .avatar-more { background: var(--surface-2); color: var(--text-muted); cursor: default; }
.layer-peers { pointer-events: none; }
.peer-select { fill: none; stroke-width: 1.6; stroke-dasharray: 4 3; }
.peer-lock { fill: none; stroke-width: 3; }
.peer-ghost { fill-opacity: 0.08; stroke-width: 1.6; stroke-dasharray: 6 4; }
.peer-tag-text { fill: #fff; font: 600 10.5px var(--font); }
.follow-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 2px solid var(--accent);
    border-radius: 999px; padding: 4px 6px 4px 14px; font-size: 0.85rem; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); z-index: 5; display: flex; align-items: center; gap: 6px; }
.follow-banner .btn { padding: 2px 10px; }

/* Image export (export-dialog.js) */
.export-menu { display: inline-block; }
.export-menu > summary { cursor: pointer; }
.export-menu .dropdown-menu { width: 280px; }
.export-dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px;
    background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.export-dialog::backdrop { background: rgb(0 0 0 / .35); }
.export-dialog h2 { margin: 0 0 14px; font-size: 1.1rem; }
.export-group { border: 0; padding: 0; margin: 0 0 14px; }
.export-group legend { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; padding: 0; }
.export-group .check { margin: 4px 0; }
.export-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 0 24px; font-size: 0.9rem; }
.export-row label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.export-note { background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin: 0 0 12px; }
ul.export-note { padding-left: 26px; }
.export-error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 8px 10px; margin: 0 0 12px; font-size: 0.9rem; }
.export-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.export-actions > span { margin-right: auto; }
.export-dialog select { font-weight: 400; }
.export-dialog .field { margin-bottom: 14px; }

/* ---------- audit log ---------- */
input[type=date], input[type=search] { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.audit-exports { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.audit-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0 8px; }
.audit-filter label { font-size: 0.85rem; }
.audit-search { flex: 1 1 200px; }
.audit-filter-actions { display: flex; gap: 6px; }
.audit-scroll { overflow-x: auto; }
.audit-table td { vertical-align: top; font-size: 0.9rem; }
.audit-table .num { text-align: right; }
.audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-kind { margin-bottom: 2px; }
.audit-access .audit-kind { background: var(--accent-soft); color: var(--accent); }
.audit-delete .audit-kind { background: var(--danger-soft); color: var(--danger); }
.audit-publish .audit-kind { background: var(--ok-soft); color: var(--ok); }
.audit-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 0.85rem; }
.audit-details dt { color: var(--text-muted); }
.audit-details dd { margin: 0; overflow-wrap: anywhere; }
.audit-pages { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.audit-head { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 12px 0; }
.audit-head dd { margin: 0; overflow-wrap: anywhere; }
#integrity { margin-top: 24px; }

.audit-filter input, .audit-filter select { height: 38px; box-sizing: border-box; }
@media (max-width: 720px) {
    /* The top bar's links scroll sideways instead of widening the page (with the Audit log link it no longer fits). */
    .topbar { flex-wrap: wrap; }
    .topnav { order: 3; flex: 1 0 100%; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
    /* Audit entries as cards. */
    .audit-table, .audit-table tbody, .audit-table tr, .audit-table td { display: block; width: auto; }
    .audit-table thead { display: none; }
    .audit-table tr { border-bottom: 1px solid var(--border); padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
    .audit-table td { border: 0; padding: 0; }
    .audit-table td:nth-child(1) { grid-row: 1 / span 2; }
    .audit-table td:nth-child(n+3) { grid-column: 2; }
    .audit-table td:nth-child(6) { margin-top: 4px; }
    .audit-exports { margin-left: 0; }
}

/* ---------- scenarios (traces and test cases) ---------- */
.scenario-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 22px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.scenario-dialog::backdrop { background: rgb(0 0 0 / .35); }
.scenario-dialog h2 { margin: 0 0 8px; font-size: 1.1rem; }
.scenario-dialog h3 { margin: 16px 0 6px; font-size: 0.95rem; }
.scenario-dialog h4 { margin: 10px 0 4px; font-size: 0.85rem; color: var(--text-muted); }
.scenario-dialog .field { margin: 0 0 14px; }
.scenario-max > span { font-weight: 400; }
.scenario-dialog input[type=number] { width: 7em; font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.scenario-existing { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.scenario-list { margin: 0; padding-left: 20px; max-height: 220px; overflow: auto; }
.scenario-list li { margin: 2px 0; overflow-wrap: anywhere; }
.scenario-preview { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.scenario-preview h3 { margin-top: 0; }
.scenario-process { margin: 4px 0; }
.scenario-process .export-note { margin: 4px 0 0; background: transparent; padding: 0 0 0 18px; }
.scenario-stale { color: var(--warn-text, #7a5300); }
.scenario-banner { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; background: var(--accent-soft); color: var(--text); }

/* ---------- diagram types ---------- */
.new-model-form { display: grid; gap: 10px; grid-column: 1 / -1; }
.diagram-type-choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 600px) { .diagram-type-choice { grid-template-columns: 1fr; } }
.diagram-type-choice legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.diagram-type-card { display: grid; grid-template-columns: auto 48px 1fr; align-items: center; gap: 10px; font-weight: 400;
    border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: var(--surface); }
.diagram-type-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.diagram-type-card:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.diagram-type-card svg { width: 48px; height: 24px; fill: none; stroke: var(--text); stroke-width: 1.4; }
.diagram-type-card > span { display: flex; flex-direction: column; gap: 2px; }
.diagram-type-badge { border: 0; cursor: pointer; font: inherit; font-size: 0.75rem; font-weight: 600; }
.diagram-type-badge:hover { background: var(--accent-soft); color: var(--accent); }
.diagram-type-field { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.diagram-type-field p { margin: 6px 0 0; }
.diagram-type-field details { margin-top: 6px; }

/* Token simulation (simulation-ui.js): the panel takes the side panel's place; tokens and buttons on the canvas */
.editor.simulating { grid-template-columns: 0 minmax(0, 1fr) 400px; }
.editor.simulating .palette { visibility: hidden; width: 0 !important; min-width: 0; padding: 0; border: 0; overflow: hidden; }
#btn-simulate.active { background: var(--accent-soft); color: var(--accent); }
.simulation-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; overflow: auto; }
.simulation-panel[hidden] { display: none; }
.sim-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sim-head h2 { font-size: 1.05rem; margin: 0; }
.sim-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sim-controls select { margin-left: auto; }
.sim-section h3 { font-size: 0.9rem; margin: 6px 0 4px; }
.sim-waiting, .sim-instances, .sim-problems { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sim-waiting li { display: grid; gap: 4px; }
.sim-options { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-act { text-align: left; white-space: normal; border: 1px solid var(--border); }
.sim-instances li { display: flex; align-items: center; gap: 8px; }
.sim-instances li > span:nth-child(2) { flex: 1; }
.sim-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sim-problem-item { border-left: 3px solid var(--danger); padding: 4px 8px; background: var(--danger-soft); border-radius: 4px; font-size: 0.85rem; }
.sim-problem-item.sim-problem-unreachable, .sim-problem-item.sim-problem-synchronization { border-left-color: #d9822b; background: var(--surface-2); }
.sim-problem-item .linklike, .sim-log .linklike { text-align: left; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline dotted; }
.check.inline { display: inline-flex; gap: 4px; align-items: center; }
.sim-log-section { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.sim-log { margin: 0; padding: 0 0 0 1.6em; overflow: auto; max-height: 40vh; font-size: 0.82rem; display: grid; gap: 2px; }
.sim-log-problem { color: var(--danger); }
.sim-log-decision, .sim-log-trigger { font-weight: 600; }
.sim-log-message { color: var(--accent); }
.sim-changed { font-size: 0.85rem; }
.layer-sim { pointer-events: none; }
.sim-token circle { stroke: #fff; stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.sim-token text { fill: #fff; font-size: 10px; font-weight: 700; }
.sim-ring { fill: none; stroke-width: 3; stroke-dasharray: 6 4; }
.sim-ring.sim-waiting { stroke: #d9822b; animation: sim-dash 1.2s linear infinite; }
.sim-ring.sim-deciding { stroke: var(--accent); animation: sim-dash 1.2s linear infinite; }
.sim-ring.sim-joining { stroke: #868e96; }
@keyframes sim-dash { to { stroke-dashoffset: -20; } }
.sim-button { pointer-events: all; cursor: pointer; }
.sim-button rect { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)); }
.sim-button text { fill: var(--accent); font-size: 11px; font-weight: 600; }
.sim-button:hover rect { fill: var(--accent); }
.sim-button:hover text { fill: var(--accent-ink); }
.sim-button.sim-start rect { stroke: var(--ok); }
.sim-button.sim-start text { fill: var(--ok); }
.sim-button.sim-start:hover rect { fill: var(--ok); }
.sim-button.sim-trigger rect { stroke: #d9822b; }
.sim-button.sim-trigger text { fill: #b5651d; }
.sim-button.sim-trigger:hover rect { fill: #d9822b; }
.sim-button.sim-chosen rect { fill: var(--accent-soft); }
.sim-button.sim-go rect { fill: var(--accent); }
.sim-button.sim-go text { fill: var(--accent-ink); }
.sim-message rect { fill: var(--surface); stroke: var(--shape-stroke); stroke-width: 1.2; }
.sim-message path { fill: none; stroke: var(--shape-stroke); stroke-width: 1.2; }
.sim-problem { fill: none; stroke: var(--danger); stroke-width: 3; }
.sim-problem-unreachable, .sim-problem-synchronization { stroke: #d9822b; }
.sim-missed { fill: none; stroke: #868e96; stroke-width: 2; stroke-dasharray: 3 3; }
.sim-missed-flow { fill: none; stroke: #868e96; stroke-width: 6; stroke-opacity: 0.35; }
.sim-offer { top: 54px; }
@media (max-width: 1100px) { .editor.simulating { grid-template-columns: 0 minmax(0, 1fr) 340px; } }
@media (max-width: 800px) {
    .editor.simulating { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 42vh; }
    .editor.simulating .side { display: flex; grid-column: 1 / -1; border-top: 1px solid var(--border); }
}
.sim-starts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }

/* Metadata (metadata-panel.js; admin page metadata.html) */
.metadata-panel { display: flex; flex-direction: column; gap: 10px; }
.metadata-panel[hidden] { display: none; }
.meta-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.meta-head h2 { margin: 0; font-size: 1rem; }
.meta-section { border-top: 1px solid var(--border); padding-top: 8px; display: grid; gap: 8px; }
.meta-section h3 { margin: 0; font-size: 0.92rem; }
.meta-section h4 { margin: 4px 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.meta-fields { display: grid; gap: 10px; }
.meta-field { display: grid; gap: 3px; }
.meta-field label { display: block; font-weight: 600; font-size: 0.86rem; }
.meta-field input, .meta-field select { width: 100%; }
.meta-field.has-problem input, .meta-field.has-problem select, .meta-custom-row.has-problem input:first-child { border-color: var(--danger); }
.meta-required { color: var(--danger); }
.meta-problem { color: var(--danger); }
.meta-missing { color: #b5651d; }
.meta-help:empty { display: none; }
.meta-value { padding: 2px 0; }
.meta-custom { display: grid; gap: 6px; }
.meta-custom-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 4px; align-items: center; }
.meta-custom-row .meta-problem { grid-column: 1 / -1; }
.meta-custom-row > span.meta-custom-key { font-weight: 600; }
.meta-add { justify-self: start; }
.meta-stale ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.meta-stale li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; background: var(--surface-2); border-radius: 4px; padding: 4px 6px; font-size: 0.85rem; }
.side-tabs { flex-wrap: wrap; }
.side-tabs button { flex: 1 1 auto; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.metadata-table .metadata-order form { display: flex; gap: 2px; }
.metadata-table tr.is-editing { background: var(--accent-soft); }
.metadata-actions { white-space: nowrap; }
.metadata-actions details { display: inline-block; position: relative; }
.metadata-actions details[open] form { position: absolute; right: 0; z-index: 3; width: 260px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); white-space: normal; }
.metadata-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.metadata-target-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.metadata-target-group { display: grid; gap: 2px; align-content: start; }
.metadata-targets { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.metadata-form textarea { width: 100%; font: inherit; }
.metadata-form input, .metadata-form textarea, .metadata-form select { font-weight: 400; }
@media (max-width: 640px) { .metadata-table th:nth-child(4), .metadata-table td:nth-child(4) { display: none; } }

/* Dragging new elements from the palette and the context pad (drop.js) */
.palette .tool, .context-pad .pad-draggable { touch-action: none; }
.context-pad .pad-draggable { cursor: grab; }
.dragging-new, .dragging-new * { cursor: copy !important; }
.dragging-new .canvas.drop-refused, .dragging-new .canvas.drop-refused * { cursor: no-drop !important; }
.drop-ghost { opacity: 0.55; pointer-events: none; } /* a preview: the pointer finds what is under it */
.drop-ghost .body, .drop-ghost .line { stroke: var(--accent); }
.drop-target .body { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 4; fill: var(--accent-soft); fill-opacity: 0.45; }
.drop-problem rect:first-child { fill: var(--danger-soft); fill-opacity: 0.6; stroke: var(--danger); stroke-width: 2; stroke-dasharray: 6 4; }
.drop-problem .cross { stroke: var(--danger); stroke-width: 2; }
.drop-problem-bg { fill: var(--surface); stroke: var(--danger); stroke-width: 1; }
.drop-problem-text { fill: var(--danger); font: 12px var(--font); }
.layer-overlay .drop-problem { pointer-events: none; }

/* ---------- modeling conventions ---------- */
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.conventions-actions { white-space: nowrap; }
.conventions-actions details { display: inline-block; }
.conventions-actions details[open] { display: block; white-space: normal; }
.convention-editor .side-tabs { margin-bottom: 12px; }
.convention-editor .panel { margin-bottom: 16px; }
.convention-editor .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.convention-editor .field > span:first-child { font-weight: 600; font-size: 0.85rem; }
.convention-editor select[multiple] { min-width: 14rem; }
.rule-row { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.rule-row > .field { flex: 1 1 14rem; }
.rule-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.rule-card.area-layout { border-left: 4px solid var(--accent); }
.rule-card.area-naming { border-left: 4px solid var(--ok); }
.rule-card.area-structure { border-left: 4px solid var(--text-muted); }
.rule-card.area-elements, .rule-card.area-properties { border-left: 4px solid var(--accent-soft); }
.rule-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-head .rule-tools { margin-left: auto; display: flex; gap: 4px; }
.rule-params { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-start; }
.rule-params > * { flex: 1 1 14rem; }
.selector { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-start; }
.selector > .field { flex: 1 1 14rem; }
.selector .where { flex: 1 1 100%; }
.where-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 4px 16px; margin-top: 8px; }
fieldset.nested { border: 1px dashed var(--border); border-radius: 6px; padding: 6px 10px; margin: 0 0 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.json-edit { width: 100%; font-size: 0.8rem; }
.save-bar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0; background: var(--bg, var(--surface)); border-top: 1px solid var(--border); }
.inherited table { width: 100%; }
.waive-form textarea { width: 100%; }
@media (max-width: 640px) {
    .rule-head .rule-tools { margin-left: 0; }
    .convention-editor select[multiple] { min-width: 0; width: 100%; }
}
.inherited table { table-layout: fixed; }
.inherited td { overflow-wrap: anywhere; }
.inherited td select, .rule-card select:not([multiple]) { max-width: 100%; }
.inherited th:nth-child(2) { width: 3rem; }
.inherited th:nth-child(3) { width: 40%; }

/* ---------- side panel: width and folding categories ---------- */
.side-resizer { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; touch-action: none; }
.side-resizer::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
.side-resizer:hover::after, .side-resizer:focus-visible::after, body.side-resizing .side-resizer::after { background: var(--accent); }
.side-resizer:focus-visible { outline: none; }
body.side-resizing { cursor: col-resize; user-select: none; }
body.side-resizing #canvas { pointer-events: none; }
.fold-toggle { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; width: 100%; cursor: pointer;
    user-select: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.fold-toggle::before { content: ""; flex: none; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid currentColor; transition: transform .15s; }
.foldable.is-folded .fold-toggle::before { transform: rotate(-90deg); }
.fold-toggle:hover { color: var(--text); }
.fold-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.fold-hidden { display: none !important; }

/* ---------- rule-check findings in the comments table ---------- */
.ct-finding .ct-body .badge { margin-right: 4px; }
.ct-finding.ct-sev-high td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.ct-finding.ct-sev-medium td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ct-finding.ct-sev-low td:first-child { box-shadow: inset 3px 0 0 var(--border); }
.ai-finding.flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color .4s; }

/* ---------- process map ---------- */
.page.page-wide { max-width: 1600px; }
.view-switch { display: inline-flex; gap: 2px; padding: 2px; margin: 0 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.view-tab { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 6px; cursor: pointer; }
.view-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.pmap { display: grid; gap: 8px; }
.pmap-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pmap-group { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pmap-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 32px; border: 0; border-radius: 6px;
    background: transparent; color: var(--text-muted); cursor: pointer; list-style: none; }
.pmap-btn::-webkit-details-marker { display: none; }
.pmap-btn:hover { background: var(--surface-2); color: var(--text); }
.pmap-btn.on, .pmap-btn[aria-checked="true"], .pmap-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.pmap-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pmap-export { position: relative; }
.pmap-export-body { right: 0; left: auto; display: grid; gap: 2px; min-width: 170px; }
.pmap-export-body .btn { justify-content: flex-start; text-align: left; }
.pmap-status:empty, .pmap-legend:empty { display: none; }
.pmap-status { margin: 0; }
.pmap-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.pmap-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pmap-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.pmap-swatch-external { border: 1.5px dashed var(--text-muted); }
.pmap-scroll { overflow: auto; max-height: calc(100vh - 220px); min-height: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.pmap-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pmap-svg { display: block; }
.pmap-svg a, .pmap-svg a:hover { text-decoration: none; }
.pmap-svg a:hover .pmap-area-name { text-decoration: underline; }
.pmap-bands { display: grid; gap: 8px; max-width: 560px; }
.pmap-bands h3 { margin: 0; }
.pmap-band-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pmap-band-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
    .pmap-scroll { max-height: none; min-height: 240px; padding: 4px; }
    .pmap-btn { width: 32px; }
}

/* ---------- the others' mouse pointers (live co-editing) ---------- */
.layer-cursors { pointer-events: none; }
.peer-cursor { transition: transform 110ms linear, opacity 300ms ease; }
.peer-cursor.is-idle { opacity: .4; }
.peer-cursor-arrow { stroke: #ffffff; stroke-width: 1.3; stroke-linejoin: round; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.peer-cursor-name { fill: #ffffff; font: 600 11px/1 var(--font); }
.peer-cursor.is-idle .peer-cursor-tag { display: none; }
@media (prefers-reduced-motion: reduce) { .peer-cursor { transition: none; } }
.presence-cursors { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-left: 4px;
    border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-muted); cursor: pointer; padding: 0; }
.presence-cursors svg { width: 15px; height: 15px; fill: currentColor; }
.presence-cursors.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- the design space: phase rail, phase lenses, command palette ---------- */
.design-space { flex: 1; min-height: 0; display: flex; }
.design-space > .editor { flex: 1; min-width: 0; }
.phase-rail { flex: none; width: 76px; display: flex; flex-direction: column; gap: 2px; padding: 8px 6px;
    background: var(--surface-2); border-right: 1px solid var(--border); overflow-y: auto; }
.phase-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text-muted); font: 600 11px/1.15 var(--font); cursor: pointer; text-align: center; position: relative; }
.phase-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.phase-btn:hover { background: var(--surface); color: var(--text); }
.phase-btn.active { background: var(--accent-soft); color: var(--accent); }
.phase-btn.active::before { content: ""; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.phase-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.editor-actions > [hidden], .side-tabs button[hidden] { display: none !important; }
.editor.no-palette .palette { visibility: hidden; width: 0 !important; min-width: 0; padding: 0; border: 0; overflow: hidden; }
@media (max-width: 800px) {
    .design-space { flex-direction: column; }
    .phase-rail { width: auto; flex-direction: row; padding: 4px 6px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; }
    .phase-btn { flex: 1 0 auto; min-width: 58px; padding: 5px 6px; }
    .phase-btn svg { width: 18px; height: 18px; }
    .phase-btn.active::before { left: 10px; right: 10px; top: auto; bottom: -4px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
    .design-space > .editor { min-height: 0; }
}

/* Overview and Release sections */
.overview-panel h2, .release-panel h2 { margin: 0 0 4px; }
.ov-cards { display: grid; gap: 10px; margin-top: 10px; }
.ov-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); display: grid; gap: 4px; }
.ov-card h3 { margin: 0; font-size: 0.95rem; }
.ov-lines { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; display: grid; gap: 2px; }
.ov-lines .muted { color: var(--text-muted); }
.ov-warn { color: var(--danger); font-weight: 600; }
.ov-ok { color: var(--ok); }
.ov-attention { color: var(--accent); font-weight: 600; }
.ov-go { justify-self: start; margin-left: -8px; }
.ov-people { margin-top: 10px; }
.release-block { margin-top: 12px; }
.release-block h3 { margin: 0 0 6px; font-size: 0.95rem; }
.release-versions { margin: 0 0 6px; padding-left: 1.2em; font-size: 0.85rem; display: grid; gap: 3px; }

/* The command palette (Ctrl+K) */
.cmd-overlay { position: fixed; inset: 0; background: rgba(15, 18, 25, .35); z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmd-box { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 48px rgba(0, 0, 0, .25); overflow: hidden; }
.cmd-input { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; font: inherit; font-size: 1rem; background: transparent; color: var(--text); outline: none; }
.cmd-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.cmd-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.cmd-item.active { background: var(--accent-soft); color: var(--accent); }
.cmd-hint { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.cmd-empty { padding: 10px; color: var(--text-muted); font-size: 0.9rem; }
/* On small screens the side panel is hidden while modeling; the other phases show it under the diagram. */
@media (max-width: 800px) {
    body:not([data-phase="model"]) .editor:not(.simulating) { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 46vh; }
    body:not([data-phase="model"]) .editor:not(.simulating) .side { display: flex; grid-column: 1 / -1; border-top: 1px solid var(--border); }
    body[data-phase="overview"] .editor:not(.simulating), body[data-phase="release"] .editor:not(.simulating) { grid-template-rows: 30vh minmax(0, 1fr); }
}
@media (max-width: 800px) {
    /* Model on a phone: the palette and the diagram; the side panel is not shown (as before the phases) */
    body[data-phase="model"] .editor:not(.simulating):not(.designing) .side { display: none; }
}
.side-tabs [data-tab="overview"], .side-tabs [data-tab="release"] { order: -1; }

/* ---------- the Overview page (design-overview.js) ---------- */
.overview-page { flex: 1; min-width: 0; overflow: auto; background: var(--bg); }
.overview-page[hidden], .editor[hidden] { display: none !important; }
.ovp { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; display: grid; gap: 18px; }
.ovp-head { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; }
.ovp-head h1 { margin: 0; font-size: 1.6rem; }
.ovp-head p { margin: 2px 0 0; }
.ovp-kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0; }
.ovp-error { margin: 0; }
.ovp-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.ovp-main, .ovp-aside { display: grid; gap: 18px; min-width: 0; }
.ovp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.ovp-card h2 { margin: 0; font-size: 1.05rem; }
.ovp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ovp-stage { display: grid; gap: 4px; justify-items: end; }
.stage-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.stage-step > button, .stage-step > span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: 600 .85rem/1 var(--font); cursor: default; }
.stage-step > button { cursor: pointer; }
.stage-step > button:hover { border-color: var(--accent); color: var(--text); }
.stage-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: .75rem; }
.stage-step.passed > * { color: var(--ok); }
.stage-step.passed .stage-dot { background: var(--ok-soft); }
.stage-step.current > * { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stage-step.current .stage-dot { background: rgba(255, 255, 255, .25); }
.stage-hint { margin: 0; }
.brief-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.brief-part h3 { margin: 10px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.brief-text { margin: 0; white-space: pre-wrap; }
.brief-people { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; }
.brief-roles { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0 0; }
.brief-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.brief-table th, .brief-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.brief-table th { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.brief-milestones { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.ms-date { display: inline-block; min-width: 7.5em; color: var(--text-muted); }
.ms-tag { margin-left: 6px; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.ms-overdue .ms-tag { background: var(--danger-soft); color: var(--danger); }
.ms-next .ms-tag { background: var(--accent-soft); color: var(--accent); }
.ms-done { color: var(--text-muted); text-decoration: line-through; }
.ms-done .ms-tag { background: var(--ok-soft); color: var(--ok); text-decoration: none; }
.brief-form .brief-field { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; margin-top: 8px; }
.brief-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-weight: 400; resize: vertical; }
.brief-rows { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.brief-rows legend { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.brief-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.brief-row input[type="text"] { flex: 1 1 140px; min-width: 0; }
.brief-row input[type="date"] { flex: 0 1 160px; }
.done-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.done-fill { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.done-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.done-row { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.done-mark { flex: none; width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--border); font-size: .7rem; font-weight: 700; color: var(--text-muted); }
.done-ok .done-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.done-unknown .done-mark { border-style: dashed; }
.done-ok .done-text { color: var(--text-muted); }
.done-text { flex: 1; min-width: 0; }
.done-tools { display: inline-flex; gap: 6px; flex: none; }
.done-add { display: flex; gap: 6px; margin-top: 8px; }
.done-add input { flex: 1; min-width: 0; }
.done-off { margin-top: 8px; }
.done-off ul { margin: 4px 0 0; padding-left: 1.2em; }
.ovp-preview { display: flex; justify-content: center; align-items: center; cursor: pointer; background: var(--canvas); border-radius: 6px; padding: 6px; overflow: hidden; }
.ovp-preview .diagram-preview { width: 100%; height: auto; min-height: 120px; max-height: 260px; cursor: pointer; touch-action: auto; }
.diagram-preview .background { display: none; }
.diagram-preview .el-shape, .diagram-preview .el-flow { pointer-events: none; }
.ovp-history { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.ovp-phases h2 { margin: 0 0 8px; font-size: 1.05rem; }
.ovp-phase-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ovp-phase { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.ovp-phase:hover { border-color: var(--accent); }
.ovp-phase-title { font-weight: 700; }
.ovp-phase .ov-lines { display: grid; gap: 2px; }
.stage-badge { cursor: pointer; border: 0; background: var(--accent-soft); color: var(--accent); }
.proposal-badge { cursor: pointer; border: 0; background: #fff3dc; color: #8a5700; margin-left: 4px; }
@media (max-width: 1000px) {
    .ovp-grid { grid-template-columns: 1fr; }
    .ovp-phase-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ovp-stage { justify-items: start; }
}
@media (max-width: 640px) {
    .ovp { padding: 14px 16px 40px; }
    .brief-cols { grid-template-columns: 1fr; }
    .stage-step > button, .stage-step > span { padding-right: 9px; font-size: .78rem; }
}

/* The Inspector (inspector.js): one card about the selection; its sections fold, the phase orders them */
.side-tabs.single { display: none; }
.inspector { padding: 0; }
.inspector[hidden] { display: none; }
.inspector .props { padding: 0; overflow: visible; flex: none; min-height: 0; }
.insp-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px 8px; }
.insp-title { font-weight: 650; font-size: 1rem; overflow-wrap: anywhere; }
.insp-kind { margin-top: 2px; }
.insp-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.insp-chip { font: inherit; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.insp-chip:hover { color: var(--text); border-color: var(--text-muted); }
.insp-chip.is-open { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.insp-chip .count:not(:empty) { margin-left: 4px; font-weight: 650; }
.insp-chip.has-new::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: var(--danger); vertical-align: middle; }
.insp-sec { border-bottom: 1px solid var(--border); }
.props .insp-sec-head, .insp-sec-head { margin: 0; font-size: 0.8rem; }
.insp-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px; border: 0; background: none; font: inherit; font-weight: 650; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); cursor: pointer; text-align: left; }
.insp-toggle:hover { color: var(--text); background: var(--surface-2); }
.insp-toggle::before { content: ""; width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.12s; }
.insp-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.insp-toggle[aria-expanded="true"] { color: var(--text); }
.insp-toggle .count:not(:empty) { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: 0.75rem; text-align: center; letter-spacing: 0; }
.insp-body { padding: 4px 16px 16px; }
.insp-body[hidden] { display: none; }
.insp-body h3 { font-size: 0.8rem; margin: 12px 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.insp-docs, .insp-traces { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; }
.insp-docs li, .insp-traces li { margin-bottom: 4px; overflow-wrap: anywhere; }
.insp-quote { margin: 0 0 10px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.insp-quote p { margin: 0 0 4px; font-size: 0.88rem; font-style: italic; }
.insp-quote footer { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.insp-mention { margin-bottom: 12px; }
.insp-mention-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.9rem; margin-bottom: 4px; }
.insp-mention-head .insp-link { margin-left: auto; }
.insp-snippet { margin: 0 0 6px; font-size: 0.85rem; line-height: 1.45; color: var(--text); padding: 4px 8px; background: var(--surface-2); border-radius: 6px; overflow-wrap: anywhere; }
.insp-snippet mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.insp-finding { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: var(--radius); border-left-width: 3px; }
.insp-finding.sev-high { border-left-color: var(--danger); }
.insp-finding.sev-medium { border-left-color: #d08a1a; }
.insp-finding.sev-low { border-left-color: var(--text-muted); }
.insp-finding p { margin: 0; }
.insp-finding > button { align-self: flex-start; }
.insp-finding-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge.sev-high { background: var(--danger-soft); color: var(--danger); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.insp-through { margin: 4px 0 8px; }

/* The evidence workspace (evidence.js): canvas marks, the reader beside the diagram, to do, proposals */
.evidence-mark { pointer-events: none; }
.evidence-mark.ev-backed rect { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 1.2; }
.evidence-mark.ev-backed path { fill: none; stroke: var(--ok); stroke-width: 1.3; stroke-linecap: round; }
.evidence-mark.ev-backed circle { fill: var(--ok); stroke: none; }
.evidence-mark.ev-backed text { fill: var(--ok); font: 700 10px var(--font); }
.evidence-mark.ev-missing :is(rect, circle, path) { fill: none; stroke: #c27a00; stroke-width: 1.6; stroke-dasharray: 5 4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .evidence-mark.ev-missing :is(rect, circle, path) { stroke: #f0b54a; } }
@media (min-width: 900px) {
    body[data-phase="sources"] .editor { grid-template-columns: auto minmax(0, 1fr) max(var(--side-w, 340px), min(500px, 38vw)); }
}
.evidence-panel { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.evidence-panel[hidden] { display: none; }
.ev-views { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex: none; }
.ev-views button { font: inherit; font-size: 0.82rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.ev-views button.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.ev-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ev-read { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ev-doc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 16px 6px; flex: none; }
.ev-doc { max-width: 100%; min-width: 0; flex: 1 1 200px; }
.ev-text { flex: 1; min-height: 120px; overflow-y: auto; padding: 8px 16px 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 0.92rem; }
.ev-text:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ev-mark { background: color-mix(in srgb, var(--ok) 18%, transparent); color: inherit; border-radius: 2px; cursor: pointer; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--ok) 55%, transparent); }
.ev-mark.ev-to-model { background: color-mix(in srgb, #d08a1a 20%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, #d08a1a 60%, transparent); }
.ev-mark.ev-overlap { background: color-mix(in srgb, var(--ok) 32%, transparent); }
.ev-mark.ev-of-selection { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.ev-mark.ev-active { outline: 2px solid var(--accent); outline-offset: 1px; }
.ev-mark.ev-preview { background: transparent; box-shadow: none; outline: 2px dashed var(--accent); outline-offset: 1px; }
.ev-bar { flex: none; border-top: 1px solid var(--border); background: var(--surface); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 6px; max-height: 45%; overflow-y: auto; }
.ev-bar[hidden] { display: none; }
.ev-bar p { margin: 0; }
.ev-bar-quote { font-style: italic; font-size: 0.88rem; }
.ev-bar-actions, .ev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ev-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ev-chip { display: inline-flex; align-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; }
.ev-chip button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 2px 4px 2px 10px; }
.ev-chip .ev-chip-x { padding: 2px 8px 2px 2px; font-weight: 700; }
.ev-chip-gone { background: var(--surface-2); color: var(--text-muted); text-decoration: line-through; }
.badge.ev-badge-to-model { background: #fff3dc; color: #8a5700; }
.ev-note { width: 100%; box-sizing: border-box; }
.ev-remove { color: var(--danger); }
.ev-todo, .ev-suggest { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; }
.ev-sec h3 { font-size: 0.8rem; margin: 14px 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ev-sec h3 .count:not(:empty) { margin-left: 4px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); color: var(--text); letter-spacing: 0; text-transform: none; }
.ev-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ev-list > li { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; }
.ev-sec .ev-list > li[data-element] { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 10px; }
.ev-el { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-align: left; }
.ev-sec li[data-element] .btn { margin-left: auto; }
.ev-quote { margin: 0; padding: 4px 10px; border-left: 3px solid var(--ok); background: var(--surface-2); border-radius: 0 6px 6px 0; font-size: 0.86rem; line-height: 1.45; overflow-wrap: anywhere; }
.ev-quote mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; }
.ev-proposal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.9rem; }
.badge.ev-origin-ai { background: var(--accent-soft); color: var(--accent); }
.ev-ask { margin: 8px 0; }
.ev-scope { font-size: 0.85rem; }
.ev-all-good { color: var(--ok); }
.ev-warnings { margin: 4px 0; padding-left: 18px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.ev-badge-to-model { background: #3a2c10; color: #f3cf7a; } }

/* The Review list (attention.js): everything that needs attention, most urgent first */
.side-tabs button.has-mine::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: top; }
.attention-panel { padding: 0; }
.attention-panel[hidden] { display: none; }
.att-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.att-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.att-chip { font: inherit; font-size: 0.78rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.att-chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.att-chip .count:not(:empty) { margin-left: 4px; font-weight: 650; }
.att-toggles { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.att-toggle { margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.att-undo { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 16px 0; padding: 6px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.85rem; }
.att-list { list-style: none; margin: 0; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.att-item { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.att-item.sev-blocking { border-left-color: var(--danger); }
.att-item.sev-high { border-left-color: var(--danger); }
.att-item.sev-medium { border-left-color: #d08a1a; }
.att-item.sev-low { border-left-color: var(--border); }
.att-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.badge.att-sev.sev-blocking { background: var(--danger); color: #fff; }
.badge.att-sev.sev-high { background: var(--danger-soft); color: var(--danger); }
.badge.att-sev.sev-medium { background: #fff3dc; color: #8a5700; }
.att-who { margin-left: auto; font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.att-who.att-me { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.att-title { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; text-align: left; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.att-title:hover { color: var(--accent); text-decoration: underline; }
.att-detail { margin: 0; overflow-wrap: anywhere; }
.att-els { display: flex; flex-wrap: wrap; gap: 4px; }
.att-el { border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 0.78rem; padding: 1px 10px; cursor: pointer; }
.att-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.att-assign { margin-left: auto; }
.att-pick { margin-left: auto; max-width: 100%; font-size: 0.85rem; }
.att-empty { padding: 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.att-sev.sev-medium { background: #3a2c10; color: #f3cf7a; } }

/* Business KPIs (kpi-panel.js; the Overview's card; the portal) */
.kpi-section { display: flex; flex-direction: column; gap: 8px; }
.kpi-section > p { margin: 0; }
.kpi-card, .kpi-form { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.kpi-card.kpi-on { border-left-color: var(--ok); }
.kpi-card.kpi-off { border-left-color: var(--danger); }
.kpi-card.kpi-none { border-left-color: var(--border); }
.kpi-card p { margin: 0; }
.kpi-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-name { overflow-wrap: anywhere; }
.kpi-state { margin-left: auto; }
.badge.kpi-state-on { background: var(--ok-soft); color: var(--ok); }
.badge.kpi-state-off { background: var(--danger-soft); color: var(--danger); }
.kpi-target { font-size: 1.05rem; font-weight: 650; }
.kpi-why { color: var(--text-muted); font-style: italic; }
.kpi-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kpi-remove { color: var(--danger); }
.kpi-trend { width: 120px; height: 28px; }
.kpi-trend-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.kpi-trend-target { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.kpi-trend-dot { fill: var(--accent); }
.kpi-record { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border-radius: 6px; background: var(--surface-2); }
.kpi-record input[type=number] { width: 7em; }
.kpi-record input[type=text] { flex: 1 1 160px; min-width: 0; }
.kpi-values { list-style: none; margin: 0; padding: 0; }
.kpi-values li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 2px 0; border-top: 1px solid var(--border); }
.kpi-x { margin-left: auto; border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }
.kpi-form .field { margin-bottom: 4px; }
.kpi-target-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kpi-target-input { width: 7em; }
.kpi-unit-input { width: 9em; }
.kpi-span { display: flex; flex-wrap: wrap; gap: 6px; }
.kpi-span select { max-width: 12em; }

/* ---------- process simulation: execution profiles (Inspector) and reports ---------- */
.sim-section { display: flex; flex-direction: column; gap: 8px; }
.sim-section p { margin: 0; }
.sim-head { display: flex; flex-direction: column; gap: 6px; }
.sim-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sim-row > .field { flex: 1 1 5em; min-width: 0; margin: 0; }
.sim-profile-select { flex: 1 1 10em; min-width: 0; }
.sim-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.sim-card h4 { margin: 0; font-size: 0.85rem; }
.sim-card .field { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sim-section input[type=number], .sim-section input[type=text], .sim-section select, .sim-section textarea {
    font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 8px; min-width: 0; box-sizing: border-box; }
.sim-section .field input[type=text], .sim-section .field select { width: 100%; }
.sim-num { width: 6.5em; max-width: 100%; }
.sim-time { width: 4.5em; font-variant-numeric: tabular-nums; }
.sim-hours-row td { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sim-hours { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); }
.sim-shifts { display: flex; flex-direction: column; gap: 8px; }
.sim-shift { display: flex; flex-direction: column; gap: 4px; }
.sim-days { display: flex; flex-wrap: wrap; gap: 2px; }
.sim-day { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px 1px 2px; border: 1px solid var(--border); border-radius: 12px; font-size: 0.8rem; cursor: pointer; background: var(--surface); }
.sim-day:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.sim-error:empty { display: none; }
.sim-currency { width: 4.5em; text-transform: uppercase; }
.sim-dist { display: flex; flex-direction: column; gap: 4px; }
.sim-param { display: flex; flex-direction: column; gap: 1px; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sim-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 2px 4px 2px 0; }
.sim-table td { padding: 2px 4px 2px 0; vertical-align: middle; overflow-wrap: anywhere; }
.sim-table input[type=text] { width: 100%; min-width: 4.5em; }
.sim-table .sim-num { width: 4.5em; }
.sim-table input.sim-time { width: 4.2em; min-width: 0; padding: 4px 6px; }
.sim-table input.sim-shift-cap { width: 3.6em; }
.sim-hours .sim-row { flex-wrap: nowrap; }
.sim-hours .kpi-actions .btn { padding-left: 6px; padding-right: 6px; }
.sim-remove { color: var(--danger); }
.sim-problems { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sim-error { color: var(--danger); }
.sim-warning { color: var(--warn-text, #7a5300); }
.sim-dialog { width: min(960px, calc(100vw - 32px)); }
.sim-picks { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 10px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.sim-running { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.sim-progress { width: 100%; }
.sim-results { margin-top: 10px; }
.sim-report h3 { margin: 18px 0 6px; font-size: 0.95rem; }
.sim-profile-name { margin: 8px 0 4px; }
.sim-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.sim-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; background: var(--surface); }
.sim-tile-label { font-size: 0.8rem; color: var(--text-muted); }
.sim-tile-value { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.sim-tile-sub { font-size: 0.78rem; color: var(--text-muted); }
.sim-callout { background: var(--accent-soft); padding: 8px 12px; border-radius: var(--radius); }
.sim-chart-wrap { position: relative; }
.sim-chart { width: 100%; max-width: 640px; height: auto; display: block; }
.sim-bar { fill: var(--accent); }
.sim-bar:hover { opacity: .8; }
.sim-axis { stroke: var(--border); stroke-width: 1; }
.sim-marker { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.sim-tick, .sim-marker-label { font-size: 11px; fill: var(--text-muted); }
.sim-row-label { font-size: 12px; fill: var(--text); }
.sim-range { stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }
.sim-box { fill: var(--accent); }
.sim-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.sim-tip { position: absolute; z-index: 2; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 8px; font-size: 0.8rem; box-shadow: 0 4px 14px rgb(0 0 0 / .15); white-space: nowrap; }
.sim-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.sim-key-line { display: inline-block; width: 18px; height: 2px; background: var(--text-muted); }
.sim-key-box { display: inline-block; width: 18px; height: 10px; border-radius: 3px; background: var(--accent); }
.sim-key-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); }
.sim-table-wrap { overflow-x: auto; }
.sim-report-table { border-collapse: collapse; font-size: 0.85rem; min-width: 60%; }
.sim-report-table th, .sim-report-table td { text-align: left; padding: 4px 12px 4px 0; border-bottom: 1px solid var(--border); vertical-align: top; font-variant-numeric: tabular-nums; }
.sim-report-table thead th { color: var(--text-muted); font-weight: 600; }
.sim-compare tbody th { font-weight: 500; }
.sim-meter { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sim-meter-track { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.sim-meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.sim-hot { color: var(--warn-text, #7a5300); }
.sim-delta { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.sim-better { color: var(--ok); }
.sim-worse { color: var(--danger); }
.expected-duration-row { display: flex; gap: 6px; }
.expected-duration-row input { width: 7em; }
.expected-duration p { margin: 4px 0 0; font-weight: 400; }
.ovp-kpi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ovp-kpi { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.ovp-kpi-target { font-weight: 650; white-space: nowrap; }
@media (max-width: 600px) { .ovp-kpi { grid-template-columns: 1fr; } }
.portal-kpi-table td { vertical-align: top; }

/* Refactorings with choices (refactor.js `form`): a dialog beside the diagram, which stays visible */
.refactor-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; margin: 72px 24px auto auto; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.refactor-dialog::backdrop { background: rgb(0 0 0 / .12); }
.refactor-dialog h2 { margin: 0 0 8px; font-size: 1.05rem; }
.refactor-dialog .field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-weight: 550; font-size: 0.9rem; }
.refactor-dialog .field select, .refactor-dialog .field input { font-weight: 400; }
.refactor-choice { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 4px; }
.refactor-choice legend { font-weight: 550; font-size: 0.9rem; padding: 0 4px; }
.refactor-choice .check { display: flex; align-items: baseline; gap: 4px; margin: 0; }
@media (max-width: 600px) { .refactor-dialog { margin: auto; } }

/* Formal verification (verification.js) */
.verification-panel { display: flex; flex-direction: column; gap: 4px; }
.verification-panel[hidden] { display: none; }
.ver-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ver-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ver-verdict { font-weight: 700; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); }
.ver-verdict.ver-sound { background: var(--ok-soft); color: var(--ok); }
.ver-verdict.ver-unsound { background: var(--danger-soft); color: var(--danger); }
.ver-verdict.ver-undecided, .ver-verdict.ver-unsupported { background: #fdf3dc; color: #7a5300; }
.ver-group { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 14px 0 4px; }
.ver-props { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ver-prop { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: start; }
.ver-icon { font-weight: 700; text-align: center; border-radius: 50%; width: 20px; height: 20px; line-height: 20px; font-size: 0.8rem; }
.ver-proved .ver-icon { background: var(--ok-soft); color: var(--ok); }
.ver-refuted .ver-icon { background: var(--danger-soft); color: var(--danger); }
.ver-refuted.ver-warning .ver-icon { background: #fdf3dc; color: #7a5300; }
.ver-undecided .ver-icon { background: var(--surface-2); color: var(--text-muted); }
.ver-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.ver-finding.ver-accepted { opacity: 0.65; }
.ver-finding.ver-focused { box-shadow: 0 0 0 2px var(--accent); }
.ver-decisions ul, .ver-notes ul { margin: 4px 0; padding-left: 1.2em; }
.ver-method p { margin: 4px 0; }
.ver-player { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; width: min(560px, calc(100% - 32px));
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgb(0 0 0 / .18); padding: 8px 12px;
    display: flex; flex-direction: column; gap: 4px; }
.ver-player-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ver-player-step { display: flex; align-items: center; gap: 4px; }
.ver-player-pos { min-width: 7em; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.ver-player-text { font-size: 0.9rem; display: flex; gap: 6px; align-items: center; }
.ver-player-text.ver-repeating { color: #7a5300; }
.ver-acting { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 6 4; pointer-events: none; }
.ver-token { pointer-events: auto; }
.ver-token circle { fill: #e8a317; stroke: #fff; stroke-width: 2; }
.ver-token-running circle, .ver-token-scope-start circle { fill: var(--accent); }
.ver-token text { fill: #fff; font-size: 11px; font-weight: 700; pointer-events: none; }
.ver-token-message rect { fill: #fff; stroke: #e8a317; stroke-width: 2; }
.ver-token-message path { fill: none; stroke: #e8a317; stroke-width: 1.5; }

/* Derive from scenarios (scenario-mining.js) */
.mine { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 24px; }
.mine-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mine-head h2 { font-size: 1.05rem; margin: 0; }
.mine h3 { font-size: 0.9rem; margin: 12px 0 4px; }
.mine-filter { width: 100%; }
.mine-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 8px; }
.mine-group { border: 0; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mine-group legend { font-weight: 600; font-size: 0.82rem; padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }
.mine-model { display: flex; gap: 6px; align-items: baseline; }
.mine-text { width: 100%; font: inherit; font-size: 0.85rem; resize: vertical; }
.mine-log { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mine-file { display: flex; flex-direction: column; gap: 4px; }
.mine-options { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mine-options input[type=range] { width: 100%; }
.mine-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mine-result { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.mine-quality { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mine-q { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; border-top-width: 3px; }
.mine-q strong { font-size: 1.1rem; }
.mine-q-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.mine-q.mine-good, .mine-q.ver-sound { border-top-color: var(--ok); }
.mine-q.mine-fair, .mine-q.ver-undecided { border-top-color: #d9822b; }
.mine-q.mine-poor, .mine-q.ver-unsound { border-top-color: var(--danger); }
td.mine-poor { color: var(--danger); }
.mine-tree { display: block; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; margin: 4px 0; }
.mine-target { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
.mine-target legend { font-weight: 600; font-size: 0.85rem; padding: 0 4px; }
.mine-props { margin: 0; padding-left: 1.2em; color: var(--danger); }
.ovp-derived-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ovp-derived-list .badge { margin-left: 6px; }
@media (max-width: 600px) { .mine-quality { grid-template-columns: 1fr; } }

/* ---------- the Sources page: library · reader · assistant (sources-library.js, evidence.js, assistant.js) ---------- */
.sources-page { flex: 1; min-width: 0; min-height: 0; display: grid; background: var(--bg);
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(320px, 400px); }
.sources-page[hidden] { display: none !important; }
.src-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.src-library { border-right: 1px solid var(--border); }
.src-chat { border-left: 1px solid var(--border); }
.src-col > .props { flex: 1; min-height: 0; }
.src-chat > .assistant-panel { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.src-chat > .assistant-panel .ai-log { min-height: 120px; }
.src-reader > .evidence-panel { background: var(--surface); }
.src-reader .ev-text { max-width: 78ch; font-size: 0.95rem; line-height: 1.65; }
.src-reader .ev-doc-row { padding-top: 14px; }
.ev-doc-title { margin: 0; font-size: 1.05rem; flex: 1 1 100%; overflow-wrap: anywhere; }
.ev-pick { max-width: 100%; font-size: 0.82rem; }
@media (max-width: 1200px) {
    .sources-page { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); grid-template-rows: minmax(360px, 1fr) minmax(420px, 55vh); overflow-y: auto; }
    .src-chat { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
    .sources-page { display: flex; flex-direction: column; overflow-y: auto; }
    .src-col { min-height: auto; border: 0; border-bottom: 1px solid var(--border); }
    .src-library > .props { max-height: 55vh; }
    .src-reader > .evidence-panel { min-height: 60vh; }
    .src-chat > .assistant-panel { min-height: 70vh; }
}

/* the library */
.documents-panel.lib-drop { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.lib-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lib-head h2 { margin: 0; flex: 1; font-size: 1.05rem; }
.lib-count:not(:empty) { margin-left: 4px; padding: 0 7px; border-radius: 9px; background: var(--surface-2); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }
.lib-adding { margin-bottom: 10px; }
.lib-adding[hidden] { display: none; }
.lib-adding > p { margin: 6px 0 0; }
.lib-upload-extra { display: grid; gap: 6px; }
.lib-progress:empty { display: none; }
.lib-progress { margin: 0 0 6px; }
.lib-search { position: sticky; top: 0; z-index: 2; width: 100%; box-sizing: border-box; font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.lib-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.lib-filters select { flex: 1 1 120px; min-width: 0; font-size: 0.82rem; }
.lib-tags-filter { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.lib-tags-filter[hidden], .lib-chosen[hidden] { display: none; }
.lib-tag { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 999px; padding: 1px 8px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.lib-tag.active, .lib-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.lib-chosen { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); margin-bottom: 4px; }
.lib-list { display: flex; flex-direction: column; gap: 4px; }
.lib-group h3 { display: flex; align-items: center; gap: 6px; }
.lib-group h3 .count { padding: 0 6px; border-radius: 9px; background: var(--surface-2); color: var(--text); letter-spacing: 0; text-transform: none; }
.lib-doc { border: 1px solid var(--border); border-radius: 8px; padding: 7px 8px 7px 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; background: var(--surface); }
.lib-doc.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.lib-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lib-tick { flex: none; margin: 0; }
.lib-name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
a.lib-name { color: var(--accent); text-decoration: none; }
.lib-name:hover { color: var(--accent); text-decoration: underline; }
.lib-status { flex: none; font: inherit; font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 1px 8px; border: 1px solid transparent; }
select.lib-status { padding: 1px 4px; max-width: 110px; }
.lib-status.st-new { background: #fff1d6; color: #8a5a00; }
.lib-status.st-read { background: var(--accent-soft); color: var(--accent); }
.lib-status.st-processed { background: var(--ok-soft); color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lib-status.st-new { background: #3a2e12; color: #f3cf7a; } }
:root[data-theme="dark"] .lib-status.st-new { background: #3a2e12; color: #f3cf7a; }
.lib-more { flex: none; border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; padding: 2px 4px; border-radius: 4px; }
.lib-more:hover { background: var(--surface-2); color: var(--text); }
.lib-meta { padding-left: 22px; overflow-wrap: anywhere; }
.lib-tags { display: flex; flex-wrap: wrap; gap: 3px; padding-left: 22px; }
.lib-tags .lib-tag { font-size: 0.72rem; padding: 0 6px; }
.lib-hits { list-style: none; margin: 2px 0 0; padding: 0 0 0 22px; display: grid; gap: 3px; }
.lib-hit { border: 0; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; padding: 3px 8px; text-align: left; font: inherit; font-size: 0.8rem; line-height: 1.4; color: var(--text); cursor: pointer; width: 100%; }
.lib-hit mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; }
.lib-text-status { margin: 4px 0; }
.lib-details { margin: 6px 0 0 22px; display: grid; gap: 6px; }
.lib-details > p { margin: 0; }
.lib-edit { display: grid; gap: 6px; }
.lib-edit label { display: grid; gap: 2px; color: var(--text-muted); }
.lib-edit select, .lib-edit input { font-size: 0.85rem; }
.lib-doc-panel { border: 0; padding: 0; }
.lib-doc-panel > .doc-name { font-weight: 500; font-size: 0.85rem; }
.lib-empty { padding: 16px 4px; }
.lib-empty p { margin: 0 0 6px; }
.lib-adding .doc-upload { background: var(--surface); }

/* the assistant on the Sources page */
.ai-quick { flex-wrap: wrap; margin: 0; }
.ai-context { margin: 0; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); overflow-wrap: anywhere; }
.ai-reads { margin-top: 4px; color: var(--text-muted); font-size: 0.78rem; white-space: normal; }
.ai-preview { display: block; width: 100%; padding: 6px; margin: 0 0 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); cursor: zoom-in; }
.ai-preview .diagram-preview { width: 100%; height: auto; max-height: 280px; min-height: 100px; }

/* a derived process into a model with elements: replace them or keep them (assistant.js) */
.ai-replace { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px 8px; margin: 0 0 8px; display: grid; gap: 6px; }
.ai-replace.ai-ask { border-color: var(--accent); background: var(--accent-soft); }
.ai-replace legend { padding: 0 4px; font-weight: 600; }
.ai-replace label { display: block; margin: 0; }
.ai-replace-hint { display: block; margin-left: 22px; }
.ai-note { margin: 0 0 6px; padding: 4px 8px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; }

/* ---------- decision models (DMN): the requirements diagram and the decision table editor ---------- */
.el-shape.family-drd .body { fill: var(--shape-fill); stroke: var(--shape-stroke); stroke-width: 1.5; }
.el-shape.type-inputData .body { stroke-width: 1.5; }
.el-shape.family-drd.selected .body { stroke: var(--select); stroke-width: 2.5; }
.el-flow.type-knowledgeRequirement .line, .el-flow.type-authorityRequirement .line { stroke-dasharray: 6 4; }
.el-shape .dmn-table-icon rect, .el-shape .dmn-table-icon path { fill: none; }
.el-shape .drill.dmn-open { opacity: 0; }
.el-shape:hover .drill.dmn-open { opacity: .35; }
.dmn-decision-list { margin: 4px 0 12px; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.dmn-failing { color: var(--danger); }
.dmn-summary { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.dmn-summary h3 { margin-top: 0 !important; }
.dmn-summary p { margin: 0 0 6px; }

.dmn-editor { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.dmn-editor[hidden] { display: none; }
.editor.dmn-table-open .context-pad, .editor.dmn-table-open .minimap { display: none !important; }
.dmn-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex: none; }
.dmn-title { min-width: 0; flex: 1 1 220px; }
.dmn-title h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.dmn-kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; font-weight: 700; color: var(--accent); }
.dmn-question { margin: 2px 0 0; }
.dmn-policy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dmn-policy select { font-size: .85rem; }
.dmn-policy-hint { max-width: 300px; font-size: .78rem; }
.dmn-views { display: flex; gap: 4px; }
.dmn-views button { font: inherit; font-size: .85rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.dmn-views button.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.dmn-views button.failing .count { background: var(--danger-soft); color: var(--danger); }
.dmn-views .count { padding: 0 6px; border-radius: 9px; background: var(--surface-2); font-size: .75rem; }
.dmn-close { margin-left: auto; }
.dmn-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 14px; overflow: hidden; }
.dmn-body > p { margin: 0; }
.dmn-scroll { flex: 0 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
/* the add buttons sit right below the table, not at the bottom of the panel */
.dmn-bottom { position: sticky; bottom: 0; }
.dmn-scroll.has-pop { flex: 1 1 auto; min-height: 420px; }
.dmn-grid .dmn-empty-row td { padding: 14px 12px; background: var(--surface); }
.dmn-empty { padding: 32px 16px; text-align: center; }
.dmn-grid { border-collapse: separate; border-spacing: 0; font-size: .86rem; min-width: 100%; }
.dmn-grid th, .dmn-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; vertical-align: top; text-align: left; }
.dmn-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; padding: 5px 8px; }
.dmn-grid thead tr:nth-child(2) th { top: 29px; }
.dmn-grid .dmn-groups th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); white-space: nowrap; }
.dmn-grid th.dmn-in-group, .dmn-grid th.dmn-input, .dmn-grid td.dmn-in { background-clip: padding-box; }
.dmn-grid thead th.dmn-input, .dmn-grid thead th.dmn-in-group { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.dmn-grid thead th.dmn-output, .dmn-grid thead th.dmn-out-group { background: color-mix(in srgb, var(--ok) 12%, var(--surface-2)); }
.dmn-grid thead th.dmn-actual, .dmn-grid thead th.dmn-actual-group { background: var(--surface-2); }
.dmn-grid th.dmn-col.dmn-output, .dmn-grid tr > th.dmn-out-group { border-left: 3px double var(--border); }
.dmn-grid td.dmn-out:first-of-type { border-left: 3px double var(--border); }
.dmn-grid .dmn-num { width: 34px; text-align: center; color: var(--text-muted); padding: 6px 4px; white-space: nowrap; background: var(--surface-2); position: sticky; left: 0; z-index: 1; }
.dmn-grid thead .dmn-num { z-index: 3; }
.dmn-col { padding: 0 !important; min-width: 140px; position: relative; }
.dmn-col-btn { display: grid; gap: 1px; width: 100%; padding: 5px 8px; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.dmn-col-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.dmn-col-label { font-weight: 600; overflow-wrap: anywhere; }
.dmn-col-sub { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; font-weight: 400; color: var(--text-muted); overflow-wrap: anywhere; }
.dmn-col-type { font-size: .7rem; font-weight: 500; color: var(--text-muted); }
.dmn-col-values { font-size: .7rem; font-weight: 400; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.dmn-add-col { margin-left: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--accent); border-radius: 6px; font: inherit; font-weight: 700; padding: 0 7px; cursor: pointer; }
.dmn-colpop { position: absolute; z-index: 10; top: 100%; left: 0; width: 280px; display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgb(0 0 0 / .18); font-weight: 400; text-transform: none; letter-spacing: 0; }
.dmn-colpop label { display: grid; gap: 2px; color: var(--text-muted); }
.dmn-colpop input, .dmn-colpop select { font: inherit; font-size: .85rem; color: var(--text); }
.dmn-colpop input[data-kind="expression"], .dmn-colpop input[data-kind="values"] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dmn-colpop-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.dmn-colpop-done { justify-self: end; }
.dmn-cell { width: 100%; min-width: 110px; box-sizing: border-box; border: 0; border-radius: 0; padding: 6px 8px; background: transparent; color: var(--text);
    font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; outline: none; }
.dmn-cell.dmn-text { font-family: var(--font); min-width: 160px; }
.dmn-cell:focus { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.dmn-cell.invalid { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 -2px 0 var(--danger); }
.dmn-cell::placeholder { color: color-mix(in srgb, var(--text-muted) 60%, transparent); }
.dmn-rule.has-high > td { background: color-mix(in srgb, var(--danger) 6%, transparent); }
.dmn-rule.has-medium > td { background: color-mix(in srgb, #d08a1a 7%, transparent); }
.dmn-rule.pointed > td, .dmn-test.pointed > td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.dmn-flag { display: inline-block; margin-left: 3px; width: 14px; height: 14px; line-height: 14px; border-radius: 50%; font-size: .7rem; font-weight: 700; color: #fff; background: #c27a00; }
.dmn-flag.sev-high { background: var(--danger); }
.dmn-row-actions { white-space: nowrap; width: 1%; }
.dmn-row-buttons { display: flex; gap: 1px; padding: 3px 4px; opacity: .25; }
tr:hover .dmn-row-buttons, tr:focus-within .dmn-row-buttons { opacity: 1; }
.dmn-row-btn { border: 0; background: none; color: var(--text-muted); font: inherit; font-size: .85rem; width: 22px; height: 24px; border-radius: 4px; cursor: pointer; }
.dmn-row-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.dmn-row-btn:disabled { opacity: .3; cursor: default; }
.dmn-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex: none; }
.dmn-table-findings { margin: 0; padding: 6px 10px 6px 26px; border-radius: 8px; background: var(--surface-2); flex: none; max-height: 30%; overflow: auto; }
.dmn-table-findings .sev-high strong { color: var(--danger); }
.dmn-hint { margin: 0; }

/* try out */
.dmn-try-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); gap: 12px 20px; flex: none; }
.dmn-try-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; align-content: start; }
.dmn-try-field { display: grid; gap: 3px; }
.dmn-try-label { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; font-weight: 600; font-size: .85rem; }
.dmn-try-field input { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 6px 8px; }
.dmn-try-field input.invalid { border-color: var(--danger); background: var(--danger-soft); }
.dmn-try-result { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dmn-try-result p { margin: 0 0 6px; }
.dmn-try-matched { font-weight: 600; }
.dmn-try-outputs { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 8px; }
.dmn-try-outputs dt { color: var(--text-muted); }
.dmn-try-outputs dd { margin: 0; font-size: 1.05rem; }
.dmn-grid-read td { padding: 5px 8px; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-muted); }
.dmn-grid-read tr.matched td { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.dmn-grid-read tr.hit td { background: color-mix(in srgb, var(--ok) 20%, transparent); font-weight: 600; }
/* Try out: a condition that does not hold for the value typed in */
.dmn-grid-read td.dmn-false { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
@media (max-width: 900px) { .dmn-try-grid { grid-template-columns: 1fr; } }

/* tests */
.dmn-test-summary { font-weight: 600; }
.dmn-test-summary.passing { color: var(--ok); }
.dmn-test-summary.failing { color: var(--danger); }
.dmn-test.failed > td { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.dmn-test.failed > td.dmn-num { background: var(--danger); color: #fff; }
.dmn-test.passed > td.dmn-num { box-shadow: inset 3px 0 0 var(--ok); }
.dmn-grid td.mismatch { box-shadow: inset 0 0 0 2px var(--danger); }
.dmn-grid td.dmn-actual { padding: 6px 8px; background: var(--surface-2); min-width: 140px; }
.dmn-tests td.dmn-out .dmn-cell { min-width: 150px; }
.dmn-test.failed > td.dmn-actual { background: color-mix(in srgb, var(--danger) 18%, var(--surface-2)); }
.dmn-test-result { padding: 6px 8px; min-width: 110px; }
.dmn-pass { color: var(--ok); font-weight: 600; }
.dmn-fail { color: var(--danger); font-weight: 700; }
.dmn-test-error { color: var(--danger); }
@media (max-width: 800px) {
    .dmn-head { padding: 8px 10px; }
    .dmn-body { padding: 8px 10px 10px; }
    .dmn-policy-hint { display: none; }
}

/* portal: decision tables */
.portal-decisions .dmn-table, .dmn-table { border-collapse: collapse; font-size: .88rem; margin: 6px 0 12px; }
.dmn-table th, .dmn-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.dmn-table th.dmn-input { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.dmn-table th.dmn-output { background: color-mix(in srgb, var(--ok) 12%, var(--surface-2)); }
.dmn-table td { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.dmn-table td.dmn-annotation { font-family: var(--font); color: var(--text-muted); }

/* Moving a model or folder (move.html) */
.move-tree { border: 1px solid var(--border); padding: 10px 14px 12px; margin: 12px 0; }
.move-tree legend { font-weight: 600; padding: 0 4px; }
.move-group { margin: 12px 0 2px; text-transform: uppercase; letter-spacing: .04em; }
.move-target { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-weight: 400; }
.move-target input { margin: 0; }
.move-target:hover { background: var(--surface-2); }
.move-target:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
.move-target.move-off { cursor: default; color: var(--text-muted); }
.move-target.move-off:hover { background: none; }
.move-target.depth-1 { padding-left: 32px; } .move-target.depth-2 { padding-left: 56px; } .move-target.depth-3 { padding-left: 80px; }
.move-target.depth-4 { padding-left: 104px; } .move-target.depth-5 { padding-left: 128px; } .move-target.depth-6 { padding-left: 152px; }
.move-target.depth-7 { padding-left: 176px; } .move-target.depth-8 { padding-left: 200px; }
@media (max-width: 600px) { .move-target.depth-1 { padding-left: 20px; } .move-target.depth-2 { padding-left: 32px; } .move-target.depth-3, .move-target.depth-4, .move-target.depth-5, .move-target.depth-6, .move-target.depth-7, .move-target.depth-8 { padding-left: 44px; } }
.move-other { display: none; }
.move-form:has(input[data-other]:checked) .move-other { display: block; }
.row-actions { text-align: right; white-space: nowrap; }
/* a list whose rows open dropdowns (Rename…): they may reach out of the table; the corners are rounded on the cells */
.table.table-menus { overflow: visible; }
.table.table-menus thead th:first-child { border-top-left-radius: var(--radius); }
.table.table-menus thead th:last-child { border-top-right-radius: var(--radius); }
.row-actions details.row-rename { display: inline-block; }
@media (max-width: 560px) {
    .table .col-role { display: none; }
    .table td.row-actions > details, .table td.row-actions > a { display: block; width: max-content; margin: 2px 0 2px auto; }
    .row-actions details.row-rename .menu-body { right: 0; }
}
.row-actions details.row-rename .menu-body { text-align: left; white-space: normal; width: min(340px, calc(100vw - 32px)); }
.row-actions details.row-rename .menu-body input[type=text] { flex: 1 1 160px; min-width: 0; }

/* Account (account.html) and the sign-in pages' notices with a form */
.page.page-narrow { max-width: 720px; }
.topbar-account { color: var(--text-muted); text-decoration: none; }
.topbar-account:hover, .topbar-account:focus-visible { color: var(--text); text-decoration: underline; }
.auth-card .notice p { margin: 0 0 8px; }
.auth-card .notice form { margin: 0; }

/* Members: an account locked after failed sign-ins */
.member-locked { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* members: invitations, requests to join, offboarding */
.table-scroll { overflow-x: auto; }
.member-inactive td { color: var(--text-muted); }
.members-requests { margin-bottom: 24px; }
.invite-place { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-place label { flex: 1 1 160px; min-width: 0; }
.invite-place select { width: 100%; }
.invite-expired { color: var(--danger); }
.offboard-effects { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.offboard-owned { margin: 8px 0 16px; padding-left: 20px; max-height: 240px; overflow: auto; }
.join-orgs { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.join-org { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.join-org strong { overflow-wrap: anywhere; }

/* organization: overview, settings, logo */
.org-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 20px; overflow-x: auto; }
.org-tabs a { padding: 8px 12px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.org-tabs a:hover { color: var(--text); }
.org-tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.org-section { margin-bottom: 8px; }
.org-section .usage-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.org-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.org-section-head h2 { font-size: 1.05rem; margin: 0 0 10px; }
.usage-tile-attention { border-color: var(--accent); }
.org-attention { color: var(--danger); }
.org-logo { height: 28px; width: auto; max-width: 140px; object-fit: contain; margin-left: 4px; }
.org-logo-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); }
.org-logo-preview img { height: 40px; width: auto; max-width: 240px; object-fit: contain; }
@media (max-width: 560px) {
    .org-logo { max-width: 72px; }
}

/* notifications: the bell, the list */
.topbar-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-muted); }
.topbar-bell:hover { background: var(--surface-2); color: var(--text); }
.topbar-bell .bell-body { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 16px; text-align: center; }
.notification-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.notification-list li + li { border-top: 1px solid var(--border); }
.notification { display: flex; gap: 12px; padding: 12px 16px; color: var(--text); text-decoration: none; }
.notification:hover { background: var(--surface-2); }
.notification-dot { flex: 0 0 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.unread .notification-dot { background: var(--accent); }
.unread .notification-title { font-weight: 600; }
.notification-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notification-excerpt { color: var(--text-muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notify-modes { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.notify-modes .check { align-items: flex-start; }
/* @mentions in comment boxes */
.mention-box { position: relative; align-self: stretch; }
.composer-hint { align-self: stretch; margin: 0; }
.mention-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 2px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); max-height: 200px; overflow: auto; }
.mention-list li { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.mention-list li[aria-selected="true"], .mention-list li:hover { background: var(--accent-soft); color: var(--accent); }
.comment-body .mention { color: var(--accent); font-weight: 600; }
.domain-list { margin: 0 0 8px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.domain-list li { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

/* the support administration: unmistakably not an organization's Process Canvas */
.support-bar { background: #1f2937; border-bottom-color: #111827; }
.support-bar .brand, .support-bar .topnav a, .support-bar .topbar-account { color: #f9fafb; }
.support-bar .topnav a { opacity: 0.8; }
.support-bar .topnav a.active, .support-bar .topnav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; }
.support-bar .btn-quiet { color: #f9fafb; }
.support-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: #f59e0b; color: #111827; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; }
.support-auth .support-badge { margin: 0 0 8px; }
.support-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.support-search input[type="search"] { flex: 1 1 240px; min-width: 0; }
.support-facts { margin-top: 4px; }
.usage-date { font-size: 1rem; font-weight: 600; margin-top: 6px; }
.support-danger { border-color: var(--danger-soft); }
.support-delete { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.support-delete h3 { font-size: 1rem; margin: 0; color: var(--danger); }
.support-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.support-log li { overflow-wrap: anywhere; }
.temp-password { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.06em; padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius); display: inline-block; user-select: all; }

/* groups */
.group-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.group-chip::before { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='5' cy='5' r='2.5'/%3E%3Ccircle cx='11' cy='5' r='2.5'/%3E%3Cpath d='M0 14c0-3 2-5 5-5s5 2 5 5zM8 14c0-2 1-4 3-4.6 3 0 5 2 5 4.6z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='5' cy='5' r='2.5'/%3E%3Ccircle cx='11' cy='5' r='2.5'/%3E%3Cpath d='M0 14c0-3 2-5 5-5s5 2 5 5zM8 14c0-2 1-4 3-4.6 3 0 5 2 5 4.6z'/%3E%3C/svg%3E") center / contain no-repeat; }
.group-chip-large { font-size: 1.3rem; padding: 2px 14px; }
.group-chip-large::before { width: 20px; height: 20px; }
.via-group { display: block; font-size: 0.85rem; }
.group-list, .group-access { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.group-list li, .group-access li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-access svg { width: 18px; height: 18px; flex: none; }

/* Process Canvas support looking at an organization */
.topbar:has(.support-view-banner) { flex-wrap: wrap; row-gap: 8px; }
.support-view-banner { flex: 1 0 100%; order: -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -10px -20px 0; padding: 8px 20px; background: #f59e0b; color: #111827; font-size: 0.9rem; }
.support-view-banner form { margin-left: auto; }
.support-view-banner .muted-on-dark { opacity: 0.75; }
.support-grants { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.support-grants li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.support-grants li form { margin-left: auto; }

/* comparing versions */
.compare-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.compare-bar label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--text-muted); }
.compare-bar select { min-width: 220px; max-width: 100%; }
.compare-arrow { font-size: 1.3rem; color: var(--text-muted); padding-bottom: 6px; }
.compare-views { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.compare-views .btn { border-radius: 0; }
.compare-views .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.compare-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.compare-diagrams { position: relative; min-width: 0; }
.compare-planes { min-height: 1.5em; margin-bottom: 6px; font-size: 0.9rem; }
.compare-planes .has-changes { text-decoration: underline wavy var(--accent); text-underline-offset: 4px; }
.compare-panes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.compare-side .compare-panes { grid-template-columns: 1fr 1fr; }
.compare-pane { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-width: 0; }
.compare-pane[data-pane="before"] { display: none; }
.compare-side .compare-pane[data-pane="before"] { display: block; }
.compare-pane figcaption { padding: 6px 12px; font-size: 0.85rem; font-weight: 600; border-bottom: 1px solid var(--border); background: var(--surface-2); overflow-wrap: anywhere; }
.compare-canvas { background: var(--canvas); display: block; width: 100%; height: min(56vh, 620px); min-height: 320px; touch-action: none; cursor: grab; }
.compare-canvas.panning { cursor: grabbing; }
.compare-zoom { position: absolute; right: 10px; top: 76px; display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.compare-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 0; padding: 0; font-size: 0.85rem; color: var(--text-muted); }
.compare-legend .swatch { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; border: 2px solid; }
.compare-legend .swatch-added { border-color: var(--ok); }
.compare-legend .swatch-changed { border-color: #d97706; }
.compare-legend .swatch-removed { border-color: var(--danger); border-style: dashed; }
.compare-legend .swatch-moved { border-color: #8b5cf6; border-style: dotted; }
.el-shape.diff-added .body, .el-shape.diff-added .swim-body { stroke: var(--ok); stroke-width: 3.5; }
.el-flow.diff-added .line { stroke: var(--ok); stroke-width: 3; }
.el-shape.diff-changed .body, .el-shape.diff-changed .swim-body { stroke: #d97706; stroke-width: 3.5; }
.el-flow.diff-changed .line { stroke: #d97706; stroke-width: 3; }
.el-shape.diff-removed .body, .el-shape.diff-removed .swim-body { stroke: var(--danger); stroke-width: 3.5; stroke-dasharray: 7 4; }
.el-flow.diff-removed .line { stroke: var(--danger); stroke-width: 3; stroke-dasharray: 7 4; }
.el-shape.diff-moved .body { stroke: #8b5cf6; stroke-width: 2.5; stroke-dasharray: 2 3; }
.el-flow.diff-moved .line { stroke: #8b5cf6; stroke-dasharray: 2 3; }
.diff-ghost { cursor: pointer; }
.diff-ghost rect, .diff-ghost circle, .diff-ghost path { fill: color-mix(in srgb, var(--danger) 8%, transparent); stroke: var(--danger); stroke-width: 2; stroke-dasharray: 6 4; }
.diff-ghost text { fill: var(--danger); font-size: 12px; text-decoration: line-through; }
.compare-list { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.compare-list h2 { font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.compare-kind { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 14px 0 6px; }
.compare-kind.kind-added { color: var(--ok); }
.compare-kind.kind-changed { color: #b45309; }
.compare-kind.kind-removed { color: var(--danger); }
.compare-kind.kind-moved { color: #7c3aed; }
.compare-entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.compare-entry { border-left: 3px solid var(--border); padding: 2px 0 2px 8px; }
.compare-entry.kind-added { border-left-color: var(--ok); }
.compare-entry.kind-changed { border-left-color: #d97706; }
.compare-entry.kind-removed { border-left-color: var(--danger); }
.compare-entry.kind-moved { border-left-color: #8b5cf6; }
.compare-entry.current { background: var(--surface-2); border-radius: 0 6px 6px 0; }
.compare-entry-button { all: unset; cursor: pointer; display: block; width: 100%; overflow-wrap: anywhere; }
.compare-entry-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.compare-entry.kind-removed strong { text-decoration: line-through; }
.compare-details { margin: 4px 0 2px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 8px; font-size: 0.85rem; }
.compare-details dt { color: var(--text-muted); }
.compare-details dd { margin: 0; overflow-wrap: anywhere; }
.compare-details del { color: var(--danger); text-decoration: line-through; }
.compare-details ins { color: var(--ok); text-decoration: none; font-weight: 600; }
@media (max-width: 1000px) {
    .compare-layout { grid-template-columns: 1fr; }
    .compare-side .compare-panes { grid-template-columns: 1fr; }
    .compare-list { position: static; max-height: none; }
    .compare-canvas { height: 48vh; }
}
@media (max-width: 560px) {
    .compare-views { margin-left: 0; }
    .compare-bar select { min-width: 0; width: 100%; }
    .compare-bar label { flex: 1 1 100%; }
    .compare-arrow { display: none; }
}

/* ---------- plans: functionalities not included ---------- */
.feature-locked, .feature-soft { position: relative; }
.feature-locked { opacity: .55; cursor: not-allowed; }
.feature-locked::after, .feature-soft::after {
    content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .35em; vertical-align: -.05em;
    background: currentColor; opacity: .8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 7V5a3.5 3.5 0 0 1 7 0v2h.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1.6 0h3.8V5a1.9 1.9 0 0 0-3.8 0z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 7V5a3.5 3.5 0 0 1 7 0v2h.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1.6 0h3.8V5a1.9 1.9 0 0 0-3.8 0z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.diagram-type-card.feature-locked::after { position: absolute; top: 8px; right: 8px; margin: 0; }
.feature-hint {
    position: absolute; z-index: 1000; padding: 8px 12px; border-radius: 6px; font-size: .875rem; line-height: 1.4;
    background: var(--text); color: var(--bg); box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
.notice-plan { background: var(--accent-soft, #e8f0fe); color: var(--text); }

/* the plan page */
.plan-current { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; }
.plan-current .plan-name { font-size: 1.5rem; font-weight: 700; }
.plan-usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0; }
.plan-usage > div { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.plan-usage dt { color: var(--text-muted); font-size: .85rem; }
.plan-usage dd { margin: 4px 0 0; font-size: 1.1rem; font-weight: 600; }
.plan-meter { height: 6px; border-radius: 3px; background: var(--border); margin-top: 6px; overflow: hidden; }
.plan-meter > span { display: block; height: 100%; background: var(--accent); }
.plan-meter.full > span { background: var(--danger); }
.plan-compare { overflow-x: auto; }
.plan-compare th.current, .plan-compare td.current { background: var(--accent-soft, #e8f0fe); }
.plan-compare td.yes { color: var(--ok); text-align: center; }
.plan-compare td.no { color: var(--text-muted); text-align: center; }
.plan-compare td.extra { color: var(--accent); text-align: center; }
.feature-list { columns: 2 240px; padding-left: 1.2em; }
.feature-list .extra-mark { color: var(--accent); font-size: .8rem; }
.support-extras { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; }
.support-extras legend { padding: 0 4px; font-weight: 600; }
.support-extras .checkbox-line { display: flex; gap: 6px; align-items: baseline; font-weight: normal; }
.support-extras p { grid-column: 1 / -1; }
.plan-compare tbody th { text-transform: none; letter-spacing: normal; font-size: inherit; font-weight: 500; color: var(--text); background: transparent; }
.stack .support-extras label.checkbox-line { flex-direction: row; align-items: baseline; gap: 6px; margin: 0; padding: 3px 0; }
.stack .support-extras label.checkbox-line input { width: auto; margin: 0; }
.plan-compare table { min-width: 680px; }
.plan-compare tbody th { min-width: 180px; }

/* banners at the top: an unconfirmed address, a running trial */
.topbar:has(.account-banner) { flex-wrap: wrap; row-gap: 8px; }
.account-banner { flex: 1 0 100%; order: -1; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin: -10px -20px 0; padding: 8px 20px; background: var(--accent-soft); color: var(--text); font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.account-banner + .account-banner { margin-top: -8px; }
.account-banner form, .account-banner > a { margin-left: auto; }
.support-trial { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; margin: 0 0 12px; border-radius: 6px; background: var(--accent-soft); }
.support-trial p { margin: 0; flex: 1 1 100%; }
.input-days { width: 5em; }
.support-trial form { display: flex; align-items: center; gap: 8px; margin: 0; }
.support-trial label { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.support-trial input.input-days { width: 5em; padding: 4px 6px; }

/* ---------- the approval wizard (editor side panel and "New process with assistant") ---------- */
.assistant-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.assistant-wizard { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.assistant-wizard .ad-head { padding: 18px 22px 10px; }
.assistant-wizard .ad-title h2 { font-size: 1.25rem; }
.assistant-wizard .ad-body { padding: 16px 22px 20px; font-size: 1rem; overflow: visible; }
.assistant-wizard .ad-nav { padding: 12px 22px; }
.aw-progress { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: 8px; }
.aw-progress > span { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.aw-count { margin: 6px 0 0; }
.ad-body .aw-title { font-size: 1.05rem; text-transform: none; letter-spacing: normal; color: var(--text); margin: 4px 0 6px; font-weight: 650; outline: none; }
.assistant-wizard .ad-body .aw-title { font-size: 1.2rem; }
.aw-hint { margin: 0 0 14px; }
.aw-cards { display: grid; gap: 8px; margin: 8px 0 12px; }
.aw-card { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 400; margin: 0; }
.aw-card:hover { border-color: var(--accent); }
.aw-card.chosen { border-color: var(--accent); background: var(--accent-soft); }
.aw-card > span { display: flex; flex-direction: column; gap: 2px; }
.aw-card strong { font-weight: 600; }
.aw-card input { margin-top: 3px !important; }
.aw-text { width: 100%; box-sizing: border-box; font-size: 1rem; padding: 8px 10px; }
.aw-patterns { padding-left: 18px; margin: 0 0 10px; }
.aw-patterns li { margin-bottom: 6px; }
.aw-why { display: block; color: var(--ok); }
.aw-answers { margin: 12px 0; font-size: 0.88rem; }
.aw-answers summary { cursor: pointer; font-weight: 600; }
.aw-answers ul { list-style: none; padding: 0; margin: 6px 0 0; }
.aw-answers li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.aw-preview { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 4px 0 12px; }
.aw-canvas { display: block; width: 100%; height: 320px; background: var(--canvas); }
@media (max-width: 600px) { .aw-canvas { height: 240px; } .assistant-wizard .ad-head, .assistant-wizard .ad-body, .assistant-wizard .ad-nav { padding-left: 14px; padding-right: 14px; } }
.ad-body .aw-card, .aw-card { flex-direction: row; text-align: left; }
.aw-preview-tabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.aw-preview-tabs .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.aw-preview-scroll { overflow-x: auto; background: var(--canvas); }
.aw-preview-scroll .aw-canvas { height: auto; }
.aw-roles .field { margin-bottom: 10px; }
.ad-approver .aw-text { font-size: 0.95rem; padding: 6px 8px; }
.aw-same { align-self: center; }
.aw-same-roles { margin: 10px 0 0; padding-left: 20px; }

/* ---------- search over the organization ---------- */
.topbar-search { margin-left: auto; }
.topbar-search + .topbar-user { margin-left: 12px; }
.topbar-search input { width: 220px; max-width: 32vw; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 0.9rem; }
.topbar-search input:focus { background: var(--surface); width: 300px; }
@media (max-width: 700px) { .topbar-search input { width: 130px; } .topbar-search input:focus { width: 170px; } }
.search-form { display: flex; gap: 8px; margin: 0 0 16px; }
.search-form input { flex: 1; font-size: 1.05rem; padding: 8px 12px; }
.search-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.search-kinds a { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.85rem; text-decoration: none; }
.search-section { margin-bottom: 22px; }
.search-section h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 8px; }
.search-hits { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.search-hits li { padding: 9px 2px; border-bottom: 1px solid var(--border); }
.search-hits .hit-title { font-weight: 600; }
.search-hits .hit-meta { color: var(--text-muted); font-size: 0.82rem; margin-left: 6px; }
.search-hits .hit-snippet { margin: 3px 0 0; font-size: 0.88rem; color: var(--text); }
.search-hits mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .search-hits mark { background: #7c5e10; } }

/* ---------- templates ---------- */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 0 0 20px; }
.template-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; overflow: hidden; margin: 0; font-weight: 400; }
.template-card:hover { border-color: var(--accent); }
.template-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.template-card input { position: absolute; opacity: 0; pointer-events: none; }
.template-preview { height: 120px; background: var(--canvas); border-bottom: 1px solid var(--border); }
.template-preview svg { width: 100%; height: 100%; display: block; }
.template-card .tc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.template-card .tc-name { font-weight: 600; }
.template-create { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.template-create input[type=text] { flex: 1; min-width: 200px; }
.template-dialog { border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); }
.template-dialog h2 { margin: 0 0 4px; font-size: 1.1rem; }
.template-dialog textarea, .template-dialog input { width: 100%; box-sizing: border-box; }
.template-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.template-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.template-row form.stack { margin: 0; }

/* Git publishing (git-publish.html, git-connections.html) */
.git-form { max-width: 760px; }
.git-form .field { display: flex; flex-direction: column; gap: 4px; }
.git-form fieldset.field { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px 10px; margin: 0; gap: 6px; }
.git-form fieldset legend { font-weight: 600; padding: 0 4px; }
.git-form select, .git-form input[type="text"], .git-form textarea { width: 100%; box-sizing: border-box; }
.git-form input.git-new-branch { margin-left: 26px; width: calc(100% - 26px); }
.git-form input.git-new-branch:disabled { opacity: .55; }
.git-form textarea { font: inherit; }
.git-branch { font-family: var(--mono, ui-monospace, monospace); font-weight: 600; }
.git-preview { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; }
.git-preview h3 { margin: 0 0 4px; font-size: .95rem; }
.git-files { list-style: none; margin: 6px 0 0; padding: 0; max-height: 280px; overflow: auto; font-size: .88rem; }
.git-files li { padding: 2px 0; overflow-wrap: anywhere; }
.git-files code { font-size: .85rem; }
.git-files .git-deleted code { text-decoration: line-through; color: var(--danger, #b42318); }
.git-links { display: flex; flex-wrap: wrap; gap: 8px; }
.git-connection { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.git-connection form.stack { margin: 0; }
.git-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 14px; }
.git-fields .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.git-fields input { width: 100%; box-sizing: border-box; }
@media (max-width: 640px) {
    .git-connection { grid-template-columns: minmax(0, 1fr); }
}
.git-sync-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.git-sync-form label { display: flex; flex-direction: column; gap: 4px; }
.git-sync-table td { vertical-align: top; overflow-wrap: anywhere; }
.git-sync-table code { font-size: .85rem; }
.git-sync-table .badge { margin-left: 6px; }
.git-sync-unchanged td, .git-sync-deleted_in_git td, .git-sync-not_allowed td { color: var(--muted, #6b7280); }
.git-conflict { color: var(--danger, #b42318); }
.git-report ul { margin: 0; padding-left: 18px; }
.git-sync-scroll { overflow-x: auto; }
.addon-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.addon-row:first-of-type { border-top: 0; }
.addon-body { flex: 1 1 320px; min-width: 0; }
.addon-body p { margin: 4px 0 0; }
.addon-body .badge { margin-left: 6px; }

/* Execution properties in the properties panel (js/editor/execution/panel.js) */
.props h4.exec-group { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); margin: 14px 0 6px; }
.props .exec-problem { display: block; color: var(--danger, #b42318); font-size: .8rem; margin-top: 2px; }
.props .exec-problem[hidden] { display: none; }
/* Camunda 7: lists of rows (inputs, listeners, form fields, …), element templates */
.props .exec-list { margin: 6px 0 10px; }
.props .exec-item { border: 1px solid var(--border); border-radius: 6px; margin: 6px 0; background: var(--bg); }
.props .exec-item > summary { cursor: pointer; padding: 6px 8px; font-size: .85rem; overflow-wrap: anywhere; }
.props .exec-item[open] > summary { border-bottom: 1px solid var(--border); }
.props .exec-item-fields { padding: 4px 8px 8px; }
.props .exec-item-fields .exec-list { margin-left: 2px; }
.props .exec-template { border-left: 3px solid var(--accent); padding-left: 8px; margin: 8px 0; }
.props .exec-template-actions { margin: 4px 0 8px; }
.props .exec-template-rest > summary { cursor: pointer; font-size: .85rem; margin: 10px 0 4px; color: var(--text-muted); }
.props .field small.muted { display: block; }
.element-templates table code { font-size: .8rem; overflow-wrap: anywhere; }
.props textarea.mono, .props input.mono { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: .82rem; }
.props .exec-operator .field small { display: block; }

/* An AI agent's proposal (change-sets.js) and the design log (design-log.js) */
.cs-title { margin: 4px 0 0; }
.cs-message { margin: 4px 0; white-space: pre-wrap; }
.cs-findings { margin: 4px 0; }
.cs-finding-list { margin: 4px 0 0; padding-left: 18px; }
.cs-changes { margin: 6px 0; padding-left: 22px; font-size: 0.85rem; display: grid; gap: 4px; }
.cs-change .check { display: flex; gap: 6px; align-items: flex-start; }
.cs-change.cs-refused > .check { color: var(--text-muted); text-decoration: line-through; }
.cs-error { color: var(--danger); }
.cs-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cs-comment textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.dlog { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.dlog-entry { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; }
.dlog-icon { color: var(--text-muted); text-align: center; }
.dlog-change_set .dlog-icon { color: var(--accent); }
.dlog-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dlog-kind { margin-right: 2px; }
.dlog-actions { display: flex; gap: 10px; margin-top: 2px; }

/* Python editor (execution: scripts, pre- and post-scripts): a see-through textarea over the highlighted code */
:root { --py-keyword: #a626a4; --py-string: #3f8f3e; --py-number: #986801; --py-comment: #8a8f98; --py-function: #2f6fdf; --py-builtin: #0b7fa8; --py-constant: #b35f00; --py-selection: rgba(47, 111, 223, .22); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --py-keyword: #c678dd; --py-string: #98c379; --py-number: #d19a66; --py-comment: #7f848e; --py-function: #61afef; --py-builtin: #56b6c2; --py-constant: #e5c07b; --py-selection: rgba(107, 156, 245, .3); }
}
:root[data-theme="dark"] { --py-keyword: #c678dd; --py-string: #98c379; --py-number: #d19a66; --py-comment: #7f848e; --py-function: #61afef; --py-builtin: #56b6c2; --py-constant: #e5c07b; --py-selection: rgba(107, 156, 245, .3); }
.code-editor { position: relative; background: var(--surface); border-radius: 6px; font-weight: 400; }
.code-editor .code-highlight, .props .code-editor .code-input {
    font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: .82rem; line-height: 1.5;
    tab-size: 4; letter-spacing: normal; white-space: pre; padding: 6px 8px; border-width: 1px; border-radius: 6px;
}
.code-editor .code-highlight {
    position: absolute; inset: 0; margin: 0; overflow: hidden; border: 1px solid transparent;
    color: var(--text); pointer-events: none;
}
.props .code-editor .code-input {
    position: relative; display: block; width: 100%; margin: 0; background: transparent; color: transparent; caret-color: var(--text);
}
.props .code-editor textarea.code-input { min-height: 3.2em; }
.props .code-editor .code-input::placeholder { color: var(--text-muted); }
.props .code-editor .code-input::selection { background: var(--py-selection); color: transparent; }
.props .code-editor .code-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.code-editor .code-highlight > code { display: block; font: inherit; will-change: transform; }
.code-editor.code-line .code-highlight { clip-path: inset(0 9px); } /* an input shows no text in its padding */
.code-editor:has(.code-input:disabled) .code-highlight { opacity: .7; }
.code-highlight .py-keyword { color: var(--py-keyword); }
.code-highlight .py-string { color: var(--py-string); }
.code-highlight .py-number { color: var(--py-number); }
.code-highlight .py-comment { color: var(--py-comment); font-style: italic; }
.code-highlight .py-function { color: var(--py-function); }
.code-highlight .py-builtin { color: var(--py-builtin); }
.code-highlight .py-constant, .code-highlight .py-decorator { color: var(--py-constant); }
