:root {
    color-scheme: light;
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    --ink: #1d2340;
    --muted: #606982;
    --line: #e2e5ed;
    --paper: #fff;
    --bg: #f6f7fb;
    --accent: #4936c4;
    --tint: #efedff;
    --teal: #167064;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 37px); font-weight: 720; letter-spacing: -.04em; line-height: 1.15; }
h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.025em; }
h3 { font-size: 14px; }
p { color: var(--muted); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 9px; }
button { color: var(--ink); background: var(--paper); padding: 8px 13px; font-size: 14px; font-weight: 650; cursor: pointer; }
button:hover { border-color: #b6addf; background: #f9f8ff; }
button:disabled { opacity: .53; cursor: default; }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #3724a9; }
button.add { color: var(--accent); background: var(--tint); border-color: #ded8ff; }
button.danger { color: #a12946; }
button[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }
:focus-visible { outline: 3px solid #8672ee; outline-offset: 3px; }
input, select, textarea { width: 100%; padding: 9px 11px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 650; min-width: 0; }
label input, label select, label textarea { font-weight: 450; font-size: 14px; }
.stack { display: grid; gap: 15px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.quiet { color: var(--muted); font-size: 13px; }
.topbar { min-height: 65px; padding: 0 max(22px, calc((100% - 1300px)/2)); border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 18px; letter-spacing: -.025em; }
.mark, .avatar, .empty-mark { display: grid; place-items: center; flex: none; }
.mark { width: 33px; height: 33px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 23px; line-height: 1; }
.topbar nav { display: flex; gap: 5px; }
.topbar nav button, .profile-button { border-color: transparent; }
.topbar button.active { color: var(--accent); background: var(--tint); }
.profile-button { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; }
#profile-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.avatar { width: 29px; height: 29px; text-transform: uppercase; border-radius: 50%; color: var(--accent); background: var(--tint); }
.workspace { max-width: 1344px; padding: 32px 22px 24px; margin: auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 14px; }
.page-head p { margin-top: 6px; }
.builder, .chat { background: #fff; border: 1px solid var(--line); border-radius: 15px; display: grid; overflow: hidden; box-shadow: 0 8px 26px #25204f08; }
.builder { grid-template-columns: minmax(0, 1fr) 288px; min-height: 605px; }
.builder-main { min-width: 0; display: flex; flex-direction: column; }
.toolbar { padding: 11px 14px; min-height: 57px; display: flex; align-items: center; gap: 10px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.legend { color: var(--muted); font-size: 12px; text-align: right; }
.canvas-scroll { position: relative; overflow: auto; height: clamp(540px, 67vh, 880px); background: #fbfbfe radial-gradient(#d8d9ea 1px, transparent 1px) 0 0/19px 19px; }
.canvas { position: relative; min-width: 100%; min-height: 100%; }
#arrows { position: absolute; width: 100%; height: 100%; inset: 0; pointer-events: none; }
#arrows path.connector { fill: none; stroke: #7261cf; stroke-width: 2; marker-end: url(#arrow-tip); }
#arrow-tip path { fill: #7261cf; }
.node { position: absolute; display: grid; grid-template-columns: minmax(0, 1fr) 35px; width: 216px; height: 82px; background: #fff; border: 1px solid #dfe0ee; border-radius: 12px; box-shadow: 0 4px 12px #28226e13; }
.node.selected { border-color: #7360e2; box-shadow: 0 0 0 2px #e4deff; }
.node.link-origin { border-color: var(--teal); box-shadow: 0 0 0 2px #d4efeb; }
.node-main, .drag-handle { border: 0; background: transparent; min-width: 0; }
.node-main { text-align: left; padding: 8px 9px 8px 13px; display: flex; flex-direction: column; justify-content: center; }
.node-main span, .node-main strong { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-main strong { font-size: 15px; }
.node-main span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.drag-handle { touch-action: none; cursor: grab; padding: 0; color: var(--muted); font-size: 18px; }
.drag-handle:active { cursor: grabbing; }
.canvas-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; padding: 25px; pointer-events: none; }
.canvas-empty button { pointer-events: auto; }
.empty-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--accent); font-size: 26px; }
.inspector { padding: 17px; border-left: 1px solid var(--line); overflow-wrap: anywhere; }
.inspector > h2, .inspector > p { margin-bottom: 12px; }
.inspector .relation { padding-top: 12px; border-top: 1px solid var(--line); }
.edge-row { display: flex; gap: 7px; align-items: center; justify-content: space-between; font-size: 13px; margin-top: 6px; }
.edge-row button { padding: 2px 8px; }
.chat { grid-template-columns: 280px minmax(0, 1fr); height: clamp(500px, 73vh, 970px); }
.chat-list { padding: 14px; border-right: 1px solid var(--line); overflow: auto; }
.chat-list h2 { font-size: 15px; margin-bottom: 11px; }
.task-item { display: grid; width: 100%; text-align: left; gap: 4px; margin-bottom: 6px; overflow-wrap: anywhere; }
.task-item span { font-size: 12px; color: var(--muted); font-weight: 500; }
.task-item[aria-current=true] { background: var(--tint); border-color: #d7ceff; color: var(--accent); }
.worker-state.ready { color: var(--teal); }
.conversation { display: flex; flex-direction: column; overflow: hidden; }
.thread-empty { margin: auto; padding: 24px; text-align: center; display: grid; justify-items: center; gap: 11px; }
.thread-head { padding: 13px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 9px; align-items: center; justify-content: space-between; overflow-wrap: anywhere; }
.thread-head p { font-size: 13px; margin-top: 3px; }
.messages { display: flex; flex: 1; flex-direction: column; gap: 10px; overflow: auto; padding: 16px 20px; }
.message { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; max-width: min(94%, 780px); align-self: flex-start; min-width: 0; overflow-wrap: anywhere; }
.message.user { background: var(--tint); align-self: flex-end; border-color: #e1dbff; }
.message.delivery { border-color: #a8d7ce; background: #effaf7; }
.message.error { border-color: #f0cdd6; background: #fff5f6; }
.message.system { color: var(--muted); font-size: 13px; }
.message header, .message summary { font-size: 12px; color: var(--muted); font-weight: 700; }
.message summary { cursor: pointer; }
.message-body { white-space: pre-wrap; margin-top: 6px; }
.composer { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { min-height: 54px; max-height: 145px; }
.panel, .auth-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 23px; }
.settings { max-width: 530px; }
.logout { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.auth-shell { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at 30% 5%, #eae5ff, var(--bg) 62%); }
.auth-card { width: min(100%, 450px); box-shadow: 0 12px 40px #2b226315; }
.auth-card h1 { margin: 19px 0; font-size: 28px; }
.form-error { color: #a12946; font-size: 13px; margin-bottom: 7px; }
dialog { width: min(94vw, 520px); border: 1px solid var(--line); border-radius: 15px; padding: 23px; color: var(--ink); }
dialog::backdrop { background: #19132d66; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toast { z-index: 3; position: fixed; right: 16px; bottom: 17px; max-width: min(460px, calc(100vw - 32px)); padding: 11px 15px; background: #242043; color: #fff; border-radius: 10px; box-shadow: 0 5px 25px #20134433; }
.toast.error { background: #8d2940; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 820px) {
    .builder { grid-template-columns: minmax(0, 1fr) 235px; }
    .chat { grid-template-columns: 210px minmax(0, 1fr); }
    .legend { display: none; }
}
@media (max-width: 620px) {
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar nav { gap: 1px; }
    .topbar nav button { padding: 7px; }
    .brand { gap: 5px; font-size: 15px; }
    #profile-name { display: none; }
    .workspace { padding: 21px 12px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .builder { grid-template-columns: minmax(0, 1fr); }
    .inspector { border-left: 0; border-top: 1px solid var(--line); }
    .canvas-scroll { height: 410px; }
    .chat { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 77vh; min-height: 625px; }
    .chat-list { max-height: 144px; border-right: 0; border-bottom: 1px solid var(--line); }
    .messages, .thread-head, .composer { padding-left: 11px; padding-right: 11px; }
    .composer button { padding: 8px; }
}

:root {
    --project-violet: #6a52d8;
    --project-blue: #3261d6;
    --project-sky: #1580b3;
    --project-teal: #168582;
    --project-green: #25804c;
    --project-lime: #6b861c;
    --project-amber: #a56d13;
    --project-orange: #bd5a25;
    --project-rose: #bf486a;
    --project-slate: #596881;
}
[data-color="violet"] { --color: var(--project-violet); }
[data-color="blue"] { --color: var(--project-blue); }
[data-color="sky"] { --color: var(--project-sky); }
[data-color="teal"] { --color: var(--project-teal); }
[data-color="green"] { --color: var(--project-green); }
[data-color="lime"] { --color: var(--project-lime); }
[data-color="amber"] { --color: var(--project-amber); }
[data-color="orange"] { --color: var(--project-orange); }
[data-color="rose"] { --color: var(--project-rose); }
[data-color="slate"] { --color: var(--project-slate); }
a { color: var(--accent); text-underline-offset: 3px; }
.brand-button { background: transparent; padding: 4px; border-color: transparent; border-radius: 9px; }
.brand-button.active { background: transparent; }
.project-bar { display: flex; align-items: center; gap: 9px; margin: -4px 0 16px; max-width: 100%; }
.project-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-back { background: transparent; border-color: transparent; color: var(--muted); padding: 5px 7px; }
.crumb-separator { color: #a0a9be; }
.project-dot { flex: 0 0 11px; height: 11px; background: var(--color, var(--accent)); border-radius: 50%; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 252px), 1fr)); gap: 16px; }
.project-card { background: #fff; padding: 17px 18px; border-radius: 15px; min-height: 124px; display: grid; align-content: space-between; justify-items: start; gap: 14px; text-align: left; box-shadow: 0 5px 20px #27234b08; min-width: 0; }
.project-card strong { color: var(--ink); line-height: 1.25; font-size: 17px; overflow-wrap: anywhere; }
.project-card span { font-size: 12px; color: var(--muted); }
.project-card .project-symbol { color: var(--color); background: color-mix(in srgb, var(--color) 12%, white); padding: 7px 10px; border-radius: 8px; line-height: 1; font-size: 18px; }
.project-card .project-caption { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; }
.project-empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 64px 14px; border: 1px dashed #d9deef; border-radius: 16px; background: #fcfcff; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
legend { font-size: 13px; font-weight: 650; margin-bottom: 7px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: grid; place-items: center; width: 31px; height: 31px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { width: 25px; height: 25px; border-radius: 50%; background: var(--color); display: grid; place-items: center; color: white; }
.swatch input:checked + span { outline: 2px solid var(--color); outline-offset: 2px; }
.swatch input:checked + span::before { content: "✓"; }
.swatch input:focus-visible + span { outline: 3px solid #25213b; outline-offset: 2px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .75fr); gap: 16px; align-items: start; }
.settings-grid .panel h2 { margin-bottom: 13px; }
.settings-grid .panel p { margin-bottom: 6px; }
.settings-grid .stack h2 { margin: 6px 0 0; }
.settings-aside { display: grid; gap: 16px; }
#knowledge-form { margin-top: 15px; }
#knowledge-list { display: grid; gap: 10px; }
.knowledge-item { border-top: 1px solid var(--line); padding-top: 10px; display: grid; justify-items: start; gap: 3px; overflow-wrap: anywhere; margin-top: 10px; }
.knowledge-item button { padding: 3px 8px; font-size: 12px; }
.inline-field { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.inline-field input { width: auto; }
.billing-card > a { display: inline-block; margin-top: 8px; }
.task-options { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 9px; }
.composer { align-items: stretch; flex-direction: column; }
.compose-tools { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.compose-tools label { flex: 0 1 auto; }
.compose-tools input[type=file] { max-width: 207px; }
.compose-tools button { margin-left: auto; }
.scheduler-warning { color: #8d5b13; }
.message.delivery { align-self: stretch; width: 100%; max-width: 780px; border: 1px solid #a9cec5; border-left: 4px solid #198370; background: #effaf7; padding: 14px 15px; }
.message.delivery > header { color: #186c5f; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result-label { color: #fff; background: #187764; padding: 3px 7px; border-radius: 5px; }
.message-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-chip { display: inline-block; overflow-wrap: anywhere; border-radius: 7px; border: 1px solid #bdcbe2; background: #fff; padding: 4px 9px; font-size: 13px; }
.node-main span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.3; }
@media (max-width: 740px) {
    .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
    .topbar { flex-wrap: wrap; min-height: 57px; padding: 6px 12px; row-gap: 4px; }
    .topbar nav { order: 4; width: 100%; }
    .topbar nav button { flex: 1; }
    .project-bar { margin-bottom: 11px; }
    .compose-tools { gap: 6px; }
    .compose-tools label { min-width: 0; }
    .compose-tools input[type=file] { max-width: 180px; }
    .compose-tools button { margin-left: 0; }
}
@media (max-width: 375px) {
    .task-options { grid-template-columns: minmax(0, 1fr); }
}
.file-control { position: relative; display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
.file-control input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; max-width: unset; }
.file-button { white-space: nowrap; flex: none; display: inline-block; border: 1px solid var(--line); background: #fff; padding: 8px 11px; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--ink); }
.file-control:hover .file-button { border-color: #b6addf; background: #f9f8ff; }
.file-control:focus-within .file-button { outline: 3px solid #8672ee; outline-offset: 3px; }
.file-name { color: var(--muted); font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(156px, 30vw); }
.compose-tools .file-label { flex: 0 1 auto; min-width: 0; max-width: 100%; }

.install-card { width: min(100%, 590px); }
.install-form fieldset { border-top: 1px solid var(--line); padding-top: 9px; }
.install-form legend { font-size: 15px; padding-right: 8px; color: var(--ink); }
.install-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.install-host { grid-template-columns: minmax(0, 1fr) 100px; }
.install-success { margin-bottom: 15px; color: var(--teal); }
.cron-settings { margin-top: 16px; }
.cron-settings summary { cursor: pointer; font-weight: 650; }
.cron-settings p { margin: 8px 0; font-size: 13px; }
.cron-settings code { display: block; padding: 8px; border-radius: 6px; background: var(--bg); overflow-wrap: anywhere; user-select: all; }
@media (max-width: 460px) {
    .auth-shell { padding: 12px; }
    .install-card { padding: 17px; }
    .install-row:not(.install-host) { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

.worker-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #87591c; margin-top: 6px; font-size: 13px; }
.worker-banner button { padding: 2px 6px; font-size: 12px; }
#queue-settings .actions { margin: 8px 0; }
#queue-url-row { margin-top: 7px; }
.node { grid-template-columns: minmax(0, 1fr); }
.node-main { cursor: grab; padding-right: 13px; touch-action: none; }
.node.dragging .node-main { cursor: grabbing; }
.node.dragging { z-index: 1; }
.task-files-only { grid-template-columns: minmax(0, 1fr); }
.dialog-turn { display: grid; min-width: 0; gap: 11px; }
.dialog-turn .message { justify-self: start; width: fit-content; }
.dialog-turn .message.user { justify-self: end; }
.dialog-turn .message.delivery { width: 100%; }
.dialog-turn .expandable { cursor: pointer; }
.discussion { min-width: 0; font-size: 13px; }
.dialog-turn > .discussion { padding: 9px 10px 0; border-top: 1px solid var(--line); }
.dialog-turn > .discussion > summary { color: var(--muted); font-weight: 650; }
.discussion > summary { cursor: pointer; color: var(--teal); }
.discussion-body { display: grid; gap: 7px; margin-top: 8px; border-left: 2px solid #e0e5ee; padding-left: 9px; cursor: auto; }
.delivery .discussion { border-top: 1px solid #c5dfd9; margin-top: 10px; padding-top: 7px; }
.discussion .message { max-width: 100%; }
.discussion .message.system { border: 0; background: transparent; padding: 4px 3px; }
.discussion .message.system .message-body { margin-top: 1px; }

.thread-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 7px; }
.thread-controls button { font-size: 13px; white-space: nowrap; padding: 6px 9px; }
.thread-cost { color: #53617b; font-size: 12px; font-variant-numeric: tabular-nums; background: #f0f3f8; padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.message .message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.message-meta time { color: #596781; font-weight: normal; font-size: 11px; }
.actor-badge { background: var(--actor-bg, #ebefff); color: var(--actor-fg, #273c80); padding: 2px 6px; line-height: 1.4; border-radius: 5px; font-weight: 720; overflow-wrap: anywhere; }
[data-actor-color="0"] { --actor-bg: #e9e2ff; --actor-fg: #4a2d96; }
[data-actor-color="1"] { --actor-bg: #d7efff; --actor-fg: #174e7f; }
[data-actor-color="2"] { --actor-bg: #d4eee6; --actor-fg: #176453; }
[data-actor-color="3"] { --actor-bg: #fbe0eb; --actor-fg: #8c2857; }
[data-actor-color="4"] { --actor-bg: #fdeacb; --actor-fg: #75450a; }
[data-actor-color="5"] { --actor-bg: #e3eed4; --actor-fg: #3e5a1a; }
[data-actor-color="6"] { --actor-bg: #f8dfdb; --actor-fg: #873e30; }
[data-actor-color="7"] { --actor-bg: #dfe7fe; --actor-fg: #343e8d; }
[data-actor-color="8"] { --actor-bg: #d8ecee; --actor-fg: #245c63; }
[data-actor-color="9"] { --actor-bg: #f1e4f2; --actor-fg: #693b70; }
.message.question { background: #fff7e2; border-color: #e5c779; }
.message.pending-question { width: 100%; }
.question-label { border-radius: 5px; padding: 2px 6px; font-weight: 720; color: #79500f; background: #fae7ad; }
.answer-question { margin-top: 8px; padding: 5px 8px; }
.question-summary { border: 1px solid #e6d5aa; background: #fff9eb; padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.question-summary p { color: #49371a; margin-top: 5px; white-space: pre-wrap; }
#telegram-form { margin-top: 12px; }
#telegram-form .quiet { margin: 0; }
@media (max-width: 620px) {
    .thread-head { flex-wrap: wrap; }
    .thread-controls { justify-content: flex-start; }
}

.workspace { max-width: none; width: 100%; padding-inline: clamp(14px, 2.5vw, 46px); }
.topbar { padding-inline: clamp(14px, 2.5vw, 46px); }
.auth-card .brand { justify-content: center; }
.brand { letter-spacing: .045em; }
.brand .mark {
    position: relative; width: 35px; height: 35px; overflow: hidden; border-radius: 11px;
    background: linear-gradient(145deg, #7057f4, #392592 78%); box-shadow: inset 0 1px 1px #ffffff5c;
}
.brand .mark::before {
    content: ""; position: absolute; inset: 7px 8px 7px;
    background: #fff; clip-path: polygon(39% 0, 62% 0, 100% 100%, 77% 100%, 51% 27%, 21% 100%, 0 100%);
}
.brand .mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; left: 15px; top: 21px; background: #7de8d7; }
.mobile-nav { display: none; }
.link-kind select { min-height: 36px; width: auto; padding: 5px 8px; }
.node-main { padding-right: 22px; }
.node-port {
    padding: 0; width: 21px; height: 21px; display: grid; place-items: center;
    border-radius: 50%; border: 2px solid #6d57cf; background: white; position: absolute; right: -9px; top: calc(50% - 10px);
    touch-action: none; cursor: crosshair;
}
.node-port::before { content: ""; width: 7px; height: 7px; background: #6d57cf; border-radius: 50%; }
.node.link-target { outline: 2px solid #147d6c; outline-offset: 3px; }
.node-team {
    position: absolute; right: 12px; bottom: 5px; padding: 1px 5px; border-color: transparent;
    font-size: 10px; color: var(--accent); background: #fff;
}
.director-node { border-color: #b7a9ef; background: #f5f0ff; }
#arrows path.connector.peer { marker-start: url(#arrow-start); stroke: #527cb0; }
#arrow-start path { fill: #527cb0; }
#arrows path#link-preview { stroke: #177f6c; stroke-width: 2; fill: none; stroke-dasharray: 6 4; marker-end: url(#arrow-tip); pointer-events: none; }
.message.source { color: #295675; background: #edf5fd; border-color: #c9dce9; }
.message-body strong { font-weight: 750; }
.message-body code { background: #e9edf6; padding: 1px 3px; border-radius: 3px; overflow-wrap: anywhere; }
#question-dialog { max-height: min(94dvh, 760px); overflow: auto; }
@media (min-width: 1000px) {
    .builder { grid-template-columns: minmax(0, 1fr) clamp(270px, 21vw, 360px); }
    .chat { grid-template-columns: clamp(240px, 19vw, 342px) minmax(0, 1fr); height: clamp(540px, calc(100dvh - 219px), 1450px); }
    .canvas-scroll { height: clamp(540px, calc(100dvh - 278px), 1400px); }
    .dialog-turn .message.delivery { max-width: min(91%, 1050px); }
}
@media (max-width: 760px) {
    .topbar { position: relative; justify-content: center; display: flex; padding: 9px 14px; min-height: 62px; }
    .topbar #project-nav, .topbar .profile-button { display: none; }
    .mobile-nav {
        display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 1px;
        padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); position: fixed; bottom: 0; left: 0; right: 0;
        z-index: 4; border-top: 1px solid #dedde9; background: #fff; box-shadow: 0 -3px 22px #29214e0e;
    }
    .mobile-nav button {
        display: grid; place-items: center; gap: 1px; min-width: 0; min-height: 49px;
        padding: 3px 1px; border: 0; background: transparent; font-size: clamp(10px, 2.8vw, 13px); overflow-wrap: anywhere;
    }
    .mobile-nav button > span { font-size: 19px; line-height: 22px; }
    .mobile-nav button.active { background: var(--tint); color: var(--accent); }
    .workspace { padding: 17px 12px calc(85px + env(safe-area-inset-bottom)); }
    .page-head { align-items: flex-start; gap: 8px; margin-bottom: 14px; }
    .project-bar { margin-bottom: 8px; }
    .builder { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .inspector { border-left: 0; border-top: 1px solid var(--line); }
    .canvas-scroll { height: min(48dvh, 440px); min-height: 260px; }
    .toolbar { padding: 8px; }
    .toolbar .actions { gap: 6px; }
    .toolbar button { padding: 6px 8px; font-size: 12px; }
    .chat { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); min-height: 560px; height: calc(100dvh - 190px); }
    .chat-list { max-height: 118px; border: 0; border-bottom: 1px solid var(--line); }
    .thread-head, .composer, .messages { padding-inline: 8px; }
    .conversation, .messages, .chat-list { min-width: 0; }
    .thread-controls { justify-content: flex-start; }
    .message { max-width: 98%; }
    .discussion-body { padding-left: 5px; }
    .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
    .node-port { width: 24px; height: 24px; right: -9px; }
}
@media (min-width: 761px) {
    .topbar { position: relative; }
    .topbar .brand-button { position: absolute; left: 50%; transform: translateX(-50%); }
}
@media (max-width: 760px) and (min-height: 521px) {
    body[data-view="tasks"] .workspace {
        height: calc(100dvh - 62px - 61px - env(safe-area-inset-bottom));
        padding-bottom: 7px; display: flex; flex-direction: column; overflow: hidden;
    }
    #view-tasks { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #view-tasks .page-head { flex: none; }
    #view-tasks .chat { flex: 1; min-height: 0; height: auto; }
    #view-tasks .chat-list { max-height: min(112px, 16dvh); }
    #view-tasks .composer { padding-block: 7px; gap: 5px; }
    #view-tasks .composer textarea { min-height: 45px; }
}
