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

:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c2129;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;
    --radius: 8px;
    --transition: 0.2s ease;
    --header-height: 56px;
    --footer-height: 32px;

    /* Status */
    --accent-green: #3fb950;
    --accent-orange: #f0883e;
    --accent-red: #f85149;
    --accent-blue: #58a6ff;
    --accent-gold: #c9a84c;

    /* Model tiers */
    --model-opus: #a855f7;
    --model-sonnet: #3b82f6;
    --model-haiku: #16a34a;
    --model-local: #ea580c;
    --model-unknown: #6b7280;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-stack);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    padding-top: env(safe-area-inset-top, 0);
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.header-tabs {
    display: flex;
    gap: 0.25rem;
}

.tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    font-family: var(--font-stack);
}

.tab:hover {
    color: var(--text);
    background: var(--surface-2);
}

.tab.active {
    color: var(--accent-gold);
    background: var(--surface-2);
}

.header-right {
    margin-left: auto;
}

.status-indicator {
    color: var(--accent-green);
    font-size: 0.85rem;
}

.status-indicator.offline {
    color: var(--accent-red);
}

/* === Main === */
.main {
    flex: 1;
    padding: 1rem 1.5rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Agents Layout (3-panel) === */
.agents-layout {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    gap: 1rem;
    height: calc(100vh - var(--header-height) - var(--footer-height) - 2rem);
}

/* Org Sidebar */
.org-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
}

.org-tree {
    font-size: 0.85rem;
}

.org-node {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
    cursor: default;
}

.org-node:hover {
    background: var(--surface-2);
}

.org-node.depth-0 {
    margin-bottom: 0.25rem;
}

.org-children {
    padding-left: 1.25rem;
    border-left: 1px solid var(--border);
    margin-left: 0.75rem;
}

.org-emoji {
    font-size: 1rem;
    flex-shrink: 0;
}

.org-name {
    flex: 1;
    font-weight: 500;
}

.org-model {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-opus { background: rgba(168, 85, 247, 0.15); color: var(--model-opus); }
.model-sonnet { background: rgba(59, 130, 246, 0.15); color: var(--model-sonnet); }
.model-haiku { background: rgba(22, 163, 74, 0.15); color: var(--model-haiku); }
.model-local { background: rgba(234, 88, 12, 0.15); color: var(--model-local); }
.model-unknown { background: rgba(107, 114, 128, 0.15); color: var(--model-unknown); }

.org-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.org-status-dot.active { background: var(--accent-green); }
.org-status-dot.idle { background: var(--accent-orange); }
.org-status-dot.error { background: var(--accent-red); }

/* Agent Cards */
.agents-main {
    overflow-y: auto;
}

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

.agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: var(--transition);
}

.agent-card:hover {
    border-color: #484f58;
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.agent-card-emoji {
    font-size: 1.5rem;
}

.agent-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
}

