:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-strong: #f0f3f6;
    --ink: #17202a;
    --muted: #627084;
    --line: #d8dee6;
    --edge: #8a98aa;
    --running: #2563eb;
    --running-soft: #dbeafe;
    --complete: #16835f;
    --complete-soft: #dff7ec;
    --failed: #c24137;
    --failed-soft: #fde2df;
    --pending: #6b7280;
    --pending-soft: #eef0f3;
    --accent: #0f766e;
    --warning: #a16207;
    --shadow: 0 12px 34px rgb(24 33 43 / 10%);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
}

.hidden {
    display: none !important;
}

button {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    height: 38px;
    padding: 0 14px;
}

button:disabled {
    background: #f4f6f8;
    border-color: #d7dde5;
    color: #94a0ae;
    cursor: not-allowed;
}

.button-link {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    height: 38px;
    padding: 0 14px;
    text-decoration: none;
}

.button-link.is-disabled {
    background: #f4f6f8;
    border-color: #d7dde5;
    color: #94a0ae;
    cursor: not-allowed;
    pointer-events: none;
}

button:hover {
    border-color: #a7b0bc;
    background: #f9fafb;
}

button.is-active {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border-color: #0f766e;
    color: #ffffff;
}

.button-link:hover {
    background: #f9fafb;
    border-color: #a7b0bc;
}

.app-shell {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    min-height: 0;
}

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 76px;
    padding: 14px 22px;
}

.brand {
    min-width: 0;
}

.eyebrow {
    color: var(--accent);
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    line-height: 1.15;
}

h2 {
    font-size: 1rem;
    line-height: 1.25;
}

.topbar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.connection {
    align-items: center;
    background: var(--pending-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 700;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    white-space: nowrap;
}

.connection-dot {
    background: var(--pending);
    border-radius: 999px;
    display: block;
    height: 8px;
    width: 8px;
}

.connection.connected {
    background: var(--complete-soft);
    color: var(--complete);
}

.connection.connected .connection-dot {
    background: var(--complete);
}

.connection.disconnected {
    background: var(--failed-soft);
    color: var(--failed);
}

.connection.disconnected .connection-dot {
    background: var(--failed);
}

.log-status {
    align-items: center;
    background: #ecfeff;
    border: 1px solid #b9edf0;
    border-radius: 999px;
    color: #0f766e;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 800;
    height: 34px;
    padding: 0 12px;
    white-space: nowrap;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 14px 350px;
    grid-template-rows: 1fr auto;
    min-height: 0;
    padding: 14px;
    gap: 12px 0;
    position: relative;
}

.workspace.sidebar-collapsed {
    grid-template-columns: 1fr 0px 0px !important;
}

.workspace.sidebar-collapsed #workspace-resizer,
.workspace.sidebar-collapsed .inspector {
    display: none !important;
}

.graph-pane {
    grid-column: 1;
    grid-row: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.inspector {
    grid-column: 3;
    grid-row: 1;
}

.graph-head {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 10px;
    padding: 12px;
}

.sidebar-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--surface-strong);
    color: var(--ink);
    border-color: #a7b0bc;
}

.sidebar-toggle.is-active {
    background: var(--surface-strong);
    color: var(--ink);
}

/* Sidebar toggle highlight animation */
@keyframes togglePulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.5);
        border-color: var(--accent);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(15, 118, 110, 0);
        border-color: var(--accent);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(15, 118, 110, 0);
    }
}

.sidebar-toggle.pulse-highlight {
    animation: togglePulseGlow 1.8s infinite;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
    border-width: 1.5px !important;
}

.metric {
    align-items: baseline;
    background: var(--surface-strong);
    border: 1px solid #e1e6ee;
    border-radius: 8px;
    display: inline-flex;
    gap: 7px;
    height: 42px;
    min-width: 104px;
    padding: 9px 11px;
}

.metric-value {
    color: var(--ink);
    font-size: 1.15rem;
    font-weight: 800;
}

.metric-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.graph-stage {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    cursor: default;
}

.graph-stage.grabbing {
    cursor: default;
}

#graph {
    display: none;
}

