/*
 * OpenClaw Dashboard v3.0 - Redesigned
 *
 * Table of Contents:
 *   1. CSS Variables & Reset
 *   2. Form Inputs
 *   3. Layout (Header, Tabs, Grid)
 *   4. Panels & Cards
 *   5. Sessions & Timeline
 *   6. Memory & Agents
 *   7. Charts & Analytics
 *   8. Tasks / Projects (Kanban)
 *   9. Modals & Dialogs
 *  10. Retired panel cleanup
 *  11. Sprint Features (Git, Uptime, Search, etc.)
 *  12. Utility Classes
 *  13. Twemoji
 *  14. Responsive / Mobile
 */

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --bg-void: #06060a;
    --bg-base: #0c0c12;
    --bg-surface: #12121a;
    --bg-elevated: #1a1a24;
    --bg-hover: #22222e;
    --bg-code: #0d0d14;
    --bg-card: #14141c;

    --border: rgba(255, 255, 255, 0.06);
    --border-active: rgba(255, 255, 255, 0.12);

    --text: #f4f4f5;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent: #4f8ef7;
    --accent-dim: rgba(79, 142, 247, 0.12);
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.15);
    --warning: #fbbf24;
    --warning-dim: rgba(251, 191, 36, 0.15);
    --info: #60a5fa;
    --info-dim: rgba(96, 165, 250, 0.15);
    --purple: #8b5cf6;
    --purple-dim: rgba(139, 92, 246, 0.15);
    --pink: #ec4899;
    --pink-dim: rgba(236, 72, 153, 0.15);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Twemoji emoji styling — see consolidated rules at line ~2983 */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-void);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ==================== */
/* PREMIUM FORM INPUTS */
/* ==================== */

/* Base form input styling - modern dark theme */
select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    outline: none; /* keyboard: see :focus-visible below */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
    width: 100%;
}

/* Hover states */
select:hover,
input[type="text"]:hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="date"]:hover,
textarea:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Focus states - accent color ring */
select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(79, 142, 247, 0.2);
    background: var(--bg-surface);
}

/* Premium Select Dropdown */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 12px center, 0 0;
    background-size: 14px 14px, 100% 100%;
    padding-right: 40px;
    cursor: pointer;
    font-weight: 500;
}

/* Select hover - lighter chevron */
select:hover {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23d4d4d8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 12px center, 0 0;
    background-size: 14px 14px, 100% 100%;
}

/* Select focus - accent chevron */
select:focus {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234f8ef7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 12px center, 0 0;
    background-size: 14px 14px, 100% 100%;
}

/* Select options dropdown styling */
select option {
    background: var(--bg-surface);
    color: var(--text);
    padding: 10px;
}

/* Number input - hide ugly spinners */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Textarea specific styling */
textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
}

/* Placeholder styling */
::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
    font-weight: 400;
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Date input specific */
input[type="date"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(0.8);
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1800px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
    overflow: visible;
}

.app.has-sidebar {
    flex-direction: row;
    padding: 0;
    max-width: none;
}

/* ==================== */
/* LEFT SIDEBAR         */
/* ==================== */

.sidebar {
    width: 220px;
    min-width: 220px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 8px;
}

.sidebar.collapsed .sidebar-collapse-btn .collapse-icon {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-logo {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
}

.sidebar.collapsed .ws-badge {
    font-size: 0;
    padding: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    min-width: 10px;
}

.sidebar.collapsed .ws-badge.connected {
    background: var(--success);
}

.sidebar.collapsed .ws-badge.disconnected {
    background: #ef4444;
}

.sidebar.collapsed .notification-badge {
    right: 2px;
    top: 2px;
    min-width: 8px;
    height: 8px;
    font-size: 0;
    padding: 0;
}

.sidebar.collapsed .sidebar-tab {
    justify-content: center;
    padding: 10px 0;
    position: relative;
    overflow: visible;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.sidebar-collapse-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

.sidebar-collapse-btn .collapse-icon {
    transition: transform 0.3s ease;
    display: flex;
}

.sidebar-logo {
    height: 36px;
    width: 36px;
    border-radius: 8px;
    object-fit: contain;
    object-position: center;
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ff8e53);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.sidebar-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.sidebar-tab:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar-tab.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-tab.active .sidebar-icon {
    transform: scale(1.1);
}

.sidebar-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.7;
}
.sidebar-tab:hover .sidebar-icon {
    color: var(--text);
    opacity: 1;
}
.sidebar-tab.active .sidebar-icon {
    color: var(--accent);
    opacity: 1;
}
.sidebar-icon svg {
    display: block;
    flex-shrink: 0;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 12px;
}

.sidebar-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 12px 16px 4px;
    margin-top: 4px;
    user-select: none;
}

.sidebar.collapsed .sidebar-section {
    display: none;
}

.sidebar-footer {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* Main content wrapper */
.main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ==================== */
/* TOP BAR (slim)       */
/* ==================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 48px;
    min-height: 48px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.topbar-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 14px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-btn--wide {
    width: auto;
    min-width: 88px;
    padding: 0 12px;
    gap: 6px;
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-active);
}

.last-update-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    flex-wrap: wrap;
}

.refresh-interval-select {
    height: 34px;
    min-width: 72px;
    padding: 0 10px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
}

.refresh-interval-select:focus-visible,
.topbar-btn:focus-visible,
.topbar-hamburger:focus-visible,
.sidebar-collapse-btn:focus-visible,
.skip-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.skip-link,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    top: 12px;
    left: 12px;
    z-index: 200;
    width: auto;
    height: auto;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-active);
    clip: auto;
    transform: translateY(-160%);
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.last-update-inline .update-text {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.last-update-inline .update-label {
    color: var(--text-muted);
}

.last-update-inline #last-update {
    color: var(--text-secondary);
    font-weight: 500;
}

.refresh-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.refresh-status-pill.live {
    background: rgba(34,197,94,0.14);
    border-color: rgba(34,197,94,0.24);
    color: #22c55e;
}

.refresh-status-pill.paused {
    background: rgba(148,163,184,0.16);
    border-color: rgba(148,163,184,0.24);
    color: var(--text-muted);
}

.refresh-status-pill.stale {
    background: rgba(245,158,11,0.14);
    border-color: rgba(245,158,11,0.24);
    color: #f59e0b;
}

/* stale coloring applied via JS to #last-update span */
.last-update-inline .stale { color: var(--warning); }
.last-update-inline .very-stale { color: #ef4444; }

#last-update-widget {
    position: relative;
}

.refresh-countdown {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.section-update-map {
    font-size: 10px;
    color: var(--text-muted);
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-header-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.widget-freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.widget-freshness-badge.fresh {
    color: #22c55e;
    border-color: rgba(34,197,94,0.2);
    background: rgba(34,197,94,0.08);
}

.widget-freshness-badge.warm {
    color: #f59e0b;
    border-color: rgba(245,158,11,0.2);
    background: rgba(245,158,11,0.08);
}

.widget-freshness-badge.stale {
    color: #ef4444;
    border-color: rgba(239,68,68,0.2);
    background: rgba(239,68,68,0.08);
}

.widget-freshness-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.9;
}

@keyframes stale-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Keep old header-tab class for backward compat (mobile nav, bottom bar) */
.header-tab {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-tab:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.header-tab.active {
    background: var(--accent);
    color: white;
}

/* ==================== */
/* MOBILE RESPONSIVE    */
/* ==================== */

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .topbar-hamburger {
        display: flex;
    }

    .main-wrapper {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 260px;
        min-width: 260px;
    }

    .topbar-actions {
        gap: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .topbar-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .topbar-btn--wide {
        min-width: 78px;
        padding: 0 10px;
    }

    .refresh-interval-select {
        height: 30px;
        min-width: 64px;
        padding: 0 8px;
    }

    .last-update {
        display: none;
    }

    /* Hide less critical buttons on mobile */
    .topbar-btn[title="Export data"],
    .topbar-btn[title="Screenshot report"] {
        display: none;
    }
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow: visible;
    flex-direction: column;
    padding: 12px;
}

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

/* Some tabs handle their own padding */
.tab-content#tab-architecture,
.tab-content#tab-security {
    padding: 0;
}

/* Tasks tab needs a proper flex height chain for the kanban board to fill */
.tab-content#tab-tasks {
    overflow: hidden;
    min-height: 0;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    min-height: 56px;
}

.stat-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-icon {
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.stat-value.cost-value {
    color: var(--success);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.action-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--text);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 10px;
    flex: 1;
}

/* Analytics Range Selector */
.analytics-range-selector {
    display: flex;
    gap: 2px;
    padding: 0 0 12px 0;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 3px;
    width: fit-content;
    margin-bottom: 12px;
}
.range-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #71717a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}
.range-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #d4d4d8;
}
.range-btn.active {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3);
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 4px 20px;
}

.analytics-grid .chart-container canvas {
    max-width: 100%;
}

.analytics-grid .panel {
    max-height: 500px;
    overflow: hidden;
}

.analytics-grid .panel .panel-content {
    overflow-y: auto;
    max-height: 400px;
}

/* System Grid */
.system-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
    flex: 1;
    min-height: 0;
    padding-bottom: 80px;
}

.system-grid .panel {
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.system-grid .panel .panel-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.system-grid .memory-panel {
    padding-bottom: 0;
}

.system-grid .memory-panel .panel-content {
    padding-right: 8px;
    padding-bottom: 60px;
}

/* Panels */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 180px;
    max-height: 500px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 44px;
}

.panel-header h2 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.panel-badge {
    background: var(--info-dim);
    color: var(--info);
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
}

.panel-content {
    padding: 10px 14px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

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

/* No Errors Success State */
.no-errors-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--success-dim);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    margin: 8px;
}

.no-errors-icon {
    font-size: 18px;
}

.no-errors-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--success);
}

/* Chart Panels */
.chart-panel {
    min-height: 280px;
    max-height: 420px;
}

.analytics-grid .chart-panel {
    max-height: 420px;
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(20,20,35,0.95) 100%);
    border: 1px solid rgba(139,92,246,0.08);
    transition: border-color 0.2s ease;
}

.analytics-grid .chart-panel:hover {
    border-color: rgba(139,92,246,0.2);
}

.chart-container {
    position: relative;
    height: 220px;
    max-height: 220px;
    overflow: hidden;
}

.chart-container canvas {
    max-height: 220px !important;
}

/* Session Items */
.session-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
    min-height: 48px;
}

.session-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--success);
    transform: translateX(4px);
}

.session-icon {
    font-size: 18px;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-weight: 500;
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.3;
}

.session-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.session-activity-bar {
    height: 3px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.session-activity-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--info), var(--purple));
    border-radius: 2px;
    transition: width 0.4s ease;
}

.session-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.session-status.idle {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* Timeline */
.timeline-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.timeline-item:hover {
    background: var(--bg-elevated);
}

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

.timeline-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 12px;
    flex-shrink: 0;
}

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

