.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th,
.table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #333);
    vertical-align: middle;
}
.table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #999);
    font-weight: 600;
}
.table a {
    color: var(--text, #dcddde);
    text-decoration: none;
    font-weight: 500;
}
.table a:hover { color: var(--primary, #7f6df2); }
.flash {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}
.flash-success {
    background: rgba(0, 201, 114, 0.16);
    color: #00c972;
}
.flash-error {
    background: rgba(255, 38, 60, 0.16);
    color: #ff8a96;
}
.form-stack {
    display: grid;
    gap: 14px;
    max-width: 520px;
    background: #262626;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.form-stack label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #999;
}
.form-stack input[type="text"],
.form-stack input[type="email"],
.form-stack input[type="password"],
.form-stack input[type="url"],
.form-stack select,
.form-stack textarea {
    width: 100%;
    min-height: 36px;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    color: #dcddde;
    background: #161616;
}
.form-stack textarea {
    min-height: 96px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
.table th:last-child,
.table td:last-child { text-align: right; }
.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}
.row-actions--start { justify-content: flex-start; }
.row-actions form { display: inline; }
.btn-ghost {
    background: transparent;
    border: 1px solid #404040;
    color: #dcddde;
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-ghost:hover { background: #2a2a2a; }
.btn-ghost.btn-danger { color: #ff263c; }
.btn-ghost--icon {
    width: 34px;
    padding: 0;
}
.muted { color: #999; font-size: 13px; }
code {
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #999;
}
.filters {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    flex-wrap: wrap;
    align-items: center;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-ok, .badge-done { background: rgba(0, 201, 114, 0.16); color: #00c972; }
.badge-failed { background: rgba(255, 38, 60, 0.16); color: #ff8a96; }
.badge-running, .badge-active { background: rgba(127, 109, 242, 0.18); color: #c4bbff; }
.badge-skipped, .badge-waiting { background: rgba(255, 152, 0, 0.16); color: #ff9800; }

.list-container {
    background: #262626;
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

.empty-stage {
    display: grid;
    place-items: center;
    gap: 10px;
    padding: 72px 24px;
    text-align: center;
    border: 1px dashed #404040;
    border-radius: 12px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0) 0 0 / 18px 18px,
        #1a1a1a;
}
.empty-stage h3 {
    margin: 8px 0 0;
    font-size: 18px;
    letter-spacing: -0.03em;
}
.empty-stage__graph {
    display: flex;
    gap: 18px;
    align-items: center;
}
.empty-stage__graph span {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--kind, #7f6df2) 22%, #262626);
    box-shadow: 0 0 18px color-mix(in srgb, var(--kind, #7f6df2) 40%, transparent);
}

.flow-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.flow-card {
    display: flex;
    flex-direction: column;
    background: #262626;
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.flow-card:hover {
    border-color: #7f6df2;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.flow-card-link {
    text-decoration: none;
    color: inherit;
    display: grid;
    gap: 12px;
    padding: 12px 12px 0;
}
.flow-card h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.02em;
    padding: 0 4px;
}
.flow-card-meta {
    margin: 0;
    font-size: 12px;
    color: #999;
    padding: 0 4px 4px;
}
.flow-thumb-wrap {
    height: 132px;
    border-radius: 8px;
    overflow: hidden;
    background:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 0) 0 0 / 14px 14px,
        #161616;
}
.flow-thumb {
    width: 100%;
    height: 100%;
    display: block;
}
.flow-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    margin-top: auto;
}

.kind-role { --kind: #7f6df2; color: var(--kind); }
.kind-persona { --kind: #e879f9; color: var(--kind); }
.kind-plugin { --kind: #2dd4bf; color: var(--kind); }
.kind-report { --kind: #fbbf24; color: var(--kind); }
.kind-scheduler { --kind: #60a5fa; color: var(--kind); }
.kind-todo { --kind: #fb7185; color: var(--kind); }

.studio {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #161616;
}
.studio-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    background: #1e1e1e;
}
.studio-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.studio-name label { display: none; }
.studio-name input {
    width: min(420px, 100%);
    height: 36px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #dcddde;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.03em;
    padding: 0 8px;
}
.studio-name input:hover,
.studio-name input:focus {
    border-color: #404040;
    background: #161616;
    outline: none;
}
.studio-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 300px;
}
.studio-palette {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 8px;
    border-right: 1px solid #333;
    background: #1a1a1a;
}
.palette-item {
    appearance: none;
    border: 1px solid #333;
    background: #262626;
    color: #dcddde;
    border-radius: 8px;
    padding: 8px 4px 7px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.palette-item:hover {
    border-color: color-mix(in srgb, var(--kind, #7f6df2) 70%, #333);
    background: color-mix(in srgb, var(--kind, #7f6df2) 14%, #262626);
}
.palette-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--kind, #7f6df2);
    background: color-mix(in srgb, var(--kind, #7f6df2) 18%, #1a1a1a);
}
.palette-icon .icon {
    width: 14px;
    height: 14px;
}
.studio-inspector {
    border-left: 1px solid #333;
    background: #1e1e1e;
    padding: 16px;
    overflow-y: auto;
}
.inspector-empty {
    color: #999;
    font-size: 13px;
    line-height: 1.5;
}
.inspector-empty strong {
    display: block;
    color: #dcddde;
    margin-bottom: 6px;
    font-size: 14px;
}
.inspector-pane h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 650;
}
.inspector-pane label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #999;
    margin: 10px 0 6px;
}
.inspector-pane input,
.inspector-pane select,
.inspector-pane textarea {
    width: 100%;
    min-height: 34px;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 6px 8px;
    background: #161616;
    color: #dcddde;
    font: inherit;
    font-size: 13px;
}
.inspector-pane textarea {
    min-height: 88px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
.inspector-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.flow-canvas-wrap {
    position: relative;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
    background-color: #141414;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0);
    background-size: 22px 22px;
}
.flow-canvas-wrap.is-panning { cursor: grabbing; }
.flow-canvas-wrap--run {
    min-height: 480px;
    border: 1px solid #333;
    border-radius: 10px;
    margin-bottom: 24px;
}
.flow-world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}
.flow-canvas {
    position: relative;
    min-height: 1600px;
    min-width: 2400px;
}
.flow-edges {
    position: absolute;
    inset: 0;
    overflow: visible;
    z-index: 2;
    pointer-events: none;
}
.flow-edge-line {
    fill: none;
    stroke: #6b6b78;
    stroke-width: 2.2;
    filter: url(#flow-glow);
}
.flow-edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 16;
    pointer-events: stroke;
    cursor: pointer;
}
.flow-edge.is-selected .flow-edge-line {
    stroke-width: 2.8;
}
.flow-edge.is-ok .flow-edge-line { stroke: #00c972; }
.flow-edge.is-failed .flow-edge-line { stroke: #ff263c; }
.flow-edge.is-other .flow-edge-line { stroke: #7f6df2; }
.flow-edge-label {
    fill: #dcddde;
    font-size: 11px;
    font-weight: 650;
    font-family: Inter, sans-serif;
}
.flow-edge-chip {
    fill: #1e1e1e;
    stroke: #404040;
}
.flow-preview-line {
    fill: none;
    stroke: #7f6df2;
    stroke-width: 2;
    stroke-dasharray: 6 6;
    pointer-events: none;
}
.flow-node {
    position: absolute;
    width: 236px;
    min-height: 92px;
    padding: 12px 14px 12px 12px;
    background: linear-gradient(180deg, #2c2c2c 0%, #232323 100%);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    box-sizing: border-box;
    cursor: grab;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    z-index: 3;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.flow-node-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--kind, #7f6df2);
    background: color-mix(in srgb, var(--kind, #7f6df2) 18%, #161616);
    box-shadow: 0 0 16px color-mix(in srgb, var(--kind, #7f6df2) 28%, transparent);
}
.flow-node-icon svg {
    width: 16px;
    height: 16px;
}
.flow-node-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding-top: 2px;
}
.flow-node strong {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #dcddde;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.flow-node-kind {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kind, #999);
    font-weight: 700;
}
.flow-node-ref {
    font-size: 11px;
    color: #666;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.flow-node-chip {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #00c972;
    background: rgba(0, 201, 114, 0.12);
    border: 1px solid rgba(0, 201, 114, 0.28);
    border-radius: 999px;
    padding: 2px 6px;
}
.flow-node.is-selected {
    border-color: color-mix(in srgb, var(--kind, #7f6df2) 80%, #fff);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--kind, #7f6df2) 55%, transparent),
        0 14px 32px rgba(0, 0, 0, 0.5),
        0 0 28px color-mix(in srgb, var(--kind, #7f6df2) 32%, transparent);
}
.flow-node.is-connecting {
    box-shadow: 0 0 0 2px #7f6df2, 0 0 24px rgba(127, 109, 242, 0.45);
}
.flow-node.is-current {
    animation: node-pulse 1.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.flow-port {
    position: absolute;
    top: 46px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    background: #141414;
    border: 2px solid var(--kind, #7f6df2);
    z-index: 4;
    box-shadow: 0 0 8px var(--kind, #7f6df2);
}
.flow-port--in { left: -7px; }
.flow-port--out { right: -7px; cursor: crosshair; }
.canvas-hint {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    color: #666;
    text-align: center;
    z-index: 1;
}
.canvas-hint[hidden],
.edge-prompt[hidden],
.connect-toast[hidden],
.inspector-pane[hidden] { display: none !important; }
.canvas-hint strong {
    display: block;
    color: #dcddde;
    font-size: 20px;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
}
.connect-toast {
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    z-index: 6;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(127, 109, 242, 0.22);
    border: 1px solid rgba(127, 109, 242, 0.5);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}
.canvas-hud {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 8px;
    background: rgba(30, 30, 30, 0.92);
    border: 1px solid #404040;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.hud-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #dcddde;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.hud-btn:hover { background: #2a2a2a; }
.hud-zoom {
    min-width: 44px;
    text-align: center;
    font-size: 11px;
    font-weight: 650;
    color: #999;
    font-variant-numeric: tabular-nums;
}
.edge-prompt {
    position: absolute;
    z-index: 8;
    width: 260px;
    padding: 12px;
    border-radius: 10px;
    background: #262626;
    border: 1px solid #404040;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    display: grid;
    gap: 8px;
}
.edge-prompt label {
    font-size: 11px;
    color: #999;
}
.edge-prompt input {
    width: 100%;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #404040;
    background: #161616;
    color: #dcddde;
    padding: 0 8px;
}
.edge-prompt-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.check-row { display: flex; gap: 8px; align-items: center; }
.section-title { font-size: 15px; margin: 24px 0 12px; font-weight: 650; }

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 201, 114, 0); }
    50% { box-shadow: 0 0 0 8px rgba(0, 201, 114, 0.16); }
}

@media (max-width: 960px) {
    .studio-body {
        grid-template-columns: 64px minmax(0, 1fr);
    }
    .studio-inspector { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .flow-node.is-current { animation: none; }
}