.zoom-controls {
    align-items: center;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(216, 222, 230, 0.7);
    border-radius: 10px;
    bottom: 16px;
    box-shadow:
        0 4px 16px rgba(24, 33, 43, 0.1),
        0 1px 3px rgba(24, 33, 43, 0.06);
    display: flex;
    gap: 2px;
    padding: 4px;
    position: absolute;
    right: 16px;
    z-index: 10;
}

.zoom-controls button {
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    padding: 0;
    transition:
        background 0.15s ease,
        color 0.15s ease;
    width: 32px;
}

.zoom-controls button:hover {
    background: var(--surface-strong);
    border: none;
    color: var(--accent);
}

.zoom-controls button:active {
    background: var(--line);
    transform: scale(0.93);
}

.zoom-level {
    color: var(--muted);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    min-width: 42px;
    text-align: center;
    user-select: none;
}

.zoom-divider {
    background: var(--line);
    height: 18px;
    margin: 0 2px;
    width: 1px;
}

.empty-state {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 1rem;
    font-weight: 700;
    inset: 0;
    justify-content: center;
    pointer-events: none;
    position: absolute;
}

.empty-state.hidden {
    display: none;
}

.agent-modal {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 150;
}

.agent-modal.hidden {
    display: none;
}

.agent-modal-backdrop {
    background: rgba(15, 23, 42, 0.56);
    inset: 0;
    position: absolute;
}

.agent-modal-dialog {
    background: var(--surface);
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 16px;
    box-shadow:
        0 30px 60px rgba(15, 23, 42, 0.24),
        0 8px 20px rgba(15, 118, 110, 0.08);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: min(88vh, 900px);
    max-width: min(860px, 100%);
    min-width: min(680px, 100%);
    overflow: hidden;
    position: relative;
    width: 100%;
}

.agent-modal-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px 22px;
}

