/* Automation workflow editor + history page styles. */

/* ----- shared bits used by editor + history pages ----- */
.auto-page-head {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1rem;
}

.auto-page-head__row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.auto-page-head__row h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.auto-page-head__actions {
    margin-left: auto;
    display: flex;
    gap: .35rem;
}

.auto-page-head__id {
    background: var(--surface-3, #1f1f1f);
    padding: .15rem .35rem;
    border-radius: 4px;
    font-size: .9em;
}

.auto-page-head__sub {
    margin: 0;
    color: var(--text-dim, #888);
    font-size: .9rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}

.auto-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .5rem;
    margin-bottom: 1rem;
}

.auto-stat {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    padding: .65rem .8rem;
}

.auto-stat__label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim, #888);
}

.auto-stat__value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: .15rem;
}

.auto-stat__value--bad {
    color: #d97a7a;
}

.auto-chip--bad {
    background: #7a2828 !important;
    color: #fff !important;
}

.auto-status {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
}

.auto-status--queued {
    background: rgba(122, 79, 181, .15);
    border-color: rgba(122, 79, 181, .35);
    color: #b89bd9;
}

.auto-status--running {
    background: rgba(11, 110, 153, .2);
    border-color: rgba(11, 110, 153, .5);
    color: #79c0ff;
    animation: auto-pulse 1.5s ease-in-out infinite;
}

@keyframes auto-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

.auto-status--succeeded {
    background: rgba(59, 109, 17, .2);
    border-color: rgba(59, 109, 17, .5);
    color: #94c97a;
}

.auto-status--failed {
    background: rgba(163, 45, 45, .2);
    border-color: rgba(163, 45, 45, .55);
    color: #e08a8a;
}

.auto-status--cancelled {
    background: rgba(95, 94, 90, .2);
    border-color: rgba(95, 94, 90, .55);
    color: #bbb;
}

.auto-runs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    overflow: hidden;
}

.auto-runs-table th,
.auto-runs-table td {
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--border, #2c2c2c);
    text-align: left;
    font-size: .9rem;
    vertical-align: middle;
}

