/* ============================================================
   SwarmAI Studio - Dark Theme Stylesheet
   Dark theme for workflow inspection UI
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Backgrounds */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-card: #16213e;
    --bg-card-hover: #1b2a4a;
    --bg-sidebar: #111827;
    --bg-header: #0d1117;
    --bg-input: #0d1b2a;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    /* Text */
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-heading: #f0f0f0;

    /* Accents */
    --accent-primary: #4fc3f7;
    --accent-primary-dim: rgba(79, 195, 247, 0.15);
    --accent-primary-glow: rgba(79, 195, 247, 0.3);

    /* Status colors */
    --color-success: #66bb6a;
    --color-success-dim: rgba(102, 187, 106, 0.15);
    --color-error: #ef5350;
    --color-error-dim: rgba(239, 83, 80, 0.15);
    --color-warning: #ffa726;
    --color-warning-dim: rgba(255, 167, 38, 0.15);
    --color-info: #42a5f5;
    --color-info-dim: rgba(66, 165, 245, 0.15);
    --color-purple: #ab47bc;
    --color-purple-dim: rgba(171, 71, 188, 0.15);

    /* Borders */
    --border-color: #1e3a5f;
    --border-color-light: #2a4a6b;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-panel: -4px 0 24px rgba(0, 0, 0, 0.5);

    /* Sizing */
    --sidebar-width: 250px;
    --header-height: 56px;
    --task-panel-width: 480px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Font */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: #81d4fa;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color-light);
}

/* ---------- HEADER ---------- */
.studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 20px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent-primary);
    font-weight: 400;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.nav-link.active {
    color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.header-right {
    display: flex;
    align-items: center;
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-secondary);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-error);
    transition: background var(--transition-normal);
}

.connection-indicator.connected .connection-dot {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
    animation: pulse-dot 2s infinite;
}

.connection-indicator.connected .connection-label {
    color: var(--color-success);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---------- LAYOUT ---------- */
.studio-layout {
    display: flex;
    height: calc(100vh - var(--header-height));
}

/* ---------- SIDEBAR ---------- */
.studio-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-top: auto;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg {
    opacity: 1;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-normal);
}

.live-dot.active {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
    animation: pulse-dot 2s infinite;
}

.sidebar-event-feed {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-event-item {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--border-color);
    font-size: 0.75rem;
    animation: fade-slide-in 300ms ease;
}

.sidebar-event-item .event-type {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-event-item .event-msg {
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-event-item.event-completed { border-left-color: var(--color-success); }
.sidebar-event-item.event-started { border-left-color: var(--color-warning); }
.sidebar-event-item.event-failed { border-left-color: var(--color-error); }
.sidebar-event-item.event-iteration { border-left-color: var(--color-info); }

.sidebar-footer-section {
    padding: 12px 16px;
}

.sidebar-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- MAIN CONTENT ---------- */
.studio-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

/* ---------- EMPTY & LOADING STATES ---------- */
.view-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
}

.empty-state-small {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-error);
    text-align: center;
}

.error-state h3 {
    margin-bottom: 8px;
}

.error-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.error-state button {
    margin-top: 16px;
    padding: 8px 20px;
    background: var(--color-error-dim);
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.error-state button:hover {
    background: var(--color-error);
    color: white;
}

/* ---------- VIEW HEADER ---------- */
.view-header {
    margin-bottom: 24px;
}

.view-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.view-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---------- CARDS ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---------- KPI CARDS ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-primary);
}

.kpi-card.kpi-success::before { background: var(--color-success); }
.kpi-card.kpi-warning::before { background: var(--color-warning); }
.kpi-card.kpi-error::before { background: var(--color-error); }
.kpi-card.kpi-info::before { background: var(--color-info); }

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- TABLES ---------- */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: rgba(0, 0, 0, 0.2);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-link {
    color: var(--accent-primary);
    cursor: pointer;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* ---------- STATUS BADGES ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-completed,
.badge-success {
    background: var(--color-success-dim);
    color: var(--color-success);
}

.badge-running,
.badge-started,
.badge-in_progress {
    background: var(--color-warning-dim);
    color: var(--color-warning);
    animation: badge-pulse 2s infinite;
}

.badge-failed,
.badge-error {
    background: var(--color-error-dim);
    color: var(--color-error);
}

.badge-pending,
.badge-unknown {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.badge-iteration {
    background: var(--color-info-dim);
    color: var(--color-info);
}

.badge-review {
    background: var(--color-purple-dim);
    color: var(--color-purple);
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Iteration number badge */
.iteration-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-info-dim);
    color: var(--color-info);
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid var(--color-info);
}

/* ---------- GRID LAYOUTS ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ---------- WORKFLOW DETAIL LAYOUT ---------- */
.workflow-detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    height: calc(100vh - var(--header-height) - 48px - 60px);
    min-height: 500px;
}