.agent-modal-title-wrap {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.agent-modal-subtitle {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
    word-break: break-word;
}

.agent-modal-close {
    align-items: center;
    background: var(--surface-strong);
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    color: var(--muted);
    display: inline-flex;
    flex-shrink: 0;
    height: 36px;
    justify-content: center;
    padding: 0;
    width: 36px;
}

.agent-modal-body {
    display: grid;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 22px 3.5rem 22px;
}

.agent-modal-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.agent-modal-section {
    display: grid;
    gap: 8px;
}

.config-modal {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 40;
}

.config-modal.hidden {
    display: none;
}

.config-modal-dialog {
    background: var(--surface);
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 16px;
    box-shadow:
        0 30px 60px rgba(15, 23, 42, 0.24),
        0 8px 20px rgba(15, 118, 110, 0.08);
    max-width: min(640px, 100%);
    min-width: min(520px, 100%);
    overflow: hidden;
    position: relative;
    width: 100%;
}

.config-form {
    display: grid;
    gap: 16px;
    padding: 18px 22px 22px;
}

.config-field {
    display: grid;
    gap: 7px;
}

.config-label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.config-input {
    background: var(--surface-strong);
    border: 1px solid #d0d8e2;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    min-width: 0;
    padding: 11px 12px;
}

.config-input:focus {
    border-color: rgba(15, 118, 110, 0.5);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
    outline: none;
}

.config-status {
    background: var(--surface-strong);
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 10px 12px;
}

.config-status.is-error {
    background: #fff5f4;
    border-color: rgba(194, 65, 55, 0.2);
    color: var(--failed);
}

.config-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.secondary-button {
    background: var(--surface-strong);
}

.inspector {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.inspector > .panel {
    flex: 1;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.node-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.panel-body {
    min-height: 0;
}

.panel-heading {
    align-items: center;
}

.panel-heading-meta {
    align-items: center;
    display: flex;
    gap: 10px;
    min-width: 0;
}

.panel-toggle {
    align-items: center;
    background: var(--surface-strong);
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    color: var(--muted);
    display: inline-flex;
    flex-shrink: 0;
    height: 30px;
    justify-content: center;
    padding: 0;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
    width: 30px;
}

.panel-toggle:hover {
    background: #f7fafc;
    border-color: #bcc7d3;
    color: var(--accent);
}

.panel-toggle svg {
    transition: transform 0.2s ease;
}

.collapsible-panel.is-collapsed .panel-toggle svg {
    transform: rotate(-90deg);
}

.collapsible-panel.is-collapsed .panel-body {
    display: none;
}

dl {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin: 0;
}

dl div {
    background: var(--surface-strong);
    border-radius: 8px;
    min-width: 0;
    padding: 9px;
}

dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 4px;
    text-transform: uppercase;
}

dd {
    font-size: 0.92rem;
    font-weight: 750;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-action {
    border-left: 3px solid var(--accent);
    color: #273241;
    font-size: 0.92rem;
    line-height: 1.45;
    padding-left: 10px;
}

.summary-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    border: 1px solid #dfe7ef;
    border-radius: 10px;
    display: grid;
    gap: 8px;
    padding: 10px;
}

.summary-card-head {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.summary-badge {
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
    text-transform: uppercase;
}

.summary-badge.pending {
    background: var(--pending-soft);
    color: var(--pending);
}

.summary-badge.ready {
    background: var(--complete-soft);
    color: var(--complete);
}

.summary-badge.error {
    background: var(--failed-soft);
    color: var(--failed);
}

.summary-description {
    color: #273241;
    font-size: 0.84rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.prompt-card {
    background: var(--surface-strong);
    border: 1px solid #e1e6ee;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 10px;
}

.prompt-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.selected-prompt {
    color: #273241;
    font-size: 0.84rem;
    line-height: 1.45;
    max-height: 132px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.tool-history-section {
    display: grid;
    gap: 10px;
    min-height: 0;
}

.tool-history-header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.tool-history-title {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.tool-history-count {
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    min-width: 28px;
    padding: 3px 8px;
    text-align: center;
}

.tool-history-empty {
    background: var(--surface-strong);
    border: 1px dashed #d0d8e2;
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
    padding: 12px;
    text-align: center;
}

.tool-history-empty.hover {
    background: #f8fafc;
}

.tool-history-list {
    display: grid;
    gap: 10px;
}

.tool-history-list.compact {
    gap: 8px;
}

.tool-history-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    border: 1px solid #dfe7ef;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    display: grid;
    gap: 10px;
    padding: 12px;
}

.tool-history-card.running {
    border-color: rgba(37, 99, 235, 0.28);
}

.tool-history-card.complete {
    border-color: rgba(15, 118, 110, 0.2);
}

.tool-history-card-header {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.tool-history-card-title-wrap {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.tool-history-card-title {
    color: var(--ink);
    font-size: 0.84rem;
    line-height: 1.2;
}

.tool-history-card-summary {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.45;
    word-break: break-word;
}

.tool-history-card-desc {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
    word-break: break-word;
}

.tool-history-caret {
    font-size: 0.75rem;
    color: var(--muted);
    width: 12px;
    text-align: center;
    transition: transform 0.2s ease;
}

.tool-history-status {
    align-self: flex-start;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.03em;
    padding: 4px 8px;
    text-transform: uppercase;
    white-space: nowrap;
}

.tool-history-status.running {
    background: #dbeafe;
    color: var(--running);
}

.tool-history-status.complete {
    background: #dff7ec;
    color: var(--complete);
}

.tool-history-card-body {
    display: grid;
    gap: 8px;
}

.tool-history-meta {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    word-break: break-word;
}

.tool-history-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tool-history-pre {
    background: #0f172a;
    border-radius: 8px;
    color: #d8f4ef;
    font-family:
        "IBM Plex Mono",
        "Cascadia Code",
        Consolas,
        monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    margin: 0;
    max-height: 180px;
    overflow: auto;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.replay-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
}

.node-panel .panel-body {
    display: grid;
    gap: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.replay-panel .panel-body {
    display: grid;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 14px;
}

.log-path {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
    padding: 0 16px;
    word-break: break-all;
}

.replay-dropzone {
    align-items: center;
    background: linear-gradient(180deg, #fbfdff 0%, #f1f6fb 100%);
    border: 1.5px dashed #9cb4ca;
    border-radius: 8px;
    color: #36506a;
    cursor: pointer;
    display: flex;
    font-size: 0.84rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1.4;
    margin: 0 16px;
    min-height: 82px;
    padding: 14px;
    text-align: center;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        color 0.15s ease;
}

.replay-dropzone:hover,
.replay-dropzone.dragover {
    background: linear-gradient(180deg, #effcf8 0%, #e0f6ee 100%);
    border-color: var(--accent);
    color: var(--accent);
}

.replay-load-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 16px 10px;
}

.replay-picker-button {
    appearance: none;
    background: linear-gradient(135deg, #effcf8 0%, #ecfeff 100%);
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    min-height: 38px;
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.replay-picker-button:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.08);
    transform: translateY(-1px);
}

.replay-picker-button.secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-color: #d7e0ea;
    color: var(--ink);
}

.replay-dropnote {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.45;
    margin: 0;
    padding: 0 16px 12px;
}

.inline-code {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    background-color: var(--surface-strong);
    color: #0d9488; /* sleek, dark teal matching --accent */
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(15, 118, 110, 0.15);
    font-size: 0.9em;
    font-weight: 600;
    word-break: break-all;
}

.replay-dropnote.is-warning {
    color: #9a3412;
}

.subagent-prompt-banner {
    background: #fef3c7; /* Light warm amber */
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 16px 16px;
    display: flex;
    gap: 10px;
    position: relative;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.08);
    animation: fadeInSlide 0.25s ease-out;
}

.subagent-prompt-banner.hidden {
    display: none !important;
}

.subagent-prompt-icon {
    color: #d97706;
    flex-shrink: 0;
    margin-top: 1px;
}

.subagent-prompt-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.subagent-prompt-text {
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.subagent-prompt-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.subagent-prompt-actions button {
    font-size: 0.72rem;
    padding: 6px 12px;
    height: auto;
}

.subagent-prompt-dismiss {
    background: none;
    border: none;
    color: #b45309;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.subagent-prompt-dismiss:hover {
    background: rgba(180, 83, 9, 0.08);
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ═══════════════════════════════════════════════════════════ */
/* Demo Logs Library                                           */
/* ═══════════════════════════════════════════════════════════ */

.demo-logs-section {
    display: grid;
    gap: 0;
    margin: 0 16px;
}

.demo-logs-toggle {
    align-items: center;
    appearance: none;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
    border: 1px solid #99e0d3;
    border-radius: 8px;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 7px;
    height: 36px;
    padding: 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    width: 100%;
}

.demo-logs-toggle:hover {
    background: linear-gradient(135deg, #e6faf5 0%, #d5f5f0 100%);
    border-color: var(--accent);
}

.demo-logs-toggle-icon {
    flex-shrink: 0;
}

.demo-logs-count {
    background: var(--accent);
    border-radius: 999px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    height: 18px;
    line-height: 18px;
    min-width: 18px;
    padding: 0 5px;
    text-align: center;
}

.demo-logs-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.demo-logs-section.collapsed .demo-logs-chevron {
    transform: rotate(-90deg);
}

.demo-logs-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0 0;
}

.demo-logs-section.collapsed .demo-logs-list,
.demo-logs-section.collapsed .demo-logs-empty,
.demo-logs-section.collapsed .session-search-container {
    display: none !important;
}

.session-search-container {
    position: relative;
    padding: 8px 0 0;
    display: flex;
    align-items: center;
    width: 100%;
}

.session-search-input {
    width: 100%;
    height: 36px;
    padding: 0 32px 0 12px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.session-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.session-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    border-radius: 50%;
    transition: color 0.18s ease;
}

.session-search-clear:hover {
    color: var(--ink);
}

.session-search-container.hidden {
    display: none !important;
}

.demo-logs-empty {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
    padding: 14px 0 4px;
    text-align: center;
}

.demo-log-card {
    background: var(--surface-strong);
    border: 1px solid #e1e6ee;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    transition: all 0.2s ease;
    position: relative;
}

.demo-log-card:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, #f7fffe 0%, #f0faf7 100%);
    box-shadow: 0 2px 12px rgba(15, 118, 110, 0.1);
}

.demo-log-card:active {
    transform: scale(0.98);
}

.demo-log-card.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.demo-log-card.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 999px;
    animation: demo-log-spin 0.6s linear infinite;
}

@keyframes demo-log-spin {
    to {
        transform: rotate(360deg);
    }
}

.demo-log-header {
    align-items: center;
    display: flex;
    gap: 8px;
}

.demo-log-play-icon {
    align-items: center;
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    flex-shrink: 0;
    height: 26px;
    justify-content: center;
    width: 26px;
    box-shadow: 0 1px 4px rgba(15, 118, 110, 0.3);
    transition: all 0.2s ease;
}

.demo-log-card:hover .demo-log-play-icon {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.4);
    transform: scale(1.08);
}

.session-log-card.is-selected {
    background: linear-gradient(135deg, #f6fffd 0%, #eefcf8 100%);
    border-color: rgba(15, 118, 110, 0.4);
    box-shadow:
        0 2px 12px rgba(15, 118, 110, 0.12),
        inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.session-log-header {
    align-items: flex-start;
}

.session-log-title-wrap {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.session-log-path {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
}

.session-log-description {
    color: #334155;
    font-size: 0.76rem;
    line-height: 1.45;
    margin: 0;
}

.session-log-meta {
    margin-top: 2px;
}

.demo-log-title {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 750;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.demo-log-description {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.demo-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.demo-log-pill {
    background: #fff;
    border: 1px solid #e1e6ee;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
    height: 22px;
    line-height: 20px;
    padding: 0 8px;
    white-space: nowrap;
}

.demo-log-pill.model-pill {
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    border-color: #e4d0f7;
    color: #7c3aed;
}

.demo-logs-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.demo-logs-list::-webkit-scrollbar-track {
    background: transparent;
}

.demo-logs-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}

.demo-logs-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .replay-load-actions {
        grid-template-columns: 1fr;
    }

    .agent-modal,
    .config-modal {
        padding: 12px;
    }

    .agent-modal-dialog,
    .config-modal-dialog {
        max-height: calc(100vh - 24px);
        min-width: 0;
    }

    .agent-modal-header,
    .agent-modal-body,
    .config-form {
        padding-left: 14px;
        padding-right: 14px;
    }

    .agent-modal-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .config-actions {
        flex-direction: column-reverse;
    }
}

.feed-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.feed-panel .panel-body {
    min-height: 0;
}

.feed-heading {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
}

#sequence {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.event-feed {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 12px;
}

.event-row {
    background: var(--surface-strong);
    border: 1px solid #e1e6ee;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 5px;
    padding: 10px;
}

.event-row:hover {
    border-color: #b8c1cd;
}

.event-row strong {
    display: block;
    font-size: 0.86rem;
    line-height: 1.2;
}

.event-row span {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    line-height: 1.35;
}

.edge-path {
    fill: none;
    stroke: var(--edge);
    stroke-linecap: round;
    stroke-width: 2.5;
}

.edge-label {
    fill: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.node {
    cursor: pointer;
}

.node-card {
    fill: #ffffff;
    stroke: #c8d0da;
    stroke-width: 1.5;
}

.node.running .node-card {
    fill: var(--running-soft);
    stroke: var(--running);
}

.node.complete .node-card {
    fill: var(--complete-soft);
    stroke: var(--complete);
}

.node.failed .node-card {
    fill: var(--failed-soft);
    stroke: var(--failed);
}

.node.pending .node-card {
    fill: var(--pending-soft);
    stroke: var(--pending);
}

.node.selected .node-card {
    stroke-width: 3;
}

.node-title {
    fill: var(--ink);
    font-size: 15px;
    font-weight: 850;
}

.node-meta {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.node-summary {
    fill: #1f2937;
    font-size: 12px;
    font-weight: 650;
}

.node-action {
    fill: #273241;
    font-size: 11px;
    font-weight: 700;
}

.status-pill {
    fill: #ffffff;
    opacity: 0.92;
    stroke-width: 1;
}

.node.running .status-pill {
    stroke: var(--running);
}

.node.complete .status-pill {
    stroke: var(--complete);
}

.node.failed .status-pill {
    stroke: var(--failed);
}

.node.pending .status-pill {
    stroke: var(--pending);
}

.status-text {
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.node.running .status-text {
    fill: var(--running);
}

.node.complete .status-text {
    fill: var(--complete);
}

.node.failed .status-text {
    fill: var(--failed);
}

.node.pending .status-text {
    fill: var(--pending);
}

.running-dot {
    fill: var(--running);
    opacity: 0;
}

.node.running .running-dot {
    animation: pulse 1.25s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.3;
        r: 4;
    }
    50% {
        opacity: 1;
        r: 6;
    }
}

@media (max-width: 860px) {
    body {
        overflow: hidden;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .workspace {
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(0, 1fr);
    }

    .inspector {
        display: none;
    }

    .resize-handle-v {
        display: none;
    }
}

/* Resize Handles Styling */
.resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.resize-handle:hover {
    background-color: rgba(15, 118, 110, 0.04);
}

.resize-handle.active {
    background-color: rgba(15, 118, 110, 0.08);
}

.resize-handle-line {
    background-color: var(--line);
    border-radius: 999px;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        width 0.2s ease,
        height 0.2s ease;
}

.resize-handle:hover .resize-handle-line,
.resize-handle.active .resize-handle-line {
    background-color: var(--accent);
}

/* Vertical Splitter (Resizes columns horizontally) */
.resize-handle-v {
    cursor: col-resize;
    width: 14px;
    height: 100%;
}

.resize-handle-v .resize-handle-line {
    width: 4px;
    height: 40px;
}

.resize-handle-v:hover .resize-handle-line,
.resize-handle-v.active .resize-handle-line {
    width: 6px;
    height: 60px;
    transform: scaleX(1.2);
}

/* Horizontal Splitter (Resizes panels vertically) */
.resize-handle-h {
    cursor: row-resize;
    height: 14px;
    width: 100%;
}

.resize-handle-h .resize-handle-line {
    width: 40px;
    height: 4px;
}

.resize-handle-h:hover .resize-handle-line,
.resize-handle.active .resize-handle-line {
    width: 60px;
    height: 6px;
    transform: scaleY(1.2);
}

/* Body cursors during drag */
body.resizing-col,
body.resizing-col * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.resizing-row,
body.resizing-row * {
    cursor: row-resize !important;
    user-select: none !important;
}

/* Custom scrollbar styling for panels and event feed */
.node-panel::-webkit-scrollbar,
.replay-panel::-webkit-scrollbar,
.event-feed::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.node-panel::-webkit-scrollbar-track,
.replay-panel::-webkit-scrollbar-track,
.event-feed::-webkit-scrollbar-track {
    background: transparent;
}

.node-panel::-webkit-scrollbar-thumb,
.replay-panel::-webkit-scrollbar-thumb,
.event-feed::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}

.node-panel::-webkit-scrollbar-thumb:hover,
.replay-panel::-webkit-scrollbar-thumb:hover,
.event-feed::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════ */
/* Replay Player Controls                                      */
/* ═══════════════════════════════════════════════════════════ */

.replay-player {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px 4px;
}

#workspace-resizer {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.workspace.sidebar-collapsed #replay-player {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: calc(100% - 48px);
    z-index: 100;
    box-shadow: 0 10px 30px rgb(24 33 43 / 15%), 0 1px 8px rgb(24 33 43 / 10%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--line);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    padding: 14px 16px;
    animation: playerFloatIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.workspace.sidebar-collapsed .linear-flow-container {
    padding-bottom: 160px;
}

@keyframes playerFloatIn {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.replay-player.active {
    display: flex;
}

.replay-clock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.replay-sim-clock {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0f766e12, #2563eb0a);
    border: 1px solid #0f766e30;
    border-radius: 8px;
    padding: 5px 10px;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    flex: 1;
}

.replay-sim-clock .clock-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--accent);
}

.replay-sim-clock .clock-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.replay-sim-clock .clock-time {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.replay-event-counter {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-strong);
    border: 1px solid #e1e6ee;
    border-radius: 8px;
    padding: 5px 9px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.replay-event-counter .counter-current {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
}

.replay-event-counter .counter-sep {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.replay-event-counter .counter-total {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.replay-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.replay-progress-track {
    flex: 1;
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.replay-progress-track input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--accent) var(--progress, 0%),
        var(--line) var(--progress, 0%)
    );
    outline: none;
    cursor: pointer;
    margin: 0;
    transition: height 0.15s ease;
}

.replay-progress-track input[type="range"]:hover {
    height: 8px;
}

.replay-progress-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--accent);
    border: 2.5px solid #fff;
    box-shadow:
        0 1px 6px rgba(15, 118, 110, 0.35),
        0 0 0 1px rgba(15, 118, 110, 0.15);
    cursor: grab;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}

.replay-progress-track input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow:
        0 2px 10px rgba(15, 118, 110, 0.45),
        0 0 0 2px rgba(15, 118, 110, 0.12);
}

.replay-progress-track input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.replay-progress-track input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--accent);
    border: 2.5px solid #fff;
    box-shadow:
        0 1px 6px rgba(15, 118, 110, 0.35),
        0 0 0 1px rgba(15, 118, 110, 0.15);
    cursor: grab;
}

.replay-progress-track input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: transparent;
}

.replay-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.replay-transport {
    display: flex;
    align-items: center;
    gap: 4px;
}

.replay-transport button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: all 0.15s ease;
}

.replay-transport button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0fdfa;
}

.replay-transport button:active {
    transform: scale(0.93);
}

.replay-transport button.is-playing {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border-color: #0f766e;
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.35);
}

.replay-transport button.is-playing:hover {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: #fff;
}

.replay-speed-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.replay-speed-control .speed-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.speed-info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

button.tooltip-trigger {
    background: var(--surface-strong);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    min-width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

button.tooltip-trigger:hover,
button.tooltip-trigger:focus {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    outline: none;
}

.tooltip-box {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 12px;
    border-radius: 8px;
    width: 240px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.tooltip-box h3 {
    margin: 0 0 6px 0;
    font-size: 0.8rem;
    font-weight: 750;
    color: var(--ink);
}

.tooltip-box p {
    margin: 4px 0;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--muted);
    text-transform: none;
    letter-spacing: normal;
}

.tooltip-box p strong {
    color: var(--ink);
}

.speed-info-tooltip:hover .tooltip-box,
button.tooltip-trigger:focus + .tooltip-box {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.replay-speed-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    height: 32px;
    padding: 0 28px 0 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23627084' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='3,4.5 6,7.5 9,4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.15s ease;
}

.replay-speed-select:hover {
    border-color: var(--accent);
}

.replay-speed-select:focus {
    outline: 2px solid rgba(15, 118, 110, 0.3);
    outline-offset: 1px;
}

.replay-elapsed {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    text-align: right;
}

/* Tool Run Item in Graph Card */
.tool-run-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
    cursor: pointer;
}

.tool-run-item:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    border-color: #cbd5e1;
}