.agent-card-state {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.state-active { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }
.state-idle { background: rgba(240, 136, 62, 0.15); color: var(--accent-orange); }
.state-error { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.state-unknown { background: rgba(107, 114, 128, 0.15); color: var(--model-unknown); }

.agent-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.agent-card-activity {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 0.4rem 0.6rem;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    max-height: 2.8em;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.model-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.model-dot.opus { background: var(--model-opus); }
.model-dot.sonnet { background: var(--model-sonnet); }
.model-dot.haiku { background: var(--model-haiku); }
.model-dot.local { background: var(--model-local); }
.model-dot.unknown { background: var(--model-unknown); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p:first-child {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Intel Panel */
.intel-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.intel-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#stat-active { color: var(--accent-green); }
#stat-error { color: var(--accent-red); }

.event-feed {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.event-type {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin: 0 0.25rem;
}

.event-type.spawn { background: rgba(88, 166, 255, 0.15); color: var(--accent-blue); }
.event-type.stop { background: rgba(139, 148, 158, 0.15); color: var(--text-muted); }
.event-type.error { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.event-type.task_complete { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }

.model-summary {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.model-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.model-row-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-weight: 600;
}

/* === Tasks Tab === */
.tasks-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    height: calc(100vh - var(--header-height) - var(--footer-height) - 2rem);
}

.task-column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.column-count {
    margin-left: auto;
    background: var(--surface-2);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.task-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.task-card:hover {
    border-color: #484f58;
}

.task-title {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.task-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.task-assignee {
    color: var(--accent-gold);
}

.task-project {
    background: var(--surface-2);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--text-muted);
}

.task-date {
    color: var(--text-muted);
    margin-left: auto;
}

.priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.priority-high { background: var(--accent-red); }
.priority-medium { background: var(--accent-orange); }
.priority-low { background: var(--text-muted); }

/* === Logs Tab === */
.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.log-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-input, .filter-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font-stack);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    cursor: pointer;
}

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

.log-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.log-table tr:hover td {
    background: var(--surface);
}

/* === Footer === */
.footer {
    height: var(--footer-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 1.5rem;
}

#connection-status {
    color: var(--accent-green);
}

/* === Bottom Tab Bar (mobile) === */
.bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    min-width: 64px;
    min-height: 44px;
    border-radius: var(--radius);
    transition: var(--transition);
    font-family: var(--font-stack);
    -webkit-tap-highlight-color: transparent;
}

.bottom-tab:active {
    background: var(--surface-2);
}

.bottom-tab.active {
    color: var(--accent-gold);
}

.bottom-tab-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.bottom-tab-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Mobile === */
@media (max-width: 1199px) {
    .agents-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .org-sidebar {
        display: none;
    }

    .intel-panel {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .intel-section {
        flex: 1;
        min-width: 200px;
    }

    .tasks-board {
        grid-template-columns: repeat(2, 1fr);
        height: auto;
    }
}

@media (max-width: 767px) {
    /* Show bottom tab bar, hide header tabs */
    .bottom-tabs {
        display: flex;
    }

    .header-tabs {
        display: none;
    }

    .header {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    /* Account for bottom tab bar */
    .main {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + 68px);
    }

    .footer {
        display: none;
    }

    /* Graph: reduced height on mobile */
    .graph-container {
        height: 200px;
    }

    .agents-layout {
        grid-template-columns: 1fr;
    }

    /* Agent cards: single column full width */
    .agent-cards {
        grid-template-columns: 1fr;
    }

    .intel-panel {
        flex-direction: column;
    }

    .tasks-board {
        grid-template-columns: 1fr;
    }

    .log-filters {
        flex-direction: column;
    }

    /* Drawer: full width on mobile */
    .agent-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    /* Touch-friendly tap targets */
    .agent-card {
        padding: 1rem;
        min-height: 44px;
    }

    .task-card {
        padding: 0.85rem;
        min-height: 44px;
    }

    .tab, .filter-input, .filter-select {
        min-height: 44px;
    }

    .drawer-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* === Tokens Tab === */
.tokens-view {
    max-width: 1200px;
    margin: 0 auto;
}

.token-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.token-filter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.token-filter-buttons {
    display: flex;
    gap: 0.25rem;
}

.token-filter-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-stack);
}

.token-filter-btn:hover {
    color: var(--text);
    border-color: #484f58;
}

.token-filter-btn.active {
    background: var(--surface-2);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.token-filter-mobile {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font-stack);
}

.token-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.token-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.token-card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.token-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text);
}

.token-card-value--cost {
    color: var(--accent-gold);
}

.token-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.token-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.token-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.token-chart-card--full {
    width: 100%;
}

.token-chart-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.token-chart-wrap {
    height: 220px;
    position: relative;
}

.token-chart-wrap--wide {
    height: 260px;
}

.token-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

.token-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.token-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.token-table tr:hover td {
    background: var(--surface-2);
}

.token-table .num {
    text-align: right;
    font-family: var(--font-mono);
}

.token-table th.num {
    text-align: right;
}

.token-table .tk-model-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.token-table .tk-tier-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--surface-2);
    color: var(--text-muted);
    text-transform: uppercase;
}

.token-table .tk-session-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-blue);
}

.token-table .tk-cell-cost {
    font-weight: 600;
}

.token-table .tk-cell-path {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.8rem;
}

@media (max-width: 767px) {
    .token-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .token-charts-row {
        grid-template-columns: 1fr;
    }

    .token-filter-buttons {
        display: none;
    }

    .token-filter-mobile {
        display: block;
    }
}

/* === Graph Container === */
.graph-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 360px;
    position: relative;
    overflow: hidden;
}

.graph-container svg {
    display: block;
}

/* D3 graph node glow ring pulse */
.pulse-ring {
    animation: ring-pulse 2s ease-in-out infinite;
}

@keyframes ring-pulse {
    0%, 100% { opacity: 0.6; r: 24; }
    50% { opacity: 0.2; r: 28; }
}

/* === Agent Drawer === */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.agent-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
}

.agent-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    flex-shrink: 0;
}

.drawer-header-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.drawer-agent-name {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.drawer-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.drawer-section {
    margin-bottom: 1.25rem;
}

.drawer-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.drawer-agent-activity {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-blue);
}

.drawer-output-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* === Animations === */

/* Pulsing halo on active agent cards */
@keyframes halo-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(63, 185, 80, 0.15); }
}

.agent-card.state-active {
    animation: halo-pulse 2.5s ease-in-out infinite;
    border-color: rgba(63, 185, 80, 0.4);
}

/* State badge pulse */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.state-active .agent-card-state {
    animation: pulse 2s ease-in-out infinite;
}

/* Smooth transitions on state changes — merged into clickable agent cards below */

.agent-card-state {
    transition: background 0.3s ease, color 0.3s ease;
}

.stat-value {
    transition: color 0.3s ease, transform 0.2s ease;
}

.stat-value.value-changed {
    transform: scale(1.15);
}

/* D3 ring pulse via CSS on SVG */
@keyframes svg-ring-pulse {
    0%, 100% { stroke-opacity: 0.6; }
    50% { stroke-opacity: 0.15; }
}

/* Clickable agent cards */
.agent-card {
    cursor: pointer;
    transition: border-color 0.5s ease, box-shadow 0.5s ease, opacity 0.3s ease, transform 0.2s ease, background 0.2s ease;
}

.agent-card:hover {
    border-color: #484f58;
    background: var(--surface-2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* === Loading Skeleton === */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

.skeleton-card {
    height: 120px;
    border: 1px solid var(--border);
}

.skeleton-graph {
    height: 100%;
    border: 1px solid var(--border);
}

.skeleton-stat {
    height: 60px;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
    gap: 0.5rem;
    font-size: 0.85rem;
}

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

.spinner-icon {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Fade-in for content appearing after load */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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