.timeline-text {
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-item.expanded .timeline-text {
    white-space: normal;
    word-break: break-word;
}

.timeline-item .expand-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.timeline-item:hover .expand-hint {
    opacity: 1;
}

.timeline-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Memory Items */
.memory-item {
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memory-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.memory-file {
    font-size: 12px;
    color: var(--info);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.memory-preview {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
    padding-right: 4px;
}

.memory-search-summary {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.memory-search-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.memory-preview mark {
    background: rgba(250, 204, 21, 0.2);
    color: #fde68a;
    border-radius: 4px;
    padding: 0 2px;
}

.memory-size {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Cron Items */
.cron-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cron-item:hover {
    background: var(--bg-hover);
}

.cron-name {
    font-size: 12px;
    font-weight: 500;
}

.cron-schedule {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.cron-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.cron-status.ok, .cron-status.enabled {
    background: var(--success-dim);
    color: var(--success);
}

.cron-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.cron-status.idle {
    background: var(--warning-dim);
    color: var(--warning);
}

/* Health Items */
.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.health-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.health-value {
    font-size: 12px;
    font-weight: 600;
}

.health-value.good { color: var(--success); }
.health-value.warning { color: var(--warning); }
.health-value.bad { color: #ef4444; }

.health-value.load-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.health-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-base);
    border-radius: 3px;
    overflow: hidden;
    margin-left: 8px;
}

.health-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 4px; /* Ensure visibility at low percentages */
}

.health-bar-fill.good { background: var(--success); }
.health-bar-fill.warning { background: var(--warning); }
.health-bar-fill.bad { background: #ef4444; }

/* Error Items */
.error-item {
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.error-text {
    font-size: 12px;
    color: #ef4444;
    font-family: 'JetBrains Mono', monospace;
}

.error-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Node Items */
.node-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.node-icon {
    font-size: 24px;
}

.node-info {
    flex: 1;
}

.node-name {
    font-size: 14px;
    font-weight: 600;
}

.node-platform {
    font-size: 11px;
    color: var(--text-muted);
}

.node-caps {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.node-cap {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--purple-dim);
    color: var(--purple);
    border-radius: 4px;
}

.node-status {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.node-status.connected {
    background: var(--success-dim);
    color: var(--success);
}

.node-status.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Skill Items */
.skill-item {
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--purple);
}

.skill-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.skill-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.skill-source {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== */
/* AGENTS TAB - REDESIGN */
/* ==================== */

.agents-tab-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* Agents Sub-Tab Switcher */
.agents-subtabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px;
    background: var(--bg-elevated);
    border-radius: 10px;
    margin-bottom: 10px;
    width: 100%;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.agents-subtab {
    padding: 7px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.agents-subtab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.agents-subtab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.agents-subtab-content {
    display: none;
}

.agents-subtab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Agent Card */
.agent-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.agent-card-icon {
    font-size: 24px;
}

.agent-card-title {
    flex: 1;
}

.agent-card-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.agent-card-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Status Badge - Green with checkmark */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

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

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

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Model Badge - Gray pill */
.model-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Kind Badge - Blue tinted for session kind (main, cron, etc.) */
.model-badge.kind-badge {
    background: var(--info-dim);
    border-color: rgba(96, 165, 250, 0.3);
    color: var(--info);
}

/* Model Tier Badges */
.model-tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.model-tier-badge.opus {
    background: rgba(218, 54, 51, 0.15);
    color: #da3633;
    border: 1px solid rgba(218, 54, 51, 0.3);
}
.model-tier-badge.sonnet {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}
.model-tier-badge.haiku {
    background: rgba(35, 134, 54, 0.15);
    color: #238636;
    border: 1px solid rgba(35, 134, 54, 0.3);
}
.model-tier-badge.groq {
    background: rgba(31, 111, 235, 0.15);
    color: #1f6feb;
    border: 1px solid rgba(31, 111, 235, 0.3);
}
.model-tier-badge.unknown {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Model Distribution Chart */
.model-dist-container {
    padding: 16px;
}
.model-dist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.model-dist-label {
    width: 70px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.model-dist-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--bg-base);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.model-dist-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 0;
}
.model-dist-bar-fill span {
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.model-dist-value {
    width: 80px;
    text-align: right;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

/* Session Duration Badge */
.session-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--warning-dim);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: var(--warning);
    margin-left: 8px;
}

/* Agent Stats Row */
.agent-card-stats {
    display: flex;
    gap: 24px;
    padding: 12px 16px;
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.agent-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.agent-stat-value.cost {
    color: var(--success);
}

.agent-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Expandable Sections */
.agent-section {
    border-top: 1px solid var(--border);
}

.agent-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.agent-section-header:hover {
    background: var(--bg-elevated);
}

.agent-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.agent-section-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.agent-section.expanded .agent-section-toggle {
    transform: rotate(180deg);
}

.agent-section-content {
    display: none;
    padding: 0 16px 16px;
}

.agent-section.expanded .agent-section-content {
    display: block;
}

.agent-section-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-code);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* ==================== */
/* SESSIONS TAB - REDESIGN */
/* ==================== */

.sessions-tab-container {
    display: flex;
    gap: 16px;
    flex: none;
    padding: 0;
    align-items: flex-start;
    overflow: visible;
}

.session-list-panel {
    width: 380px;
    min-width: 360px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    position: sticky;
    top: 64px;
    align-self: flex-start;
}

.session-list-panel > .panel-header {
    flex-shrink: 0;
    background: var(--bg-surface);
    border-radius: var(--radius) var(--radius) 0 0;
}

.session-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Session History Item */
.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    overflow: hidden;
}

.history-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--info);
}

.history-item.selected {
    background: var(--bg-hover);
    border-left-color: var(--accent);
}

.history-icon {
    font-size: 16px;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-id {
    font-size: 11px;
    color: var(--info);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.3;
}

.history-meta {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-kind {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--info);
}

.history-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-base);
    border-radius: 4px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Session Detail Panel */
.session-detail-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.session-placeholder {
    flex: 1;
    min-height: 300px;
}

.session-detail-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.session-detail-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.session-detail-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Session Stats Cards - 6-card colorful grid */
.session-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.stat-card-new {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card-new .stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-card-new .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Stat card colors — neutral by default, semantic only */
.stat-card-new .stat-value { color: var(--text); }
.stat-card-new.blue .stat-value { color: var(--text); }
.stat-card-new.yellow .stat-value { color: var(--text); }
.stat-card-new.gray .stat-value { color: var(--text-secondary); }
.stat-card-new.cyan .stat-value { color: var(--text); }
.stat-card-new.red .stat-value { color: #f87171; } /* errors only */
.stat-card-new.purple .stat-value { color: var(--text); }
.stat-card-new.green .stat-value { color: #4ade80; } /* positive status only */

/* Session Stats Bar - Legacy (kept for backward compatibility) */
.session-stats-bar {
    display: none; /* Hidden - replaced by cards */
    gap: 24px;
    padding: 12px 16px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.session-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.session-stat-value.cost {
    color: var(--success);
}

.session-stat-value.errors {
    color: #ef4444;
}

.session-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Session Stats Grid - Three panels */
.session-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.stats-column {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.stats-column-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-usage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-usage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.tool-usage-name {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-usage-icon {
    font-size: 14px;
}

.tool-usage-count {
    font-weight: 600;
    color: var(--pink);
    background: var(--pink-dim);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.performance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.performance-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.performance-label {
    color: var(--text-muted);
}

.performance-value {
    color: var(--text);
    font-weight: 500;
}

/* Issues Panel */
.issues-success {
    background: var(--success-dim);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--success);
}

.issues-error-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.issues-error-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-xs);
    padding: 8px 10px;
    font-size: 11px;
    color: #ef4444;
}

/* Tool Distribution Section */
.tool-distribution-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.tool-distribution-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tool-distribution-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-dist-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-dist-label {
    width: 100px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-dist-bar-container {
    flex: 1;
    height: 20px;
    background: var(--bg-base);
    border-radius: 4px;
    overflow: hidden;
}

.tool-dist-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.tool-dist-percent {
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Tool Distribution Bar (inline) */
.tool-distribution {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.tool-distribution-segment {
    height: 100%;
    transition: width 0.3s;
}

/* Search Box */
.session-search-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.session-search-input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    transition: border-color 0.2s;
}

.session-search-input:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--info);
}

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

/* Session Messages Timeline */
.session-messages {
    padding: 16px;
}

/* Message Item */
.message-item {
    margin-bottom: 16px;
}

.message-item.hidden {
    display: none;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

/* Role Badges - Enhanced */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge .role-icon {
    font-size: 12px;
}

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

.role-badge.assistant {
    background: var(--success-dim);
    color: var(--success);
}

.role-badge.tool {
    background: var(--pink-dim);
    color: var(--pink);
}

.message-timestamp {
    font-size: 11px;
    color: var(--text-muted);
}

.message-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.message-meta .tokens {
    background: var(--bg-base);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Message Content */
.message-content {
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-content.user-content {
    border-left: 3px solid var(--info);
}

.message-content.assistant-content {
    border-left: 3px solid var(--success);
}

.message-content.tool-content {
    border-left: 3px solid var(--pink);
}

/* Thinking Section - Enhanced */
.thinking-section {
    margin-top: 10px;
}

.thinking-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--purple-dim);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--purple);
    cursor: pointer;
    transition: all 0.2s;
}

.thinking-toggle:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--purple);
}

.thinking-toggle .arrow {
    transition: transform 0.2s;
    font-size: 10px;
}

.thinking-section.expanded .thinking-toggle .arrow {
    transform: rotate(180deg);
}

.thinking-content {
    display: none;
    margin-top: 10px;
    padding: 14px;
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    max-height: 250px;
    overflow-y: auto;
}

.thinking-section.expanded .thinking-content {
    display: block;
}

/* Tool Call - Enhanced Card Style */
.tool-call {
    margin-top: 10px;
    padding: 14px;
    background: var(--bg-code);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-call-icon {
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pink-dim);
    border-radius: var(--radius-xs);
}

.tool-call-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--pink);
    font-family: 'JetBrains Mono', monospace;
}

.tool-call-toggle {
    font-size: 11px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tool-call-toggle:hover {
    background: var(--pink-dim);
    border-color: var(--pink);
    color: var(--pink);
}

.tool-call-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.tool-call.expanded .tool-call-details {
    display: block;
}

.tool-call-section {
    margin-top: 12px;
}

.tool-call-section:first-child {
    margin-top: 0;
}

.tool-call-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.tool-call-code {
    background: var(--bg-base);
    padding: 12px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--border);
}

/* Tool Result */
.tool-result-item {
    margin-left: 20px;
    border-left: 3px solid var(--success);
    background: rgba(52, 211, 153, 0.05);
}

.tool-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(52, 211, 153, 0.1);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tool-result-icon {
    font-size: 14px;
}

.tool-result-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
}

.tool-result-content {
    padding: 8px 12px 12px;
}

.tool-result-content .tool-call-code {
    margin-top: 6px;
    max-height: 300px;
}

/* WebSocket Status */
.ws-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ws-badge.connected {
    background: var(--success-dim);
    color: var(--success);
    animation: live-pulse 2s ease-in-out infinite;
}

.ws-badge.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Refresh Button */
.refresh-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    border-color: var(--info);
    background: var(--bg-card);
    color: var(--text);
    transform: rotate(180deg);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 18px;
    overflow-y: auto;
}

/* Detail Rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

.detail-value.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--info);
}

/* Search */
.search-input-large {
    flex: 1;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.search-results {
    overflow-y: auto;
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 12px;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-icon { margin-right: 4px; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--accent); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

/* Keyboard Shortcuts Help */
.shortcuts-grid {
    display: grid;
    gap: 24px;
}

.shortcut-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.shortcut-item kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 32px;
    text-align: center;
}

.shortcut-item span {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Command Palette */
.command-palette {
    position: fixed;
    top: 20vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-active);
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    z-index: 10001;
}

.command-palette-input {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    outline: none; /* keyboard: see :focus-visible below */
}

.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.command-item:hover,
.command-item.selected {
    background: var(--bg-hover);
}

.command-item.selected {
    border-left: 2px solid var(--accent);
}

.command-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.command-info {
    flex: 1;
    min-width: 0;
}

.command-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.command-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Text Colors */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: #ef4444; }
.text-info { color: var(--info); }

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Agent Preview in Overview */
.agent-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-preview-item:hover {
    background: var(--bg-hover);
}

.agent-preview-icon {
    font-size: 16px;
}

.agent-preview-info {
    flex: 1;
    min-width: 0;
}

.agent-preview-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-preview-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.agent-preview-status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.agent-preview-status.completed {
    background: var(--success-dim);
    color: var(--success);
}

/* Responsive */
@media (max-width: 1400px) {
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
    }
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .session-stats-grid {
        grid-template-columns: 1fr;
    }
    .session-stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    /* Allow whole tab to scroll on smaller screens */
    .tab-content {
        overflow-y: auto;
    }
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
        flex: none;
    }
    .panel {
        min-height: 250px;
    }
    /* Agents tab - let whole page scroll */
    .agents-tab-container {
        flex: none;
        overflow-y: visible;
    }
    /* Sessions tab - make detail panel not flex-shrink */
    .sessions-tab-container {
        flex: none;
        min-height: auto;
    }
    .session-detail-panel {
        min-height: 600px;
    }
    .session-messages {
        overflow-y: visible;
        flex: none;
    }
    /* System tab */
    .system-grid {
        flex: none;
    }
}

@media (max-width: 1000px) {
    .tab-content {
        overflow-y: auto;
    }
    .main-grid, .analytics-grid, .system-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        flex: none;
    }
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .session-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .header-tabs {
        display: none;
    }
    /* Agents tab */
    .agents-tab-container {
        flex: none;
        overflow-y: visible;
    }
    /* Sessions tab - stack vertically, let whole page scroll */
    .sessions-tab-container {
        flex-direction: column;
        flex: none;
        min-height: auto;
    }
    .session-list-panel {
        width: 100%;
        max-height: 300px;
    }
    .session-list-content {
        overflow-y: auto;
    }
    .session-detail-panel {
        flex: none;
        min-height: auto;
    }
    .session-messages, .session-flow-diagram {
        overflow-y: visible;
        flex: none;
    }
    .panel {
        min-height: 250px;
    }
    .tool-distribution-section {
        display: none; /* Hide on mobile */
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* View Toggle Bar */
.view-toggle-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.view-toggle {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.view-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.view-toggle.active {
    background: var(--info-dim);
    border-color: var(--info);
    color: var(--info);
}

/* Waterfall Chart */
.session-waterfall {
    padding: 16px 0;
}

.waterfall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.waterfall-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.waterfall-label {
    width: 140px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.waterfall-bar-container {
    flex: 1;
    height: 20px;
    background: var(--bg-base);
    border-radius: 4px;
    position: relative;
}

.waterfall-bar {
    height: 100%;
    border-radius: 4px;
    position: absolute;
    top: 0;
    min-width: 3px;
}

.waterfall-bar.user { background: var(--info); }
.waterfall-bar.assistant { background: var(--success); }
.waterfall-bar.thinking { background: var(--purple); }
.waterfall-bar.tool { background: var(--pink); }

.waterfall-duration {
    width: 60px;
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* View Session Button */
.view-session-btn {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--info-dim);
    border: 1px solid var(--info);
    border-radius: var(--radius-sm);
    color: var(--info);
    cursor: pointer;
    transition: all 0.15s;
}

.view-session-btn:hover {
    background: var(--info);
    color: var(--bg-base);
}

/* ==================== */
/* FLOW DIAGRAM VIEW    */
/* ==================== */

.session-flow-diagram {
    padding: 16px;
}

.flow-diagram-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.flow-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
    border-radius: var(--radius);
    transition: all 0.25s ease;
    border: 1px solid transparent;
    position: relative;
}

.flow-item:hover {
    background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-elevated) 100%);
    border-color: var(--border-active);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Duration Badge - Pill Style */
.flow-duration {
    min-width: 52px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    border-radius: 20px;
    background: var(--bg-base);
    color: var(--text-muted);
}

.flow-duration.fast {
    background: var(--success-dim);
    color: var(--success);
}

.flow-duration.medium {
    background: var(--warning-dim);
    color: var(--warning);
}

.flow-duration.slow {
    background: var(--accent-dim);
    color: var(--accent);
}

/* Flow Icon - Gradient with Glow */
.flow-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.flow-item:hover .flow-icon {
    transform: scale(1.1);
}

.flow-icon.user {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.flow-icon.assistant {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.flow-icon.tool {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.flow-icon.thinking {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.flow-icon.result {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Flow Content */
.flow-content {
    flex: 1;
    min-width: 0;
}

.flow-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Flow Timestamp */
.flow-timestamp {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

/* Connector Line on left */
.flow-diagram-container::before {
    content: '';
    position: absolute;
    left: 72px;
    top: 30px;
    bottom: 30px;
    width: 2px;
    background: linear-gradient(180deg, var(--info) 0%, var(--success) 33%, var(--warning) 66%, var(--purple) 100%);
    border-radius: 2px;
    opacity: 0.3;
}

/* ==================== */
/* SUB-AGENTS SECTION */
/* ==================== */

.subagents-section {
    margin-bottom: 32px;
}

.section-header {
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.agents-section-divider {
    margin: 24px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.agents-section-divider h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.subagents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sub-Agent Card */
.subagent-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.subagent-card:hover {
    border-color: var(--border-active);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.subagent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
}

.subagent-icon {
    font-size: 24px;
}

.subagent-title {
    flex: 1;
}

.subagent-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.subagent-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

.subagent-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.subagent-status.completed {
    background: var(--success-dim);
    color: var(--success);
}

.subagent-status.running {
    background: var(--info-dim);
    color: var(--info);
}

.subagent-status.failed {
    background: var(--accent-dim);
    color: var(--accent);
}

.subagent-model {
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-muted);
}

.subagent-expand {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.subagent-card.expanded .subagent-expand {
    transform: rotate(180deg);
}

/* Sub-Agent Content (expandable) */
.subagent-content {
    display: none;
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.subagent-card.expanded .subagent-content {
    display: block;
}

.subagent-section {
    margin-top: 16px;
}

.subagent-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.subagent-task,
.subagent-findings {
    background: var(--bg-code);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', monospace;
}

.subagent-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-base);
    font-size: 11px;
    color: var(--text-muted);
}

.subagent-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.subagent-footer-item {
    display: flex;
    gap: 6px;
}

.subagent-session-btn {
    padding: 4px 10px;
    background: var(--info-dim);
    color: var(--info);
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.subagent-session-btn:hover {
    background: rgba(96, 165, 250, 0.3);
}

.subagent-footer-label {
    color: var(--text-muted);
}

.subagent-footer-value {
    color: var(--info);
    font-family: 'JetBrains Mono', monospace;
}

.subagent-session-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.subagent-session-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Sub-agent Modal */
.subagent-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.subagent-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.subagent-modal-badges {
    display: flex;
    gap: 8px;
}

.subagent-modal-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.subagent-modal-stats {
    display: flex;
    gap: 24px;
}

.subagent-modal-stats .stat-item {
    font-size: 14px;
}

.subagent-modal-stats .stat-label {
    color: var(--text-muted);
    margin-right: 8px;
}

.subagent-modal-section {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.subagent-modal-section .section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.subagent-modal-section .section-content {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text);
}

.subagent-modal-note {
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.subagent-footer-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Agents Preview Panel */
.agents-preview-panel .panel-content {
    max-height: 400px;
    overflow-y: auto;
}

/* Twemoji styling for consistent emoji rendering */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
    display: inline-block;
}

.stat-icon img.emoji,
.logo img.emoji {
    height: 1.2em;
    width: 1.2em;
}

.header-tab img.emoji {
    height: 1em;
    width: 1em;
    margin-right: 4px;
}

.timeline-icon img.emoji,
.session-icon img.emoji {
    height: 1.1em;
    width: 1.1em;
}

/* Session detail header with copy link */
.session-detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.copy-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-link-btn:hover {
    color: var(--text);
    background: var(--bg-card);
    border-color: var(--info);
}

/* ==================== PROJECTS TAB ==================== */

.projects-tab-container {
    padding: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.projects-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.project-filter {
    /* Inherits premium select styling from global */
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 10px center, 0 0;
    background-size: 14px 14px, 100% 100%;
    padding-right: 36px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.project-filter:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.project-filter:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(79, 142, 247, 0.2);
}

.action-btn.primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    border: none;
}

.action-btn.primary:hover {
    filter: brightness(1.1);
}

/* Kanban Board */
.kanban-board {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    overflow: hidden;
    flex: 1;
    min-height: 400px;
    /* JS sets exact height on tab activation via resizeKanbanBoard() */
}

/* Board subtab: don't fight the board's explicit height */
#subtab-tasks-board.agents-subtab-content.active,
#subtab-tasks-board.active {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.kanban-column {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    flex: 1;
    align-self: stretch;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kanban-column-title {
    font-weight: 600;
    font-size: 14px;
}

.kanban-column-count {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.kanban-column-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Task Card */
.task-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.task-card:hover {
    border-color: var(--info);
    transform: translateY(-1px);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.task-card-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.3;
    flex: 1;
}

.task-card-type {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    margin-left: 8px;
    flex-shrink: 0;
}

.task-card-type.task { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.task-card-type.feature { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.task-card-type.epic { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.task-card-type.bug { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.task-card-type.fix { background: rgba(251, 146, 60, 0.2); color: #fb923c; }
.task-card-type.improvement { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

.task-card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.task-card-category-badge {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-code);
    font-weight: 500;
}

.task-card-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.task-card-todos {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card-sessions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card-priority {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.task-card-priority.high { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.task-card-priority.medium { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.task-card-priority.low { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

/* Task Modal */
.task-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.task-modal-header-row {
    margin-bottom: 12px;
}

.task-modal-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.task-modal-type {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: var(--info-dim);
    color: var(--info);
}

.task-modal-type.feature {
    background: var(--purple-dim);
    color: var(--purple);
}

.task-modal-type.epic {
    background: var(--pink-dim);
    color: var(--pink);
}

.task-modal-category {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.task-modal-priority {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.task-modal-priority.high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.task-modal-priority.medium {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.task-modal-priority.low {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.task-modal-dates {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.task-modal-date {
    font-size: 12px;
    color: var(--text-muted);
}

.task-modal-date.completed {
    color: var(--success);
}

.task-modal-date.due {
    color: var(--warning);
}

.task-modal-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.task-modal-section {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.task-modal-section .section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.task-modal-section .section-content {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text);
}

.task-modal-section .section-content.empty {
    color: var(--text-muted);
    font-style: italic;
}

.action-btn.danger {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.task-todo-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-code);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-todo-item:hover {
    background: var(--bg-card);
}

.task-todo-item.done {
    opacity: 0.6;
}

.task-todo-item.done .task-todo-text {
    text-decoration: line-through;
}

.task-todo-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-todo-item.done .task-todo-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.task-todo-text {
    font-size: 13px;
}

.task-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-session-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-code);
    border-radius: 4px;
    color: var(--info);
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-session-link:hover {
    background: var(--bg-card);
}

.task-modal-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.task-modal-actions .action-btn {
    flex: 1;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    /* Inherits from global select/input/textarea styles above */
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
    width: 100%;
}

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.form-input:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(79, 142, 247, 0.2);
    background: var(--bg-surface);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
    font-weight: 400;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Status move buttons */
.task-move-buttons {
    display: flex;
    gap: 6px;
}

.task-move-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-move-btn:hover {
    border-color: var(--info);
    color: var(--text);
}

.task-move-btn.active {
    background: var(--info);
    border-color: var(--info);
    color: white;
}

/* Drag and Drop */
.task-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.kanban-column-content.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
}

.kanban-column-content.drag-over {
    border-color: var(--info);
    background: rgba(59, 130, 246, 0.1);
}

.task-card[draggable="true"] {
    cursor: grab;
}

.task-card[draggable="true"]:active {
    cursor: grabbing;
}

/* Global Search */
.search-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-btn:hover {
    border-color: var(--info);
    background: var(--bg-card);
}

.global-search-modal {
    align-items: flex-start;
    padding-top: 15vh;
}

.global-search-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.global-search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.global-search-icon {
    font-size: 18px;
    opacity: 0.6;
}

.global-search-input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--text);
    outline: none; /* keyboard: see :focus-visible below */
}

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

.global-search-hint {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--bg-elevated);
    border-radius: 4px;
    color: var(--text-muted);
}

.global-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.global-search-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.global-search-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.global-search-item:hover, .global-search-item:focus {
    background: var(--bg-elevated);
    outline: none; /* keyboard: see :focus-visible below */
}

.global-search-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.global-search-item-content {
    flex: 1;
    min-width: 0;
}

.global-search-item-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-item-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-item-type {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-code);
    border-radius: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.panel-badge.positive {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.panel-badge.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.position-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.position-symbol {
    font-weight: 600;
    font-size: 14px;
}

.position-market {
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.position-details {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 12px;
}

.position-qty, .position-outcome {
    color: var(--text-muted);
}

.position-pnl {
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.position-pnl.positive {
    color: #4ade80;
}

.position-pnl.negative {
    color: #f87171;
}

.regime-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.regime-badge.bullish {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.regime-badge.bearish {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.regime-badge.neutral {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.market-headline {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
}

.market-headline-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.market-headline-item .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.market-headline-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.market-headline-item .value.positive {
    color: #4ade80;
}

.market-headline-item .value.negative {
    color: #f87171;
}

.top-sectors {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    margin-bottom: 12px;
}

.sector-label {
    font-weight: 500;
    white-space: nowrap;
}

.sector-list {
    color: var(--text-secondary);
}

.market-status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.market-stat {
    background: var(--bg-elevated);
    padding: 10px;
    border-radius: 8px;
}

.market-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.market-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.market-stat-value.success {
    color: #4ade80;
}

.market-stat-value.danger {
    color: #f87171;
}

.market-stat-value.warning {
    color: #fbbf24;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 56px;
    right: 24px;
    z-index: 10002;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(79, 142, 247, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    padding: 0;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(79, 142, 247, 0.35);
    border-color: #ff8e53;
}

.chat-toggle-icon {
    width: 38px;
    height: 38px;
    display: block;
    object-fit: contain;
    object-position: center;
}

.chat-toggle-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.chat-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    object-position: center;
}

.chat-title {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

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

.chat-header-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

.chat-header-actions button:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
}

.chat-close:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-surface);
}

.chat-welcome {
    text-align: center;
    padding: 48px 24px 32px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chat-welcome-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    padding: 4px;
    background: var(--bg-elevated);
    margin-bottom: 8px;
    object-fit: contain;
    object-position: center;
}

.chat-welcome-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.chat-welcome-sub {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    max-width: 240px;
    line-height: 1.5;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-elevated);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-message.typing {
    align-self: flex-start;
    background: var(--bg-elevated);
    padding: 12px 18px;
}

.typing-dots span {
    animation: typing 1.4s infinite;
    font-size: 18px;
    color: var(--text-muted);
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    outline: none; /* keyboard: see :focus-visible below */
}

.chat-input:focus {
    border-color: var(--info);
}

.chat-send {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}

.chat-send:hover {
    background: #ff8e53;
    transform: scale(1.05);
}

/* Theme Toggle Button */
.theme-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: var(--info);
}

/* Cron Run Modal */
.cron-run-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cron-run-item:hover {
    background: var(--bg-card);
    border-left: 3px solid var(--info);
}

.cron-run-name {
    font-weight: 500;
    font-size: 14px;
}

.cron-run-schedule {
    font-size: 12px;
    color: var(--text-muted);
}

/* Light Theme */
[data-theme="light"] {
    /* Full light theme - override ALL dark mode variables */
    --bg-void: #f0f4f8;
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-code: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --info: #3b82f6;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --accent: #6366f1;
    --accent-muted: rgba(99, 102, 241, 0.15);
    --glow-subtle: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .header {
    background: #ffffff;
    border-bottom-color: #e2e8f0;
}

[data-theme="light"] .panel {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .stat-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .modal-content {
    background: #ffffff;
}

[data-theme="light"] .chat-panel {
    background: #ffffff;
}

[data-theme="light"] .global-search-container {
    background: #ffffff;
}

/* Light theme polish — fix inconsistencies */
[data-theme="light"] .header-tab {
    color: #64748b;
}
[data-theme="light"] .header-tab:hover {
    background: #f1f5f9;
    color: #0f172a;
}
[data-theme="light"] .header-tab.active {
    background: #6366f1;
    color: #fff;
}
[data-theme="light"] .stat-icon {
    background: #f1f5f9;
}
[data-theme="light"] .action-btn {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #334155;
}
[data-theme="light"] .action-btn:hover {
    background: #f1f5f9;
    border-color: #6366f1;
    color: #0f172a;
}
[data-theme="light"] .session-item {
    background: #f8fafc;
}
[data-theme="light"] .session-item:hover {
    background: #f1f5f9;
}
[data-theme="light"] .cron-item {
    background: #f8fafc;
}
[data-theme="light"] .cron-item:hover {
    background: #f1f5f9;
}
[data-theme="light"] .history-item {
    background: #f8fafc;
}
[data-theme="light"] .history-item:hover {
    background: #f1f5f9;
}
[data-theme="light"] .history-item.selected {
    background: #ede9fe;
    border-left-color: #6366f1;
}
[data-theme="light"] .agent-preview-item {
    background: #f8fafc;
}
[data-theme="light"] .agent-preview-item:hover {
    background: #f1f5f9;
}
[data-theme="light"] .memory-item {
    background: #f8fafc;
}
[data-theme="light"] .memory-item:hover {
    background: #f1f5f9;
}
[data-theme="light"] .kanban-column {
    background: #f8fafc;
    border-color: #e2e8f0;
}
[data-theme="light"] .task-card {
    background: #ffffff;
    border-color: #e2e8f0;
}
[data-theme="light"] .task-card:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .message-content {
    background: #f8fafc;
}
[data-theme="light"] .tool-call {
    background: #f8fafc;
    border-color: #e2e8f0;
}
[data-theme="light"] .tool-call-code {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}
[data-theme="light"] .thinking-content {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}
[data-theme="light"] .health-bar {
    background: #e2e8f0;
}
[data-theme="light"] .agents-subtab {
    color: #64748b;
}
[data-theme="light"] .agents-subtab:hover {
    color: #0f172a;
    background: #f1f5f9;
}
[data-theme="light"] .agents-subtab.active {
    background: #6366f1;
    color: #fff;
}
[data-theme="light"] .subagent-card {
    background: #ffffff;
    border-color: #e2e8f0;
}
[data-theme="light"] .agent-card {
    background: #ffffff;
    border-color: #e2e8f0;
}
[data-theme="light"] .ws-badge.connected {
    background: rgba(34, 197, 94, 0.15);
}
[data-theme="light"] .ws-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
}
[data-theme="light"] .notif-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .notif-overlay { background: rgba(0,0,0,0.15); }
[data-theme="light"] .toast {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .flow-item {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}
[data-theme="light"] .flow-item:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] select,
[data-theme="light"] input[type="text"],
[data-theme="light"] textarea {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] select:focus,
[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
[data-theme="light"] .node-item,
[data-theme="light"] .skill-item {
    background: #f8fafc;
}
[data-theme="light"] .error-item {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
}
[data-theme="light"] .no-errors-state {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
}
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f1f5f9;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
[data-theme="light"] .health-score-banner {
    background: #ffffff;
    border-color: #e2e8f0;
}
[data-theme="light"] .log-stream-panel .log-entry {
    border-bottom-color: #f1f5f9;
}

/* ==================== */
/* HEALTH SCORE BANNER  */
/* ==================== */

.health-score-banner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    flex-shrink: 0;
    position: relative;
}

.health-score-ring-container {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.health-score-ring {
    width: 90px;
    height: 90px;
}

.health-score-arc {
    stroke: var(--success);
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.health-score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
}

.health-score-details {
    flex: 1;
}

.health-score-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.health-score-components {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.hsc-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hsc-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hsc-bar {
    height: 6px;
    background: var(--bg-base);
    border-radius: 3px;
    overflow: hidden;
}

.hsc-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--success);
    transition: width 1s ease, background-color 0.5s ease;
}

/* ==================== */
/* LIVE LOG STREAM      */
/* ==================== */

.log-stream-panel {
    grid-column: 1 / -1;
    max-height: 280px;
    overflow-y: auto;
}

.log-stream-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.6;
    padding: 8px 12px !important;
}

.log-icon {
    font-size: 12px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.log-entry:hover {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.hsc-item {
    position: relative;
}
.hsc-item:hover .hsc-fill {
    filter: brightness(1.2);
}

/* Custom health score tooltips */
.hsc-custom-tooltip {
    display: none;
    position: absolute;
    background: linear-gradient(135deg, rgba(24,24,32,0.97), rgba(18,18,26,0.97));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    z-index: 100;
    min-width: 240px;
    pointer-events: none;
}
.hsc-tt-header {
    font-size: 13px;
    color: #f4f4f5;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 6px;
}
.hsc-tt-score {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}
.hsc-tt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.hsc-tt-label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    min-width: 65px;
    flex-shrink: 0;
}
.hsc-tt-bar {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.hsc-tt-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.hsc-tt-value {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: #f4f4f5;
    font-weight: 600;
    min-width: 55px;
    text-align: right;
}
[data-theme="light"] .hsc-custom-tooltip {
    background: linear-gradient(135deg, rgba(255,255,255,0.97), rgba(248,250,252,0.97));
    border-color: #e2e8f0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
[data-theme="light"] .hsc-tt-header { color: #1e293b; border-color: #f1f5f9; }
[data-theme="light"] .hsc-tt-label { color: #94a3b8; }
[data-theme="light"] .hsc-tt-value { color: #1e293b; }
[data-theme="light"] .hsc-tt-bar { background: #f1f5f9; }

.log-entry:last-child {
    border-bottom: none;
}

.log-level {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 42px;
    text-align: center;
}

.log-level.info {
    background: var(--info-dim);
    color: var(--info);
}

.log-level.warning {
    background: var(--warning-dim);
    color: var(--warning);
}

.log-level.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.log-source {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 70px;
    flex-shrink: 0;
}

.log-text {
    color: var(--text-secondary);
    word-break: break-word;
    flex: 1;
}

.log-time {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
}

.log-stream-indicator {
    color: var(--success);
    font-size: 10px;
    animation: log-pulse 2s ease-in-out infinite;
}

@keyframes log-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== */
/* SPARKLINE CHARTS     */
/* ==================== */

.position-item {
    position: relative;
}

.sparkline-container {
    width: 100px;
    height: 36px;
    flex-shrink: 0;
}

.sparkline-container svg {
    width: 100%;
    height: 100%;
}

/* Notifications */
.notification-wrapper {
    position: relative;
}

.notification-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Notification side panel */
.notif-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}
.notif-overlay.open { display: block; }

.notif-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-active);
    box-shadow: -8px 0 32px rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease;
}
.notif-panel.open { right: 0; }

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.notif-panel-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.notif-clear-btn {
    background: none; border: none; color: var(--info); font-size: 12px; cursor: pointer;
}
.notif-close-btn {
    background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 0 4px;
}
.notif-close-btn:hover { color: var(--text-primary); }

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Keep old .notification-dropdown for JS toggle compat */
.notification-dropdown { display: none; }

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease, transform 0.1s ease;
    border-left: 3px solid transparent;
}

.notification-item.clickable {
    cursor: pointer;
}

.notification-item.clickable:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

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

/* Notification type colors */
.notification-item.error {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
}

.notification-item.error:hover {
    background: rgba(239, 68, 68, 0.15);
}

.notification-item.message {
    border-left-color: var(--info);
}

.notification-item.message:hover {
    background: rgba(96, 165, 250, 0.1);
}

.notification-item.cron {
    border-left-color: var(--warning);
}

.notification-item.cron:hover {
    background: rgba(251, 191, 36, 0.1);
}

.notification-item.subagent {
    border-left-color: var(--purple);
}

.notification-item.subagent:hover {
    background: rgba(139, 92, 246, 0.1);
}

.notification-item.trade {
    border-left-color: var(--success);
}

.notification-item.trade:hover {
    background: rgba(34, 197, 94, 0.1);
}

.notification-item.system {
    border-left-color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
}

.notification-item.system:hover {
    background: rgba(251, 191, 36, 0.15);
}

.notification-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.notification-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.notification-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.notification-link-label {
    font-size: 11px;
    color: var(--accent);
    margin-top: 6px;
    font-weight: 600;
}

/* Export Button */
.export-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    border-color: var(--info);
}

/* Pin Button */
.pin-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 2px;
    flex-shrink: 0;
}
.history-item:hover .pin-btn,
.pin-btn.pinned {
    opacity: 0.6;
}
.pin-btn:hover, .pin-btn.pinned {
    opacity: 1;
}

.history-item.pinned {
    background: rgba(251, 191, 36, 0.1);
}

/* (mobile styles consolidated at end of file) */

/* Calendar Widget */
.calendar-widget .panel-content {
    min-height: 80px;
}

.calendar-today {
    text-align: center;
    padding: 16px;
}

.calendar-date {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.calendar-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Performance Widget */
.perf-metric {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.perf-metric:last-child {
    border-bottom: none;
}

.perf-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.perf-value {
    font-size: 13px;
    font-weight: 600;
}

.perf-value.warning {
    color: var(--warning);
}

/* Session Replay Button */
.replay-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.replay-btn:hover {
    border-color: var(--info);
}

/* Improved Task Cards */
.task-card-meta-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.task-card-parent {
    font-size: 11px;
    color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-card-parent:hover { background: rgba(139, 92, 246, 0.2); }

.task-card-children {
    font-size: 11px;
    color: var(--info, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.task-card-children .children-progress {
    color: var(--muted);
    font-size: 10px;
}

/* Modal parent/children styles */
.task-parent-link {
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    cursor: pointer;
    color: var(--accent);
    font-weight: 500;
    transition: background 0.15s;
}
.task-parent-link:hover { background: rgba(139, 92, 246, 0.2); }
.task-parent-link .link-arrow { opacity: 0.5; }

.task-children-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.task-child-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.task-child-item:hover { background: rgba(148, 163, 184, 0.15); }
.task-child-item.done .child-title { text-decoration: line-through; opacity: 0.6; }
.task-child-item .child-status { font-size: 14px; flex-shrink: 0; }
.task-child-item .child-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.task-card-input {
    font-size: 11px;
    color: var(--muted);
    background: rgba(148, 163, 184, 0.1);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.task-card-output {
    font-size: 11px;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.task-duration {
    font-size: 10px;
    color: var(--warning);
    font-weight: 500;
}

.task-card-stats {
    display: flex;
    gap: 10px;
    align-items: center;
}

.task-card-todos.complete {
    color: var(--success);
    font-weight: 600;
}

.task-card-session-link {
    font-size: 11px;
    color: var(--info);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    transition: all 0.2s ease;
}

.task-card-session-link:hover {
    background: rgba(59, 130, 246, 0.2);
}

.task-card-date {
    font-size: 10px;
    color: var(--text-muted);
}

.task-card-dates {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 10px;
}

.task-date-created {
    color: var(--text-muted);
}

.task-date-completed {
    color: var(--success);
    font-weight: 500;
}

.task-modal-dates {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-modal-meta.completed {
    color: var(--success);
}

.task-modal-meta.due {
    color: var(--warning);
}

/* Better Done column styling */
.kanban-column[data-status="done"] .task-card {
    border-left: 3px solid var(--success);
}

.kanban-column[data-status="in-progress"] .task-card {
    border-left: 3px solid var(--warning);
}

.kanban-column[data-status="planned"] .task-card {
    border-left: 3px solid var(--info);
}

/* Session Empty State */
.session-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.session-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.session-empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.session-empty-hint {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==================== */
/* TASK DUE DATES */
/* ==================== */

.task-card-due {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.task-card-due.due-soon {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    animation: pulse-warning 2s ease-in-out infinite;
}

.task-card-due.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    animation: pulse-danger 1.5s ease-in-out infinite;
}

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

@keyframes pulse-danger {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

/* ==================== */
/* CALENDAR WIDGET */
/* ==================== */

.calendar-today {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.calendar-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.calendar-empty {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar-event {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--info);
    transition: all 0.2s ease;
}

.calendar-event:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.calendar-event.today {
    border-left-color: var(--accent);
    background: rgba(79, 142, 247, 0.08);
}

.calendar-event-time {
    min-width: 70px;
    text-align: right;
}

.calendar-event-day {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.calendar-event-hour {
    font-size: 10px;
    color: var(--text-muted);
}

.calendar-event-title {
    flex: 1;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* (mobile styles consolidated at end of file) */

.panel-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.panel-link:hover {
    opacity: 1;
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .header-tab {
        font-size: 10px;
        padding: 5px 8px;
    }

    .session-stats-cards {
        grid-template-columns: 1fr;
    }
}

/* Subagent Summary (when transcript unavailable) */
.subagent-summary {
    padding: 20px;
}
.subagent-note {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.subagent-section {
    margin-bottom: 20px;
}
.subagent-section-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text);
}
.subagent-section-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}
.subagent-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 12px;
}
.subagent-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==================== */
/* NEW FEATURES v6.0    */
/* ==================== */

/* Feature 1: Voice Toggle */
#voice-toggle-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}
#voice-toggle-btn.active {
    background: var(--success-dim);
    border-color: var(--success);
}

/* Feature 2: P&L Chart */
.pnl-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
}
.pnl-chart-header .positive { color: var(--success); }
.pnl-chart-header .negative { color: var(--accent); }
.pnl-chart-container {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* Feature 3: Resolution Tracker */
.resolution-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.resolution-item {
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
}
.resolution-item.urgent {
    border-left-color: var(--accent);
    background: rgba(79, 142, 247, 0.1);
}
.resolution-item.soon {
    border-left-color: var(--warning);
}
.resolution-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}
.resolution-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}
.resolution-position {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.resolution-position.yes {
    background: var(--success-dim);
    color: var(--success);
}
.resolution-position.no {
    background: var(--accent-dim);
    color: var(--accent);
}

/* Feature 4: Comparison View */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.comparison-column {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 16px;
}
.comparison-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}
.comparison-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comparison-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.comparison-stat span { color: var(--text-muted); }
.comparison-stat strong { color: var(--text); }
.comparison-divider {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
}
.comparison-diff {
    background: var(--bg-code);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.comparison-diff h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.diff-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
}
.comparison-actions {
    text-align: center;
}

/* Feature 5: Task Dependencies */
.task-link-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
}
.task-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
}
.task-link-item:hover {
    background: var(--bg-hover);
}
.task-link-item input {
    width: 16px;
    height: 16px;
}
.task-link-item span {
    flex: 1;
    font-size: 13px;
}
.task-link-category {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--bg-base);
    border-radius: 4px;
    color: var(--text-muted);
}
.task-link-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Feature 6: Session Tags */
.tag-session-content {
    padding: 8px 0;
}
.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.tag-item {
    cursor: pointer;
    transition: transform 0.15s;
}
.tag-item:hover {
    transform: scale(1.05);
}
.tag-item.selected .tag-badge {
    box-shadow: 0 0 0 2px var(--info);
}
.tag-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}
.tag-badge.tag-important { background: var(--accent-dim); color: var(--accent); }
.tag-badge.tag-bug { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.tag-badge.tag-feature { background: var(--success-dim); color: var(--success); }
.tag-badge.tag-research { background: var(--purple-dim); color: var(--purple); }
.tag-badge.tag-review { background: var(--warning-dim); color: var(--warning); }
.tag-badge.tag-archived { background: var(--bg-base); color: var(--text-muted); }
.custom-tag-input {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}
.custom-tag-input input {
    flex: 1;
}
.tag-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Feature 7: Memory Editor */
.memory-editor {
    display: flex;
    flex-direction: column;
    height: 60vh;
}
.memory-editor-textarea {
    flex: 1;
    width: 100%;
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    resize: none;
}
.memory-editor-textarea:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--info);
}
.memory-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
}
.memory-editor-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: auto;
}

/* Feature 8: Cron Builder */
.cron-builder {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cron-builder-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cron-builder-section label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.cron-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-code);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
}
.cron-preview code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--info);
}
.cron-builder-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* Feature 9: Layout Manager */
.layout-manager {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.layout-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.layout-section label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.layout-save-row {
    display: flex;
    gap: 8px;
}
.layout-save-row input {
    flex: 1;
}
.layout-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.layout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.layout-item:hover {
    background: var(--bg-hover);
}
.layout-item.active {
    background: var(--info-dim);
    border: 1px solid var(--info);
}
.layout-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}
.layout-delete:hover {
    color: var(--accent);
}
.layout-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.layout-panel-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
}
.layout-panel-toggle:hover {
    background: var(--bg-hover);
}

/* Feature 10: Tool Heatmap */
.heatmap-container {
    overflow-x: auto;
}
.heatmap-header {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}
.heatmap-hour {
    width: 20px;
    text-align: center;
    font-size: 9px;
    color: var(--text-muted);
}
.heatmap-row {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
}
.heatmap-tool {
    width: 80px;
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.heatmap-cell {
    width: 20px;
    height: 16px;
    border-radius: 2px;
    cursor: pointer;
}
.heatmap-cell:hover {
    box-shadow: 0 0 0 2px var(--text);
}

/* Form inputs styling defined globally above - no duplicate needed */

/* Button variations */
.action-btn.primary {
    background: var(--info);
    border-color: var(--info);
    color: white;
}
.action-btn.primary:hover {
    background: #4f8af0;
}
.action-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}
.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Comparison button in session list */
.compare-btn {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.history-item:hover .compare-btn {
    opacity: 1;
}
.compare-btn:hover {
    background: var(--info-dim);
    border-color: var(--info);
    color: var(--info);
}

/* Session tags display */
.session-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.session-tag-mini {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 10px;
    background: var(--bg-base);
    color: var(--text-muted);
}

/* Memory edit button */
.memory-item {
    position: relative;
}
.memory-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.memory-item:hover .memory-edit-btn {
    opacity: 1;
}
.memory-edit-btn:hover {
    background: var(--info-dim);
    border-color: var(--info);
}

/* Layout button */
.layout-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 16px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.layout-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Voice toggle button in chat */
.voice-toggle-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.voice-toggle-btn:hover {
    background: var(--bg-hover);
}
.voice-toggle-btn.active {
    background: var(--success-dim);
}

/* Tag button on session items */
.tag-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.history-item:hover .tag-btn {
    opacity: 0.5;
}
.tag-btn:hover {
    opacity: 1;
}

/* Session tags */
.session-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.session-tag-mini {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--purple-dim);
    color: var(--purple);
    border-radius: 3px;
}

/* Tag modal */
.tag-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0;
}
.tag-item {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.tag-item:hover {
    border-color: var(--accent);
}
.tag-item.selected {
    background: var(--accent-dim);
    border-color: var(--accent);
}
.custom-tag-input {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}
.custom-tag-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text);
}
.tag-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* Session Kind Filter */
.session-kind-filter {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin-right: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 8px center, 0 0;
    background-size: 12px 12px, 100% 100%;
    padding-right: 28px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.session-kind-filter:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.session-kind-filter:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(79, 142, 247, 0.2);
}

/* Session Message Preview */
.history-preview {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    opacity: 0.7;
}

/* ==================== */
/* MOBILE RESPONSIVE   */
/* COMPREHENSIVE       */
/* ==================== */

/* Hamburger Menu Button (hidden on desktop) */
.hamburger-btn {
    display: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 20px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: var(--bg-hover);
}

/* Mobile nav overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.mobile-nav-overlay.open {
    display: block;
}

.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-nav-panel.open {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-tabs {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.mobile-nav-tabs .header-tab {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: var(--radius-sm);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.mobile-nav-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-nav-actions button {
    min-height: 44px;
    min-width: 44px;
    font-size: 16px;
}

/* ---- Tablet (768px) ---- */
@media (max-width: 768px) {
    .app {
        padding: 6px;
    }

    /* Header: show hamburger, hide desktop tabs & some icons */
    .hamburger-btn {
        display: flex;
    }

    .header {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 8px 12px;
        gap: 8px;
    }

    .header-left {
        flex: 1;
        min-width: 0;
    }

    .header-left .header-tabs {
        display: none;
    }

    .header h1 {
        font-size: 18px;
    }

    .header-right {
        gap: 6px;
        flex-wrap: nowrap;
    }

    /* Hide less important header items on mobile */
    .header-right .last-update,
    .header-right .export-btn,
    .header-right .layout-btn {
        display: none;
    }

    .header-right .search-btn,
    .header-right .notification-btn,
    .header-right .theme-btn,
    .header-right .refresh-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }

    .ws-badge {
        font-size: 9px;
        padding: 3px 6px;
    }

    /* Stats bar */
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
        min-height: 48px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }

    /* Quick actions */
    .quick-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .action-btn {
        font-size: 12px;
        padding: 8px 12px;
        min-height: 40px;
    }

    /* Main grid */
    .main-grid {
        grid-template-columns: 1fr;
    }

    /* Panels */
    .panel {
        min-height: 180px;
        max-height: none;
    }

    /* Analytics */
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-range-selector {
        width: 100%;
        justify-content: center;
    }

    /* System */
    .system-grid {
        grid-template-columns: 1fr;
    }

    /* Sessions */
    .sessions-tab-container {
        flex-direction: column;
        padding: 4px;
    }

    .session-list-panel {
        width: 100%;
        max-height: 350px;
    }

    .session-detail-panel {
        width: 100%;
        min-height: auto;
        overflow-x: hidden;
    }

    .session-detail-header {
        padding: 10px;
        overflow: hidden;
    }

    .session-detail-title-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .session-detail-title-row .copy-link-btn {
        font-size: 11px;
        padding: 4px 8px;
    }

    .session-stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 10px;
    }

    .session-stats-grid {
        grid-template-columns: 1fr;
    }

    .tool-distribution-section {
        overflow-x: auto;
    }

    /* Session history items */
    .history-item,
    .session-history-entry {
        padding: 8px;
        overflow: hidden;
        word-break: break-word;
    }

    .history-badge {
        font-size: 10px;
    }

    /* View toggle bar */
    .view-toggle-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .view-toggle {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Agents */
    .agents-tab-container {
        padding: 8px;
    }

    .agents-subtabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .agents-subtab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .agent-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .agent-card-stats {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Projects / Kanban */
    .projects-tab-container {
        padding: 12px;
        height: auto;
    }

    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .projects-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .kanban-board {
        grid-template-columns: 1fr;
        overflow-x: visible;
        overflow-y: visible;
    }

    .kanban-column {
        min-width: unset;
        min-height: 150px;
    }

    /* Modals */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh;
        margin: auto;
    }

    .modal-body {
        padding: 12px;
    }

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

    /* Chat */
    .chat-panel {
        width: calc(100vw - 24px);
        right: -12px;
        height: 65vh;
    }

    .chat-widget {
        bottom: 20px;
        right: 12px;
    }

    /* Search */
    .global-search-modal {
        padding: 12px;
        padding-top: 5vh;
    }

    .global-search-container {
        width: 100%;
        max-width: 100%;
    }

    /* Notification panel mobile */
    .notif-panel { width: 100vw; right: -100vw; }

    /* Comparison grid */
    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .comparison-divider {
        display: none;
    }

    /* Flow diagram */
    .flow-diagram-container::before {
        left: 48px;
    }

    .flow-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .flow-icon {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .flow-title {
        font-size: 13px;
    }

    /* Subagent cards */
    .subagent-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .subagent-badges {
        flex-wrap: wrap;
    }

    /* History items - bigger touch targets */
    .history-item {
        padding: 12px 8px;
        min-height: 56px;
    }

    /* Hide compare/tag buttons on mobile to reduce clutter */
    .history-item .compare-btn,
    .history-item .tag-btn {
        display: none;
    }

    /* Waterfall */
    .waterfall-label {
        width: 80px;
        font-size: 11px;
    }

    /* Layout panels */
    .layout-panels {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Toast */
    .toast {
        left: 16px;
        right: 16px;
        bottom: 80px;
    }
}

/* ---- Small Mobile (425px and below) ---- */
@media (max-width: 425px) {
    .app {
        padding: 4px;
    }

    .header {
        padding: 6px 8px;
    }

    .logo {
        font-size: 22px;
    }

    .header h1 {
        font-size: 16px;
    }

    .header-right .search-btn,
    .header-right .notification-btn,
    .header-right .theme-btn {
        display: none;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .stat-card {
        padding: 8px;
        gap: 6px;
    }

    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .stat-value {
        font-size: 16px;
    }

    .quick-actions {
        gap: 4px;
    }

    .action-btn {
        font-size: 11px;
        padding: 6px 8px;
    }

    .panel-header h2 {
        font-size: 11px;
    }

    /* Session stats */
    .session-stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .stat-card-new {
        padding: 10px;
    }

    .stat-card-new .stat-value {
        font-size: 18px;
    }

    /* Kanban - horizontal scroll mode */
    .kanban-board {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-bottom: 12px;
        scroll-snap-type: x mandatory;
    }

    .kanban-column {
        min-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .projects-title h2 {
        font-size: 18px;
    }

    /* Agents */
    .agents-subtab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    /* Session list */
    .session-list-panel {
        max-height: 280px;
    }

    .history-name {
        font-size: 12px;
    }

    .history-meta {
        font-size: 9px;
    }

    /* Session detail — prevent left clipping */
    .session-detail-panel {
        overflow-x: hidden;
    }

    .session-detail-header {
        padding: 8px;
    }

    .session-detail-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .session-detail-title-row .copy-link-btn {
        font-size: 10px;
        padding: 4px 6px;
    }

    .session-detail-title {
        font-size: 14px;
        word-break: break-word;
    }

    /* Action buttons row — horizontal scroll */
    .session-detail-title-row {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tool chart — ensure it fits */
    .tool-distribution-section {
        padding: 8px;
        overflow-x: auto;
    }

    .tool-distribution-section canvas,
    .tool-distribution-section .chart-container {
        max-width: 100%;
    }

    /* Session content overflow */
    .session-content,
    .session-messages-container {
        padding: 8px;
        overflow-x: hidden;
        word-break: break-word;
    }

    /* Tab content — tighter on small screens */
    .tab-content {
        padding: 6px;
    }

    /* Chat */
    .chat-toggle {
        width: 48px;
        height: 48px;
    }

    .chat-toggle-icon {
        width: 32px;
        height: 32px;
    }
}

/* ---- Extra Small (320px) ---- */
@media (max-width: 320px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 14px;
    }

    .session-stats-cards {
        grid-template-columns: 1fr;
    }
}

/* Performance Metrics */
.perf-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
}
.perf-label {
    font-size: 12px;
    color: var(--text-secondary);
}
.perf-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.perf-panel {
    grid-column: span 1;
    max-height: 250px !important;
}

/* ==================== AI INSIGHTS PANEL ==================== */
.insights-panel {
    grid-column: 1 / -1;
}
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.insight-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.insight-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
}
.insight-item.type-info::before { background: var(--accent); }
.insight-item.type-warning::before { background: #d29922; }
.insight-item.type-danger::before { background: #da3633; }
.insight-item.type-success::before { background: #238636; }
.insight-item:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.insight-icon {
    flex-shrink: 0;
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
}
.insight-body {
    flex: 1;
    min-width: 0;
}
.insight-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}
.insight-detail {
    font-size: 11px;
    color: var(--text-muted);
}
.insight-badge {
    font-size: 18px;
    font-weight: 700;
    padding: 0 8px;
    flex-shrink: 0;
}
.insight-badge.green { color: #22c55e; }
.insight-badge.yellow { color: #eab308; }
.insight-badge.red { color: #ef4444; }
.insight-badge.blue { color: #3b82f6; }
.insight-badge.purple { color: #8b5cf6; }
    font-size: 16px;
}
.insight-text {
    color: var(--text-secondary);
}

/* ==================== MESSAGE BOOKMARKS ==================== */
.bookmark-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.3;
    transition: opacity 0.15s, transform 0.15s;
    padding: 2px 4px;
    margin-left: auto;
}
.bookmark-btn:hover {
    opacity: 0.8;
    transform: scale(1.15);
}
.bookmark-btn.bookmarked {
    opacity: 1;
}
.message-item:hover .bookmark-btn {
    opacity: 0.6;
}
.message-item:hover .bookmark-btn.bookmarked {
    opacity: 1;
}

/* Bookmarks modal */
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bookmark-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.bookmark-entry:hover {
    background: var(--bg-hover);
}
.bookmark-info {
    flex: 1;
    min-width: 0;
}
.bookmark-preview {
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bookmark-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.bookmark-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}
.bookmark-remove:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

/* Architecture info panel animation */
@keyframes archPanelIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#arch-info-panel {
  pointer-events: auto;
}

/* ==================== */
/* MEMORY TIMELINE TAB  */
/* ==================== */

.memory-timeline-container {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mt-stats {
    grid-template-columns: repeat(4, 1fr) !important;
}

.mt-stats .stat-card {
    position: relative;
    overflow: hidden;
}

.mt-stats .stat-card::before {
    display: none;
}

.mt-stats .stat-card:hover {
    border-color: rgba(139,92,246,0.35);
    box-shadow: 0 4px 20px rgba(139,92,246,0.12);
}

.mt-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.mt-chart-panel {
    max-height: 350px;
}

.mt-topics-panel {
    max-height: 350px;
}

.mt-graph-panel {
    border: 1px solid rgba(139,92,246,0.12);
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(15,15,25,0.95) 100%);
    max-height: none;
    overflow: visible;
}

.mt-daily-panel {
    max-height: none;
}

/* Topic Pills */
.topic-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.topic-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
}

.topic-pill:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border-color: rgba(255,255,255,0.12);
}

.topic-pill .topic-count {
    font-size: 11px;
    opacity: 0.8;
}

/* Daily Activity Items */
.daily-item {
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--bg-elevated), rgba(30,30,45,0.6));
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 3px solid rgba(139,92,246,0.3);
    border: 1px solid rgba(255,255,255,0.04);
    border-left: 3px solid rgba(139,92,246,0.3);
}

.daily-item:hover {
    background: linear-gradient(135deg, var(--bg-hover), rgba(40,40,60,0.6));
    border-left-color: #8b5cf6;
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(139,92,246,0.08);
}

.daily-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.daily-item-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.daily-item-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.daily-item-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.daily-item-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.daily-topic-tag {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(139,92,246,0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(139,92,246,0.2);
    transition: all 0.2s ease;
}

.daily-topic-tag:hover {
    background: rgba(139,92,246,0.18);
    border-color: rgba(139,92,246,0.35);
}

.daily-item-expand {
    display: none;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.daily-item.expanded .daily-item-expand {
    display: block;
}

/* Memory indicator (legacy) */
.memory-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    box-shadow: 0 0 6px var(--purple);
    display: inline-block;
    margin-left: 6px;
}

/* Stat sublabel */
.stat-sublabel {
    font-size: 10px;
    margin-top: 2px;
    color: var(--text-muted);
}

/* ========================= */
/* MT DAY CARDS (polished)   */
/* ========================= */
.mt-day-card {
    background: var(--bg-elevated);
    border-radius: 10px;
    border-left: 3px solid #3f3f46;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mt-day-card:hover {
    background: var(--bg-hover);
    transform: translateX(3px);
}
.mt-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mt-day-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mt-day-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mt-day-date {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.mt-day-memory {
    font-size: 12px;
    opacity: 0.7;
}
.mt-day-expand {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.mt-day-card.expanded .mt-day-expand {
    transform: rotate(180deg);
}
.mt-day-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.daily-topic-pill {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.mt-day-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.mt-day-sessions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    opacity: 0;
    margin-top: 0;
}
.mt-day-card.expanded .mt-day-sessions {
    max-height: 800px;
    opacity: 1;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.mt-session-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 3px 0;
    background: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.mt-session-row:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}
.mt-session-icon {
    font-size: 12px;
}
.mt-session-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mt-session-msgs {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}
.mt-session-snippet {
    grid-column: 2 / -1;
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.7;
}

/* ==================== */
/* INTELLIGENCE TAB     */
/* ==================== */

.intelligence-container {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.intel-pattern-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.intel-card {
    max-height: 400px;
}

.intel-signals-panel {
    max-height: 600px;
}

/* Explosion Items */
.intel-item {
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.intel-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.intel-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.intel-item-topic {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
}

.intel-item-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.intel-item-badge.hot {
    background: rgba(79, 142, 247, 0.2);
    color: var(--accent);
    border: 1px solid rgba(79, 142, 247, 0.3);
}

.intel-item-badge.warm {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.intel-item-badge.cool {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.intel-item-badge.streak {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.intel-item-badge.blocker {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
    font-size: 10px;
}

.intel-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Signal Grid */
.signal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.signal-card {
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.signal-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.signal-topic {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
    margin-bottom: 6px;
}

.signal-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.signal-freq {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.signal-sessions {
    font-size: 11px;
    color: var(--text-muted);
}

/* Responsive for new tabs */
@media (max-width: 900px) {
    .mt-grid {
        grid-template-columns: 1fr;
    }
    .intel-pattern-cards {
        grid-template-columns: 1fr;
    }
    .mt-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .signal-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ============================================================
   INTERACTIVE DASHBOARD v2 - Drill-downs, Modals, Animations
   ============================================================ */

/* Signal Detail Modal */
.signal-detail-modal .modal-body { max-height: 70vh; overflow-y: auto; }
.signal-detail-header { margin-bottom: 16px; }
.signal-detail-header h4 { margin: 0 0 8px; font-size: 1.1em; color: var(--text-primary); }
/* Signal modal sparklines */
.signal-sparkline-section { margin-bottom: 20px; padding: 16px; background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary)); border-radius: 12px; }
.signal-section-title { margin: 0 0 10px; color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.signal-total-badge, .signal-count-badge { font-size: 10px; background: var(--bg-tertiary); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.signal-sparkline { display: flex; align-items: flex-end; gap: 3px; height: 70px; padding: 0; }
.signal-sparkline-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.signal-sparkline-bar { width: 100%; min-width: 8px; border-radius: 3px 3px 0 0; transition: all 0.2s; cursor: pointer; }
.signal-sparkline-bar:hover { opacity: 0.8; transform: scaleY(1.05); transform-origin: bottom; }
.signal-sparkline-label { font-size: 8px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; }
.signal-stat-card { display: flex; flex-direction: column; align-items: center; padding: 16px; }
.signal-stat-value { font-size: 36px; font-weight: 700; color: var(--accent); }
.signal-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Signal snippet cards */
.signal-snippets-section { margin-top: 8px; }
.signal-snippet-list { display: flex; flex-direction: column; gap: 6px; }
.signal-snippet-card { padding: 10px 14px; background: var(--bg-tertiary); border-radius: 10px; border-left: 3px solid var(--accent); cursor: pointer; transition: all 0.2s; }
.signal-snippet-card:hover { background: var(--bg-hover); transform: translateX(3px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.signal-snippet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.signal-snippet-session-link { font-size: 12px; color: var(--accent); font-weight: 600; cursor: pointer; }
.signal-snippet-session-link:hover { text-decoration: underline; }
.signal-snippet-ago { font-size: 10px; color: var(--text-muted); }
.signal-snippet-body { font-size: 12px; color: var(--text-secondary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.signal-show-more-btn { display: block; width: 100%; margin-top: 8px; padding: 8px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.signal-show-more-btn:hover { background: var(--bg-hover); }
.signal-snippet-overflow .signal-snippet-card { margin-top: 6px; }

/* Blocker error cards */
.blocker-error-card { border-left-color: #ef4444 !important; }
.blocker-error-message { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.error-source-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.error-source-cron { background: #7f1d1d; color: #fca5a5; }
.error-source-transcript { background: #78350f; color: #fdba74; }
.error-source-tool { background: #1e3a5f; color: #93c5fd; }
.error-source-system { background: #374151; color: #9ca3af; }

/* Signal grid cards */
.signal-card { transition: all 0.2s; }
.signal-card:hover { transform: scale(1.03); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

/* Clickable intel items */
.intel-item { cursor: pointer; transition: all 0.2s ease; }
.intel-item:hover { transform: translateX(4px); filter: brightness(1.1); }

/* Signal cards clickable */
.signal-card { cursor: pointer; transition: all 0.2s ease; }
.signal-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* Color-coded signal badges */
.signal-freq.signal-red { background: rgba(255,107,107,0.2) !important; color: var(--accent) !important; }
.signal-freq.signal-orange { background: rgba(251,191,36,0.2) !important; color: #fbbf24 !important; }
.signal-freq.signal-yellow { background: rgba(234,179,8,0.2) !important; color: #eab308 !important; }
.signal-freq.signal-green { background: rgba(34,197,94,0.2) !important; color: #22c55e !important; }

/* Intelligence search bar */
.intel-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px; }
.intel-search-icon { font-size: 16px; opacity: 0.5; }
.intel-search-input { flex: 1; background: none; border: none; color: var(--text-primary); font-size: 14px; outline: none; /* keyboard: see :focus-visible below */ }
.intel-search-input::placeholder { color: var(--text-muted); }

/* Task widgets row */
.intel-task-widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 768px) { .intel-task-widgets { grid-template-columns: 1fr; } }

/* Priority items */
.priority-item { padding: 5px 8px; background: transparent; border-radius: 4px; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: background 0.15s; border-left: 2px solid transparent; }
.priority-item:hover { background: var(--bg-hover); }
.priority-badge { font-size: 9px; padding: 1px 5px; border-radius: 3px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0; }
.priority-badge.high { background: rgba(239,68,68,0.15); color: #ef4444; }
.priority-badge.medium { background: rgba(251,191,36,0.12); color: #d4a017; }
.priority-badge.low { background: rgba(96,165,250,0.12); color: #60a5fa; }
.priority-title { flex: 1; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.priority-category { font-size: 9px; color: var(--text-muted); white-space: nowrap; }

/* Decision items */
.decision-item { padding: 8px 12px; background: var(--bg-tertiary); border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; }
.decision-item:hover { background: var(--bg-hover); }
.decision-title { font-size: 13px; color: var(--text-primary); margin-bottom: 2px; }
.decision-meta { font-size: 10px; color: var(--text-muted); }
.decision-output { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Memory Timeline - clickable day bars (chart.js handles this) */
/* Daily item expand animation */
/* Legacy daily-item styles (kept for backward compat) */
.daily-item { cursor: pointer; transition: all 0.3s ease; overflow: hidden; }
.daily-item:hover { background: var(--bg-hover); }
.daily-item .daily-sessions { max-height: 0; overflow: hidden; transition: max-height 0.4s ease, opacity 0.3s ease; opacity: 0; }
.daily-item.expanded .daily-sessions { max-height: 500px; opacity: 1; }
.daily-session-item { padding: 6px 12px; margin: 4px 0; background: var(--bg-tertiary); border-radius: 6px; border-left: 2px solid var(--accent); cursor: pointer; transition: all 0.2s; }
.daily-session-item:hover { background: var(--bg-hover); transform: translateX(2px); }
.daily-session-name { font-size: 12px; font-weight: 600; color: var(--accent); }
.daily-session-meta { font-size: 10px; color: var(--text-muted); }
.daily-session-snippet { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Topic pill clickable */
.topic-pill { cursor: pointer; transition: all 0.2s ease; }
.topic-pill:hover { transform: scale(1.05); filter: brightness(1.2); }
.topic-pill.active { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }

/* Expand arrow indicator */
.daily-item-header::after { content: '▸'; float: right; color: var(--text-muted); transition: transform 0.3s ease; font-size: 12px; }
.daily-item.expanded .daily-item-header::after { transform: rotate(90deg); }

/* Loading spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal enter animation */
.modal-overlay { animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { animation: modalSlideIn 0.25s ease; }
@keyframes modalSlideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ==================== */
/* COST BREAKDOWN PANEL */
/* ==================== */
.cost-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.cost-section {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.cost-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}
.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.cost-row:last-child { border-bottom: none; }
.cost-label { color: var(--text-secondary); }
.cost-value { font-weight: 600; color: #f59e0b; font-family: 'JetBrains Mono', monospace; }
.cost-bar {
    height: 6px;
    background: var(--bg-base);
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}
.cost-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.cost-total-card {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, 0.2);
    margin-bottom: 16px;
}
.cost-total-value {
    font-size: 36px;
    font-weight: 800;
    color: #f59e0b;
}
.cost-total-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}
.cost-trend-chart {
    height: 120px;
    margin-top: 16px;
}

/* ==================== */
/* CRON TIMELINE GANTT  */
/* ==================== */
.gantt-container {
    position: relative;
    overflow-x: auto;
    padding: 8px 0;
}
.gantt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.gantt-label {
    width: 140px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.gantt-track {
    flex: 1;
    height: 24px;
    background: var(--bg-base);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    min-width: 300px;
}
.gantt-bar {
    position: absolute;
    height: 100%;
    border-radius: 3px;
    min-width: 3px;
    cursor: pointer;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gantt-bar:hover {
    opacity: 0.85;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.gantt-bar.success { background: var(--success); }
.gantt-bar.error { background: #ef4444; }
.gantt-bar.running { background: var(--info); animation: gantt-pulse 1.5s ease-in-out infinite; }
@keyframes gantt-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.gantt-bar-text {
    font-size: 9px;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
    overflow: hidden;
}
.gantt-time-axis {
    display: flex;
    justify-content: space-between;
    padding: 4px 0 0 148px;
    font-size: 9px;
    color: var(--text-muted);
}
.gantt-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--text-muted);
}
.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.gantt-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* ==================== */
/* MEMORY GRAPH         */
/* ==================== */
#memory-graph-container {
    background: radial-gradient(ellipse at center, rgba(139,92,246,0.04) 0%, transparent 70%);
}
.graph-tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(24,24,32,0.97), rgba(18,18,26,0.97));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 12px;
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 1px rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    pointer-events: none;
    z-index: 10;
    max-width: 280px;
    min-width: 200px;
}
.graph-tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.graph-tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
}
.graph-tooltip-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
}
.graph-tooltip-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.graph-tooltip-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}
.graph-tooltip-stat-label {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 70px;
    flex-shrink: 0;
}
.graph-tooltip-stat-value {
    font-size: 12px;
    font-weight: 600;
    color: #f4f4f5;
    font-family: 'JetBrains Mono', monospace;
}
.graph-tooltip-bar-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.graph-tooltip-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.graph-tooltip-section {
    margin-bottom: 6px;
}
.graph-tooltip-section-label {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    display: block;
    margin-bottom: 3px;
}
.graph-tooltip-section-text {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    font-family: 'JetBrains Mono', monospace;
}
.graph-tooltip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.graph-tooltip-tag {
    font-size: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 2px 7px;
    color: rgba(255,255,255,0.7);
}
.graph-tooltip-tag em {
    font-style: normal;
    color: rgba(255,255,255,0.35);
    font-size: 9px;
    margin-left: 2px;
}
.graph-tooltip-footer {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: right;
}

/* ==================== */
/* MOBILE BOTTOM BAR    */
/* ==================== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 900;
    padding: 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 4px);
    justify-content: space-around;
}
.bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    padding: 6px 12px;
    cursor: pointer;
    transition: color 0.15s;
    min-width: 56px;
}
.bottom-tab.active {
    color: var(--accent);
}
.bottom-tab-icon {
    font-size: 20px;
}
.bottom-tab-label {
    font-weight: 500;
}

@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: flex;
    }
    /* Add padding at bottom for the bar */
    .app {
        padding-bottom: 70px;
    }
    .chat-widget {
        bottom: 80px;
    }
    /* Make footer not overlap */
    .footer {
        margin-bottom: 60px;
    }
}

/* Swipe gesture feedback */
.tab-content.swiping-left {
    transform: translateX(-20px);
    opacity: 0.7;
    transition: transform 0.15s, opacity 0.15s;
}
.tab-content.swiping-right {
    transform: translateX(20px);
    opacity: 0.7;
    transition: transform 0.15s, opacity 0.15s;
}

/* Collapsible sidebar for desktop */
.sidebar-collapsed .header-tabs {
    display: none;
}
.sidebar-toggle-btn {
    display: none;
}

@media (max-width: 1000px) {
    .cost-breakdown-grid {
        grid-template-columns: 1fr;
    }
}

[data-theme="light"] .mobile-bottom-bar {
    background: #ffffff;
    border-top-color: #e2e8f0;
}
[data-theme="light"] .bottom-tab.active {
    color: #6366f1;
}
[data-theme="light"] .gantt-track {
    background: #f1f5f9;
}
[data-theme="light"] .cost-section {
    background: #f8fafc;
}
[data-theme="light"] .graph-tooltip {
    background: linear-gradient(135deg, rgba(255,255,255,0.97), rgba(248,250,252,0.97));
    border-color: #e2e8f0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
[data-theme="light"] .graph-tooltip-stat-label { color: #94a3b8; }
[data-theme="light"] .graph-tooltip-stat-value { color: #1e293b; }
[data-theme="light"] .graph-tooltip-section-text { color: #475569; }
[data-theme="light"] .graph-tooltip-tag { background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
[data-theme="light"] .graph-tooltip-tag em { color: #94a3b8; }
[data-theme="light"] .graph-tooltip-footer { color: #94a3b8; border-color: #f1f5f9; }

/* Projects search - mobile flex */
.projects-header {
    flex-wrap: wrap;
}
#project-search-input {
    flex: 1;
    min-width: 140px;
}
@media (max-width: 768px) {
    .projects-header {
        flex-direction: column;
        gap: 8px;
    }
    .projects-header > * {
        width: 100%;
    }
    .projects-header .action-btn {
        width: auto;
    }
}

/* ==================== */
/* SPRINT 2 TAB */
/* ==================== */

.insights-container {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.insights-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.insights-section-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.insights-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .insights-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Treemap */
.treemap-cell {
    position: absolute;
    border: 1px solid var(--bg-void);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    cursor: default;
    transition: opacity 0.15s;
}

.treemap-cell:hover {
    opacity: 0.85;
}

.treemap-cell .treemap-symbol {
    font-size: 13px;
    font-weight: 700;
}

.treemap-cell .treemap-value {
    font-size: 10px;
    opacity: 0.8;
}

/* Cron Execution Timeline */
.cron-exec-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cron-exec-label {
    width: 140px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.cron-exec-track {
    flex: 1;
    height: 20px;
    background: var(--bg-base);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.cron-exec-bar {
    position: absolute;
    height: 100%;
    border-radius: 4px;
    min-width: 4px;
    cursor: default;
}

.cron-exec-bar.ok { background: var(--success); opacity: 0.8; }
.cron-exec-bar.error { background: #ef4444; opacity: 0.8; }

.cron-exec-time-axis {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 148px 0 148px;
}

/* Error Log Items */
.error-log-item {
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    border-left: 3px solid #ef4444;
}

.error-log-source {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--warning);
    margin-bottom: 2px;
}

.error-log-message {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-word;
    line-height: 1.4;
}

.error-log-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Deployment Items */
.deploy-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.deploy-icon {
    font-size: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    border-radius: 6px;
    flex-shrink: 0;
}

.deploy-info {
    flex: 1;
    min-width: 0;
}

.deploy-message {
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deploy-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.deploy-type-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.deploy-type-badge.git-commit { background: var(--success-dim); color: var(--success); }
.deploy-type-badge.docker { background: var(--info-dim); color: var(--info); }
.deploy-type-badge.config { background: var(--warning-dim); color: var(--warning); }

/* Agent Flow Diagram */
.agent-flow-tree {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-flow-parent {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 10px;
    border-left: 3px solid var(--info);
}

.agent-flow-parent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.agent-flow-children {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 16px;
    border-left: 2px solid var(--border);
    padding-left: 12px;
}

.agent-flow-child {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-flow-child::before {
    content: '🚀';
    font-size: 10px;
}

.agent-flow-child-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Session Replay Controls */
.replay-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.replay-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.replay-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.replay-btn.active {
    background: var(--accent);
    color: white;
}

.replay-progress {
    flex: 1;
    height: 6px;
    background: var(--bg-base);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.replay-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.replay-counter {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    min-width: 60px;
    text-align: center;
}

.replay-speed {
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-base);
}

/* ==================== Sprint #3 Styles ==================== */

/* GitHub Actions */
.gha-repo-card { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; background: var(--bg-card); }
.gha-repo-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.gha-repo-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.gha-link { color: var(--info); font-size: 12px; text-decoration: none; }
.gha-link:hover { text-decoration: underline; }
.gha-table-wrap { overflow-x: auto; }
.gha-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gha-table th, .gha-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.gha-table th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.gha-table tbody tr:hover { background: var(--bg-elevated); }
.gha-table code { font-family: 'JetBrains Mono', monospace; background: var(--bg-code); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.gha-workflow { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.gha-badge { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 7px; border-radius: 999px; }
.gha-badge.success { color: #22c55e; background: rgba(34,197,94,0.15); }
.gha-badge.failure { color: #ef4444; background: rgba(239,68,68,0.14); }
.gha-badge.running { color: #f59e0b; background: rgba(245,158,11,0.16); }
.gha-error { padding: 12px; color: #f59e0b; font-size: 12px; }
.gha-empty { color: var(--text-muted); font-style: italic; }

/* Git Commit Browser */
.git-commit-item { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.git-commit-item:last-child { border-bottom: none; }
.git-commit-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.git-commit-hash { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--info); background: var(--bg-code); padding: 2px 6px; border-radius: 4px; }
.git-commit-repo { font-size: 11px; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; }
.git-commit-date { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.git-commit-message { font-size: 13px; color: var(--text-primary); margin-bottom: 4px; }
.git-commit-stats { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.git-commit-author { color: var(--text-muted); }
.git-stat-add { color: #22c55e; font-family: 'JetBrains Mono', monospace; }
.git-stat-del { color: #ef4444; font-family: 'JetBrains Mono', monospace; }
.git-stat-files { color: var(--text-muted); }

/* Bulk Actions */
.tasks-list-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.tasks-list-stat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; line-height: 1; }
.tasks-list-stat-chip strong { color: var(--text-primary); }
.bulk-actions-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bulk-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.bulk-checkbox { cursor: pointer; font-size: 16px; margin-right: 4px; opacity: 0.6; display: inline-block; width: 20px; text-align: center; }
.bulk-checkbox.checked { opacity: 1; color: var(--info); }
#bulk-mode-btn.active { background: var(--info); color: white; }

/* Keyboard Shortcuts */
.shortcut-list { display: grid; gap: 8px; }
.shortcut-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.shortcut-key { background: var(--bg-code); border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-primary); min-width: 80px; text-align: center; }
.shortcut-desc { font-size: 13px; color: var(--text-secondary); }

/* Cost Forecast */
.forecast-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.forecast-card { background: var(--bg-code); border-radius: 8px; padding: 12px; text-align: center; }
.forecast-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.forecast-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }
@media (max-width: 768px) { .forecast-grid { grid-template-columns: repeat(2, 1fr); } }

/* Week Comparison */
.comparison-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.comparison-card { background: var(--bg-code); border-radius: 8px; padding: 12px; text-align: center; }
.comparison-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.comparison-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.comparison-delta { font-size: 11px; margin-top: 4px; }
.comparison-delta.up { color: #22c55e; }
.comparison-delta.down { color: #ef4444; }
@media (max-width: 768px) { .comparison-grid { grid-template-columns: repeat(2, 1fr); } }

/* Model Switcher */
.model-switch-btn { transition: background 0.2s; }
.model-switch-btn:hover { background: var(--bg-elevated) !important; }
.model-btn, .schedule-btn, .screenshot-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.model-btn:hover, .schedule-btn:hover, .screenshot-btn:hover {
    border-color: var(--info);
    background: var(--bg-card);
}

/* Export Schedule */
.export-schedule-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--bg-code); border-radius: 6px; margin-bottom: 6px; font-size: 13px; }

/* Load More Button - Done column pagination */
.load-more-btn {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: rgba(79, 142, 247, 0.1);
    border: 1px dashed rgba(79, 142, 247, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.load-more-btn:hover {
    background: rgba(79, 142, 247, 0.2);
    border-color: rgba(255, 107, 107, 0.5);
}

/* Trend indicators */
.trend-indicator {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Expandable card text */
.expandable { cursor: pointer; }
.expandable .text-full { display: none; }
.expandable.expanded .text-full { display: inline; }
.expandable.expanded .text-short { display: none; }
.expandable:hover { opacity: 0.85; }

/* ==================== CRON HEALTH WIDGET ==================== */
.cron-health-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.cron-health-item:last-child { border-bottom: none; }
.cron-health-item.danger { background: rgba(239, 68, 68, 0.05); }
.cron-health-item.warning { background: rgba(251, 191, 36, 0.05); }
.cron-health-icon { font-size: 14px; flex-shrink: 0; }
.cron-health-name { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text); }
.cron-health-age { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

/* ==================== USAGE ANALYTICS WIDGET ==================== */
.usage-stats-row { display: flex; gap: 16px; margin-bottom: 16px; }
.usage-stat { flex: 1; text-align: center; padding: 12px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.usage-stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--text); }
.usage-stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.usage-endpoints-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.usage-endpoint-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.usage-endpoint-path { flex: 0 0 160px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-endpoint-bar-bg { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.usage-endpoint-bar { height: 100%; background: var(--info); border-radius: 3px; transition: width 0.3s; }
.usage-endpoint-count { flex: 0 0 40px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); }

/* ==================== CHANGELOG WIDGET ==================== */
.changelog-repo-group { margin-bottom: 16px; }
.changelog-repo-group:last-child { margin-bottom: 0; }
.changelog-repo-header { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.changelog-repo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.changelog-entry { display: flex; align-items: center; gap: 10px; padding: 5px 0 5px 16px; font-size: 12px; border-left: 2px solid var(--border); }
.changelog-hash { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--info); background: var(--info-dim); padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.changelog-msg { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changelog-date { flex-shrink: 0; color: var(--text-muted); font-size: 11px; }

/* ==================== METRICS WIDGET ==================== */
.metric-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.metric-row:last-child { border-bottom: none; }
.metric-name { color: var(--text-secondary); text-transform: capitalize; }
.metric-labels { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted); }
.metric-value { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text); }

/* ==================== OPTIONS GREEKS WIDGET ==================== */
.options-table-wrap { overflow-x: auto; }
.options-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.options-table th { text-align: left; padding: 6px 8px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.options-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.options-table tr:last-child td { border-bottom: none; }
.option-type-badge { padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.option-type-badge.call { background: var(--success-dim); color: var(--success); }
.option-type-badge.put { background: var(--accent-dim); color: var(--accent); }
td.positive { color: var(--success); }
td.negative { color: var(--accent); }

/* ==================== SPRINT 2 WIDGETS ==================== */
.widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; padding: 8px; }
.widget-card { background: var(--bg-elevated); border-radius: 8px; padding: 10px; }
.widget-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.widget-value { font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.widget-detail { font-size: 11px; color: var(--text-secondary); }
.widget-detail.small { font-size: 10px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-simple { padding: 8px; }
.chart-bar { display: flex; align-items: center; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.bar-label { width: 80px; flex-shrink: 0; color: var(--text-muted); font-size: 10px; }
.sector-bars { padding: 8px; font-size: 12px; }
.code-block { font-family: 'JetBrains Mono', monospace; font-size: 10px; background: var(--bg); padding: 8px; border-radius: 6px; overflow: auto; max-height: 200px; white-space: pre-wrap; }
#auto-refresh-toggle.active { background: var(--success-dim); color: var(--success); }

/* ==================== SKELETON LOADING ==================== */
@keyframes skeleton-shimmer {
    0% { background-position: -600px 0; }
    100% { background-position: calc(600px + 100%) 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 30%, color-mix(in srgb, var(--bg-elevated) 70%, var(--bg-hover)) 50%, var(--bg-elevated) 70%);
    background-size: 600px 100%;
    animation: skeleton-shimmer 3s ease-in-out infinite;
    border-radius: var(--radius-xs);
}
.skeleton-container {
    transition: opacity 0.3s ease-out;
}
.skeleton-container.fade-out {
    opacity: 0;
}
.skeleton-line { height: 12px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 90%; }
.skeleton-stat { height: 36px; width: 60px; border-radius: 6px; margin-bottom: 4px; }
.skeleton-card { height: 80px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.loading-state-shell { min-width: 0; }
.loading-state-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.loading-state-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.loading-inline-host { display: inline-flex; align-items: center; min-width: 0; }
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}
.loading-inline-bar {
    width: 44px;
    height: 10px;
    flex: 0 0 auto;
}
.loading-inline-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== DATA FRESHNESS INDICATORS ==================== */
.freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    background: var(--bg-elevated);
}
.freshness-badge.fresh { color: var(--success); background: var(--success-dim); }
.freshness-badge.aging { color: var(--warning); background: var(--warning-dim); }
.freshness-badge.stale { color: var(--accent); background: var(--accent-dim); }
.freshness-dot { width: 6px; height: 6px; border-radius: 50%; }
.freshness-dot.fresh { background: var(--success); }
.freshness-dot.aging { background: var(--warning); }
.freshness-dot.stale { background: var(--accent); }

/* ==================== TASK VELOCITY CHART ==================== */
.velocity-stats { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.velocity-stat { text-align: center; }
.velocity-stat .v-value { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.velocity-stat .v-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ==================== */
/* CANVAS GALLERY TAB   */
/* ==================== */

.canvas-gallery-container {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.canvas-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.canvas-search {
    flex: 1;
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    transition: border-color 0.2s;
}

.canvas-search:focus {
    outline: none; /* keyboard: see :focus-visible below */
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.canvas-filter-select {
    min-width: 160px;
}

.canvas-view-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 16px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-view-btn:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.canvas-view-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.canvas-pin-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.canvas-pin-toggle input {
    accent-color: var(--accent);
}

/* Canvas Grid View */
.canvas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.canvas-grid.list-view {
    grid-template-columns: 1fr;
}

/* Canvas Card */
.canvas-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.canvas-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 142, 247, 0.1);
}

.canvas-card.pinned {
    border-color: rgba(251, 191, 36, 0.3);
}

.canvas-card.pinned::before {
    content: '📌';
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    font-size: 16px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Canvas Thumbnail / Preview */
.canvas-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--bg-base) 0%, var(--bg-elevated) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.canvas-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.canvas-card:hover .canvas-thumbnail img {
    transform: scale(1.05);
}

.canvas-thumbnail-placeholder {
    font-size: 48px;
    opacity: 0.3;
}

.canvas-thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    gap: 6px;
    align-items: center;
}

.canvas-version-badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

/* Canvas Card Body */
.canvas-card-body {
    padding: 14px;
}

.canvas-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.canvas-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.canvas-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.canvas-category-badge.architecture { background: var(--purple-dim); color: var(--purple); }
.canvas-category-badge.chart { background: var(--info-dim); color: var(--info); }
.canvas-category-badge.diagram { background: var(--warning-dim); color: var(--warning); }
.canvas-category-badge.report { background: var(--success-dim); color: var(--success); }
.canvas-category-badge.trading { background: var(--accent-dim); color: var(--accent); }
.canvas-category-badge.fun { background: var(--pink-dim); color: var(--pink); }
.canvas-category-badge.vesta { background: rgba(201,165,92,0.18); color: #C9A55C; }
.canvas-category-badge.other { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.canvas-card-date {
    font-size: 10px;
    color: var(--text-muted);
}

.canvas-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.canvas-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
}

/* Canvas Card Actions */
.canvas-card-actions {
    display: flex;
    gap: 4px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    opacity: 0;
    transition: opacity 0.2s;
}

.canvas-card:hover .canvas-card-actions {
    opacity: 1;
}

.canvas-action-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
    text-align: center;
}

.canvas-action-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* Canvas List View */
.canvas-grid.list-view .canvas-card {
    display: flex;
    flex-direction: row;
}

.canvas-grid.list-view .canvas-thumbnail {
    width: 200px;
    height: auto;
    min-height: 100px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
}

.canvas-grid.list-view .canvas-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.canvas-grid.list-view .canvas-card-actions {
    flex-direction: column;
    border-top: none;
    border-left: 1px solid var(--border);
    padding: 8px;
    width: 120px;
    opacity: 1;
}

/* Canvas Preview Modal */
.canvas-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.canvas-preview-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 95vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.canvas-preview-title {
    font-size: 16px;
    font-weight: 600;
}

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

.canvas-preview-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.canvas-preview-close:hover {
    color: var(--text);
}

.canvas-preview-iframe {
    flex: 1;
    border: none;
    background: white;
}

/* Canvas Version History in Modal */
.canvas-version-list {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
    display: none;
}

.canvas-version-list.visible {
    display: block;
}

.canvas-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-xs);
    margin-bottom: 4px;
    font-size: 12px;
}

.canvas-version-item.current {
    border-left: 3px solid var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .canvas-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .canvas-grid {
        grid-template-columns: 1fr;
    }
    .canvas-grid.list-view .canvas-card {
        flex-direction: column;
    }
    .canvas-grid.list-view .canvas-thumbnail {
        width: 100%;
        height: 120px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .canvas-grid.list-view .canvas-card-actions {
        flex-direction: row;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* Canvas Version History - Enhanced */
.canvas-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.canvas-version-item.current {
    border-left-color: var(--success);
    background: var(--success-dim);
}

.canvas-version-item.previewing {
    border-left-color: var(--info);
    background: var(--info-dim);
}

.canvas-version-item:hover {
    background: var(--bg-hover);
}

.cv-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cv-version-num {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    min-width: 30px;
}

.cv-current-badge {
    background: var(--success);
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cv-version-date {
    color: var(--text-muted);
    font-size: 11px;
}

.cv-version-hash {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.cv-version-size {
    color: var(--text-secondary);
    font-size: 11px;
    min-width: 40px;
    text-align: right;
}

.cv-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

.cv-action-btn {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.cv-action-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.cv-action-btn.preview:hover {
    background: var(--info-dim);
    border-color: var(--info);
    color: var(--info);
}

.cv-action-btn.restore:hover {
    background: var(--success-dim);
    border-color: var(--success);
    color: var(--success);
}

/* Delete button styling */
.canvas-delete-btn {
    color: var(--text-muted) !important;
}

.canvas-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

/* Canvas Live Preview in Cards */
.canvas-live-preview {
    position: relative;
    overflow: hidden;
}

.canvas-preview-thumb {
    width: 400%;
    height: 400%;
    border: none;
    pointer-events: none;
    transform: scale(0.25);
    transform-origin: top left;
    position: absolute;
    top: 0;
    left: 0;
}

.canvas-preview-hover-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.canvas-card:hover .canvas-preview-hover-hint {
    opacity: 1;
}

/* ==================== SPRINT 3 BATCH 3 FEATURES ==================== */

/* Task 1: Task time estimates */
.task-estimated-hours {
    font-size: 10px;
    color: var(--info, #3b82f6);
    background: rgba(59, 130, 246, 0.12);
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 500;
    white-space: nowrap;
}

/* Task 5: Memory File Tree */
.memory-tree {
    font-size: 12px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    line-height: 1.4;
}
.tree-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.tree-file:hover { background: var(--bg-elevated, #27272a); }
.tree-file-icon { flex-shrink: 0; }
.tree-file-name { flex: 1; color: var(--text-primary, #f4f4f5); }
.tree-file-size {
    font-size: 10px;
    color: var(--text-muted, #71717a);
    flex-shrink: 0;
}
.tree-dir {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary, #a1a1aa);
    transition: background 0.15s;
    user-select: none;
}
.tree-dir:hover { background: var(--bg-elevated, #27272a); }
.tree-dir-arrow { font-size: 9px; color: var(--text-muted, #71717a); min-width: 10px; }
.tree-dir-name { flex: 1; }
.tree-dir-count {
    font-size: 10px;
    color: var(--text-muted, #71717a);
    font-weight: 400;
}
.tree-children { border-left: 1px solid var(--border, rgba(255,255,255,0.08)); margin-left: 16px; }

/* Memory Live Feed */
.mt-feed-panel { margin-bottom: 16px; }
.mf-entry { padding: 12px 16px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.06)); }
.mf-entry:last-child { border-bottom: none; }
.mf-entry:hover { background: rgba(255,255,255,0.02); }
.mf-entry-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.mf-time { color: var(--text-muted, #71717a); font-size: 11px; min-width: 55px; font-variant-numeric: tabular-nums; }
.mf-commit-msg { color: var(--text-secondary, #a1a1aa); font-size: 12px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-stats { color: var(--text-muted, #71717a); font-size: 10px; background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.mf-file-block { margin: 4px 0 8px 0; }
.mf-file-name { font-size: 11px; color: var(--accent, #60a5fa); font-weight: 500; margin-bottom: 4px; }
.mf-lines { padding-left: 8px; border-left: 2px solid rgba(96,165,250,0.15); }
.mf-line { font-size: 12px; color: var(--text-primary, #e4e4e7); padding: 1px 0; line-height: 1.5; }
.mf-line.mf-header { color: var(--accent, #60a5fa); font-weight: 600; font-size: 13px; margin-top: 4px; }
.mf-line.mf-subheader { color: var(--text-secondary, #a1a1aa); font-weight: 500; }
.mf-line.mf-key { color: var(--text-primary, #e4e4e7); }
.mf-line.mf-key strong, .mf-line.mf-key b { color: var(--accent, #60a5fa); }
.mf-line.mf-item { color: var(--text-secondary, #a1a1aa); padding-left: 4px; }
.mf-line.mf-more { color: var(--text-muted, #71717a); font-style: italic; font-size: 11px; margin-top: 4px; }

/* Light theme overrides */
[data-theme="light"] .mf-entry:hover { background: rgba(0,0,0,0.02); }
[data-theme="light"] .mf-lines { border-left-color: rgba(59,130,246,0.2); }
[data-theme="light"] .mf-stats { background: rgba(0,0,0,0.04); }

/* Task 5: Memory tree panel */
.mt-tree-panel { margin-top: 16px; }

/* Task 6: Export buttons (already using action-btn small, just ensure it fits) */
.export-page-btn {
    font-size: 11px;
    padding: 4px 10px;
}

/* Task 7: Favicon badge — no CSS needed (canvas-based) */

/* Task 8: Keyboard navigation focus for task cards */
.task-card:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Task 10: Velocity chart in projects tab */
#projects-velocity-panel .velocity-stats {
    display: flex;
    gap: 16px;
    padding: 8px 0 4px;
    flex-wrap: wrap;
}
#projects-velocity-panel .velocity-stat {
    text-align: center;
    min-width: 60px;
}
#projects-velocity-panel .v-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary, #f4f4f5);
}
#projects-velocity-panel .v-label {
    font-size: 10px;
    color: var(--text-muted, #71717a);
    margin-top: 2px;
}

/* Light theme overrides for new elements */
[data-theme="light"] .tree-file:hover,
[data-theme="light"] .tree-dir:hover {
    background: rgba(0,0,0,0.06);
}
[data-theme="light"] .tree-children {
    border-left-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .task-estimated-hours {
    background: rgba(59, 130, 246, 0.1);
}

/* ==================== SYSTEM PROMPTS TAB ==================== */
/* ── System Prompts Tab ── */
.prompts-container { display: flex; height: calc(100vh - 120px); gap: 16px; padding: 0; }
.prompts-sidebar { width: 260px; flex-shrink: 0; overflow-y: auto; background: var(--bg-surface, var(--card-bg)); border-radius: 12px; padding: 8px; border: 1px solid var(--border); }
.prompts-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* File list items */
.prompts-file-item { padding: 12px 14px; cursor: pointer; border-radius: 8px; margin-bottom: 4px; transition: all 0.15s; display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; }
.prompts-file-item:hover { background: var(--bg-hover, var(--hover-bg)); }
.prompts-file-item.active { background: var(--accent-muted, rgba(99,102,241,0.1)); border-color: var(--accent); }
.prompts-file-item .file-header { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text); }
.prompts-file-item .file-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; }
.prompts-file-item .file-desc { font-size: 12px; color: var(--text-secondary, var(--text-muted)); }

/* Badges — muted, not alarming */
.prompts-file-item .readonly-badge { font-size: 9px; font-weight: 600; letter-spacing: 0.5px; background: var(--border); color: var(--text-muted); padding: 2px 6px; border-radius: 3px; }
.prompts-file-item .editable-badge { font-size: 9px; font-weight: 600; letter-spacing: 0.5px; background: var(--accent-muted, rgba(99,102,241,0.12)); color: var(--accent); padding: 2px 6px; border-radius: 3px; }

/* Toolbar */
.prompts-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-surface, var(--card-bg)); border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px; }
.prompts-toolbar .toolbar-title { font-weight: 600; font-size: 15px; flex: 1; display: flex; align-items: center; gap: 8px; color: var(--text); }
.prompts-toolbar .toolbar-btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-surface, var(--card-bg)); color: var(--text-secondary, var(--text)); cursor: pointer; font-size: 12px; font-weight: 500; transition: all 0.15s; }
.prompts-toolbar .toolbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted, rgba(99,102,241,0.08)); }
.prompts-toolbar .toolbar-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.prompts-toolbar .toolbar-btn.save-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.prompts-toolbar .toolbar-btn.save-btn:hover { opacity: 0.85; }

/* Content area */
.prompts-content { flex: 1; overflow-y: auto; background: var(--bg-surface, var(--card-bg)); border-radius: 12px; border: 1px solid var(--border); }

/* Markdown preview */
.prompts-preview { padding: 28px 32px; line-height: 1.75; font-size: 14px; color: var(--text); }
.prompts-preview h1 { font-size: 22px; margin: 28px 0 12px 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.prompts-preview h2 { font-size: 18px; margin: 24px 0 10px 0; color: var(--text); }
.prompts-preview h3 { font-size: 15px; margin: 18px 0 8px 0; color: var(--text); }
.prompts-preview h1:first-child, .prompts-preview h2:first-child, .prompts-preview h3:first-child { margin-top: 0; }
.prompts-preview code { background: var(--bg-code, rgba(255,255,255,0.06)); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.prompts-preview pre { background: var(--bg-code, rgba(0,0,0,0.2)); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); }
.prompts-preview pre code { background: none; padding: 0; color: var(--text); }
.prompts-preview ul, .prompts-preview ol { padding-left: 24px; margin: 8px 0; }
.prompts-preview li { margin: 4px 0; }
.prompts-preview a { color: var(--accent); text-decoration: none; }
.prompts-preview a:hover { text-decoration: underline; }
.prompts-preview hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.prompts-preview blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 12px 0; color: var(--text-muted); font-style: italic; }
.prompts-preview strong { font-weight: 700; }
.prompts-preview em { font-style: italic; color: var(--text-secondary, var(--text-muted)); }

/* Editor */
.prompts-editor { width: 100%; height: 100%; border: none; background: transparent; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.6; padding: 24px; resize: none; outline: none; /* keyboard: see :focus-visible below */ box-sizing: border-box; }

/* History panel */
.prompts-history { position: absolute; top: 0; right: 0; bottom: 0; width: 380px; background: var(--bg-surface, var(--card-bg)); border-radius: 12px; border: 1px solid var(--border); overflow-y: auto; z-index: 10; box-shadow: -4px 0 24px rgba(0,0,0,0.15); }
.prompts-history .history-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.prompts-history .history-close { cursor: pointer; font-size: 18px; opacity: 0.5; transition: opacity 0.15s; }
.prompts-history .history-close:hover { opacity: 1; }

/* Version banner */
.version-banner { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--accent-muted, rgba(99,102,241,0.1)); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--accent); }
.version-banner button { padding: 4px 12px; border-radius: 4px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; }
.version-banner button:hover { background: var(--accent); color: #fff; }

/* Light mode overrides */
[data-theme="light"] .prompts-sidebar { background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
[data-theme="light"] .prompts-file-item.active { background: rgba(99,102,241,0.08); }
[data-theme="light"] .prompts-toolbar { background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
[data-theme="light"] .prompts-content { background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
[data-theme="light"] .prompts-preview code { background: #f1f5f9; color: #6366f1; }
[data-theme="light"] .prompts-preview pre { background: #f8fafc; border-color: #e2e8f0; }
[data-theme="light"] .prompts-preview pre code { color: #334155; }
[data-theme="light"] .prompts-history { box-shadow: -4px 0 24px rgba(0,0,0,0.08); background: #ffffff; }
[data-theme="light"] .prompts-editor { color: #0f172a; }
[data-theme="light"] .prompts-file-item .readonly-badge { background: #f1f5f9; color: #94a3b8; }
[data-theme="light"] .prompts-file-item .editable-badge { background: rgba(99,102,241,0.08); color: #6366f1; }
.history-commit { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.history-commit:hover { background: var(--hover-bg); }
.history-commit .commit-msg { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.history-commit .commit-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; }
.history-commit .commit-stats { font-size: 11px; margin-top: 4px; }
.history-commit .stat-add { color: #4ade80; }
.history-commit .stat-remove { color: #f87171; }
.history-commit-actions { display: flex; gap: 6px; margin-top: 6px; }
.history-commit-actions button { font-size: 11px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; }
.history-commit-actions button:hover { border-color: var(--accent); color: var(--text); }
.diff-view { padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.diff-add { background: rgba(74,222,128,0.1); color: #4ade80; display: block; padding: 1px 8px; }
.diff-remove { background: rgba(248,113,113,0.1); color: #f87171; display: block; padding: 1px 8px; }
.diff-header { color: var(--text-muted); display: block; padding: 1px 8px; }
.version-banner { padding: 10px 16px; background: rgba(59,130,246,0.15); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.version-banner button { padding: 4px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-size: 12px; }

@media (max-width: 768px) {
    .prompts-container { flex-direction: column; height: auto; }
    .prompts-sidebar { width: 100%; max-height: 200px; }
    .prompts-history { width: 100%; position: relative; }
}

/* ============================================================
   Sprint 2 Batch 1 additions
   ============================================================ */

/* Task 6a8d60c9: Cron success/failure rate badges */
.cron-success-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
}
.cron-success-badge.good { background: rgba(34,197,94,0.15); color: #4ade80; }
.cron-success-badge.warn { background: rgba(245,158,11,0.15); color: #fbbf24; }
.cron-success-badge.bad  { background: rgba(239,68,68,0.15); color: #f87171; }

/* Task 479f035b: Agent status badge variants */
.status-badge.running { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-badge.failed  { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* Task 24c5b270: Session sparkline mini */
.session-sparkline-mini {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.75;
    margin: 0 4px;
}
.session-sparkline-mini svg { display: block; }
.history-item:hover .session-sparkline-mini { opacity: 1; }

/* Task 56a1e573: Improved calendar widget */
.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 4px 8px;
}
.cal-month-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}
.cal-today-label {
    font-size: 10px;
    color: var(--text-muted);
}
.cal-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 2px;
}
.cal-dow {
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 2px 0;
}
/* Overview mini-calendar widget — scoped to avoid conflicting with cron calendar */
#calendar-events .cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 10px;
}
#calendar-events .cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 4px;
    cursor: default;
    position: relative;
    color: var(--text-secondary);
    user-select: none;
}
#calendar-events .cal-cell.empty { opacity: 0; pointer-events: none; }
#calendar-events .cal-cell.cal-today {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}
.cal-cell.cal-has-events { cursor: pointer; }
.cal-cell.cal-has-events:not(.cal-today):hover { background: var(--hover-bg); }
.cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
}
.cal-today .cal-dot { background: rgba(255,255,255,0.8); }
.cal-events-section { margin-top: 4px; }
.cal-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0 6px;
    border-top: 1px solid var(--border);
}
.cal-event-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
}
.cal-event-item:hover { background: var(--hover-bg); }
.cal-event-item.cal-event-today { background: rgba(99,102,241,0.06); }
.cal-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    margin-top: 4px;
}
.cal-event-dot.today { background: var(--accent); }
.cal-event-body { flex: 1; min-width: 0; }
.cal-event-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
}
.cal-event-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-event-time-label {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.cal-event-day-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}
.cal-event-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
    max-height: 80px;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.cal-event-desc.collapsed { max-height: 0; }

/* Task 38d832b4: Chart empty overlay (doesn't destroy canvas) */
.chart-empty-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-panel);
    z-index: 1;
    border-radius: 8px;
}

/* =============================================================================
   Nightly 2026-02-18: Service Health Grid, Log Filter Bar, Backup Status
   ============================================================================= */

/* Log Filter Bar */
.log-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.log-filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.log-filter-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.log-filter-btn:hover { background: var(--bg-hover); }
.log-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.log-filter-btn.error.active { background: var(--error); border-color: var(--error); }
.log-filter-btn.warning.active { background: #f59e0b; border-color: #f59e0b; }
.log-count {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
    display: inline-block;
}

/* Service Health Grid */
/* Compact panel override */
.panel.panel-compact { min-height: auto; }

/* Service Health — compact chip row */
.sh-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-chip { display: flex; align-items: center; gap: 5px; padding: 5px 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; font-size: 11px; transition: all 0.15s; }
.sh-chip:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.1); }
.sh-chip.down, .sh-chip.error { border-color: rgba(239,68,68,0.3); }
.sh-dot { font-size: 8px; line-height: 1; }
.sh-name { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.sh-detail { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
/* Legacy compat */
.service-health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.service-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.service-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.service-card.up::before { background: var(--success); }
.service-card.down::before { background: var(--error); }
.service-card-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.service-card-type { font-size: 10px; color: var(--text-muted); }
.service-card-status { font-size: 11px; font-weight: 500; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.service-card.up .service-card-status { color: var(--success); }
.service-card.down .service-card-status { color: var(--error); }
.service-card-detail { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-health-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    font-size: 12px;
}
.service-health-pct {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
}
.service-health-pct.degraded { color: #f59e0b; }
.service-health-pct.critical { color: var(--error); }

/* Backup Status Widget */
.backup-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    padding: 8px;
}
.backup-repo-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
}
.backup-repo-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.backup-repo-meta {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.backup-dirty-badge {
    background: #f59e0b20;
    color: #f59e0b;
    border: 1px solid #f59e0b40;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 600;
}
.backup-clean-badge {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 600;
}
.backup-commit {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====== Anomaly Highlighting (Nightly 2026-02-19) ====== */
.duration-warning {
    color: #fbbf24 !important;
    font-weight: 600;
}
.duration-warning::before {
    content: '⚠️ ';
    font-size: 10px;
}
.duration-critical {
    color: #ef4444 !important;
    font-weight: 700;
}
.duration-critical::before {
    content: '🔴 ';
    font-size: 10px;
}

/* ====== Session list tooltip for truncated names ====== */
.session-item .session-name {
    cursor: default;
}
.session-item .session-name[title]:hover {
    text-decoration: underline dotted;
    text-decoration-color: var(--text-muted);
}

/* ====== Wider search input ====== */
.session-search-input {
    min-width: 120px !important;
}

/* ==================== SPRINT 3 FEATURES ==================== */

/* Task 5fe199c3: Sessions keyboard navigation */
.history-item.keyboard-highlight {
    background: var(--primary-transparent) !important;
    border-left: 3px solid var(--primary);
    box-shadow: 0 0 0 2px var(--primary-transparent);
}

/* Task 1a1e0b4a: Token usage comparison widget */
.token-comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.token-comp-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.token-comp-card.today {
    border: 2px solid #8b5cf6;
}

.token-comp-card.avg {
    border: 2px solid #3b82f6;
}

.token-comp-card.change {
    border: 2px solid var(--border);
}

.token-comp-card.change.increase {
    border-color: #ef4444;
}

.token-comp-card.change.decrease {
    border-color: #22c55e;
}

.token-comp-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.token-comp-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.token-comp-bar {
    display: flex;
    gap: 8px;
    height: 8px;
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-elevated);
}

.token-comp-bar-today {
    background: #8b5cf6;
    transition: width 0.3s ease;
}

.token-comp-bar-avg {
    background: #3b82f6;
    transition: width 0.3s ease;
}

.token-comp-note {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Task 8577e095: Memory topic filtering */
.memory-filter-banner {
    background: var(--primary-transparent);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.memory-filter-banner strong {
    color: var(--primary);
    font-weight: 600;
}

.memory-topic-tag {
    display: inline-block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    margin: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memory-topic-tag:hover {
    background: var(--primary-transparent);
    border-color: var(--primary);
    color: var(--primary);
}

.memory-topic-tag.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

/* Task a937f74e: Skill registry search */
#skill-search-input {
    max-width: 200px;
}

.skill-item {
    transition: background 0.2s ease;
}

.skill-item:hover {
    background: var(--bg-elevated);
}

/* ==================== END SPRINT 3 ==================== */

/* ==================== VOICE CHAT ==================== */
.chat-mic-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-mic-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.chat-mic-btn.recording {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(231,76,60,0); }
}
.chat-message .speaker-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
    padding: 2px 4px;
    margin-left: 4px;
    transition: opacity 0.2s;
}
.chat-message .speaker-btn:hover { opacity: 1; }
.chat-message .speaker-btn.playing { opacity: 1; animation: mic-pulse 1s infinite; }

/* ==================== COMPREHENSIVE MOBILE FIXES ==================== */
@media (max-width: 768px) {
    /* Memory Timeline */
    .memory-timeline-container { padding: 10px; gap: 12px; }
    .mt-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .mt-filter-bar { flex-wrap: wrap; gap: 6px; }
    .mt-filter-bar select, .mt-filter-bar input { font-size: 12px; min-width: 0; }
    .memory-entry { padding: 10px; }
    .memory-entry-header { flex-wrap: wrap; gap: 4px; }
    #memory-graph-container { height: 200px !important; min-height: 200px; }

    /* Intelligence */
    .intelligence-container { padding: 10px; gap: 10px; }
    .intel-pattern-cards { grid-template-columns: 1fr; gap: 10px; }
    .intel-search-bar { flex-wrap: wrap; gap: 6px; }
    .intel-search-bar input { min-width: 0; flex: 1; }
    .intel-card { max-height: 300px; }
    .intel-signals-panel { max-height: 400px; }

    /* System */
    .system-grid { grid-template-columns: 1fr; gap: 10px; }

    /* Architecture — make scrollable */
    #tab-architecture { overflow: auto; -webkit-overflow-scrolling: touch; }
    #architecture-container { min-width: 800px; }

    /* Insights */
    .insights-container { padding: 10px; }
    .insights-grid { grid-template-columns: 1fr; }
    .insights-grid-2 { grid-template-columns: 1fr; }
    .insight-item { padding: 10px 12px; font-size: 12px; }

    /* Prompts */
    .prompts-container { flex-direction: column; height: auto; padding: 10px; gap: 10px; }
    .prompts-sidebar { width: 100%; max-height: 180px; overflow-y: auto; }
    .prompts-editor { min-height: 300px; }
    .prompts-toolbar { flex-wrap: wrap; gap: 6px; }
    .prompts-toolbar button { font-size: 11px; padding: 4px 8px; }
    .prompts-history { width: 100%; position: relative; max-height: 300px; }

    /* Canvas */
    .canvas-gallery-container { padding: 10px; }
    .canvas-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

    /* Overview — ensure panels don't overflow */
    .main-grid { gap: 10px; }
    .panel { overflow: hidden; }
    .panel-content { overflow-x: auto; }

    /* Agents */
    .agents-tab-container { padding: 10px; }
    .agent-card { padding: 12px; }
    .agent-card-header { flex-wrap: wrap; }
    .agent-card-stats { flex-wrap: wrap; gap: 8px; }
    .agent-detail-grid { grid-template-columns: 1fr; }

    /* Projects / Kanban */
    .projects-tab-container { padding: 10px; }
    .kanban-board { gap: 10px; }

    /* Analytics */
    .analytics-grid { grid-template-columns: 1fr; }
    .analytics-range-selector { flex-wrap: wrap; justify-content: center; }

    /* Security iframe */
    #tab-security iframe { min-height: 800px; }

    /* Global overflow safety */
    .tab-content { overflow-x: hidden; }
    pre, code { overflow-x: auto; word-break: break-all; }
    table { display: block; overflow-x: auto; }
}

@media (max-width: 425px) {
    /* Memory Timeline — single col stats */
    .mt-stats { grid-template-columns: 1fr 1fr; }

    /* Intelligence — even tighter */
    .intelligence-container { padding: 6px; }
    .intel-card { max-height: 250px; }

    /* Canvas — single column */
    .canvas-gallery { grid-template-columns: 1fr; }

    /* Prompts — stack fully */
    .prompts-container { padding: 6px; }
    .prompts-sidebar { max-height: 150px; }
}

/* ============================================
   Activity Timeline — Shadcn-inspired
   ============================================ */

.tl-date-group { margin-bottom: 24px; }
.tl-date-header {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); padding: 0 0 8px 44px; border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.tl-items { display: flex; flex-direction: column; gap: 2px; }
.tl-item {
    display: flex; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
    transition: background .15s;
}
.tl-item:hover { background: var(--bg-hover); }
.tl-line {
    display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 32px; position: relative;
}
.tl-line::after {
    content: ''; position: absolute; top: 32px; bottom: -10px; width: 1px; background: var(--border);
}
.tl-date-group:last-child .tl-items .tl-item:last-child .tl-line::after { display: none; }
.tl-dot {
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; flex-shrink: 0; z-index: 1;
}
.tl-dot svg { width: 14px; height: 14px; }
.tl-content { flex: 1; min-width: 0; padding-top: 2px; }
.tl-header {
    display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 2px; flex-wrap: wrap;
}
.tl-label { font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.tl-repo, .tl-cat, .tl-src {
    padding: 1px 6px; border-radius: 4px; font-size: 10px; background: var(--bg-hover); color: var(--text-secondary);
}
.tl-time { margin-left: auto; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.tl-title {
    font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tl-detail {
    font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Approval Queue — Card Grid */
.aq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; max-height: 400px; overflow-y: auto; }
.aq-grid::-webkit-scrollbar { width: 4px; }
.aq-grid::-webkit-scrollbar-track { background: transparent; }
.aq-grid::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 4px; }
.aq-card {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; transition: border-color .15s;
}
.aq-card:hover { border-color: var(--border-active); }
.aq-card-header {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.aq-card-label { font-weight: 600; font-size: 13px; flex: 1; }
.aq-card-count {
    font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
    min-width: 22px; text-align: center;
}
.aq-card-items { padding: 6px; max-height: 280px; overflow-y: auto; }
.aq-card-items::-webkit-scrollbar { width: 4px; }
.aq-card-items::-webkit-scrollbar-track { background: transparent; }
.aq-card-items::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 4px; }
.aq-card-item {
    padding: 8px 10px; border-radius: var(--radius-sm); transition: background .15s; cursor: default;
}
.aq-card-item:hover { background: var(--bg-hover); }
.aq-item-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aq-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.aq-item-cat {
    font-size: 10px; padding: 1px 6px; border-radius: 4px;
    background: var(--bg-hover); color: var(--text-secondary);
}
.aq-item-badge {
    font-size: 10px; font-weight: 600; padding: 1px 8px; border-radius: 99px;
    letter-spacing: .3px;
}
.aq-item-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Activity filter buttons */
.activity-filter { font-size: 12px !important; padding: 4px 12px !important; border-radius: 99px !important; }
.activity-filter.active { background: var(--accent) !important; color: #fff !important; }

/* Spinner */
.spinner {
    width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Cron Calendar
   ========================================================================== */
/* ==========================================================================
   Calendar — Mission Control Week Grid
   ========================================================================== */
.cal-legend { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; padding: 8px 12px; background: #1A1A22; border-radius: 8px; border: 1px solid rgba(255,255,255,0.06); }
.cal-legend-item { display: flex; align-items: center; gap: 7px; font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 500; }
.cal-legend-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.cal-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; padding:10px 12px; background:#1A1A22; border-radius:8px; border:1px solid rgba(255,255,255,0.06); flex-wrap:wrap; }
.cal-view-switch, .cal-day-switch { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.cal-view-btn, .cal-nav-btn, .cal-today-btn { height:30px; padding:0 12px; border-radius:8px; border:1px solid rgba(255,255,255,0.08); background:#12121A; color:rgba(255,255,255,0.72); cursor:pointer; font-size:12px; font-weight:600; }
.cal-view-btn.active { background:rgba(74,108,247,0.18); border-color:rgba(74,108,247,0.45); color:#8ea7ff; }
.cal-day-label { min-width:72px; text-align:center; font-size:12px; font-weight:700; color:rgba(255,255,255,0.82); }
.cal-day-switch.is-hidden { display:none; }
.cal-day-view { display:flex; flex-direction:column; gap:10px; }
.cal-day-row { display:grid; grid-template-columns:72px minmax(0, 1fr); gap:12px; align-items:start; background:#12121A; border:1px solid rgba(255,255,255,0.06); border-radius:10px; padding:12px; }
.cal-day-row-now { box-shadow: inset 0 0 0 1px rgba(74,108,247,0.35); background: rgba(74,108,247,0.05); }
.cal-day-time { font-size:12px; font-weight:700; color:rgba(255,255,255,0.55); font-variant-numeric:tabular-nums; padding-top:4px; }
.cal-day-jobs { display:flex; flex-direction:column; gap:8px; min-width:0; }
.cal-day-job { border-radius:8px; padding:10px 12px; min-width:0; }
.cal-day-job-name { font-size:13px; font-weight:700; line-height:1.3; margin-bottom:4px; }
.cal-day-job-meta { font-size:11px; color:rgba(255,255,255,0.5); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-day-empty { font-size:12px; color:rgba(255,255,255,0.35); padding:6px 0; }
@media (min-width: 769px) {
  .main-wrapper.viewport-lock { overflow: hidden; }
  .main-wrapper.viewport-lock #tab-calendar.active { flex: 1 1 0; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
  .main-wrapper.viewport-lock #calendar-grid { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
  .main-wrapper.viewport-lock #calendar-grid .cal-grid { flex: 1 1 0; min-height: 0; height: 100%; }
  .main-wrapper.viewport-lock #calendar-grid .cal-always-section { flex-shrink: 0; }
  .main-wrapper.viewport-lock #calendar-grid .cal-legend { flex-shrink: 0; }
  .main-wrapper.viewport-lock #calendar-grid .cal-summary { flex-shrink: 0; }
}
#calendar-grid .cal-grid { display: grid; gap: 1px; background: rgba(255,255,255,0.04); border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.06); width: 100%; grid-auto-rows: minmax(28px, 1fr); }
.cal-corner { background: #0F0F17; }
.cal-hour { padding: 0 4px; font-size: 8px; color: rgba(255,255,255,0.35); background: #0F0F17; display: flex; align-items: center; justify-content: flex-end; font-variant-numeric: tabular-nums; font-weight: 500; }
.cal-cell { background: #12121A; padding: 0 2px; position: relative; overflow: hidden; min-width: 0; }
.cal-cell-today { background: rgba(74,108,247,0.04); }
.cal-cell-now { background: rgba(74,108,247,0.08); box-shadow: inset 0 0 0 1px rgba(74,108,247,0.3); }
.cal-block { font-size: 8px; padding: 0 3px; border-radius: 2px; margin: 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; letter-spacing: 0; line-height: 1.4; max-width: 100%; }
.cal-block:hover { opacity: 0.85; transform: scale(1.02); }
.cal-day-header { text-align: center; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; padding: 2px 2px; background: #0F0F17; color: rgba(255,255,255,0.45); }
.cal-day-header.current-day { color: #4A6CF7; text-shadow: 0 0 12px rgba(74,108,247,0.4); }
.cal-summary { margin-top: 14px; font-size: 12px; color: rgba(255,255,255,0.35); }
.cal-always-section { margin-top: 16px; padding: 14px 16px; background: #1A1A22; border-radius: 8px; border: 1px solid rgba(255,255,255,0.06); }
.cal-always-title { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.7); margin-bottom: 10px; letter-spacing: 0.5px; }
.cal-always-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-always-item { background: #12121A; border-radius: 6px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.cal-always-name { font-size: 11px; font-weight: 600; }
.cal-always-next { font-size: 10px; color: rgba(255,255,255,0.35); }

/* ==========================================================================
   Kanban Board — Mission Control style
   ========================================================================== */
.kanban-filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.kanban-filter-btn { font-size: 11px; padding: 5px 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.08); background: #1A1A22; color: rgba(255,255,255,0.5); cursor: pointer; transition: all .15s; font-weight: 500; }
.kanban-filter-btn:hover { border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.8); background: #222230; }
.kanban-filter-btn.active { background: rgba(74,108,247,0.15); border-color: rgba(74,108,247,0.4); color: #4A6CF7; }
.kanban { display: flex; gap: 12px; height: calc(100vh - 160px); overflow-x: auto; }
.kanban-col { flex: 1; min-width: 280px; background: #0F0F17; border-radius: 10px; display: flex; flex-direction: column; border: 1px solid rgba(255,255,255,0.06); }
.kanban-col-header { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: space-between; background: #1A1A22; border-radius: 10px 10px 0 0; }
.kanban-col-label { display: flex; align-items: center; gap: 8px; }
.kanban-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { font-weight: 700; font-size: 13px; color: rgba(255,255,255,0.85); }
.kanban-col-count { font-size: 11px; padding: 2px 10px; border-radius: 99px; font-weight: 600; background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5); }
.kanban-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.kanban-card { background: #1A1A22; border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 12px 14px; transition: transform .15s, box-shadow .15s, border-color .15s; cursor: default; }
.kanban-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.4); border-color: rgba(255,255,255,0.12); }
.kanban-card-title { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.9); margin-bottom: 6px; line-height: 1.4; }
.kanban-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kanban-card-cat { font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 500; }
.kanban-source-badge { font-size: 12px; margin-right: 4px; opacity: 0.9; }
.kanban-card-priority { font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.kanban-card-time { font-size: 10px; color: rgba(255,255,255,0.3); margin-left: auto; }
.kanban-empty { padding: 24px; font-size: 12px; color: rgba(255,255,255,0.25); text-align: center; }

/* ============================================
   v7 — PREMIUM SLEEK POLISH
   Final visual QA pass — Feb 2026
   ============================================ */

/* === STAT CARDS — Tighter, sleeker === */
.stats-bar {
    gap: 8px !important;
    margin-bottom: 8px !important;
}

.stat-card {
    padding: 14px 16px !important;
    min-height: 56px !important;
    gap: 10px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #1A1A22 0%, #1E1E2A 100%) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.03) !important;
}

.stat-card:hover {
    background: linear-gradient(135deg, #1E1E2A 0%, #242434 100%) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04) !important;
    border-color: rgba(255,255,255,0.08) !important;
    transform: translateY(-1px) !important;
}

.stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.04) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.stat-value {
    font-size: 22px !important;
    font-weight: 700 !important;
    letter-spacing: -0.3px !important;
    line-height: 1.1 !important;
}

.stat-label {
    font-size: 10px !important;
    letter-spacing: 0.5px !important;
    color: rgba(255,255,255,0.4) !important;
    margin-top: 2px !important;
    text-transform: none !important;
}

.stat-change {
    font-size: 10px !important;
    font-weight: 500 !important;
}

/* === QUICK ACTIONS — Compact pill buttons === */
.quick-actions {
    gap: 4px !important;
    margin-bottom: 8px !important;
    padding: 0 !important;
}

.quick-actions .action-btn {
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    color: rgba(255,255,255,0.5) !important;
    white-space: nowrap !important;
}

.quick-actions .action-btn:hover {
    background: rgba(255,255,255,0.08) !important;
    color: rgba(255,255,255,0.8) !important;
    border-color: rgba(255,255,255,0.12) !important;
}

/* === PREMIUM CARDS (overview widgets) — Consistent treatment === */
.premium-card {
    border-radius: 10px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
    margin-bottom: 8px !important;
}

.premium-card > .section-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    background: rgba(255,255,255,0.02) !important;
    border-bottom: 1px solid rgba(255,255,255,0.04) !important;
    margin: 0 !important;
}

.premium-card > .section-header h3 {
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px !important;
    color: rgba(255,255,255,0.7) !important;
    text-transform: none !important;
    margin: 0 !important;
}

.section-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
}

.premium-card .panel-content,
.premium-card .widget-detail,
.premium-card > div:not(.section-header) {
    padding: 12px 16px !important;
}

/* === MAIN GRID — Better panel sizing === */
.main-grid {
    gap: 8px !important;
}

.main-grid .panel {
    border-radius: 10px !important;
    min-height: 200px !important;
    max-height: 500px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
}

.main-grid .panel .panel-header {
    padding: 10px 16px !important;
    background: rgba(255,255,255,0.02) !important;
}

.main-grid .panel .panel-header h2 {
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px !important;
    text-transform: none !important;
    color: rgba(255,255,255,0.7) !important;
}

.main-grid .panel .panel-content {
    padding: 10px 14px !important;
    font-size: 12px !important;
}

/* Log stream panel — span full width */
.main-grid .log-stream-panel {
    grid-column: 1 / -1 !important;
    max-height: 350px !important;
}

/* === PANELS — Global premium treatment === */
.panel {
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.02) !important;
    background: #1A1A22 !important;
    margin-bottom: 8px !important;
}

.panel-header {
    background: rgba(255,255,255,0.02) !important;
    padding: 10px 16px !important;
    border-bottom: 1px solid rgba(255,255,255,0.04) !important;
}

.panel-header h2 {
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0.2px !important;
    color: rgba(255,255,255,0.7) !important;
}

/* === SESSIONS — Tighter list items === */
.history-item, .session-item {
    border-radius: 8px !important;
    padding: 10px 14px !important;
    margin-bottom: 4px !important;
    border: 1px solid rgba(255,255,255,0.04) !important;
    background: #1A1A22 !important;
    transition: all 0.12s ease !important;
}

.history-item:hover, .session-item:hover {
    background: #1E1E2A !important;
    border-color: rgba(255,255,255,0.08) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3) !important;
}

/* === ANALYTICS — Chart cards === */
.analytics-grid {
    gap: 8px !important;
    padding: 0 !important;
}

.analytics-grid .panel {
    max-height: none !important;
    overflow: visible !important;
}

.chart-container, .chart-card {
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
    padding: 14px !important;
}

/* === SYSTEM — Even grid === */
.system-grid {
    gap: 8px !important;
    grid-template-rows: auto !important;
    padding-bottom: 40px !important;
    align-items: start !important;
}

.system-grid .panel {
    max-height: 500px !important;
    min-height: 0 !important;
}

.system-grid .service-health-full-panel {
    max-height: 300px !important;
}

/* === TAB CONTENT — Consistent page padding === */
.tab-content {
    padding: 16px !important;
}

/* === HEALTH SCORE BANNER — Sleeker === */
.health-score-banner {
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
    padding: 16px !important;
    margin-bottom: 8px !important;
    background: linear-gradient(135deg, #1A1A22 0%, #1E1E2A 100%) !important;
}

.health-score-title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: rgba(255,255,255,0.6) !important;
}

/* === SIDEBAR — Premium navigation === */
.sidebar-section {
    font-size: 9px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    color: rgba(255,255,255,0.25) !important;
    padding: 16px 16px 4px !important;
}

.sidebar-tab {
    height: 34px !important;
    font-size: 12.5px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: rgba(255,255,255,0.5) !important;
    transition: all 0.12s ease !important;
}

.sidebar-tab:hover {
    color: rgba(255,255,255,0.8) !important;
    background: rgba(255,255,255,0.03) !important;
}

.sidebar-icon {
    font-size: 14px !important;
    width: 20px !important;
    text-align: center !important;
}

/* === TOPBAR — Clean header === */
.topbar, .header-bar, .top-bar {
    height: 44px !important;
    background: #0B0B12 !important;
    border-bottom: 1px solid rgba(255,255,255,0.04) !important;
    box-shadow: 0 1px 8px rgba(0,0,0,0.4) !important;
}

/* === TYPOGRAPHY — Panel headers sentence case === */
h3, h4, .panel-header h2, .section-header h3 {
    text-transform: none !important;
    letter-spacing: 0.2px !important;
}

/* === CRON ITEMS — Tighter === */
.cron-item {
    padding: 10px 14px !important;
    border-radius: 8px !important;
    margin-bottom: 4px !important;
}

/* === FOOTER — Minimal === */
footer, .footer, [class*="status-bar"] {
    height: 32px !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    font-size: 10px !important;
    color: rgba(255,255,255,0.2) !important;
    background: #0A0A0F !important;
}

/* === SCROLLBAR — Ultra thin === */
::-webkit-scrollbar { width: 3px !important; height: 3px !important; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06) !important; }

/* === MASCOT — Subtle === */
.mascot-button, .chat-fab, .chat-toggle {
    opacity: 0.3 !important;
    transform: scale(0.85) !important;
}
.mascot-button:hover, .chat-fab:hover, .chat-toggle:hover {
    opacity: 0.9 !important;
    transform: scale(1) !important;
}

/* === BADGES — Uniform === */
.model-badge, .model-tier-badge {
    background: rgba(139,92,246,0.12) !important;
    color: #A78BFA !important;
    font-size: 9px !important;
    height: 18px !important;
    padding: 0 6px !important;
    border-radius: 4px !important;
}

.status-badge, .panel-badge {
    height: 18px !important;
    padding: 0 6px !important;
    font-size: 9px !important;
    border-radius: 4px !important;
}

/* === AGENT CARDS === */
.subagent-card, .agent-card, .cron-card {
    border-radius: 10px !important;
    padding: 14px 16px !important;
    margin-bottom: 6px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    background: linear-gradient(135deg, #1A1A22 0%, #1C1C28 100%) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
}

.subagent-card:hover, .agent-card:hover, .cron-card:hover {
    border-color: rgba(255,255,255,0.08) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35) !important;
}

/* === LIGHT THEME === */
[data-theme="light"] .stat-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
}

[data-theme="light"] .panel {
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
}

[data-theme="light"] .panel-header {
    background: rgba(0,0,0,0.02) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

[data-theme="light"] .stat-label {
    color: rgba(0,0,0,0.5) !important;
}

/* =============================================================================
   File Browser
   ============================================================================= */
.filebrowser-container { display:flex; height:calc(100vh - 140px); gap:0; }
.filebrowser-sidebar { width:300px; min-width:240px; border-right:1px solid var(--border); overflow-y:auto; display:flex; flex-direction:column; }
.filebrowser-path-bar { padding:10px 12px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:12px; color:var(--text-secondary); font-family:monospace; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.filebrowser-tree { flex:1; overflow-y:auto; padding:4px 0; }
.fb-item { display:flex; align-items:center; padding:4px 8px; cursor:pointer; font-size:13px; gap:6px; white-space:nowrap; }
.fb-item:hover { background:var(--bg-hover); }
.fb-item.active { background:rgba(99,102,241,0.15); color:var(--accent); }
.fb-item .fb-icon { width:16px; text-align:center; flex-shrink:0; }
.fb-item .fb-name { flex:1; overflow:hidden; text-overflow:ellipsis; }
.fb-item .fb-size { font-size:11px; color:var(--text-muted); margin-left:auto; padding-left:8px; }
.fb-indent { display:inline-block; width:16px; flex-shrink:0; }
.fb-toggle { width:16px; text-align:center; cursor:pointer; flex-shrink:0; color:var(--text-secondary); font-size:10px; }
.filebrowser-main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.filebrowser-toolbar { padding:8px 16px; background:var(--bg-secondary); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; }
.fb-filename { font-weight:600; font-size:14px; }
.fb-meta { font-size:12px; color:var(--text-secondary); margin-left:auto; }
.filebrowser-content { flex:1; overflow:auto; padding:16px; }
.filebrowser-content pre { margin:0; white-space:pre-wrap; word-break:break-word; font-size:13px; line-height:1.5; font-family:'JetBrains Mono',monospace; }

/* =============================================================================
   Terminal
   ============================================================================= */
.terminal-container { display:flex; flex-direction:column; height:calc(100vh - 140px); background:#0d1117; border-radius:8px; overflow:hidden; }
.terminal-quick-bar { display:flex; flex-wrap:wrap; gap:6px; padding:10px 12px; background:#161b22; border-bottom:1px solid #21262d; }
.term-quick-btn { background:#21262d; color:#c9d1d9; border:1px solid #30363d; border-radius:6px; padding:4px 10px; font-size:12px; cursor:pointer; transition:all 0.15s; white-space:nowrap; }
.term-quick-btn:hover { background:#30363d; border-color:var(--accent); color:#fff; }
.terminal-output { flex:1; overflow-y:auto; padding:12px 16px; font-family:'JetBrains Mono',monospace; font-size:13px; line-height:1.6; }
.term-line { white-space:pre-wrap; word-break:break-word; }
.term-line.term-cmd { color:#58a6ff; }
.term-line.term-cmd::before { content:'$ '; color:#8b949e; }
.term-line.term-output { color:#c9d1d9; }
.term-line.term-error { color:#f85149; }
.term-line.term-system { color:#8b949e; font-style:italic; }
.terminal-input-row { display:flex; align-items:center; padding:8px 16px; border-top:1px solid #21262d; background:#161b22; gap:8px; }
.term-prompt { color:#8b949e; font-family:'JetBrains Mono',monospace; font-size:13px; }
.term-input { flex:1; background:transparent; border:none; outline: none; /* keyboard: see :focus-visible below */ color:#c9d1d9; font-family:'JetBrains Mono',monospace; font-size:13px; }

/* =============================================================================
   Search
   ============================================================================= */
.search-container { max-width:900px; margin:0 auto; padding:16px; }
.search-bar-row { display:flex; gap:8px; margin-bottom:16px; }
.search-input { flex:1; padding:10px 14px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:8px; color:var(--text, #e4e4e7); font-size:14px; outline: none; /* keyboard: see :focus-visible below */ }
.search-input:focus { border-color:var(--accent); }
.search-results { display:flex; flex-direction:column; gap:12px; }
.search-result-group { background:var(--bg-elevated, #1a1a24); border:1px solid rgba(255,255,255,0.08); border-radius:8px; overflow:hidden; }
.search-result-header { padding:10px 14px; background:rgba(255,255,255,0.04); font-size:12px; font-family:'JetBrains Mono',monospace; color:var(--accent, #6366f1); cursor:pointer; font-weight:600; }
.search-result-header:hover { text-decoration:underline; background:rgba(255,255,255,0.06); }
.search-result-lines { padding:8px 14px; font-family:'JetBrains Mono',monospace; font-size:12px; line-height:1.8; }
.search-result-line { white-space:pre-wrap; word-break:break-word; padding:2px 0; }
.search-result-line.context { color:#71717a; }
.search-result-line.match { color:#e4e4e7; }
.search-result-line .search-highlight { background:rgba(255,213,79,0.3); color:#ffd54f; padding:1px 3px; border-radius:2px; font-weight:600; }
.search-result-line .line-num { color:#52525b; margin-right:12px; user-select:none; min-width:3ch; display:inline-block; text-align:right; }
/* Unified search enhancements */
.search-loading { display:flex; align-items:center; gap:10px; color:var(--text-muted); padding:24px; justify-content:center; font-size:14px; }
.search-summary { font-size:12px; color:var(--text-muted); padding:6px 0 12px; border-bottom:1px solid var(--border); margin-bottom:12px; }
.search-section { background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.search-section-header { padding:8px 14px; background:rgba(255,255,255,0.04); font-size:12px; font-weight:700; color:var(--text-primary); border-bottom:1px solid var(--border); }
.search-result-row { display:flex; align-items:flex-start; gap:10px; padding:8px 14px; border-bottom:1px solid var(--border-subtle, rgba(255,255,255,0.05)); transition:background 0.1s; }
.search-result-row:last-child { border-bottom:none; }
.search-result-row:hover { background:rgba(255,255,255,0.04); }
.search-result-icon { font-size:14px; flex-shrink:0; padding-top:1px; }
.search-result-body { min-width:0; flex:1; }
.search-result-title { font-size:13px; color:var(--text-primary); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.search-result-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* Notification Inbox Tab (Task 79f06709)
   ============================================================================= */
.inbox-container { max-width:1100px; margin:0 auto; padding:20px; }
.inbox-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:14px; padding:16px 18px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:12px; }
.inbox-header h2 { margin:0; font-size:1.15rem; flex:1; }
.inbox-subtitle { margin-top:4px; font-size:12px; color:var(--text-muted); }
.inbox-header-actions { display:flex; gap:8px; }
.inbox-filters { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.inbox-filter-pill { padding:4px 12px; border-radius:99px; border:1px solid var(--border); background:transparent; color:var(--text-muted); font-size:12px; cursor:pointer; transition:all 0.15s; }
.inbox-filter-pill:hover { background:var(--bg-elevated); color:var(--text-primary); }
.inbox-filter-pill.active { background:var(--accent, #6366f1); border-color:var(--accent, #6366f1); color:#fff; }
.inbox-content { display:flex; flex-direction:column; gap:8px; }
.inbox-empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:48px 24px; text-align:center; background:var(--bg-elevated); border:1px solid var(--border); border-radius:12px; color:var(--text-primary); }
.inbox-item { display:flex; align-items:flex-start; gap:12px; padding:12px 16px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; cursor:pointer; transition:background 0.1s; position:relative; }
.inbox-item:hover { background:var(--bg-secondary); }
.inbox-item.read { opacity:0.6; }
.inbox-item-icon { font-size:18px; flex-shrink:0; padding-top:2px; }
.inbox-item-body { flex:1; min-width:0; }
.inbox-item-row1 { display:flex; align-items:center; gap:8px; margin-bottom:4px; flex-wrap:wrap; }
.inbox-item-source { font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--accent); font-weight:600; background:rgba(99,102,241,.12); padding:1px 6px; border-radius:4px; }
.inbox-item-time { font-size:11px; color:var(--text-muted); margin-left:auto; white-space:nowrap; }
.inbox-item-title { font-size:13px; font-weight:700; color:var(--text-primary); margin-bottom:3px; }
.inbox-item-text { font-size:13px; color:var(--text-primary); line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.inbox-item-expand { margin-top:5px; font-size:12px; color:var(--accent); cursor:pointer; user-select:none; }
.inbox-item-expand:hover { text-decoration:underline; }
.inbox-item-link { margin-top:6px; font-size:12px; color:var(--accent); cursor:pointer; }
.inbox-item-link:hover { text-decoration:underline; }
.inbox-unread-dot { position:absolute; top:12px; right:12px; width:10px; height:10px; border-radius:50%; background:var(--accent, #6366f1); flex-shrink:0; }
.inbox-item:not(.read):first-child .inbox-unread-dot { animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(1.3)} }
.sidebar-badge { display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px; padding:0 4px; border-radius:99px; background:var(--danger, #e74c3c); color:#fff; font-size:9px; font-weight:700; margin-left:4px; line-height:1; }

@media (max-width:768px) {
    .filebrowser-container { flex-direction:column; }
    .filebrowser-sidebar { width:100%; max-height:40vh; border-right:none; border-bottom:1px solid var(--border); }
}

/* Markdown Preview */
.md-preview { padding: 16px; font-size: 13px; line-height: 1.7; color: var(--text-primary); }
.md-preview h1 { font-size: 22px; font-weight: 700; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.md-preview h2 { font-size: 18px; font-weight: 600; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.md-preview h3 { font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
.md-preview h4 { font-size: 13px; font-weight: 600; margin: 12px 0 4px; color: var(--text-muted); }
.md-preview p { margin: 0 0 10px; }
.md-preview ul, .md-preview ol { margin: 0 0 10px; padding-left: 24px; }
.md-preview li { margin: 2px 0; }
.md-preview code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.md-preview pre { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 12px 16px; overflow-x: auto; margin: 0 0 12px; }
.md-preview pre code { background: none; padding: 0; font-size: 12px; }
.md-preview blockquote { border-left: 3px solid var(--accent, #6366f1); margin: 0 0 10px; padding: 4px 16px; color: var(--text-muted); }
.md-preview a { color: var(--accent, #6366f1); text-decoration: none; }
.md-preview a:hover { text-decoration: underline; }
.md-preview table { border-collapse: collapse; margin: 0 0 12px; width: 100%; }
.md-preview th, .md-preview td { border: 1px solid rgba(255,255,255,0.1); padding: 6px 10px; font-size: 12px; text-align: left; }
.md-preview th { background: rgba(255,255,255,0.05); font-weight: 600; }
.md-preview hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-preview img { max-width: 100%; border-radius: 6px; }
.md-preview strong { font-weight: 600; }
.md-preview em { font-style: italic; color: var(--text-muted); }

/* Sprint badge */
.task-sprint-badge { background: rgba(168,85,247,0.15); color: #a855f7; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }

/* Time to complete */
.task-time-complete { color: #22c55e; font-size: 11px; font-weight: 500; }

/* Task age */
.task-age { color: var(--text-muted, #71717a); font-size: 11px; }
.task-age.aging { color: #fbbf24; }
.task-age.stale { color: #ef4444; }

/* Git badge on card */
.task-git-badge { background: rgba(96,165,250,0.12); color: #60a5fa; padding: 2px 6px; border-radius: 8px; font-size: 10px; cursor: default; }

/* Category velocity */
.task-cat-velocity { color: var(--text-muted, #71717a); font-size: 11px; }

/* Description in card */
.task-card-desc { font-size: 11px; color: var(--text-muted, #71717a); margin: 4px 0; padding: 4px 8px; background: rgba(255,255,255,0.02); border-radius: 4px; line-height: 1.4; }

/* Git commits in modal */
.task-commits-list { display: flex; flex-direction: column; gap: 6px; }
.task-commit-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(255,255,255,0.03); border-radius: 6px; font-size: 12px; }
.commit-hash { font-family: 'SF Mono', monospace; background: rgba(96,165,250,0.12); color: #60a5fa; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.commit-msg { flex: 1; color: var(--text-primary, #e4e4e7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commit-date { color: var(--text-muted, #71717a); font-size: 10px; white-space: nowrap; }

/* Related tasks in modal */
.task-related-list { display: flex; flex-direction: column; gap: 4px; }
.task-related-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background 0.15s; font-size: 12px; }
.task-related-row:hover { background: rgba(255,255,255,0.05); }
.related-title { color: var(--text-primary, #e4e4e7); }
.related-status { font-size: 11px; }

/* Light theme */
[data-theme="light"] .task-card-desc { background: rgba(0,0,0,0.03); }
[data-theme="light"] .task-commit-row { background: rgba(0,0,0,0.03); }
[data-theme="light"] .task-related-row:hover { background: rgba(0,0,0,0.05); }

/* ==================== */
/* KEYBOARD ACCESSIBILITY — visible focus indicators */
/* ==================== */
:focus-visible {
    outline: 2px solid var(--accent, var(--accent)) !important;
    outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.sidebar-tab:focus-visible,
.header-tab:focus-visible,
.range-btn:focus-visible,
.action-btn:focus-visible {
    outline: 2px solid var(--accent, var(--accent)) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px var(--accent-dim, var(--accent-dim));
}

/* ==================== */
/* MODAL ACCESSIBILITY PATCH */
/* ==================== */
.modal-close,
.modal-close-btn,
.canvas-preview-close {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.modal-close:focus-visible,
.modal-close-btn:focus-visible,
.canvas-preview-close:focus-visible,
.modal-overlay:focus-visible,
.modal-content:focus-visible {
    outline: 2px solid var(--accent, var(--accent)) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px var(--accent-dim, var(--accent-dim));
}

.modal-overlay[aria-hidden="true"] {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-overlay[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-content,
    .modal-close,
    .modal-close-btn,
    .canvas-preview-close {
        animation: none !important;
        transition: none !important;
    }
}

@media (forced-colors: active) {
    .modal-content,
    .modal-header,
    .modal-body,
    .modal-close,
    .modal-close-btn,
    .canvas-preview-close {
        forced-color-adjust: auto;
        border: 1px solid CanvasText;
        color: CanvasText;
        background: Canvas;
    }
}

/* ================================================================== */
/* PHASE 2: VISUAL POLISH — Premium SaaS feel                        */
/* Appended at end to override without breaking existing rules        */
/* ================================================================== */

/* --- Subtle glow on sidebar active tab --- */
.sidebar-tab.active {
    box-shadow: inset 3px 0 0 var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: linear-gradient(90deg, var(--accent-dim) 0%, transparent 100%);
}

/* --- Sidebar brand polish --- */
.sidebar-brand {
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.04) 0%, transparent 100%);
}

/* --- Panels: subtle gradient bg + glow on hover --- */
.panel {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    border-color: var(--border);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.panel:hover {
    border-color: var(--border-active);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-active);
}

/* --- Panel headers: sharper, more refined --- */
.panel-header {
    background: rgba(255, 255, 255, 0.015);
    backdrop-filter: blur(8px);
}
.panel-header h2 {
    font-size: 11px;
    letter-spacing: 0.8px;
}

/* --- Stat cards: glass morphism --- */
.stat-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}
.stat-icon {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-hover) 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

/* --- Topbar: frosted glass --- */
.topbar {
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

/* --- Sub-tabs: pill style refinement --- */
.agents-subtab {
    border-radius: 20px;
    transition: all 0.2s ease;
}
.agents-subtab.active {
    box-shadow: 0 2px 8px rgba(79, 142, 247, 0.2);
}

/* --- Scrollbar refinement (WebKit) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Smoother page transitions --- */
.tab-content {
    animation: fadeSlideIn 0.2s ease-out;
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Sidebar hover: subtle glow --- */
.sidebar-tab:hover {
    background: linear-gradient(90deg, var(--bg-hover) 0%, transparent 80%);
}

/* --- Button refinements --- */
.topbar-btn {
    border-radius: 8px;
    backdrop-filter: blur(4px);
}
.topbar-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- Badge polish --- */
.panel-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* --- Session items --- */
.session-item {
    transition: all 0.2s ease;
}
.session-item:hover {
    background: linear-gradient(90deg, var(--bg-hover) 0%, transparent 100%);
}

/* --- Kanban cards: depth --- */
.kanban-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.kanban-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* --- Calendar cells: cleaner grid --- */
.cal-slot {
    transition: background 0.15s ease;
}
.cal-slot:hover {
    background: var(--bg-hover);
}

/* --- Sidebar section labels: subtle accent underline --- */
.sidebar-section {
    border-bottom: 1px solid rgba(79, 142, 247, 0.08);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

/* --- Overview stat values: subtle glow --- */
.stat-value {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}

/* --- Selection color --- */
::selection {
    background: rgba(79, 142, 247, 0.3);
    color: var(--text);
}

/* ================================================================== */
/* PHASE 2B: FULL COMPONENT POLISH — Every page, every element        */
/* ================================================================== */

/* --- Agent Cards: premium depth + subtle left accent --- */
.agent-card {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
}
.agent-card:hover {
    border-color: var(--border-active);
    border-left-color: var(--info);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}
.agent-card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* --- Status badges: glow effect --- */
.status-badge.completed {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
}
.status-badge.running {
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.2);
    animation: pulseRunning 2s ease-in-out infinite;
}
@keyframes pulseRunning {
    0%, 100% { box-shadow: 0 0 8px rgba(96, 165, 250, 0.2); }
    50% { box-shadow: 0 0 16px rgba(96, 165, 250, 0.4); }
}
.status-badge.error {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

/* --- Model badge refinement --- */
.model-badge {
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* --- Session items: smoother transitions --- */
.session-item {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.8) 100%);
    border: 1px solid transparent;
    border-left: 3px solid transparent;
}
.session-item:hover {
    background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-elevated) 100%);
    border-color: rgba(255, 255, 255, 0.04);
    border-left-color: var(--success);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.session-item.active, .session-item[data-active="true"] {
    border-left-color: var(--info);
    background: linear-gradient(90deg, var(--info-dim) 0%, var(--bg-elevated) 100%);
}

/* --- Timeline items: polish --- */
.timeline-item {
    border-radius: var(--radius-xs);
    padding: 8px 6px;
    margin: 0 -6px;
}
.timeline-item:hover {
    background: linear-gradient(90deg, var(--bg-elevated) 0%, transparent 100%);
}
.timeline-icon {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-hover) 100%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* --- Memory items: file-tree feel --- */
.memory-item {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.6) 100%);
    border: 1px solid transparent;
    border-left: 2px solid var(--info-dim);
}
.memory-item:hover {
    border-color: rgba(255, 255, 255, 0.04);
    border-left-color: var(--info);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    background: var(--bg-hover);
}

/* --- Cron items: cleaner rows --- */
.cron-item {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.6) 100%);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.cron-item:hover {
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.cron-status {
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- Health bars: smoother fills --- */
.health-bar {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.03);
}
.health-bar-fill {
    box-shadow: 0 0 6px currentColor;
}
.health-bar-fill.good { box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
.health-bar-fill.warning { box-shadow: 0 0 6px rgba(251, 191, 36, 0.4); }
.health-bar-fill.bad { box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }

/* --- Kanban columns: refined containers --- */
.kanban-column {
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(20, 20, 28, 0.8) 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.kanban-column-header {
    background: rgba(255, 255, 255, 0.015);
}
.kanban-column-count {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-hover) 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-weight: 600;
}

/* --- Task cards: depth + lift --- */
.task-card {
    background: linear-gradient(145deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.task-card:hover {
    border-color: var(--info);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
.task-card-type {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

/* --- Task modal: premium overlay --- */
.modal-overlay {
    background: rgba(6, 6, 10, 0.85);
    backdrop-filter: blur(8px) saturate(120%);
}
.modal-content {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.08);
}
.modal-header {
    background: rgba(255, 255, 255, 0.015);
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: all 0.15s;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
}

/* --- Quick action buttons: premium feel --- */
.action-btn {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    border-color: rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.action-btn:hover {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-hover) 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

/* --- Sub-tabs: refined pill selector --- */
.agents-subtabs {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.agents-subtab {
    border-radius: 20px;
    font-size: 13px;
    padding: 8px 18px;
}
.agents-subtab.active {
    background: linear-gradient(135deg, var(--accent) 0%, #ff8e53 100%);
    box-shadow: 0 2px 12px rgba(79, 142, 247, 0.3);
}
.agents-subtab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
}

/* --- Log entries: cleaner rows --- */
.log-entry {
    border-radius: var(--radius-xs);
    padding: 6px 4px;
    margin: 0 -4px;
    transition: background 0.15s;
}
.log-entry:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Calendar events: accent borders --- */
.calendar-event {
    border-left: 3px solid var(--info);
    transition: all 0.15s ease;
}
.calendar-event:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.calendar-event.today {
    border-left-color: var(--accent);
    background: var(--accent-dim);
}

/* --- Search: refined input --- */
.search-input-large {
    background: linear-gradient(135deg, var(--bg-base) 0%, var(--bg-surface) 100%);
    border-color: rgba(255, 255, 255, 0.06);
    transition: all 0.25s ease;
}
.search-input-large:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* --- Toast notifications: premium feel --- */
.toast {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
}

/* --- File browser: refined tree + code view --- */
.filebrowser-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.filebrowser-sidebar {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-card) 100%);
}
.filebrowser-path-bar {
    background: rgba(255, 255, 255, 0.02);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}
.fb-item {
    border-radius: var(--radius-xs);
    margin: 1px 4px;
    transition: all 0.15s;
}
.fb-item:hover {
    background: linear-gradient(90deg, var(--bg-hover) 0%, transparent 100%);
}
.fb-item.active {
    background: linear-gradient(90deg, var(--accent-dim) 0%, transparent 100%);
    border-left: 2px solid var(--accent);
}
.filebrowser-content {
    background: var(--bg-code);
}
.filebrowser-toolbar {
    background: rgba(255, 255, 255, 0.015);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

/* --- Terminal: deeper immersion --- */
.terminal-container {
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}
.terminal-input-row {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
}
.term-input:focus {
    box-shadow: none;
}
.term-line.term-cmd {
    text-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
}

/* --- Canvas gallery cards --- */
.canvas-card {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.canvas-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.1);
}
.canvas-card.pinned {
    border-color: rgba(79, 142, 247, 0.3);
}

/* --- Velocity stats: monospace elegance --- */
.velocity-stat .v-value {
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- WS badge: connection indicator --- */
.ws-badge {
    transition: all 0.2s ease;
}
.ws-badge.connected {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

/* --- Chart panels: refined containers --- */
.chart-panel {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
}

/* --- Detail rows in modals: cleaner dividers --- */
.detail-row {
    border-bottom-color: rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}
.detail-row:hover {
    background: rgba(255, 255, 255, 0.015);
    border-radius: var(--radius-xs);
}

/* --- Priority badges: subtle glow --- */
.task-card-priority.high {
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.2);
}
.task-card-priority.medium {
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.15);
}

/* --- Burndown chart container --- */
.burndown-container, [id*="burndown"] {
    background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-card) 100%);
}

/* --- Sidebar footer: subtle top glow --- */
.sidebar-footer {
    background: linear-gradient(180deg, transparent 0%, rgba(255, 107, 107, 0.02) 100%);
}

/* --- Notification badge: pulse --- */
.notification-badge {
    animation: notifPulse 2s ease-in-out infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* --- Approval queue items --- */
.approval-item {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 26, 36, 0.6) 100%);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.approval-item:hover {
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

/* --- Config/Settings items --- */
.config-item, .setting-item {
    transition: background 0.15s;
    border-radius: var(--radius-xs);
}
.config-item:hover, .setting-item:hover {
    background: rgba(255, 255, 255, 0.015);
}

/* --- Global link styling inside panels --- */
.panel-content a {
    color: var(--info);
    text-decoration: none;
    transition: color 0.15s;
}
.panel-content a:hover {
    color: var(--accent);
}

/* --- Micro-interaction: all interactive elements --- */
button, [role="button"], .clickable {
    transition: all 0.15s ease;
}

/* --- Loading shimmer for empty states --- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-xs);
}

/* ================================================================== */
/* PHASE 2C: SPACING & PADDING AUDIT FIXES                           */
/* ================================================================== */

/* --- Tab content top padding --- */
.tab-content { padding: 16px; }

/* --- Sub-tabs: breathing room --- */
.agents-subtabs { margin-top: 4px; margin-bottom: 16px; }

/* --- Overview: stat grid spacing --- */
.main-grid { gap: 12px; margin-bottom: 14px; }
.quick-actions { margin-bottom: 14px; margin-top: -2px; }

/* --- Panels: consistent padding --- */
.panel-content { padding: 12px 16px; }

/* --- Kanban refinements --- */
.kanban-column-header { padding: 12px 16px; }
.kanban-column-content { padding: 10px; gap: 8px; }
.kanban-board { gap: 12px; }
.task-card { padding: 10px 12px; }
.task-card-description { margin-top: 6px; margin-bottom: 6px; }

/* --- Session items --- */
.session-item { padding: 10px 12px; margin-bottom: 4px; }

/* --- Timeline items --- */
.timeline-item { padding: 10px 8px; margin: 0 -8px; gap: 12px; }

/* --- Memory items --- */
.memory-item { padding: 10px 12px; margin-bottom: 4px; }

/* --- Cron items --- */
.cron-item { padding: 10px 12px; margin-bottom: 4px; }

/* --- Health items --- */
.health-item { padding: 6px 0; }

/* --- File browser --- */
.fb-item { padding: 5px 10px; line-height: 1.4; }
.filebrowser-path-bar { padding: 10px 16px; }

/* --- Log entries --- */
.log-entry { padding: 6px 8px; gap: 10px; }

/* --- Agent cards --- */
.agent-card-header { padding: 14px 16px; }

/* --- Search --- */
.search-box { margin-bottom: 14px; }
.search-input-large { padding: 12px 16px; font-size: 15px; }

/* --- Terminal --- */
.terminal-input-row { padding: 10px 16px; }

/* --- Grid gaps --- */
.system-grid { gap: 14px; }
.analytics-grid { gap: 14px; }

/* --- Modals --- */
.modal-body { padding: 20px; }
.modal-header { padding: 16px 20px; }
.detail-row { padding: 10px 0; }

/* --- Topbar actions --- */
.topbar-actions { gap: 8px; }

/* --- Sidebar sections --- */
.sidebar-section { padding: 14px 16px 6px; margin-top: 6px; }
.sidebar-footer { min-height: 44px; padding: 8px 12px; }

/* ==================== v19.0: Prompts, Hooks, Tech Radar ==================== */

/* Prompts Grid */
.prompts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.prompt-card { background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255,255,255,0.03) 100%); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: all 0.2s; }
.prompt-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.prompt-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prompt-card-name { font-weight: 600; font-size: 14px; color: var(--text); }
.prompt-card-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.badge-readonly { background: rgba(255,100,100,0.15); color: var(--accent); }
.badge-editable { background: rgba(100,255,100,0.15); color: #6bff6b; }
.prompt-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.prompt-card-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); opacity: 0.7; }

/* Prompt Viewer */
.prompt-viewer { display: flex; flex-direction: column; height: calc(100vh - 180px); }
.prompt-viewer-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-shrink: 0; }
.prompt-viewer-title { font-weight: 600; font-size: 16px; flex: 1; }
.prompt-viewer-actions { display: flex; gap: 8px; }
.prompt-viewer-content { flex: 1; overflow-y: auto; padding: 16px; background: rgba(0,0,0,0.2); border-radius: 8px; }
.prompt-editor { width: 100%; flex: 1; min-height: 400px; background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 13px; resize: vertical; }
.action-btn-primary { background: linear-gradient(135deg, var(--accent), #ff8c00) !important; color: #fff !important; }

/* Prompt History */
.prompt-history-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.prompt-history-item { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 12px; transition: border-color 0.2s; }
.prompt-history-item:hover { border-color: var(--accent); }
.prompt-history-hash { font-family: monospace; font-size: 12px; color: var(--accent); margin-bottom: 4px; }
.prompt-history-msg { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.prompt-history-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.prompt-diff-stat { display: flex; gap: 8px; }
.diff-add { color: #4caf50; }
.diff-del { color: #f44336; }

/* Hooks Table */
.hooks-table-container { overflow-x: auto; }
.hooks-table { width: 100%; border-collapse: collapse; }
.hooks-table th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.hooks-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; }
.hooks-table tr:hover td { background: rgba(255,255,255,0.03); }
.hook-status-badge { font-size: 11px; padding: 3px 10px; border-radius: 10px; font-weight: 600; }
.hook-ready { background: rgba(76,175,80,0.15); color: #4caf50; }
.hook-disabled { background: rgba(158,158,158,0.15); color: #9e9e9e; }
.hook-source-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* Tech Radar */
.tech-radar-container { padding: 0; }
.tech-radar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.tech-radar-header h2 { margin: 0; font-size: 20px; }
.tech-radar-subtitle { font-size: 12px; color: var(--text-muted); }
.tech-radar-count { font-size: 14px; color: var(--text-muted); background: rgba(255,255,255,0.06); padding: 4px 12px; border-radius: 8px; }
.tech-radar-controls { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tech-radar-controls .search-input { flex: 1; min-width: 200px; }
.tech-radar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tech-radar-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }

.radar-card { background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255,255,255,0.03) 100%); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: all 0.2s; }
.radar-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.radar-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.radar-card-title { font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.3; flex: 1; }
.radar-card-score { font-size: 18px; font-weight: 700; white-space: nowrap; }
.radar-card-score small { font-size: 11px; font-weight: 400; opacity: 0.6; }
.radar-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
.radar-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.radar-source-badge { padding: 2px 8px; border-radius: 6px; background: rgba(255,165,0,0.15); color: #ffa500; font-weight: 600; }
.radar-status-badge { padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.radar-status-new { background: rgba(33,150,243,0.15); color: #2196f3; }
.radar-status-alerted { background: rgba(255,152,0,0.16); color: #ffb74d; }
.radar-status-tasked { background: rgba(156,39,176,0.16); color: #ce93d8; }
.radar-status-reviewed { background: rgba(0,188,212,0.16); color: #80deea; }
.radar-status-done { background: rgba(76,175,80,0.15); color: #4caf50; }
.radar-status-watching { background: rgba(255,193,7,0.15); color: #ffc107; }
.radar-status-implemented { background: rgba(76,175,80,0.15); color: #4caf50; }
.radar-status-archived { background: rgba(158,158,158,0.15); color: #9e9e9e; }

/* Tech Radar Sources */
.radar-sources-section { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px; }
.radar-sources-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.radar-sources-header h3 { margin: 0; font-size: 16px; }
.radar-source-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255,255,255,0.02) 100%); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; transition: all 0.2s; }
.radar-source-item:hover { border-color: var(--accent); }
.radar-source-disabled { opacity: 0.5; }
.radar-source-info { display: flex; align-items: center; gap: 12px; }
.radar-source-emoji { font-size: 24px; }
.radar-source-name { font-weight: 600; font-size: 14px; }
.radar-source-type { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.radar-source-actions { display: flex; gap: 6px; }
.action-btn-sm { padding: 4px 8px !important; font-size: 12px !important; min-width: unset !important; }
.action-btn-danger:hover { background: rgba(244,67,54,0.2) !important; border-color: #f44336 !important; }
.radar-add-source-form { background: rgba(0,0,0,0.3); border: 1px solid var(--accent); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.radar-form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.radar-form-row label { min-width: 140px; font-size: 13px; color: var(--text-muted); }
.radar-form-row input, .radar-form-row select { flex: 1; padding: 8px 12px; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.radar-form-row input:focus, .radar-form-row select:focus { border-color: var(--accent); outline: none; }
.radar-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Prompts Two-Column Layout */
.prompts-two-col { display: flex; height: calc(100vh - 160px); gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.prompts-sidebar { width: 260px; min-width: 260px; background: rgba(0,0,0,0.2); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.prompts-sidebar-header { padding: 14px 16px; font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.prompts-count { background: var(--accent); color: #000; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 700; }
.prompts-list { flex: 1; overflow-y: auto; }
.prompt-list-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.03); transition: all 0.15s; }
.prompt-list-item:hover { background: rgba(255,255,255,0.04); }
.prompt-list-item.active { background: rgba(255,165,0,0.1); border-left: 3px solid var(--accent); }
.prompt-list-icon { font-size: 18px; flex-shrink: 0; }
.prompt-list-info { min-width: 0; }
.prompt-list-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt-list-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompts-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.prompts-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 8px; }
.prompts-placeholder-icon { font-size: 48px; opacity: 0.3; }
.prompt-content-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: rgba(0,0,0,0.15); }
.prompt-content-title { font-weight: 600; font-size: 15px; }
.prompt-content-actions { display: flex; gap: 6px; }
.prompt-content-body { flex: 1; overflow-y: auto; padding: 20px; }
.prompts-content .prompt-editor { flex: 1; margin: 0; border-radius: 0; border: none; border-top: none; resize: none; }
.prompts-content .prompt-history-list { flex: 1; overflow-y: auto; padding: 16px; }

/* ==================== Workers & Jobs ==================== */
.workers-container { padding: 0; }
.workers-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.workers-header h2 { margin: 0; font-size: 20px; }
.workers-header-actions { display: flex; gap: 8px; }
.workers-stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.workers-subtabs { margin-bottom: 0; }
#tab-workers .agents-subtab-content { padding-top: 16px; }

/* ==================== Signals & Health ==================== */
.signals-container { padding: 0; }
.signals-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.signals-header h2 { margin: 0; font-size: 20px; }
.signals-header-actions { display: flex; gap: 8px; }
.signals-stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.signals-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; min-height: calc(100vh - 280px); }
.signals-main { overflow-y: auto; }
.signals-sidebar { display: flex; flex-direction: column; gap: 16px; }
.signals-patterns-panel, .signals-health-panel, .signals-resources-panel, .signals-research-panel {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.signals-patterns-panel h3, .signals-health-panel h3, .signals-resources-panel h3, .signals-research-panel h3 {
    margin: 0 0 12px; font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}

/* Signal Timeline */
.signal-timeline-item { padding: 12px 16px; border-left: 3px solid var(--border); margin-bottom: 8px; background: rgba(255,255,255,0.02); border-radius: 0 8px 8px 0; transition: all 0.2s; }
.signal-timeline-item:hover { background: rgba(255,255,255,0.04); }
.signal-timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.signal-timeline-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.signal-timeline-time { font-size: 11px; color: var(--text-muted); }
.signal-timeline-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.signal-timeline-detail { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.signal-timeline-meta { display: flex; align-items: center; gap: 8px; }
.signal-source-badge { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--text-muted); }
.signal-resolved-badge { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(76,175,80,0.15); color: #4caf50; }

/* Pattern rows */
.pattern-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pattern-name { font-size: 12px; color: var(--text); }
.pattern-count { font-size: 13px; font-weight: 700; color: var(--accent); min-width: 30px; text-align: right; }

/* Health checks */
.health-check-row { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.health-check-status { margin-right: 8px; }
.health-check-name { font-size: 13px; font-weight: 600; }
.health-check-issues { margin-top: 4px; padding-left: 28px; }
.health-issue { font-size: 11px; color: var(--danger); margin-bottom: 2px; }

/* Resource bars */
.resource-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.resource-bar-row > span:first-child { min-width: 35px; color: var(--text-muted); }
.resource-bar-row > span:last-child { min-width: 80px; text-align: right; font-size: 11px; color: var(--text-muted); }
.resource-bar { flex: 1; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.resource-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.resource-history-chart {
    margin: -2px 0 10px 43px;
    padding: 6px 8px 4px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
}
.resource-history-chart svg {
    width: 100%;
    height: 44px;
    display: block;
}
.resource-history-grid {
    stroke: rgba(255,255,255,0.08);
    stroke-width: 1;
    fill: none;
}
.resource-history-line {
    stroke-width: 2.25;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.resource-history-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.research-cache-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 10px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.research-cache-list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow-y: auto; }
.research-cache-item {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
}
.research-cache-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.research-cache-title { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.research-cache-badge { font-size: 10px; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
.research-cache-badge.is-acted { color: #4caf50; border-color: rgba(76,175,80,0.35); background: rgba(76,175,80,0.12); }
.research-cache-badge.is-pending { color: #ffb74d; border-color: rgba(255,183,77,0.35); background: rgba(255,183,77,0.12); }
.research-cache-thesis { margin-top: 4px; font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.research-cache-meta-row { margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--text-muted); }

@media (max-width: 900px) {
    .signals-layout { grid-template-columns: 1fr; }
}

/* Tech Radar AI Summary */
.radar-card-ai-summary { font-size: 12px; color: var(--accent); margin-bottom: 6px; padding: 6px 10px; background: rgba(255,165,0,0.06); border-radius: 6px; border-left: 2px solid var(--accent); line-height: 1.4; }

/* Fix Now / Create Task buttons */
.action-btn-fix { background: linear-gradient(135deg, rgba(255,165,0,0.2), rgba(255,100,0,0.15)) !important; border-color: rgba(255,165,0,0.4) !important; color: #ffa500 !important; }
.action-btn-fix:hover { background: linear-gradient(135deg, rgba(255,165,0,0.35), rgba(255,100,0,0.25)) !important; }
.action-btn-muted { opacity: 0.6; }
.action-btn-muted:hover { opacity: 1; }
.action-btn-sm { font-size: 11px !important; padding: 3px 10px !important; }

/* Tech Radar v2 — enhanced cards */
.radar-card-hot { border-color: rgba(76,175,80,0.3) !important; box-shadow: 0 0 12px rgba(76,175,80,0.08) !important; }
.radar-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.radar-card-title-wrap { display: flex; align-items: flex-start; gap: 8px; flex: 1; min-width: 0; }
.radar-card-source-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.radar-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.radar-card-score-wrap { display: flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 8px; flex-shrink: 0; min-width: 48px; }
.radar-card-score { font-size: 20px; font-weight: 800; line-height: 1; }
.radar-card-score-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.radar-card-stats { display: flex; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.radar-stat-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.05); color: var(--text-muted); white-space: nowrap; }
.radar-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.radar-card-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.radar-tag { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: rgba(255,165,0,0.1); color: var(--accent); }
.radar-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-bottom: 4px; }

/* ==================== Tech Radar: Action Trail Badges ==================== */
.radar-card-actions { display: flex; gap: 6px; padding: 0 0 4px 0; flex-wrap: wrap; }
.radar-action-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0.3px; }
.radar-action-alerted { background: rgba(255,152,0,0.15); color: #ff9800; border: 1px solid rgba(255,152,0,0.25); }
.radar-action-tasked { background: rgba(33,150,243,0.15); color: #2196f3; border: 1px solid rgba(33,150,243,0.25); }

/* ==================== Tech Radar: Actions Log ==================== */
.radar-actions-log { margin-top: 24px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.radar-actions-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.radar-actions-header h3 { margin: 0; font-size: 14px; color: var(--text-primary); }
.radar-actions-list { max-height: 300px; overflow-y: auto; }
.radar-action-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.radar-action-row:last-child { border-bottom: none; }
.radar-action-icon { font-size: 14px; flex-shrink: 0; }
.radar-action-label { font-weight: 600; color: var(--text-secondary); min-width: 100px; flex-shrink: 0; }
.radar-action-title { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radar-action-score { font-weight: 700; color: var(--success); min-width: 30px; text-align: right; }
.radar-action-time { color: var(--text-muted); font-size: 11px; min-width: 120px; text-align: right; }

/* ==================== Agent Dispatch Button ==================== */
.action-btn-dispatch { background: rgba(156,39,176,0.15) !important; color: #ce93d8 !important; border: 1px solid rgba(156,39,176,0.3) !important; font-weight: 600; }
.action-btn-dispatch:hover { background: rgba(156,39,176,0.3) !important; }

/* ==================== Dispatch Log ==================== */
.dispatch-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px; transition: background 0.2s; }
.dispatch-row:hover { background: rgba(255,255,255,0.02); }
.dispatch-row:last-child { border-bottom: none; }
.dispatch-running { border-left: 3px solid #ff9800; }
.dispatch-done { border-left: 3px solid var(--success); }
.dispatch-pending { border-left: 3px solid var(--text-muted); }
.dispatch-status { font-size: 16px; flex-shrink: 0; }
.dispatch-title { flex: 1; color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-source { color: var(--text-muted); font-size: 11px; padding: 2px 6px; background: rgba(255,255,255,0.05); border-radius: 4px; }
.dispatch-task { color: var(--accent); font-family: monospace; font-size: 11px; }
.dispatch-time { color: var(--text-muted); font-size: 11px; min-width: 130px; text-align: right; }

/* ==================== Dispatch Pulse Animation ==================== */
@keyframes dispatch-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.dispatch-pulse { animation: dispatch-pulse 1.5s ease-in-out infinite; }
.dispatch-info { flex: 1; min-width: 0; }
.dispatch-output { font-size: 11px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }

/* ==================== Signal Dispatch Summary ==================== */
.signal-dispatch-summary { background: rgba(156,39,176,0.08); border: 1px solid rgba(156,39,176,0.2); border-radius: 8px; padding: 8px 12px; margin-top: 6px; }
.signal-dispatch-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.signal-dispatch-badge { font-size: 11px; font-weight: 700; color: #ce93d8; background: rgba(156,39,176,0.15); padding: 2px 8px; border-radius: 6px; }
.signal-dispatch-task { font-size: 10px; font-family: monospace; color: var(--accent); background: rgba(255,165,0,0.1); padding: 2px 6px; border-radius: 4px; }
.signal-dispatch-duration { font-size: 10px; color: var(--success); font-weight: 600; }
.signal-dispatch-output { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ===== CONTROL TOWER ===== */
.ct-grid { display:flex; flex-direction:column; gap:16px; }

/* Hero metrics row */
.ct-hero {
    display:grid; grid-template-columns:repeat(6,1fr); gap:12px;
}
.ct-metric {
    background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
    padding:16px; text-align:center; cursor:pointer;
    transition:all 0.2s; position:relative; overflow:hidden;
}
.ct-metric::before {
    content:''; position:absolute; top:0; left:0; right:0; height:3px;
    background:linear-gradient(90deg, var(--accent), #ff8e53); opacity:0;
    transition:opacity 0.2s;
}
.ct-metric:hover { border-color:var(--border-active); transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.2); }
.ct-metric:hover::before { opacity:1; }
.ct-metric-value { font-size:28px; font-weight:700; color:var(--text-primary); line-height:1.1; }
.ct-metric-label { font-size:12px; font-weight:600; color:var(--text-secondary); margin-top:4px; }
.ct-metric-sub { font-size:10px; color:var(--text-muted); margin-top:2px; }

/* Cards */
.ct-card {
    background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
    overflow:hidden;
}
.ct-card-header {
    display:flex; justify-content:space-between; align-items:center;
    padding:12px 16px; border-bottom:1px solid var(--border);
}
.ct-card-title { font-size:13px; font-weight:600; color:var(--text-primary); }

/* Status badge */
.ct-status-badge {
    font-size:11px; font-weight:600; padding:2px 10px; border-radius:12px;
    background:rgba(34,197,94,0.15); color:#22c55e;
}
.ct-badge-warn {
    font-size:11px; font-weight:600; padding:2px 10px; border-radius:12px;
    background:rgba(245,158,11,0.2); color:#f59e0b;
}
.ct-health-grid { padding:10px 16px; }

/* Row 2: System + Attention */
.ct-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.ct-attention-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; padding:12px 16px; }
.ct-attention-col {}
.ct-section-label {
    font-size:10px; font-weight:700; color:var(--text-muted); text-transform:uppercase;
    letter-spacing:0.5px; margin-bottom:6px;
}

/* Row 3: Feed + Quick Nav */
.ct-row-3 { display:grid; grid-template-columns:2fr 1fr; gap:16px; }

/* Feed tabs */
.ct-feed-tabs { display:flex; gap:2px; background:var(--bg-void); border-radius:6px; padding:2px; }
.ct-feed-tab {
    background:none; border:none; color:var(--text-muted); font-size:11px; font-weight:600;
    padding:4px 12px; border-radius:4px; cursor:pointer; transition:all 0.15s;
}
.ct-feed-tab.active { background:var(--bg-card); color:var(--text-primary); }
.ct-feed-tab:hover { color:var(--text-primary); }
.ct-feed-filters {
    display:flex; gap:4px; padding:6px 16px; border-bottom:1px solid var(--border);
    align-items:center; flex-wrap:wrap;
}
.ct-feed-content { max-height:400px; overflow-y:auto; }
.ct-source-select {
    font-size:10px; padding:3px 6px; background:var(--bg-elevated); border:1px solid var(--border);
    border-radius:4px; color:var(--text-secondary); margin-left:auto;
}
.ct-icon-btn {
    background:none; border:none; color:var(--text-muted); font-size:16px; cursor:pointer;
    padding:2px 4px; transition:color 0.15s;
}
.ct-icon-btn:hover { color:var(--text-primary); }

/* Quick Nav */
.ct-quick-nav { display:flex; flex-direction:column; }
.ct-actions-row { display:flex; flex-wrap:wrap; gap:6px; }
.ct-action-btn {
    background:var(--bg-card); border:1px solid var(--border); border-radius:6px;
    padding:6px 12px; font-size:11px; color:var(--text-secondary); cursor:pointer;
    transition:all 0.15s; white-space:nowrap;
}
.ct-action-btn:hover { border-color:var(--accent); color:var(--text-primary); background:var(--bg-elevated); }

.ct-nav-cards { display:flex; flex-direction:column; gap:6px; }
.ct-nav-card {
    display:flex; align-items:center; gap:12px; padding:10px 14px;
    background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
    cursor:pointer; transition:all 0.2s;
}
.ct-nav-card:hover { border-color:var(--border-active); transform:translateX(4px); background:var(--bg-elevated); }
.ct-nav-icon { font-size:20px; flex-shrink:0; }
.ct-nav-info { min-width:0; }
.ct-nav-title { font-size:13px; font-weight:600; color:var(--text-primary); }
.ct-nav-desc { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Mobile */
@media (max-width: 768px) {
    .ct-hero { grid-template-columns:repeat(3,1fr); }
    .ct-row-2 { grid-template-columns:1fr; }
    .ct-row-3 { grid-template-columns:1fr; }
    .ct-metric-value { font-size:22px; }
    .ct-metric { padding:12px 8px; }
}
@media (max-width: 480px) {
    .ct-hero { grid-template-columns:repeat(2,1fr); }
}

/* Service Health v2 cards */
.sh-grid-v2 { display:grid; grid-template-columns:repeat(auto-fill, minmax(160px, 1fr)); gap:8px; padding:12px 16px; }
.sh-card-v2 {
    padding:10px 12px; border-radius:6px; transition:transform 0.15s;
}
.sh-card-v2:hover { transform:translateY(-1px); }
.sh-card-v2.service-status-changed {
    animation: stale-pulse 1.4s ease-in-out 2;
    box-shadow: 0 0 0 1px rgba(96,165,250,0.18), 0 0 18px rgba(96,165,250,0.12);
}
.sh-card-top { display:flex; align-items:center; gap:6px; }
.sh-dot-v2 { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.sh-name-v2 { font-size:12px; font-weight:600; color:var(--text-primary); }
.sh-latency { font-size:10px; color:var(--text-muted); margin-left:auto; font-family:monospace; }
.sh-card-detail { font-size:10px; color:var(--text-muted); margin-top:4px; padding-left:14px; }

/* Needs Attention v2 */
.ct-attention { max-height:320px; overflow:hidden; display:flex; flex-direction:column; }
.ct-attention .ct-card-header { flex-shrink:0; }
.ct-attention-grid { flex:1; overflow-y:auto; max-height:240px; }
.ct-attention-col { min-width:0; }
#intel-priorities .priority-item, #intel-blockers .priority-item,
#intel-priorities > div, #intel-blockers > div {
    padding:6px 10px; border-radius:6px; margin-bottom:4px;
    background:var(--bg-elevated); border-left:3px solid var(--border);
    font-size:12px; line-height:1.4; color:var(--text-secondary);
}
#intel-priorities > div { border-left-color:var(--accent); }
#intel-blockers > div { border-left-color:#f59e0b; }

/* ===== MISSION CONTROL TOWER v22 ===== */

/* Scanline background */
/* ═══════════════════ CONTROL TOWER v2 ═══════════════════ */

/* Keyframes */
@keyframes mc-pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
@keyframes mc-glow-pulse { 0%,100%{box-shadow:0 0 4px rgba(255,107,107,0.3);} 50%{box-shadow:0 0 12px rgba(255,107,107,0.6);} }
@keyframes mc-slide-up { from{opacity:0;transform:translateY(12px);} to{opacity:1;transform:translateY(0);} }
@keyframes mc-count-in { from{opacity:0;transform:scale(0.8);} to{opacity:1;transform:scale(1);} }
@keyframes mc-live-pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
@keyframes mc-ring-fill { from{stroke-dashoffset:283;} }
@keyframes ct2-orb-pulse {
    0%,100%{box-shadow:0 0 4px 1px rgba(34,197,94,0.4), 0 0 10px 2px rgba(34,197,94,0.1); transform:scale(0.95);}
    50%{box-shadow:0 0 8px 3px rgba(34,197,94,0.6), 0 0 20px 6px rgba(34,197,94,0.2); transform:scale(1.1);}
}

.ct2 {
    display:flex; flex-direction:column; gap:10px;
    position:relative; animation:mc-slide-up 0.3s ease-out;
    height:calc(100vh - 112px);
    min-height:620px;
}

.ct2-hero {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:0 2px;
    min-height:34px;
}
.ct2-hero-copy {
    display:flex;
    flex-direction:column;
    gap:2px;
}
.ct2-hero-kicker {
    font-size:10px;
    font-weight:700;
    letter-spacing:1px;
    text-transform:uppercase;
    color:var(--accent);
    line-height:1;
}
.ct2-hero-title {
    margin:0;
    font-size:18px;
    line-height:1;
    letter-spacing:-0.02em;
    color:var(--text-primary);
}
.ct2-hero-actions {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    justify-content:flex-end;
}
.ct2-hero-btn {
    display:inline-flex;
    align-items:center;
    gap:8px;
    height:30px;
    padding:0 10px;
    border-radius:999px;
    border:1px solid rgba(255,255,255,0.07);
    background:rgba(255,255,255,0.025);
    color:var(--text-secondary);
    font-size:11px;
    font-weight:600;
    transition:all .18s ease;
    box-shadow:none;
}
.ct2-hero-btn:hover {
    background:rgba(255,255,255,0.05);
    border-color:rgba(255,255,255,0.14);
    color:var(--text-primary);
    transform:none;
}
.ct2-hero-btn--primary {
    background:rgba(79,142,247,0.16);
    border-color:rgba(79,142,247,0.32);
    color:var(--text-primary);
}

/* ── Row 1: Command Strip ── */
.ct2-command-strip {
    display:flex; align-items:stretch; gap:12px;
    background:linear-gradient(180deg, rgba(var(--bg-card-rgb,20,20,25),0.78), rgba(var(--bg-card-rgb,20,20,25),0.64));
    backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
    border:1px solid rgba(255,255,255,0.07); border-radius:14px;
    padding:10px 12px; position:relative; overflow:hidden;
    animation:mc-slide-up 0.3s ease-out;
    box-shadow:0 10px 28px rgba(0,0,0,0.16);
}
.ct2-command-strip::before {
    content:''; position:absolute; top:0; left:0; right:0; height:1px;
    background:linear-gradient(90deg, transparent 5%, rgba(255,107,107,0.4) 50%, transparent 95%);
    pointer-events:none;
}

/* Status Orb */
.ct2-status-orb-wrap {
    display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:6px;
    flex-shrink:0; cursor:pointer;
    min-width:90px;
    padding:8px 9px;
    border-radius:12px;
    background:rgba(255,255,255,0.025);
    border:1px solid rgba(255,255,255,0.05);
}
.ct2-orb {
    width:16px; height:16px; border-radius:50%;
    background:#22c55e;
    animation:ct2-orb-pulse 2s ease-in-out infinite;
    transition:background 0.5s;
    box-shadow:0 0 18px currentColor;
}
.ct2-orb.warn { background:#f59e0b; color:#f59e0b; }
.ct2-orb.critical { background:#ef4444; color:#ef4444; }
.ct2-orb-label {
    font-size:10px; font-weight:800; color:var(--text-secondary);
    letter-spacing:1.2px; font-family:'SF Mono',ui-monospace,monospace;
}

/* Metrics strip */
.ct2-metrics {
    display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:10px; flex:1;
}
.ct2-stat {
    display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:4px;
    min-height:68px;
    padding:10px 12px; border-radius:12px; cursor:pointer;
    transition:all 0.2s; position:relative;
    background:rgba(255,255,255,0.025);
    border:1px solid rgba(255,255,255,0.05);
}
.ct2-stat:hover {
    background:rgba(79,142,247,0.08);
    border-color:rgba(79,142,247,0.22);
    transform:translateY(-1px);
}
.ct2-stat-icon {
    font-size:12px; color:var(--accent); opacity:0.75;
    font-family:'SF Mono',ui-monospace,monospace;
}
.ct2-stat-value {
    font-size:19px; font-weight:800; color:var(--text-primary); line-height:1.05;
    font-family:'SF Mono','Fira Code',ui-monospace,monospace;
    letter-spacing:-0.5px; animation:mc-count-in 0.5s ease-out;
}
.ct2-stat-label {
    font-size:9px; font-weight:700; color:var(--text-muted);
    letter-spacing:1.1px; margin-top:2px;
    font-family:'SF Mono',ui-monospace,monospace;
}

/* ── Row 2: Three-Column Grid ── */
.ct2-main {
    display:grid; grid-template-columns:280px minmax(0, 1fr) 280px; gap:14px;
    align-items:start;
    min-height:0; flex:1;
}
.ct2-col { display:flex; flex-direction:column; gap:14px; min-height:0; overflow:hidden; }
.ct2-col > .mc-card { flex-shrink:0; }
.ct2-col-center .mc-card { flex:1; display:flex; flex-direction:column; flex-shrink:1; }
.ct2-col-center .mc-live-feed {
    flex:1;
    display:flex;
    flex-direction:column;
    min-height:0;
    height:calc(100vh - 220px);
    max-height:calc(100vh - 220px);
}
body.safari-live-feed-mode .ct2-col-center .mc-live-feed {
    height:calc(100dvh - 180px);
    max-height:calc(100dvh - 180px);
    min-height:680px;
}
body.safari-live-feed-mode .ct2-col-center #ct-feed-logs {
    display:flex;
}
body.safari-live-feed-mode .ct2-col-center #log-stream-content {
    display:block;
    padding:12px;
    overflow-y:auto;
}
.ct2-col-center .ct-feed-content {
    flex:1;
    overflow:hidden;
    min-height:0;
    max-height:none;
    display:flex;
    flex-direction:column;
}
.ct2-col-center #ct-feed-logs,
.ct2-col-center #ct-feed-activity { flex:1; min-height:0; }
.ct2-col-center #log-stream-content,
.ct2-col-center #activity-timeline { flex:1; min-height:0; overflow-y:auto; }

/* Pulse body (health ring + services) */
.ct2-pulse-body {
    display:flex; flex-direction:column; align-items:center; gap:12px; padding:14px;
}
.ct2-pulse-body .mc-health-ring-wrap {
    width:112px; height:112px; display:flex; align-items:center; justify-content:center;
}
.ct2-pulse-body .mc-health-services { width:100%; }
.mc-ring-bg {
    fill:none;
    stroke:rgba(255,255,255,0.08);
    stroke-width:9;
}
.mc-ring-fill {
    fill:none;
    stroke-width:9;
    stroke-linecap:round;
    filter:drop-shadow(0 0 10px color-mix(in srgb, currentColor 40%, transparent));
    animation:mc-ring-fill .45s ease-out;
}
.mc-ring-text {
    fill:var(--text-primary);
    font-size:21px;
    font-weight:800;
    font-family:'SF Mono','Fira Code',ui-monospace,monospace;
}
.mc-ring-label {
    fill:var(--text-muted);
    font-size:9px;
    letter-spacing:1.6px;
    text-transform:uppercase;
}

/* Nodes card */
.ct2-nodes-card .ct2-nodes-list { padding:8px 12px; }
.ct2-node-count {
    font-size:11px; font-weight:700; color:var(--text-muted);
    font-family:'SF Mono',ui-monospace,monospace;
}
.ct2-node-pill {
    display:flex; align-items:center; gap:8px; padding:6px 8px;
    border-radius:6px; margin-bottom:4px; transition:background 0.2s;
    font-size:12px; color:var(--text-secondary);
    font-family:'SF Mono',ui-monospace,monospace;
}
.ct2-node-pill:hover { background:rgba(255,255,255,0.04); }
.ct2-node-dot {
    width:6px; height:6px; border-radius:50%; flex-shrink:0;
    box-shadow:0 0 6px currentColor;
}
.ct2-node-dot.online { background:#22c55e; color:#22c55e; }
.ct2-node-dot.offline { background:#ef4444; color:#ef4444; }
.ct2-node-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Model routing card */
.ct2-model-body { padding:14px 14px; display:flex; flex-direction:column; gap:10px; }
.ct2-model-badge {
    font-size:10px; font-weight:700; padding:2px 8px; border-radius:10px;
    background:rgba(255,107,107,0.15); color:#ff8e53; letter-spacing:0.4px;
}
.ct2-model-grid {
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
}
.ct2-model-stat {
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:10px;
    border-radius:12px;
    background:rgba(255,255,255,0.03);
    border:1px solid rgba(255,255,255,0.06);
}
.ct2-model-route {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}
.ct2-model-row { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.ct2-model-label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.8px; }
.ct2-model-value { font-size:11px; color:var(--text-primary); text-align:right; max-width:58%; word-break:break-word; }
.ct2-model-chip {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:4px 8px;
    border-radius:999px;
    border:1px solid rgba(255,255,255,0.08);
    background:rgba(255,255,255,0.04);
    font-family:'SF Mono', ui-monospace, monospace;
    font-size:10px;
    line-height:1.2;
    color:var(--text-primary);
}
.ct2-model-chip-provider {
    color:var(--text-muted);
    text-transform:uppercase;
    letter-spacing:0.06em;
    font-size:9px;
}
.ct2-model-chip.primary {
    border-color:rgba(91,138,255,0.25);
    background:rgba(91,138,255,0.12);
}
.ct2-model-chip.compact {
    border-color:rgba(52,211,153,0.24);
    background:rgba(52,211,153,0.12);
}
.ct2-model-chip.neutral {
    border-color:rgba(255,255,255,0.08);
    background:rgba(255,255,255,0.04);
}
.ct2-model-stack {
    display:flex;
    flex-direction:column;
    gap:6px;
    padding-top:4px;
    border-top:1px solid rgba(255,255,255,0.05);
}
.ct2-model-chain {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
    font-size:10px; color:var(--text-secondary); line-height:1.5;
}
.ct2-model-arrow { color:var(--text-muted); }
.ct2-model-chain code {
    font-family:'SF Mono', ui-monospace, monospace; font-size:10px;
    color:#9bd0ff; background:rgba(91,138,255,0.10); padding:3px 6px; border-radius:999px;
}

/* Runtime resource card */
.ct2-runtime-body { padding:14px 14px; display:flex; flex-direction:column; gap:8px; }
.ct2-runtime-row { display:flex; justify-content:space-between; align-items:center; }
.ct2-runtime-bar {
    width:100%; height:6px; border-radius:999px;
    background:rgba(255,255,255,0.08); overflow:hidden;
    margin-bottom:4px;
}
.ct2-runtime-fill { height:100%; border-radius:999px; transition:width .3s ease; }

/* Actions card */
.ct2-actions-grid {
    display:grid; grid-template-columns:repeat(3,1fr); gap:6px; padding:10px;
}
.ct2-action {
    display:flex; flex-direction:column; align-items:center; gap:4px;
    padding:10px 4px; border-radius:8px; border:1px solid rgba(255,255,255,0.06);
    background:rgba(255,255,255,0.02); color:var(--text-secondary);
    cursor:pointer; font-size:9px; font-weight:600; letter-spacing:0.8px;
    font-family:'SF Mono',ui-monospace,monospace; transition:all 0.2s;
}
.ct2-action span { font-size:16px; }
.ct2-action:hover {
    border-color:rgba(255,107,107,0.4); background:rgba(255,107,107,0.08);
    color:var(--text-primary); transform:translateY(-1px);
    box-shadow:0 4px 12px rgba(255,107,107,0.15);
}

/* Extra stats mini-card */
.ct2-extra-stats { padding:8px; display:grid; gap:8px; }
.ct2-extra-row {
    display:flex; justify-content:space-between; align-items:center;
    padding:12px 14px; cursor:pointer; transition:background 0.2s;
    border:1px solid rgba(255,255,255,0.05);
    border-radius:12px;
    font-family:'SF Mono',ui-monospace,monospace;
    background:rgba(255,255,255,0.02);
}
.ct2-extra-row:hover { background:rgba(255,107,107,0.06); }
.ct2-extra-label { font-size:10px; font-weight:600; color:var(--text-muted); letter-spacing:1px; }
.ct2-extra-val { font-size:16px; font-weight:800; color:var(--text-primary); }

.mc-card {
    border-radius:16px;
    border:1px solid rgba(255,255,255,0.06);
    background:linear-gradient(180deg, rgba(18,20,28,0.9), rgba(13,15,22,0.88));
    box-shadow:0 16px 34px rgba(0,0,0,0.18);
}
.mc-card-header {
    padding:14px 16px;
    border-bottom:1px solid rgba(255,255,255,0.05);
}
.mc-card-title {
    letter-spacing:0.08em;
}
.ct-attention { min-height:0; overflow:hidden; }
.ct-attention-grid {
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    padding:12px;
}
.ct-attention-col {
    min-width:0;
    padding:10px;
    border-radius:12px;
    background:rgba(255,255,255,0.025);
    border:1px solid rgba(255,255,255,0.05);
}
.mc-section-label {
    margin-bottom:8px;
}

#intel-priorities,
#intel-blockers,
#approval-queue-content {
    display:grid;
    gap:8px;
}

#intel-priorities .priority-item,
#intel-blockers .intel-item {
    display:flex;
    align-items:flex-start;
    gap:8px;
    padding:10px;
    margin:0;
    border-radius:10px;
    background:rgba(255,255,255,0.03);
    border:1px solid rgba(255,255,255,0.05);
    border-left-width:3px;
}

.priority-item {
    border-left-color:var(--accent);
}

#intel-blockers .intel-item {
    flex-direction:column;
    border-left-color:#ef4444;
}

.priority-title,
.intel-item-topic {
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    line-height:1.4;
}

.priority-category,
.intel-item-meta {
    font-size:10px;
}

.aq-grid {
    grid-template-columns:1fr;
    max-height:none;
    overflow:visible;
    padding:0 12px 12px;
}
.aq-card {
    border-radius:12px;
    background:rgba(255,255,255,0.025);
}

.ct-feed-tabs,
.mc-feed-tabs,
.ct-feed-tab,
.mc-feed-tab,
.ct-feed-filters,
.mc-feed-filters,
.ct-source-select,
.mc-source-select,
.ct-icon-btn,
.mc-icon-btn {
    font-family:inherit;
}

.ct-feed-tabs,
.mc-feed-tabs {
    display:flex;
    align-items:center;
    gap:4px;
    padding:3px;
    border-radius:999px;
    background:rgba(255,255,255,0.04);
    border:1px solid rgba(255,255,255,0.05);
}
.ct-feed-tab,
.mc-feed-tab {
    background:none;
    border:none;
    color:var(--text-muted);
    cursor:pointer;
    padding:5px 10px;
    border-radius:999px;
    font-size:10px;
    letter-spacing:0.08em;
}
.ct-feed-tab.active,
.mc-feed-tab.active {
    background:rgba(79,142,247,0.18);
}
.ct-feed-filters,
.mc-feed-filters {
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:6px;
    padding:8px 12px;
    justify-content:flex-end;
}
.log-filter-btn {
    padding:4px 9px;
    border-radius:999px;
    font-size:10px;
}
.ct-source-select,
.mc-source-select {
    min-height:28px;
    border-radius:999px;
    padding:4px 10px;
    margin-left:auto;
}
.ct-icon-btn,
.mc-icon-btn {
    width:28px;
    height:28px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:rgba(255,255,255,0.04);
    border:1px solid rgba(255,255,255,0.05);
    color:var(--text-secondary);
    cursor:pointer;
}

.log-stream-content {
    display:block;
    height:100%;
    max-height:none !important;
    padding:0 !important;
    overflow-y:auto;
}

.log-feed-list {
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:12px 12px 18px;
}

.log-entry {
    margin:0;
    padding:12px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,0.06);
    background:linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.log-entry.level-error {
    border-color:rgba(239,68,68,0.28);
    background:linear-gradient(180deg, rgba(239,68,68,0.10), rgba(255,255,255,0.02));
}

.log-entry.level-warning,
.log-entry.level-warn {
    border-color:rgba(245,158,11,0.26);
    background:linear-gradient(180deg, rgba(245,158,11,0.10), rgba(255,255,255,0.02));
}

.log-entry-topline,
.log-entry-meta {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
}

.log-entry-meta {
    justify-content:flex-start;
    flex-wrap:wrap;
}

.log-icon {
    font-size:13px;
    opacity:0.9;
}

.log-pill {
    display:inline-flex;
    align-items:center;
    padding:2px 7px;
    border-radius:999px;
    font-size:10px;
    font-weight:700;
    letter-spacing:0.05em;
    text-transform:uppercase;
}

.log-pill.source {
    background:rgba(255,255,255,0.06);
    color:var(--text-secondary);
}

.log-pill.level.info {
    background:rgba(59,130,246,0.14);
    color:#93c5fd;
}

.log-pill.level.warning,
.log-pill.level.warn {
    background:rgba(245,158,11,0.16);
    color:#fbbf24;
}

.log-pill.level.error {
    background:rgba(239,68,68,0.16);
    color:#fca5a5;
}

.log-title {
    margin-top:8px;
    font-size:12px;
    line-height:1.45;
    color:var(--text-primary);
    white-space:normal;
    word-break:break-word;
}

.log-detail {
    margin-top:6px;
    font-size:11px;
    line-height:1.5;
    color:var(--text-muted);
    white-space:normal;
    word-break:break-word;
}

.log-time {
    font-size:10px;
    color:var(--text-muted);
    white-space:nowrap;
}

.ct2-footer-minimal {
    display:flex;
    align-items:center;
    justify-content:flex-start;
    min-height:18px;
    padding:0 2px;
}

.ct2-footer,
.ct2-footer-actions,
.ct2-footer-btn,
.ct2-footer-link,
.ct2-footer-sep {
    display:none !important;
}

@media (max-width: 1200px) {
    .ct2-hero { align-items:flex-start; flex-direction:column; }
    .ct2-hero-actions { justify-content:flex-start; }
    .ct2-metrics { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .ct2-main { grid-template-columns:1fr; }
    .ct2 { height:auto; min-height:0; }
    .ct2-col { overflow:visible; }
    .ct2-col-center .mc-live-feed { height:560px; max-height:560px; }
}

@media (max-width: 720px) {
    .ct2-hero-title { font-size:24px; }
    .ct2-command-strip { padding:12px; }
    .ct2-status-orb-wrap { min-width:auto; width:100%; }
    .ct2-command-strip { flex-direction:column; align-items:stretch; }
    .ct2-metrics { grid-template-columns:1fr; }
    .ct2-stat { min-height:76px; }
}

/* ═══════════════════════════════════════════════════════════════
   MISSION CONTROL — Command Center Redesign
═══════════════════════════════════════════════════════════════ */

/* Animations */
@keyframes mc-pulse {
    0%,100% { opacity:1; box-shadow:0 0 7px currentColor; }
    50% { opacity:0.45; box-shadow:none; }
}
@keyframes mc-beam {
    0%,100% { opacity:0.5; }
    50% { opacity:1; }
}
@keyframes mc-scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

.task-list-category {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.task-list-source {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--text-secondary);
    border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}


.task-list-todo-badge {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.24);
}

.task-list-age {
    color: var(--text-muted);
    min-width: 62px;
    text-align: right;
    padding: 0;
}

.tasks-load-more-bar,
.tasks-list-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 10px;
    flex-shrink: 0;
    min-height: 0;
}

.tasks-load-more-meta,
.tasks-list-footer-meta {
    font-size: 11px;
    color: var(--text-muted);
}


/* Nightly mobile responsive pass (task dfabb125) */
@media (max-width: 600px) {
    .topbar { flex-wrap: wrap; gap: 8px; }
    .topbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .last-update-inline { width: 100%; margin-left: 0; justify-content: space-between; }
    .section-update-map { max-width: 56vw; }
    .refresh-interval-select { order: 2; }
    #auto-refresh-toggle { order: 1; }
    .refresh-countdown { min-width: 24px; }

    .kanban-board { grid-template-columns: 1fr; }
    .kanban-column { min-height: 240px; }
    .agents-subtabs { overflow-x: auto; }

    .signal-timeline-header,
    .signal-timeline-meta,
    .research-cache-item-top,
    .research-cache-meta-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .signals-sidebar { gap: 12px; }
    .signals-patterns-panel, .signals-health-panel, .signals-resources-panel, .signals-research-panel {
        padding: 12px;
    }

    .session-list-panel,
    .session-detail-panel,
    .workers-container,
    .signals-container {
        min-width: 0;
    }

    .panel-content {
        overflow-x: auto;
    }
}

/* Clone source filter toolbar in Tasks tab */
.tasks-source-pills {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.tasks-source-pills label {
    font-size: 10px;
    opacity: 0.6;
    white-space: nowrap;
}

.market-ticker-panel {
  margin: 14px 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  overflow: hidden;
}
.market-ticker-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.market-ticker-shell {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}
.market-ticker-track { min-height: 34px; display:flex; align-items:center; }
.market-ticker-marquee {
  display: inline-flex;
  gap: 10px;
  white-space: nowrap;
  align-items: center;
  animation: marketTickerScroll 32s linear infinite;
}
.market-ticker-track:hover .market-ticker-marquee { animation-play-state: paused; }
.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}
.ticker-pill.up { border-color: rgba(34,197,94,0.35); }
.ticker-pill.down { border-color: rgba(239,68,68,0.35); }
.ticker-label { font-weight: 600; color: var(--text); }
.ticker-value { color: var(--text-muted); }
.market-ticker-empty { color: var(--text-muted); font-size: 12px; }
@keyframes marketTickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.signals-thresholds-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel-bg);
}
.signals-thresholds-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
}
.threshold-grid {
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
.threshold-card {
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.threshold-title { font-size:12px; font-weight:700; }
.threshold-row { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:12px; color:var(--text-muted); }
.threshold-row input {
  width:68px;
  padding:6px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
}
.threshold-hint { margin-top:10px; font-size:11px; color:var(--text-muted); }
.alert-builder-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.alert-builder-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.alert-delivery-grid,
.alert-webhook-events {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.alert-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.alert-toggle.compact {
  padding: 6px 8px;
}
.alert-webhook-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.alert-webhook-url {
  grid-column: 1 / -1;
}
.alert-webhook-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.alert-webhook-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
}
.alert-webhook-actions {
  margin-top: 10px;
}
.resource-threshold-alerts { margin-top:8px; display:flex; flex-direction:column; gap:6px; }
.resource-threshold-alert { font-size:11px; color:#fbbf24; }

.audit-trail-item {
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.audit-trail-item:last-child { border-bottom:none; }
.audit-trail-icon {
  width:32px; height:32px; border-radius:10px; display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,0.05); flex:0 0 32px;
}
.audit-trail-body { min-width:0; }
.audit-trail-title { font-size:13px; font-weight:600; color:var(--text); margin-bottom:2px; }
.audit-trail-meta { font-size:11px; color:var(--text-muted); }

@media (max-width: 900px) {
  .threshold-grid { grid-template-columns: 1fr; }
  .alert-webhook-grid { grid-template-columns: 1fr; }
  .market-ticker-header { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   Trading Calendar (Task 28db3345)
   ========================================================= */
.tc-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.tc-summary-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tc-timeline {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tc-date-group {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.tc-date-group.tc-today {
  border-color: var(--accent-primary);
  background: rgba(74, 108, 247, 0.05);
}
.tc-date-group.tc-soon {
  border-color: rgba(245, 158, 11, 0.4);
}
.tc-date-label {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-today .tc-date-label { color: var(--accent-primary); }
.tc-soon-badge {
  background: rgba(245,158,11,0.2);
  color: #f59e0b;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.tc-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}
.tc-event-card {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  transition: background 0.15s;
}
.tc-event-card:hover { background: rgba(255,255,255,0.05); }
.tc-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tc-event-icon { font-size: 14px; }
.tc-event-title { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; }
.tc-event-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.7;
}
.tc-event-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.tc-event-meta span {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 2px 6px;
  border-radius: 4px;
}

/* =========================================================
   File Diff Viewer (Task b7246468)
   ========================================================= */
.filebrowser-content pre {
  padding: 12px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  color: var(--text-primary);
}
#fb-diff-output {
  flex: 1;
  overflow: auto;
  max-height: calc(100vh - 200px);
}

/* =========================================================
   UI polish batch: messages, users, agents, light-mode fit
   ========================================================= */
.message-item {
  border-radius: 14px;
}

.message-header {
  flex-wrap: wrap;
}

.message-meta {
  margin-left: auto;
  min-width: 0;
}

.message-meta .tokens {
  border: 1px solid var(--border);
}

.message-content {
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.tool-call,
.tool-result-item,
.subagent-card,
.agent-card,
.session-item,
.history-item {
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.agent-card,
.subagent-card,
.session-item,
.history-item,
.tool-call,
.tool-result-item {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.agent-card:hover,
.subagent-card:hover,
.session-item:hover,
.history-item:hover,
.tool-call:hover,
.tool-result-item:hover {
  transform: translateY(-1px);
}

.agent-card-header,
.subagent-card-header {
  align-items: flex-start;
}

.agent-card-stats {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%);
}

.role-badge,
.status-badge,
.model-badge,
.session-duration-badge,
.tool-call-toggle,
.bookmark-btn {
  backdrop-filter: blur(10px);
}

.bookmark-btn {
  border: 1px solid transparent;
}

.bookmark-btn:hover,
.bookmark-btn.bookmarked {
  border-color: var(--border);
}

[data-theme="light"] .message-content {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #dbe5f1;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .message-content.user-content {
  border-left-color: #3b82f6;
}

[data-theme="light"] .message-content.assistant-content {
  border-left-color: #10b981;
}

[data-theme="light"] .tool-call {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #dbe5f1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .tool-call-header,
[data-theme="light"] .tool-result-header,
[data-theme="light"] .agent-card-stats {
  background: rgba(148, 163, 184, 0.08);
}

[data-theme="light"] .tool-call-toggle,
[data-theme="light"] .bookmark-btn,
[data-theme="light"] .message-meta .tokens,
[data-theme="light"] .model-badge {
  background: #ffffff;
  border-color: #dbe5f1;
  color: #334155;
}

[data-theme="light"] .tool-call-toggle:hover,
[data-theme="light"] .bookmark-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

[data-theme="light"] .bookmark-btn.bookmarked {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

[data-theme="light"] .role-badge.user {
  background: rgba(59,130,246,0.12);
  color: #1d4ed8;
}

[data-theme="light"] .role-badge.assistant {
  background: rgba(16,185,129,0.12);
  color: #047857;
}

[data-theme="light"] .role-badge.tool {
  background: rgba(236,72,153,0.12);
  color: #be185d;
}

[data-theme="light"] .session-item,
[data-theme="light"] .history-item,
[data-theme="light"] .agent-card,
[data-theme="light"] .subagent-card,
[data-theme="light"] .tool-result-item {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #dbe5f1;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .session-item:hover,
[data-theme="light"] .history-item:hover,
[data-theme="light"] .agent-card:hover,
[data-theme="light"] .subagent-card:hover,
[data-theme="light"] .tool-result-item:hover {
  border-color: #c7d2fe;
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.10);
}

[data-theme="light"] .history-item.selected,
[data-theme="light"] .session-item.active,
[data-theme="light"] .session-item[data-active="true"] {
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #a5b4fc;
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.14);
}

[data-theme="light"] .agents-subtab {
  border: 1px solid transparent;
}

[data-theme="light"] .agents-subtab.active {
  border-color: rgba(99,102,241,0.24);
  box-shadow: 0 8px 20px rgba(99,102,241,0.16);
}

[data-theme="light"] .status-badge.completed {
  background: rgba(16,185,129,0.12);
  color: #047857;
}

[data-theme="light"] .status-badge.running {
  background: rgba(59,130,246,0.12);
  color: #1d4ed8;
}

[data-theme="light"] .status-badge.error {
  background: rgba(239,68,68,0.12);
  color: #b91c1c;
}

.agent-type-group {
  margin-bottom: 14px;
}

.agent-type-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-bg);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
}

.agent-type-group-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.agent-type-group-title {
  font-weight: 700;
}

.agent-type-group-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.task-timing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-timing-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  font-size: 12px;
}

.task-timing-chip.compact {
  padding: 3px 8px;
  font-size: 11px;
}

.task-timing-chip.planned { color: #f59e0b; }
.task-timing-chip.in-progress { color: #38bdf8; }
.task-timing-chip.done { color: #22c55e; }
.task-timing-chip.cancelled { color: #ef4444; }

.task-timing-timeline {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.task-timing-event {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.task-timing-event-status {
  color: var(--text-primary);
  font-weight: 600;
  text-transform: capitalize;
}

.loading-card-stack {
  display: grid;
  gap: 10px;
}

/* 2026-04-28 Projects board visual reset: calm operator UI, not carnival kanban. */
#tab-tasks .agents-tab-container {
    gap: 14px;
}

#tab-tasks .agents-subtabs {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 5px;
    width: fit-content;
}

#tab-tasks .agents-subtab {
    border-radius: 10px;
    padding: 7px 12px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

#tab-tasks .agents-subtab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    box-shadow: none;
}

#subtab-tasks-board .kanban-board {
    gap: 14px;
    padding: 0;
    overflow: hidden;
}

#subtab-tasks-board .kanban-column {
    background: rgba(15, 15, 22, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    box-shadow: none;
}

#subtab-tasks-board .kanban-column-header {
    min-height: 48px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.026);
    border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

#subtab-tasks-board .kanban-column-title {
    font-size: 13px;
    font-weight: 760;
    letter-spacing: -0.01em;
}

#subtab-tasks-board .kanban-column-count {
    min-width: 28px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-muted);
    box-shadow: none;
}

#subtab-tasks-board .kanban-column-content {
    padding: 10px;
    gap: 8px;
}

#subtab-tasks-board .task-card {
    border-radius: 12px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.065);
    box-shadow: none;
    transform: none;
}

#subtab-tasks-board .task-card:hover {
    transform: translateY(-1px);
    border-color: rgba(125, 165, 255, 0.35);
    background: rgba(255, 255, 255, 0.052);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

#subtab-tasks-board .kanban-column[data-status="planned"] .task-card,
#subtab-tasks-board .kanban-column[data-status="in-progress"] .task-card,
#subtab-tasks-board .kanban-column[data-status="done"] .task-card {
    border-left-width: 2px;
}

#subtab-tasks-board .task-card-header {
    gap: 10px;
    margin-bottom: 7px;
}

#subtab-tasks-board .task-card-title {
    font-size: 13px;
    line-height: 1.35;
    font-weight: 650;
    color: var(--text);
    letter-spacing: -0.01em;
}

#subtab-tasks-board .task-card-type,
#subtab-tasks-board .task-card-priority,
#subtab-tasks-board .task-card-category-badge,
#subtab-tasks-board .task-sprint-badge,
#subtab-tasks-board .task-card-due,
#subtab-tasks-board .task-estimated-hours,
#subtab-tasks-board .task-time-complete,
#subtab-tasks-board .task-age,
#subtab-tasks-board .task-cycle-time,
#subtab-tasks-board .task-column-time,
#subtab-tasks-board .task-git-badge,
#subtab-tasks-board .task-duration,
#subtab-tasks-board .task-card-todos,
#subtab-tasks-board .task-card-session-link {
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 650;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.055);
    color: var(--text-muted);
    box-shadow: none;
    letter-spacing: 0;
}

#subtab-tasks-board .task-card-meta-row {
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

#subtab-tasks-board .task-card-input,
#subtab-tasks-board .task-card-output,
#subtab-tasks-board .task-card-desc,
#subtab-tasks-board .task-card-parent,
#subtab-tasks-board .task-card-children {
    border-radius: 9px;
    padding: 6px 8px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.045);
    color: var(--text-muted);
}

#subtab-tasks-board .task-card-footer {
    margin-top: 8px;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.045);
    gap: 8px;
}

#subtab-tasks-board .task-card-dates {
    opacity: 0.76;
}

#subtab-tasks-board .empty-state {
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 28px 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.018);
}

#subtab-tasks-board .load-more-btn,
.tasks-load-more-bar .load-more-btn {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    box-shadow: none;
}

.ct2-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ct2-quick-actions .action-btn {
    justify-content: center;
    min-height: 34px;
}

.shortcut-grid {
    display: grid;
    gap: 10px;
}

.shortcut-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 14px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
}

.shortcut-row kbd {
    display: inline-flex;
    justify-content: center;
    border-radius: 8px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 12px;
}

.shortcut-hint {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.pull-refresh-indicator {
    position: fixed;
    top: -46px;
    left: 50%;
    z-index: 10000;
    transform: translate(-50%, 0);
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 17, 22, 0.92);
    color: var(--text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
    font-size: 12px;
    font-weight: 650;
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.tab-error-boundary {
    margin: 12px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(248, 81, 73, 0.35);
    border-radius: 12px;
    background: rgba(248, 81, 73, 0.10);
    color: var(--text);
}

@media (max-width: 640px) {
    .ct2-quick-actions,
    .shortcut-row {
        grid-template-columns: 1fr;
    }
}