/* Status variants matching theme colors */
.tool-run-item.complete {
    border-left: 3px solid var(--complete);
}

.tool-run-item.running {
    border-left: 3px solid var(--running);
}

/* Tool Run Header */
.tool-run-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    min-height: 36px;
    box-sizing: border-box;
    background: #f8fafc;
}

.tool-run-item.running .tool-run-header {
    background: var(--running-soft);
}

.tool-run-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #94a3b8;
}

.tool-run-item.complete .tool-run-dot {
    background-color: var(--complete);
}

.tool-run-item.running .tool-run-dot {
    background-color: var(--running);
    animation: tool-pulse 1.25s infinite;
}

@keyframes tool-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.25); }
}

.tool-run-title-wrap {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.tool-run-title {
    font-weight: 700;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-run-desc {
    font-weight: 500;
    color: #64748b;
    font-size: 0.65rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* margin-top: 1px; */
}

.tool-run-caret {
    font-size: 9px;
    color: #64748b;
    transition: transform 0.2s;
}

/* Tool Run Body */
.tool-run-body {
    padding: 8px;
    background: #0f172a;
    color: #e2e8f0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.tool-run-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-run-section-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.tool-run-val {
    margin: 0;
    padding: 6px;
    background: #1e293b;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 60px;
    border: 1px solid #334155;
}

/* Custom scrollbar styling for tool-run scrollable areas */
.tool-run-body::-webkit-scrollbar,
.tool-run-val::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.tool-run-body::-webkit-scrollbar-track,
.tool-run-val::-webkit-scrollbar-track {
    background: transparent;
}

.tool-run-body::-webkit-scrollbar-thumb,
.tool-run-val::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.tool-run-body::-webkit-scrollbar-thumb:hover,
.tool-run-val::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

/* Linear Flow container */
.linear-flow-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Linear node card style */
.node-card-html {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
}

.node-card-html:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgb(24 33 43 / 14%);
    border-color: var(--accent);
}

.node-card-html.selected {
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15), var(--shadow);
}