.workflow-detail-header {
    grid-column: 1 / -1;
}

.workflow-graph-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    min-height: 400px;
    position: relative;
}

.workflow-graph-container .graph-canvas {
    width: 100%;
    height: 100%;
}

.graph-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.graph-toolbar button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.graph-toolbar button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.workflow-timeline-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.timeline-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.timeline-header .event-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
}

.timeline-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ---------- EVENT TIMELINE ---------- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--border-color);
}

.timeline-event {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
    position: relative;
    cursor: default;
}

.timeline-event:hover {
    background: rgba(255, 255, 255, 0.03);
}

.timeline-event.highlighted {
    background: var(--accent-primary-dim);
    border: 1px solid var(--accent-primary);
}

.timeline-event.new-event {
    animation: fade-slide-in 400ms ease;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
    z-index: 1;
    border: 2px solid var(--bg-card);
}

.timeline-dot.dot-completed { background: var(--color-success); }
.timeline-dot.dot-started { background: var(--color-warning); }
.timeline-dot.dot-failed { background: var(--color-error); }
.timeline-dot.dot-iteration { background: var(--color-info); }
.timeline-dot.dot-review { background: var(--color-purple); }
.timeline-dot.dot-tool { background: var(--accent-primary); }
.timeline-dot.dot-memory { background: #78909c; }
.timeline-dot.dot-default { background: var(--text-muted); }

.timeline-event-body {
    flex: 1;
    min-width: 0;
}

.timeline-event-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.timeline-event-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.timeline-event-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.timeline-event-message {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.timeline-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.timeline-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 8px;
    border-radius: 10px;
}

.timeline-meta-tag .tag-label {
    opacity: 0.7;
}

/* ---------- TASK SLIDE-IN PANEL ---------- */
.task-panel-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.task-panel-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.task-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--task-panel-width);
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-panel);
    z-index: 210;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
}

.task-panel.open {
    transform: translateX(0);
}

.task-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.task-panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}

.task-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.task-panel-close:hover {
    background: var(--color-error-dim);
    border-color: var(--color-error);
    color: var(--color-error);
}

.task-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.task-detail-section {
    margin-bottom: 20px;
}

.task-detail-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.task-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.85rem;
}

.task-detail-row .label {
    color: var(--text-muted);
}

.task-detail-row .value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.task-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-event-item {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--border-color);
    font-size: 0.8rem;
}

.task-event-item .event-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.task-event-item.completed { border-left-color: var(--color-success); }
.task-event-item.started { border-left-color: var(--color-warning); }
.task-event-item.failed { border-left-color: var(--color-error); }

/* ---------- CHART CONTAINERS ---------- */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.chart-card .chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 16px;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ---------- TOKEN DASHBOARD ---------- */
.token-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.token-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
}

.token-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}

.token-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- WORKFLOW DETAIL INFO BAR ---------- */
.workflow-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.workflow-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.workflow-info-item .info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.workflow-info-item .info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-heading);
}

.workflow-info-item .info-value.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.info-divider {
    width: 1px;
    height: 32px;
    background: var(--border-color);
}

/* ---------- BACK LINK ---------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-primary);
}

/* ---------- DECISION TREE ---------- */
.decision-section {
    margin-top: 20px;
}

.decision-explain {
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
}

/* ---------- ANIMATIONS ---------- */
@keyframes fade-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fade-in 300ms ease;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1200px) {
    .workflow-detail-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }

    .workflow-graph-container {
        min-height: 350px;
    }
}

@media (max-width: 900px) {
    .studio-sidebar {
        display: none;
    }

    .header-nav {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .studio-main {
        padding: 16px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .workflow-info-bar {
        gap: 12px;
    }

    .info-divider {
        display: none;
    }
}

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

    .task-panel {
        width: 100vw;
    }

    .header-right {
        display: none;
    }
}

/* ---------- UTILITY ---------- */
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.hidden { display: none !important; }