.auto-runs-table th {
    background: var(--surface-3, #1f1f1f);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim, #888);
}

.auto-runs-table tr:last-child td {
    border-bottom: none;
}

.auto-runs-table__row--bad td {
    background: rgba(163, 45, 45, .05);
}

.auto-runs-table__row--ok td {
    background: rgba(59, 109, 17, .03);
}

.auto-runs-table__err {
    color: #d97a7a;
    font-size: .8rem;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-error-banner {
    background: rgba(163, 45, 45, .12);
    border: 1px solid rgba(163, 45, 45, .4);
    color: #e8b1b1;
    padding: .65rem .85rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.auto-step-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.auto-step {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-left: 3px solid var(--accent, #666);
    border-radius: 6px;
    padding: .65rem .85rem;
}

.auto-step--succeeded { --accent: #3B6D11; }
.auto-step--failed { --accent: #A32D2D; }
.auto-step--running { --accent: #0B6E99; }

.auto-step__head {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.auto-step__order {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-3, #1f1f1f);
    color: var(--text-dim, #888);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
}

.auto-step__title {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.auto-step__title small {
    font-size: .7rem;
    color: var(--text-dim, #888);
}

.auto-step__dur {
    color: var(--text-dim, #888);
    font-size: .85rem;
}

.auto-step__error {
    margin-top: .5rem;
    padding: .35rem .55rem;
    color: #e8b1b1;
    background: rgba(163, 45, 45, .12);
    border-radius: 4px;
    font-size: .85rem;
}

.auto-step__panes {
    margin-top: .5rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.auto-step__details {
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    padding: .25rem .5rem;
}

.auto-step__details summary {
    cursor: pointer;
    color: var(--text-dim, #888);
    font-size: .8rem;
    user-select: none;
}

.auto-step__details summary i {
    margin-right: .15rem;
}

.auto-json {
    margin: .35rem 0 0;
    padding: .5rem;
    background: rgba(0, 0, 0, .25);
    border-radius: 3px;
    font-size: .78rem;
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    color: #cbd5dc;
    overflow: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ----- workflow hub card grid ----- */
.auto-hub__toolbar {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.auto-hub__search {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.auto-hub__search input {
    width: 100%;
    padding: .45rem .75rem .45rem 2rem;
    border-radius: 6px;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    color: inherit;
}

.auto-hub__search i {
    position: absolute;
    left: .65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim, #888);
}

.auto-hub__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .75rem;
}

.auto-card {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 8px;
    padding: .85rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: border-color .15s ease, transform .15s ease;
}

.auto-card:hover {
    border-color: var(--accent, #0B6E99);
    transform: translateY(-1px);
}

.auto-card__head {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.auto-card__name {
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-card__chips {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}

.auto-card__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .25rem;
    margin-top: .15rem;
}

.auto-card__stat {
    background: var(--surface-3, #1f1f1f);
    border-radius: 4px;
    padding: .3rem .45rem;
}

.auto-card__stat-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim, #888);
}

.auto-card__stat-value {
    font-size: .9rem;
    font-weight: 600;
}

.auto-card__actions {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    margin-top: .25rem;
}

.auto-card__actions .btn {
    flex: 1;
    min-width: 0;
}

.auto-card__sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
}

.auto-card__sparkline span {
    flex: 1;
    min-width: 2px;
    border-radius: 1px;
    background: #444;
}

.auto-card__sparkline span[data-s="Succeeded"] { background: #94c97a; }
.auto-card__sparkline span[data-s="Failed"] { background: #e08a8a; }
.auto-card__sparkline span[data-s="Running"] { background: #79c0ff; }

/* ----- templates gallery ----- */
.auto-templates {
    margin-bottom: 1rem;
}

.auto-templates__head {
    font-size: .8rem;
    color: var(--text-dim, #888);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .35rem;
}

.auto-templates__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .5rem;
}

.auto-template {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-left: 3px solid var(--accent, #0B6E99);
    border-radius: 6px;
    padding: .65rem;
    cursor: pointer;
    transition: transform .12s ease, border-color .12s ease;
    text-align: left;
    color: inherit;
}

.auto-template:hover {
    transform: translateY(-1px);
    border-color: #0B6E99;
}

.auto-template__title {
    font-weight: 600;
    margin-bottom: .15rem;
}

.auto-template__desc {
    font-size: .8rem;
    color: var(--text-dim, #888);
}

/* ----- webhook test panel ----- */
.auto-webhook-panel {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    padding: .75rem;
    margin-bottom: .75rem;
}

.auto-webhook-panel__head {
    font-weight: 600;
    margin-bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.auto-webhook-panel__url {
    display: flex;
    gap: .25rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}

.auto-webhook-panel__url code {
    flex: 1;
    background: var(--surface-3, #1f1f1f);
    padding: .35rem .5rem;
    border-radius: 4px;
    font-size: .8rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auto-webhook-panel__curl {
    background: rgba(0, 0, 0, .25);
    color: #cbd5dc;
    border-radius: 4px;
    padding: .5rem;
    font-size: .78rem;
    font-family: 'JetBrains Mono', monospace;
    overflow-x: auto;
    white-space: pre;
    margin-bottom: .35rem;
}

.auto-webhook-panel__test {
    display: flex;
    gap: .25rem;
    flex-direction: column;
}

.auto-webhook-panel__test textarea {
    width: 100%;
    background: var(--surface-3, #1f1f1f);
    color: inherit;
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    padding: .35rem .5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: .8rem;
    min-height: 70px;
}

/* ============================================================
   EDITOR v2
   ============================================================ */

.wf-editor-host {
    /* Break the workflow editor out of the constrained .tool-page__main
       column so it can use the full content width. */
    width: 100%;
}

.wf-editor-host--fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg, #0e0e0e);
    padding: .5rem;
    display: flex;
}

.wf-editor-host--fullscreen > #wf-editor {
    flex: 1;
    min-height: 0;
}

.wf-shell--v2 {
    display: grid;
    grid-template-columns: 260px 1fr 360px;
    height: calc(100vh - 200px);
    min-height: 680px;
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface, #1a1a1a);
}

.wf-editor-host--fullscreen .wf-shell--v2 {
    height: 100%;
    min-height: 0;
    width: 100%;
}

.wf-shell--v2 .wf-palette {
    display: flex;
    flex-direction: column;
    background: var(--surface-2, #161616);
    border-right: 1px solid var(--border, #2c2c2c);
    overflow: hidden;
}

.wf-palette__search {
    position: relative;
    padding: .5rem;
    border-bottom: 1px solid var(--border, #2c2c2c);
}

.wf-palette__search input {
    width: 100%;
    padding: .35rem .5rem .35rem 1.9rem;
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    color: inherit;
    font-size: .85rem;
}

.wf-palette__search i {
    position: absolute;
    left: 1.05rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim, #888);
    pointer-events: none;
}

.wf-shell--v2 .wf-palette__list {
    flex: 1;
    overflow-y: auto;
    padding: .5rem;
}

.wf-palette__group {
    margin-bottom: .6rem;
}

.wf-palette__group-title {
    text-transform: uppercase;
    font-size: .65rem;
    letter-spacing: .05em;
    color: var(--text-dim, #888);
    margin: .25rem 0 .15rem;
}

.wf-palette__item {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    color: inherit;
    padding: .35rem .5rem;
    border-radius: 4px;
    cursor: grab;
    margin-bottom: .1rem;
    border-left: 3px solid var(--accent, #666);
    transition: background .1s ease;
    font-size: .85rem;
}

.wf-palette__item:hover {
    background: rgba(255, 255, 255, .04);
}

.wf-palette__item:active {
    cursor: grabbing;
}

.wf-palette__hint {
    padding: .5rem .65rem;
    font-size: .72rem;
    color: var(--text-dim, #888);
    border-top: 1px solid var(--border, #2c2c2c);
    display: flex;
    gap: .35rem;
    align-items: flex-start;
}

.wf-canvas-wrap {
    position: relative;
    overflow: hidden;
    outline: none;
    background:
        radial-gradient(circle, var(--bg-grid, #262626) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--bg, #0e0e0e);
    user-select: none;
}

.wf-canvas-wrap:focus {
    box-shadow: inset 0 0 0 1px rgba(11, 110, 153, .35);
}

.wf-canvas-wrap--panning {
    cursor: grabbing !important;
}

.wf-canvas {
    position: relative;
    transform-origin: 0 0;
    will-change: transform;
}

.wf-wires {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.wf-wires .wf-wire {
    pointer-events: stroke;
    cursor: crosshair;
    transition: stroke-width .1s ease;
}

.wf-wire-group:hover .wf-wire {
    stroke-width: 3;
}

/* n8n-style + button at the wire midpoint. Subtle when idle, brightens on
   hover so it doesn't visually compete with the wires themselves. The
   parent <svg.wf-wires> has pointer-events:none, so opt back in here. */
.wf-wire-plus {
    pointer-events: auto;
    cursor: pointer;
    opacity: .6;
    transition: opacity .12s ease;
}

.wf-wire-group:hover .wf-wire-plus,
.wf-wire-plus:hover {
    opacity: 1;
}

.wf-wire-plus circle {
    transition: r .12s ease;
}

.wf-wire-plus:hover circle {
    r: 13;
}

/* Splice popup — floats over the canvas, positioned where the user clicked
   the + button. */
.wf-splice {
    position: absolute;
    width: 260px;
    max-height: 320px;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
    z-index: 12;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wf-splice__head {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border, #2c2c2c);
}

.wf-splice__head > i {
    color: var(--text-dim, #888);
}

.wf-splice__head input {
    flex: 1;
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    padding: .25rem .45rem;
    color: inherit;
    font-size: .85rem;
}

.wf-splice__close {
    background: transparent;
    border: 0;
    color: var(--text-dim, #888);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 .35rem;
    border-radius: 3px;
}

.wf-splice__close:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--text, #eee);
}

.wf-splice__list {
    overflow-y: auto;
    padding: .25rem;
}

.wf-splice__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-left: 3px solid var(--accent, #666);
    border-radius: 4px;
    padding: .35rem .5rem;
    color: inherit;
    cursor: pointer;
    margin-bottom: .15rem;
    font-size: .82rem;
}

.wf-splice__item:hover {
    background: rgba(255, 255, 255, .05);
}

.wf-splice__item i {
    font-size: 1rem;
    color: var(--accent, #aaa);
}

.wf-splice__name {
    font-weight: 600;
    line-height: 1.15;
}

.wf-splice__cat {
    font-size: .68rem;
    color: var(--text-dim, #888);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.wf-splice__empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-dim, #888);
    font-size: .85rem;
}

/* Sticky notes — canvas-only, ignored by the engine. */
.wf-sticky {
    position: absolute;
    background: var(--sticky, #f6d77a);
    color: #1c1c1c;
    border-radius: 6px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .35),
        0 6px 14px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    min-width: 140px;
    min-height: 90px;
    /* Behind nodes/wires. */
    z-index: 0;
}

.wf-sticky--selected {
    outline: 2px solid #0B6E99;
    outline-offset: 1px;
}

.wf-sticky__bar {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 2px 4px;
    background: rgba(0, 0, 0, .08);
    border-radius: 6px 6px 0 0;
    cursor: grab;
    user-select: none;
}

.wf-sticky__bar:active {
    cursor: grabbing;
}

.wf-sticky__color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sticky);
    border: 1px solid rgba(0, 0, 0, .25);
    cursor: pointer;
    padding: 0;
}

.wf-sticky__handle {
    flex: 1;
    text-align: center;
    color: rgba(0, 0, 0, .35);
    font-size: .8rem;
    line-height: 1;
}

.wf-sticky__del {
    background: transparent;
    border: 0;
    color: rgba(0, 0, 0, .55);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 .25rem;
    border-radius: 3px;
}

.wf-sticky__del:hover {
    background: rgba(0, 0, 0, .12);
    color: #a02525;
}

.wf-sticky__text {
    flex: 1;
    padding: .45rem .6rem;
    font-size: .88rem;
    font-family: 'Inter', system-ui, sans-serif;
    color: #1c1c1c;
    overflow: auto;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    cursor: text;
}

.wf-sticky__text:empty::before {
    content: "Click to add a note…";
    color: rgba(0, 0, 0, .35);
}

.wf-sticky__resize {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, .35) 50%);
    border-radius: 0 0 4px 0;
}

/* N8N-style node: chunky icon badge on the left, body on the right.
   The accent colour fills the badge instead of a thin side bar. */
.wf-node {
    position: absolute;
    width: 220px;
    background: var(--surface-3, #1f1f1f);
    color: inherit;
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    user-select: none;
    display: flex;
    align-items: stretch;
    cursor: grab;
    transition: box-shadow .1s ease, border-color .1s ease, transform .08s ease;
    overflow: visible;
}

.wf-node:hover {
    border-color: color-mix(in srgb, var(--accent, #0B6E99) 70%, var(--border, #2c2c2c));
    transform: translateY(-1px);
}

.wf-node--selected {
    box-shadow: 0 0 0 2px var(--accent, #0B6E99), 0 4px 14px rgba(0, 0, 0, .5);
    border-color: var(--accent, #0B6E99);
}

.wf-node__badge {
    width: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, #666);
    border-radius: 7px 0 0 7px;
    color: #fff;
}

.wf-node__badge i {
    font-size: 1.65rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}

.wf-node__body {
    flex: 1;
    min-width: 0;
    padding: .55rem .7rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
}

.wf-node__name {
    font-size: .92rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.wf-node__type {
    font-size: .68rem;
    color: var(--text-dim, #888);
    text-transform: uppercase;
    letter-spacing: .04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Per-node hover toolbar — floats above the node, only visible on hover or
   when selected (so touch users can still reach it after a tap-select). */
.wf-node__hover-bar {
    position: absolute;
    top: -16px;
    right: 8px;
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(2px);
    transition: opacity .1s ease, transform .1s ease;
    z-index: 3;
}

.wf-node:hover .wf-node__hover-bar,
.wf-node--selected .wf-node__hover-bar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.wf-node__hover-bar button {
    background: transparent;
    border: 0;
    color: var(--text-dim, #888);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    font-size: .85rem;
}

.wf-node__hover-bar button:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--text, #eee);
}

.wf-node__hover-bar button[data-action="delete"]:hover {
    color: #d97a7a;
    background: rgba(163, 45, 45, .14);
}

.wf-node__hover-bar button[data-action="run"]:hover {
    color: #94c97a;
    background: rgba(59, 109, 17, .18);
}

.wf-node__port {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--port, var(--accent, #0B6E99));
    border: 2px solid var(--surface-3, #1f1f1f);
    cursor: crosshair;
    z-index: 2;
    transition: transform .1s ease, box-shadow .1s ease;
}

.wf-node__port:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 4px rgba(11, 110, 153, .25);
}

.wf-node__port--in {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.wf-node__port--out {
    right: -7px;
    /* `top` is set inline per-port for stacking */
}

.wf-node__port-label {
    position: absolute;
    right: 16px;
    top: -3px;
    font-size: .65rem;
    color: var(--text-dim, #888);
    background: var(--surface-3, #1f1f1f);
    padding: 0 .25rem;
    border-radius: 2px;
    pointer-events: none;
    white-space: nowrap;
}

.wf-zoombar {
    position: absolute;
    bottom: .65rem;
    left: .65rem;
    display: flex;
    gap: .15rem;
    align-items: center;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    padding: .15rem;
    font-size: .8rem;
}

.wf-zoombar button {
    background: transparent;
    border: 0;
    color: inherit;
    padding: .25rem .35rem;
    cursor: pointer;
    border-radius: 3px;
}

.wf-zoombar button:hover { background: rgba(255, 255, 255, .06); }

.wf-zoombar span {
    padding: 0 .35rem;
    color: var(--text-dim, #888);
    font-variant-numeric: tabular-nums;
    min-width: 3em;
    text-align: center;
}

.wf-minimap {
    position: absolute;
    bottom: .65rem;
    right: .65rem;
    width: 160px;
    height: 100px;
    background: rgba(0, 0, 0, .45);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    overflow: hidden;
}

.wf-minimap__dot {
    position: absolute;
    width: 6px;
    height: 4px;
    border-radius: 1px;
}

.wf-minimap__viewport {
    position: absolute;
    border: 1px solid rgba(11, 110, 153, .8);
    background: rgba(11, 110, 153, .12);
    pointer-events: none;
}

.wf-help {
    position: absolute;
    top: .65rem;
    right: .65rem;
    font-size: .7rem;
    color: var(--text-dim, #888);
    background: rgba(0, 0, 0, .5);
    padding: .3rem .5rem;
    border-radius: 4px;
    pointer-events: none;
}

.wf-help kbd {
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 3px;
    padding: 0 .3rem;
    font-size: .8em;
    font-family: inherit;
}

.wf-shell--v2 .wf-inspect {
    background: var(--surface-2, #161616);
    border-left: 1px solid var(--border, #2c2c2c);
    overflow-y: auto;
    padding: .75rem;
}

.wf-inspect__head {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border, #2c2c2c);
    margin-bottom: .65rem;
}

.wf-inspect__head i {
    color: var(--accent, #aaa);
}

.wf-inspect__head small {
    margin-left: auto;
    color: var(--text-dim, #888);
    font-size: .7rem;
    font-family: 'JetBrains Mono', monospace;
}

.wf-inspect__desc {
    color: var(--text-dim, #888);
    font-size: .85rem;
    margin: 0 0 .85rem;
}

.wf-inspect__empty {
    color: var(--text-dim, #888);
    font-size: .85rem;
    padding: 1rem 0;
    text-align: center;
}

.wf-inspect__footer {
    display: flex;
    gap: .25rem;
    margin-top: .85rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border, #2c2c2c);
}

.wf-field {
    display: flex;
    flex-direction: column;
    margin-bottom: .6rem;
}

.wf-field__label {
    font-size: .72rem;
    color: var(--text-dim, #888);
    margin-bottom: .15rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.wf-field input,
.wf-field textarea,
.wf-field select {
    width: 100%;
    background: var(--surface-3, #1f1f1f);
    color: inherit;
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    padding: .4rem .55rem;
    font-family: inherit;
    font-size: .85rem;
}

.wf-field input:focus,
.wf-field textarea:focus,
.wf-field select:focus {
    outline: none;
    border-color: var(--accent, #0B6E99);
}

.wf-field textarea {
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-size: .8rem;
}

.wf-field__help {
    font-size: .7rem;
    color: var(--text-dim, #888);
    margin-top: .15rem;
}

.wf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .75rem;
    padding: .5rem;
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
}

.wf-toolbar label {
    display: flex;
    flex-direction: column;
    font-size: .7rem;
    color: var(--text-dim, #888);
}

.wf-toolbar input,
.wf-toolbar select {
    background: var(--surface-3, #1f1f1f);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 4px;
    color: inherit;
    padding: .25rem .45rem;
    font-size: .85rem;
}

.wf-toolbar__group {
    display: flex;
    gap: .35rem;
    align-items: center;
}

.wf-meta {
    background: var(--surface-2, #161616);
    border: 1px solid var(--border, #2c2c2c);
    border-radius: 6px;
    padding: .75rem;
    margin-bottom: .75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem .5rem;
}

.wf-meta code {
    font-size: .8rem;
    background: var(--surface-3, #1f1f1f);
    padding: .15rem .35rem;
    border-radius: 3px;
}

@media (max-width: 1100px) {
    .wf-shell--v2 {
        grid-template-columns: 200px 1fr 300px;
    }
}

@media (max-width: 900px) {
    .wf-shell--v2 {
        grid-template-columns: 1fr;
        height: auto;
    }

    .wf-shell--v2 .wf-palette,
    .wf-shell--v2 .wf-inspect {
        max-height: 280px;
    }

    .wf-shell--v2 .wf-canvas-wrap {
        height: 460px;
    }
}