/* Highlight flash animation */
@keyframes highlightFlash {
    0% {
        background-color: var(--surface);
    }
    30% {
        background-color: rgba(15, 118, 110, 0.15);
    }
    100% {
        background-color: var(--surface);
    }
}

.node-card-html.highlight-flash {
    animation: highlightFlash 1.2s ease;
}

/* Card Header */
.card-header-html {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--surface-strong);
    padding-bottom: 12px;
}

.card-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Pulsing dot for running agents */
.card-running-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--running);
    display: none;
}

.node-card-html.running .card-running-dot {
    display: block;
    animation: pulse-html 1.25s ease-in-out infinite;
}

@keyframes pulse-html {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.card-title-text {
    font-size: 1.05rem;
    font-weight: 850;
    color: var(--ink);
}

.card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.card-badge.role {
    background-color: var(--surface-strong);
    color: var(--muted);
    border: 1px solid var(--line);
}

.card-badge.status {
    background-color: #ffffff;
    border: 1px solid transparent;
}

.node-card-html.running .card-badge.status {
    background-color: var(--running-soft);
    color: var(--running);
    border-color: var(--running);
}

.node-card-html.complete .card-badge.status {
    background-color: var(--complete-soft);
    color: var(--complete);
    border-color: var(--complete);
}

.node-card-html.failed .card-badge.status {
    background-color: var(--failed-soft);
    color: var(--failed);
    border-color: var(--failed);
}

.node-card-html.pending .card-badge.status {
    background-color: var(--pending-soft);
    color: var(--pending);
    border-color: var(--pending);
}

/* Card Meta Data (e.g. model, elapsed time) */
.card-meta-html {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 650;
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Spawn relationships links */
.card-relations-html {
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    font-size: 0.82rem;
    background: var(--surface-strong);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.card-relations-html a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.card-relations-html a:hover {
    text-decoration: underline;
}

/* Spawn prompt styling */
.card-prompt-html {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.card-prompt-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
}

.card-prompt-text {
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--ink);
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
}

/* Description / Last Action styling */
.card-description-html {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--ink);
    font-weight: 600;
}

.card-action-html {
    font-size: 0.82rem;
    background-color: rgba(15, 118, 110, 0.05);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    color: #273241;
    font-weight: 700;
    border-radius: 0 6px 6px 0;
}

/* Tool runs nested section styling */
.card-tools-html {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.card-tools-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* Subagent Container */
.card-subagents-html {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
    border-top: 1px dashed var(--line);
    padding-top: 14px;
}

.card-subagents-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* Subagent Item (Card) */
.subagent-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.subagent-item:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    border-color: var(--accent);
}

.subagent-item.selected {
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* Status variants matching theme colors */
.subagent-item.complete {
    border-left: 4px solid var(--complete);
}

.subagent-item.running {
    border-left: 4px solid var(--running);
}

.subagent-item.failed {
    border-left: 4px solid var(--failed);
}

.subagent-item.pending {
    border-left: 4px solid var(--pending);
}

/* Subagent Header */
.subagent-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    min-height: 40px;
    box-sizing: border-box;
    background: var(--surface-strong);
}

.subagent-item.running .subagent-header {
    background: var(--running-soft);
}

.subagent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--muted);
}

.subagent-item.complete .subagent-dot {
    background-color: var(--complete);
}

.subagent-item.running .subagent-dot {
    background-color: var(--running);
    animation: tool-pulse 1.25s infinite;
}

.subagent-item.failed .subagent-dot {
    background-color: var(--failed);
}

.subagent-item.pending .subagent-dot {
    background-color: var(--pending);
}

.subagent-title-wrap {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.subagent-title {
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subagent-subtitle {
    font-weight: 500;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subagent-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.subagent-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.subagent-select-btn:hover {
    background: var(--surface-strong);
    border-color: var(--muted);
}

.subagent-caret {
    font-size: 9px;
    color: var(--muted);
    transition: transform 0.2s;
}

/* Subagent Body */
.subagent-body {
    padding: 12px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subagent-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subagent-section-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.subagent-val {
    margin: 0;
    padding: 8px;
    background: var(--surface-strong);
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--line);
    max-height: 100px;
    color: var(--ink);
}

.subagent-desc {
    font-size: 11px;
    color: var(--ink);
    line-height: 1.4;
    background: var(--surface-strong);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.subagent-item.highlight-flash {
    animation: highlightFlash 1.2s ease;
}
