/* ─────────────────────────────────────────────────────────
   Mission Briefing Panel
   ───────────────────────────────────────────────────────── */

/* Mission Briefing button in header */
.mission-briefing-btn {
    font-size: 14px !important;
    font-weight: 600;
    padding: 6px 14px !important;
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
    color: #a78bfa !important;
}

.mission-briefing-btn:hover {
    background: rgba(139, 92, 246, 0.3) !important;
    border-color: var(--accent-purple) !important;
    color: #fff !important;
}

/* Panel overlay + slide-in */
.mission-briefing-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: min(1040px, 95vw);
    min-width: 400px;
    max-width: 95vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

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

.mission-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.mission-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mission-panel-body::-webkit-scrollbar {
    width: 5px;
}

.mission-panel-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

.mission-panel-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Section labels */
.mission-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

/* Textarea */
.mission-textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 12px 14px;
    resize: vertical;
    min-height: 280px;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.5;
    width: 100%;
}

.mission-textarea:focus {
    border-color: var(--accent-blue);
}

/* Agent select dropdown */
.mission-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    width: 100%;
}

.mission-select:focus {
    border-color: var(--accent-blue);
}

/* Label row met guided toggle */
.mission-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}
.mission-label-row .mission-label { margin-bottom: 0; }

.mission-guide-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.mission-guide-toggle:hover,
.mission-guide-toggle.active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(59,130,246,0.08);
}

/* ── Guided Mode ─────────────────────────────── */
.mission-guided-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 280px;
}

.guided-progress {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.guided-question {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.guided-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guided-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
}
.guided-option:hover {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.08);
}
.guided-option.selected {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.15);
    color: #fff;
}
.guided-option-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-top: 1px;
}
.guided-option:hover .guided-option-num,
.guided-option.selected .guided-option-num {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.guided-anders {
    display: flex;
    gap: 8px;
    align-items: center;
}
.guided-anders-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-blue);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    font-family: inherit;
}
.guided-anders-btn {
    background: var(--accent-blue);
    border: none;
    border-radius: 7px;
    color: #fff;
    font-size: 16px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.guided-anders-btn:hover { background: #2563eb; }

.guided-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.guided-build-btn {
    flex: 1;
    background: var(--accent-green);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.guided-build-btn:hover { background: #059669; }

.guided-restart-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 11px 14px;
    cursor: pointer;
}
.guided-restart-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.guided-building {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}
.guided-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Clarify button ───────────────────────────── */
.mission-clarify-btn {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 11px 16px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mission-clarify-btn:hover:not(:disabled) {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(59,130,246,0.06);
    border-style: solid;
}
.mission-clarify-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Enquête ──────────────────────────────────── */
.mission-enquete {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}
.mission-enquete-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-secondary);
}
.mission-enquete-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.mission-enquete-sub   { font-size: 11px; color: var(--text-secondary); }

.mission-enquete-questions {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Één vraag-blok */
.enquete-question-block {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.enquete-question-block:last-child { border-bottom: none; }

.enquete-q-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}
.enquete-q-num {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}
.enquete-options {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.enquete-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-primary);
    transition: border-color 0.12s, background 0.12s;
    font-size: 12px;
    color: var(--text-primary);
    text-align: left;
}
.enquete-option:hover { border-color: var(--accent-blue); background: rgba(59,130,246,0.07); }
.enquete-option.selected {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.18);
    color: #fff;
}
.enquete-option-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    transition: border-color 0.12s, background 0.12s;
}
.enquete-option.selected .enquete-option-dot {
    border-color: #fff;
    background: #fff;
}
.enquete-anders-row {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-top: 2px;
}
.enquete-anders-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 7px 10px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.12s;
}
.enquete-anders-input:focus { border-color: var(--accent-blue); }
.enquete-anders-input::placeholder { color: var(--text-secondary); }

.mission-refine-btn {
    margin: 12px 16px;
    background: var(--accent-blue);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mission-refine-btn:hover { background: #2563eb; }
.mission-refine-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Verfijnd prompt box ─────────────────────── */
.mission-refined-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-green);
    border-radius: 10px;
    flex-shrink: 0;
}
.mission-refined-header {
    padding: 10px 14px;
    background: rgba(16,185,129,0.1);
    border-bottom: 1px solid rgba(16,185,129,0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mission-refined-title { font-size: 13px; font-weight: 700; color: var(--accent-green); }
.mission-refined-use {
    background: var(--accent-green);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.12s;
}
.mission-refined-use:hover { background: #059669; }
.mission-refined-text {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Image drop zone */
.mission-label-optional {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 4px;
}
.mission-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
}
.mission-drop-zone:hover,
.mission-drop-zone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.06);
}
.mission-drop-icon { font-size: 28px; }
.mission-drop-text { font-size: 13px; color: var(--text-primary); }
.mission-drop-sub  { font-size: 11px; color: var(--text-secondary); }

.mission-image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.mission-image-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}
.mission-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mission-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
.mission-image-remove:hover { background: var(--accent-red); }

/* Hera fixed target */
.mission-hera-target {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    padding: 10px 14px;
}
.mission-hera-emoji { font-size: 24px; flex-shrink: 0; }
.mission-hera-info { display: flex; flex-direction: column; gap: 2px; }
.mission-hera-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.mission-hera-sub  { font-size: 11px; color: var(--text-secondary); }

/* Analyseer knop */
.mission-analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mission-analyze-btn:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.35);
    border-color: var(--accent-purple);
    color: #fff;
}

.mission-analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading spinner */
.mission-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(196, 181, 253, 0.3);
    border-top-color: #c4b5fd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Result section */
.mission-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeInMsg 0.3s ease;
}

/* Stars */
.mission-stars-section {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.mission-score-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.mission-stars {
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 6px;
    line-height: 1.2;
}

.mission-star-filled {
    color: #f59e0b;
}

.mission-star-empty {
    color: var(--border-color);
}

.mission-score-num {
    font-size: 28px;
    font-weight: 800;
    color: #f59e0b;
}

.mission-score-num.score-low {
    color: var(--accent-red);
}

.mission-score-num.score-mid {
    color: var(--accent-yellow);
}

.mission-score-num.score-high {
    color: var(--accent-green);
}

/* Section title */
.mission-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Dimensions */
.mission-dimensions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mission-dimension-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 6px;
}

.mission-dimension-icon {
    font-size: 16px;
    text-align: center;
}

.mission-dimension-content {
    min-width: 0;
}

.mission-dimension-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.mission-dimension-feedback {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mission-dimension-score {
    font-size: 13px;
    font-weight: 800;
    min-width: 28px;
    text-align: right;
}

.dim-score-low { color: var(--accent-red); }
.dim-score-mid { color: var(--accent-yellow); }
.dim-score-high { color: var(--accent-green); }

/* Tips */
.mission-tips-section {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 14px;
    border: 1px solid var(--border-color);
}

.mission-tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mission-tips-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 18px;
    position: relative;
    line-height: 1.4;
}

.mission-tips-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
    font-weight: 700;
}

/* Recommendation */
.mission-recommendation {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--accent-green);
    font-weight: 500;
    text-align: center;
}

.mission-recommendation.warn {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--accent-yellow);
}

/* Verstuur knop */
.mission-send-btn {
    background: var(--accent-green);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    width: 100%;
}

.mission-send-btn:hover:not(:disabled) {
    background: #059669;
}

.mission-send-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    border: 1px solid var(--border-color);
}

.mission-send-status {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    min-height: 16px;
}

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

:root {
    /* Dark Theme Colors (default) */
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #1e2235;
    --text-primary: #e8eaf0;
    --text-secondary: #6b7280;
    --accent-blue: #6366f1;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --border-color: #2a2d3e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.light-theme {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f7f8fa;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-yellow: #d97706;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Shell */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 16px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0;
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--accent-blue);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13px;
}

.sidebar-footer {
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
}

.sidebar-status-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Page Content */
.page-content {
    flex: 1;
    margin-left: 200px;
    min-height: 100vh;
    padding: 24px;
    max-width: calc(100vw - 200px);
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header-left {
    display: flex;
    flex-direction: column;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* KPI Cards (Dashboard) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.kpi-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 6px;
}

.kpi-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    opacity: 0.7;
}

/* Section panels */
.section-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}

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

.section-title {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.section-action {
    font-size: 12px;
    color: var(--accent-blue);
    text-decoration: none;
    cursor: pointer;
}

.section-action:hover {
    text-decoration: underline;
}

.section-body {
    padding: 14px 18px;
}

/* Timeline styles */
.timeline-filters {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.timeline-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.timeline-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 5px 10px;
    outline: none;
    cursor: pointer;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--accent-blue);
}

.timeline-day-group {
    margin-bottom: 20px;
}

.timeline-day-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 52px 28px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.1s;
}

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

.timeline-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    white-space: nowrap;
}

.timeline-agent-emoji {
    font-size: 16px;
    text-align: center;
}

.timeline-preview {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-agent-name {
    font-weight: 600;
    margin-right: 4px;
}

.timeline-preview-text {
    color: var(--text-secondary);
}

.type-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.type-badge.msg {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.type-badge.tool {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.type-badge.spawn {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.type-badge.err {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.load-more-btn {
    display: block;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s;
    margin-top: 12px;
}

.load-more-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Costs page tables */
.costs-section {
    margin-bottom: 28px;
}

.costs-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.costs-section-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.costs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 12px;
}

.costs-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.costs-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(42, 45, 62, 0.4);
}

.costs-table tbody td.num {
    text-align: right;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
}

.costs-table .total-row td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    padding-top: 10px;
    font-weight: 700;
}

/* Settings page */
.settings-group {
    margin-bottom: 24px;
}

.settings-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

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

.settings-value {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
}

.settings-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.settings-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* Header icon buttons (clean SVG) */
.header-icon-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.header-icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.header-icon-btn svg {
    display: block;
}

/* Running-now chips on dashboard */
.running-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.running-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s;
}

.running-chip:hover {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

.running-chip .chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    flex-shrink: 0;
}

.running-chip .chip-status {
    display: none;
}

/* Dashboard recent activity mini list */
.mini-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.mini-activity-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    min-width: 44px;
    flex-shrink: 0;
}

.mini-activity-agent {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.mini-activity-text {
    color: var(--text-secondary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Placeholder page */
.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-secondary);
    text-align: center;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.placeholder-desc {
    font-size: 13px;
    max-width: 400px;
}

/* Mobile sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .page-content {
        margin-left: 0;
        max-width: 100vw;
        padding-top: 60px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .sidebar-hamburger {
        display: flex;
    }
}

/* Dashboard Layout (legacy — kept for backward compat) */
.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--accent-green);
    animation: none;
}

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

.last-update {
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: 20px;
}

/* Panel Styles */
.panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.panel h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Agent List */
.agent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.agent-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 16px 18px;
    border-radius: 10px;
    border-left: 3px solid var(--accent-blue);
    transition: background 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.agent-card:hover {
    background: var(--bg-tertiary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.agent-card.active {
    border-left-color: var(--accent-green);
}

.agent-card.idle {
    border-left-color: var(--accent-yellow);
}

.agent-card.offline {
    border-left-color: var(--text-secondary);
    opacity: 0.55;
}

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

.agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.agent-card.active .agent-avatar { background: rgba(16, 185, 129, 0.12); }
.agent-card.idle .agent-avatar { background: rgba(245, 158, 11, 0.12); }
.agent-card.offline .agent-avatar { background: rgba(107, 114, 128, 0.12); }

.agent-header-text {
    flex: 1;
    min-width: 0;
}

.agent-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--accent-blue);
}

.agent-status-dot.active { background: var(--accent-green); }
.agent-status-dot.idle { background: var(--accent-yellow); }
.agent-status-dot.offline { background: var(--text-secondary); }

.agent-name {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.agent-role-line {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Legacy compat — hidden in new layout */
.agent-emoji { display: none; }
.agent-status-badge { display: none; }

.agent-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
}

/* Subagent Badge */
.subagent-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
    margin-left: 4px;
}

/* Org Chart */
.org-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.org-level {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.org-node {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    min-width: 120px;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

.org-node.orchestrator {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
}

.org-node.active {
    border-color: var(--accent-green);
}

.org-node-emoji {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

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

.org-node-role {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.org-connector {
    width: 2px;
    height: 20px;
    background: var(--border-color);
    margin: 0 auto;
}

.org-subagent-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* CSS Tree (Agent Hierarchy) */
.css-tree {
    overflow-x: auto;
    padding: 8px 0;
}

.css-tree ul {
    list-style: none;
    padding-left: 24px;
    margin: 0;
    position: relative;
}

.css-tree ul.tree-root {
    padding-left: 0;
}

/* Vertical line connecting siblings */
.css-tree ul ul > li {
    position: relative;
    padding-left: 20px;
}

.css-tree ul ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.css-tree ul ul > li:last-child::before {
    bottom: calc(100% - 18px);
}

/* Horizontal branch to node */
.css-tree ul ul > li::after {
    content: '';
    position: absolute;
    left: 0;
    top: 18px;
    width: 16px;
    height: 1px;
    background: var(--border-color);
}

.tree-node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
    margin: 4px 0;
    border: 1px solid var(--border-color);
    font-size: 13px;
    transition: border-color 0.2s;
}

.tree-node.active {
    border-color: var(--accent-green);
}

.tree-node.idle {
    border-color: var(--accent-yellow);
}

.tree-node.offline {
    opacity: 0.6;
}

.tree-node-emoji {
    font-size: 16px;
    flex-shrink: 0;
}

.tree-node-name {
    font-weight: 600;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--accent-red);
}

.tree-status-dot.active {
    background: var(--accent-green);
}

.tree-status-dot.idle {
    background: var(--accent-yellow);
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-blue);
}

.task-item.completed {
    border-left-color: var(--accent-green);
    opacity: 0.7;
}

.task-item.failed {
    border-left-color: var(--accent-red);
}

.task-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

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

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

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

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    background: var(--bg-tertiary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.activity-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    margin-bottom: 2px;
    line-height: 1.4;
}

.activity-agent {
    font-weight: 600;
    margin-right: 4px;
    white-space: nowrap;
}

.activity-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    margin-right: 5px;
    flex-shrink: 0;
    vertical-align: middle;
}

.activity-preview {
    color: var(--text-secondary);
    word-break: break-word;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Token Usage Table */
.token-panel {
    grid-column: 1 / -1;
}

.token-table-wrap {
    overflow-x: auto;
}

.token-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.token-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.token-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(45, 55, 72, 0.4);
}

.token-table tbody td.num {
    text-align: right;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
}

.token-agent {
    font-weight: 600;
}

.token-model {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 6px;
}

.token-totals td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    padding-top: 10px;
}

/* Utility Classes */
.loading, .info-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

/* Scrollbar Styling */
.activity-feed::-webkit-scrollbar {
    width: 6px;
}

.activity-feed::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

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

.activity-feed::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Agent Detail Slide-Over */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.agent-detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 420px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.panel-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.panel-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.panel-agent-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.panel-agent-emoji {
    font-size: 28px;
}

.panel-agent-name {
    font-size: 22px;
    font-weight: 700;
}

.panel-agent-role {
    font-size: 13px;
    color: var(--text-secondary);
}

.panel-body {
    padding: 0 1.5rem 1.5rem;
    flex: 1;
}

.panel-section {
    margin-top: 1.25rem;
}

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

/* Metadata Table */
.metadata-table {
    width: 100%;
    border-collapse: collapse;
}

.metadata-table td {
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(45, 55, 72, 0.5);
}

.meta-label {
    color: var(--text-secondary);
    width: 90px;
    font-weight: 500;
}

.meta-value {
    color: var(--text-primary);
}

.meta-value code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Subagents List */
.subagents-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.subagent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
}

.subagent-key {
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
}

.subagent-time {
    color: var(--text-secondary);
    font-size: 11px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Messages List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.message-item {
    background: var(--bg-tertiary);
    padding: 10px 12px;
    border-radius: 6px;
}

.message-role {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.role-user {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.role-assistant {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.role-system {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
}

.role-unknown {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-secondary);
}

.message-content {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

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

/* Fix 1: TOOLRESULT collapse styles */
.msg-tool-result {
    background: rgba(255,165,0,0.08);
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}
.msg-tool-result summary {
    color: #f59e0b;
    font-weight: 600;
    user-select: none;
    list-style: none;
}
.msg-tool-result summary::-webkit-details-marker { display: none; }
.msg-tool-result-content {
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Fix 1: TOOLCALL badge */
.msg-toolcall-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-right: 4px;
}

/* Fix 1: JSON summary */
.json-summary {
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    user-select: none;
}
.json-content {
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 6px;
    color: var(--text-secondary);
}

/* Agent Card Quick Actions */
.agent-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.agent-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.agent-action-btn:hover {
    color: var(--accent-blue);
}

.agent-action-btn.copy-feedback {
    color: var(--accent-green);
}

/* Message Dialog */
.message-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.message-dialog-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.message-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 420px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 1101;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.message-dialog.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

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

.message-dialog-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.message-dialog-close {
    position: static;
    font-size: 22px;
    padding: 2px 6px;
}

.message-dialog-body {
    padding: 14px 18px;
}

.message-dialog-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.15s;
}

.message-dialog-input:focus {
    border-color: var(--accent-blue);
}

.message-dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.message-dialog-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-dialog-status.status-success {
    color: var(--accent-green);
}

.message-dialog-status.status-error {
    color: var(--accent-red);
}

.message-dialog-send-btn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 7px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.message-dialog-send-btn:hover {
    background: #2563eb;
}

.message-dialog-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar for panel sections */
.subagents-list::-webkit-scrollbar,
.messages-list::-webkit-scrollbar {
    width: 5px;
}

.subagents-list::-webkit-scrollbar-track,
.messages-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.subagents-list::-webkit-scrollbar-thumb,
.messages-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Agent Activity Preview */
.agent-activity-preview {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

.agent-current-activity {
    font-size: 12px;
    color: var(--accent-yellow);
    margin-top: 4px;
    font-weight: 500;
}

/* Chat button in agent card actions */
.agent-chat-btn {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
    color: var(--accent-blue) !important;
    font-weight: 600 !important;
}

.agent-chat-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #fff !important;
    border-color: var(--accent-blue) !important;
}

.agent-chat-btn:disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
}

/* Tree subagent count badge */
.tree-subagent-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-yellow);
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 1px 5px;
    margin-left: 4px;
}

/* ─────────────────────────────────────────────────────────
   Agent Chat Panel
   ───────────────────────────────────────────────────────── */

.agent-chat-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 460px;
    min-width: 320px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.chat-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
    transition: background 0.15s;
}
.chat-resize-handle:hover,
.chat-resize-handle.dragging {
    background: var(--accent-blue);
    opacity: 0.5;
}

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

.chat-header-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.chat-header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.chat-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-panel-emoji {
    font-size: 24px;
    flex-shrink: 0;
}

.chat-panel-info {
    min-width: 0;
}

.chat-panel-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-panel-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-panel-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 6px;
}

.chat-panel-status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.chat-panel-status-badge.idle {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow);
}

.chat-panel-status-badge.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Chat messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

.chat-loading, .chat-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 30px 20px;
    flex: 1;
}

.chat-empty-emoji {
    font-size: 36px;
    margin-bottom: 8px;
}

/* Chat message bubbles */
.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 90%;
    animation: fadeInMsg 0.2s ease;
}

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

.chat-message.from-history {
    opacity: 0.75;
}

.chat-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-agent {
    align-self: flex-start;
}

.chat-message-avatar {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    margin-bottom: 2px;
}

.chat-message-body {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    min-width: 40px;
    max-width: 100%;
}

.chat-message-user .chat-message-body {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    border-radius: 12px 12px 4px 12px;
}

.chat-message-agent .chat-message-body {
    border-radius: 12px 12px 12px 4px;
}

.chat-message-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-message-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
}

/* Thinking animation */
.chat-message-thinking .chat-message-body {
    padding: 10px 14px;
}

.thinking-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: thinkDot 1.2s infinite;
    display: inline-block;
}

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

@keyframes thinkDot {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

/* Chat input area */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.chat-attachment-preview {
    display: none; /* toggled to flex via JS */
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--accent-amber);
    margin-bottom: 6px;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.chat-attachment-preview.has-file {
    display: flex;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.chat-img-btn {
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
}

.chat-img-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.3);
}

.chat-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.4;
}

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

.chat-send-btn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    align-self: flex-end;
    height: 44px;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #2563eb;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 5px;
    min-height: 14px;
}

@media (max-width: 480px) {
    .agent-chat-panel {
        width: 100vw;
    }
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* Keyboard Shortcuts Overlay */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.shortcuts-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.shortcuts-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 32px;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.shortcuts-dialog h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

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

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

.shortcut-key {
    display: inline-block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 28px;
    text-align: center;
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: 16px;
}

.shortcuts-close {
    display: block;
    margin: 16px auto 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.shortcuts-close:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

/* Login Screen */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 90vw;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-box p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.login-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 14px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 12px;
}

.login-input:focus {
    border-color: var(--accent-blue);
}

.login-btn {
    width: 100%;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover {
    background: #2563eb;
}

.login-error {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

@media (max-width: 480px) {
    .agent-detail-panel {
        width: 100vw;
    }
}

/* Responsive Design */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .dashboard {
        padding: 12px;
    }
    
    .panel {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: 8px;
    }
    
    .dashboard-header {
        padding: 12px 14px;
    }
    
    .dashboard-header h1 {
        font-size: 18px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .panel {
        padding: 12px;
        border-radius: 8px;
    }
    
    .panel h2 {
        font-size: 15px;
    }
    
    .agent-card {
        padding: 10px 12px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    .css-tree {
        font-size: 12px;
    }
    
    .tree-node-name {
        max-width: 110px;
    }
}

/* ─────────────────────────────────────────────────────────
   Mobile Sidebar Hamburger
   ───────────────────────────────────────────────────────── */

.sidebar-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 18px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
}

.sidebar-hamburger:hover {
    background: var(--bg-tertiary);
}

.sidebar-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.sidebar-mobile-overlay.visible {
    display: block;
}

/* ─────────────────────────────────────────────────────────
   Task Board — Kanban columns
   ───────────────────────────────────────────────────────── */

.task-board {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    padding: 0 0 8px;
}

.task-column {
    flex: 1 1 220px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.task-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.task-column-header--over-wip {
    border-bottom: 2px solid var(--accent-red);
}

.task-column-header--over-wip .task-column-count {
    background: var(--accent-red);
    color: #fff;
}

.task-column-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.task-column-count {
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.task-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 80px;
}

/* Empty state per column */
.task-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
    opacity: 0.7;
}

/* ─── Task Cards ──────────────────────────────────────── */

.task-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    transition: border-color 0.12s, box-shadow 0.12s, opacity 0.15s;
    user-select: none;
}

.task-card:hover {
    border-color: var(--accent-blue);
}

.task-card--focused {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.task-card--selected {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.06);
}

.task-card--dragging {
    opacity: 0.4;
}

.task-card-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.task-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-secondary);
}

.task-card-agent {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.task-card-subtasks {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--accent-green);
}

.task-card-subtasks::before {
    content: '☑';
    font-size: 10px;
}

.task-card-label {
    display: inline-block;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-card-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}

/* ─── Priority Dots ───────────────────────────────────── */

.task-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.task-priority-dot--urgent {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.task-priority-dot--high {
    background: #f97316;
}

.task-priority-dot--medium {
    background: var(--accent-yellow);
}

.task-priority-dot--low {
    background: var(--text-secondary);
}

/* ─── Task Status Dot ─────────────────────────────────── */

.task-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.task-dot--yellow { background: #f59e0b; }
.task-dot--green  { background: #22c55e; }
.task-dot--blue   { background: #4a9eff; }
.task-dot--grey   { background: #555; }
.task-dot--red    { background: #ef4444; }

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

.task-dot--pulse {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ─── Quick Add ───────────────────────────────────────── */

.task-quick-add {
    padding: 6px 8px;
    border-top: 1px solid var(--border-color);
}

.task-quick-add-input {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.task-quick-add-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.task-quick-add-input:focus {
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
}

/* ─── Filter Bar ──────────────────────────────────────── */

.task-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 12px;
    flex-wrap: wrap;
}

.task-filter-bar select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
    outline: none;
}

.task-filter-bar select:focus {
    border-color: var(--accent-blue);
}

.task-active-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.task-filter-chip:hover {
    background: rgba(99, 102, 241, 0.22);
}

.task-filter-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(239, 68, 68, 0.08);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1;
}

.task-filter-reset-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ─── Status Bar ──────────────────────────────────────── */

.task-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 0;
    font-size: 11px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.task-status-hint {
    opacity: 0.7;
}

.task-status-focus {
    font-weight: 500;
    color: var(--accent-blue);
}

/* ─── Task Detail (inside slide-over panel) ───────────── */

.task-detail-subtask {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

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

.task-detail-subtask input[type="checkbox"] {
    accent-color: var(--accent-green);
}

.task-subtask-done {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-history-item {
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.task-history-time {
    color: var(--text-secondary);
    opacity: 0.7;
    margin-right: 6px;
}

/* ─── Task Detail Panel — 3-tab redesign ─────────────── */

/* Disable outer scroll when showing task detail */
.agent-detail-panel.td-task-detail-open {
    overflow-y: hidden;
}

.td-task-detail {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #1a1d21;
}

/* Header */
.td-header {
    background: #1f2329;
    padding: 14px 44px 12px 16px;
    border-bottom: 1px solid #2a2e36;
    flex-shrink: 0;
    position: relative;
}

.td-header-title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.td-title {
    font-size: 16px;
    font-weight: 600;
    color: #e8eaed;
    line-height: 1.4;
    word-break: break-word;
}

.td-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.td-badge {
    font-size: 11px;
    border-radius: 4px;
    padding: 2px 6px;
    background: #262b33;
    color: #888;
}

.td-badge--source {
    background: #262b33;
    color: #999;
}

.td-badge--status {
    background: #1b2f45;
    color: #4a9eff;
}

.td-badge-dot {
    font-size: 11px;
    color: #555;
    padding: 0 1px;
}

/* Tab bar */
.td-tab-bar {
    display: flex;
    background: #16191d;
    border-bottom: 1px solid #2a2e36;
    flex-shrink: 0;
}

.td-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 6px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.td-tab:hover {
    color: #aaa;
}

.td-tab--active {
    color: #e8eaed;
    border-bottom-color: #4a9eff;
}

.td-tab-count {
    font-size: 10px;
    background: #2a2e36;
    border-radius: 10px;
    padding: 1px 5px;
    margin-left: 4px;
    color: #888;
    vertical-align: middle;
}

/* Tab panels */
.td-tab-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;      /* needed for flex children to scroll */
}

.td-tab-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.td-tab-scroll::-webkit-scrollbar {
    width: 4px;
}
.td-tab-scroll::-webkit-scrollbar-track { background: transparent; }
.td-tab-scroll::-webkit-scrollbar-thumb { background: #2a2e36; border-radius: 2px; }

/* Properties tab */
.td-props {
    padding: 6px 16px 0;
    display: flex;
    flex-direction: column;
}

.td-prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #1e2229;
    gap: 8px;
}

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

.td-prop-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #666;
    text-transform: uppercase;
    flex-shrink: 0;
}

.td-select {
    background: #262b33;
    border: 1px solid #2a2e36;
    border-radius: 6px;
    color: #c8cad0;
    font-size: 13px;
    padding: 5px 10px;
    cursor: pointer;
    outline: none;
    min-width: 120px;
    max-width: 190px;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 26px;
}

.td-select:hover,
.td-select:focus {
    border-color: #4a9eff;
}

.td-input {
    background: #262b33;
    border: 1px solid #2a2e36;
    border-radius: 6px;
    color: #c8cad0;
    font-size: 13px;
    padding: 5px 10px;
    outline: none;
    min-width: 120px;
    max-width: 220px;
    transition: border-color 0.15s;
}

.td-input:hover,
.td-input:focus {
    border-color: #4a9eff;
}

/* Description */
.td-desc-section {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.td-description {
    background: #262b33;
    border: 1px solid #2a2e36;
    border-radius: 6px;
    color: #c8cad0;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.55;
    padding: 8px 10px;
    resize: none;
    min-height: 80px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
    overflow: hidden;
}

.td-description:focus {
    border-color: #4a9eff;
}

.td-description::placeholder {
    color: #444;
}

/* Action buttons footer */
.td-actions {
    padding: 12px 16px 14px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #1e2229;
    flex-shrink: 0;
    background: #1a1d21;
}

.td-action-btn {
    flex: 1;
    padding: 7px 8px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.td-action-btn--hera {
    background: #4a9eff;
    color: #fff;
}
.td-action-btn--hera:hover { background: #3a8ef0; }

.td-action-btn--archive {
    background: #3a3f4a;
    color: #c8cad0;
}
.td-action-btn--archive:hover { background: #464d5c; }

.td-action-btn--delete {
    background: #3a3f4a;
    color: #c8cad0;
}
.td-action-btn--delete:hover {
    background: #ef4444;
    color: #fff;
}

/* Subtasks tab */
.td-subtasks-list {
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
}

.td-add-subtask-area {
    padding: 10px 16px 14px;
    border-top: 1px solid #1e2229;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    background: #1a1d21;
}

.td-subtask-input {
    flex: 1;
    background: #262b33;
    border: 1px solid #2a2e36;
    border-radius: 6px;
    color: #c8cad0;
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.15s;
}

.td-subtask-input:focus {
    border-color: #4a9eff;
}

.td-add-subtask-btn {
    background: #262b33;
    border: 1px solid #2a2e36;
    border-radius: 6px;
    color: #4a9eff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.td-add-subtask-btn:hover {
    background: #1b2f45;
    border-color: #4a9eff;
}

/* Activity tab */
.td-activity-list {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.td-activity-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 10px;
    border-left: 2px solid #2a2e36;
    margin-bottom: 3px;
    line-height: 1.4;
}

.td-activity-time {
    font-size: 12px;
    font-family: 'SF Mono', 'Cascadia Code', Monaco, monospace;
    color: #888;
    flex-shrink: 0;
    min-width: 38px;
}

.td-activity-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.td-activity-icon--updated { color: #4a9eff; }
.td-activity-icon--created { color: #f59e0b; }

.td-activity-text {
    font-size: 13px;
    color: #aaa;
    word-break: break-word;
}

/* Empty states */
.td-empty {
    font-size: 13px;
    color: #555;
    padding: 14px 0;
    display: block;
}

/* ── Responsive: mobile bottom sheet ─────────────────── */
@media (max-width: 640px) {
    .agent-detail-panel {
        width: 100% !important;
        max-width: 100%;
        height: 70vh;
        top: auto;
        bottom: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        border-left: none;
        border-top: 1px solid #2a2e36;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    }

    .agent-detail-panel.panel-open {
        transform: translateY(0);
    }

    .td-task-detail {
        height: 70vh;
    }
}

/* ─── Drag & Drop feedback ────────────────────────────── */

.task-column.drag-over .task-column-body {
    background: rgba(99, 102, 241, 0.04);
    outline: 2px dashed rgba(99, 102, 241, 0.3);
    outline-offset: -2px;
    border-radius: 6px;
}

/* ─── Task Create Form ────────────────────────────────── */

.task-create-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-form-row {
    display: flex;
    gap: 12px;
}

.task-form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-form-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.task-form-input:focus {
    border-color: var(--accent-blue);
}

.task-form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.task-form-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.task-form-select:focus {
    border-color: var(--accent-blue);
}

.task-form-textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
    font-family: inherit;
    transition: border-color 0.15s;
}

.task-form-textarea:focus {
    border-color: var(--accent-blue);
}

.task-form-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.task-form-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.task-form-drop-zone:hover,
.task-form-drop-zone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.04);
}

.task-form-image-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* ─── Task Form — AI Assist ───────────────────────────── */

.task-ai-assist {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.task-ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: background 0.15s;
}

.task-ai-header:hover {
    background: var(--bg-secondary);
}

.task-ai-toggle {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.15s;
}

.task-ai-body {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.task-ai-actions {
    display: flex;
    gap: 8px;
}

.task-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--accent-blue);
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.task-ai-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.task-ai-btn--secondary {
    border-color: var(--border-color);
    background: transparent;
    color: var(--text-secondary);
}

.task-ai-btn--secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.task-ai-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 6px 0;
}

.task-ai-option {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.12s;
    font-family: inherit;
}

.task-ai-option:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.task-ai-option--selected {
    border-color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
    font-weight: 600;
}

/* ─── Task Form — Action buttons ──────────────────────── */

.task-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-form-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
}

.task-form-btn--cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.task-form-btn--cancel:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.task-form-btn--create {
    background: var(--accent-blue);
    color: #fff;
}

.task-form-btn--create:hover {
    background: #5558e6;
}

.task-form-btn--hera {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.task-form-btn--hera:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #fff;
}

/* ─── Responsive (task board) ─────────────────────────── */

@media (max-width: 768px) {
    .task-board {
        flex-direction: column;
    }

    .task-column {
        max-width: 100%;
        min-width: 0;
    }

    .task-filter-bar {
        overflow-x: auto;
    }
}

/* ═══════════════════════════════════════════════════════════
   ACTIVITY FEED (Daedalus sprint — 2026-02-23)
   ════════════════════════════════════════════════════════ */

.activity-feed-list {
    display: flex;
    flex-direction: column;
}

.activity-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.12s;
}
.activity-feed-item:last-child { border-bottom: none; }
.activity-feed-item:hover { background: rgba(255,255,255,0.03); }

/* Role badge: U or A */
.activity-badge {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    letter-spacing: 0;
}
.activity-badge-u {
    background: rgba(99, 102, 241, 0.18);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.activity-badge-a {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.activity-feed-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.activity-feed-agent {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.activity-feed-text {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-feed-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   AGENT DETAIL PANEL — Chat Bubbles
   ════════════════════════════════════════════════════════ */

#panelMessages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
    max-height: 380px;
    overflow-y: auto;
}

.chat-bubble-row {
    display: flex;
}
.bubble-user {
    justify-content: flex-end;
}
.bubble-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bubble-user .chat-bubble {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-bottom-right-radius: 3px;
}
.bubble-assistant .chat-bubble {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 3px;
}

.chat-bubble-content {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-bubble-time {
    font-size: 10px;
    color: var(--text-secondary);
    align-self: flex-end;
}

/* "Open chat" button in agent detail panel header */
.panel-open-chat-btn {
    padding: 5px 12px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    color: #818cf8;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.panel-open-chat-btn:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.6);
}

/* ═══════════════════════════════════════════════════════════
   METRICS — Token Usage Bar Chart
   ════════════════════════════════════════════════════════ */

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

.metrics-agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.metrics-most-expensive .metrics-agent-name {
    color: var(--accent);
}

.metrics-agent-label {
    width: 120px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.metrics-agent-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.metrics-badge-exp {
    font-size: 9px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metrics-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.metrics-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}
.metrics-bar-track-sm {
    height: 4px;
}
.metrics-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.4s ease;
    min-width: 2px;
}
.metrics-bar-highlight {
    background: var(--accent);
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
}
.metrics-bar-today {
    background: #10b981;
}

.metrics-agent-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    width: 80px;
    flex-shrink: 0;
}
.metrics-stat {
    font-size: 11px;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.metrics-stat-cost {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}
.metrics-stat-today {
    font-size: 10px;
    color: var(--text-secondary);
}

.metrics-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}
.metrics-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}
.metrics-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.metrics-legend-alltime { background: var(--accent); }
.metrics-legend-today   { background: #10b981; }

.metrics-summary-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}
.metrics-summary-row strong {
    color: var(--text-primary);
}

/* Responsive metrics */
@media (max-width: 600px) {
    .metrics-agent-row { flex-wrap: wrap; }
    .metrics-agent-label { width: 100%; }
    .metrics-agent-stats { flex-direction: row; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   FEATURE #1 — NEW TASK MODAL (centered)
   ════════════════════════════════════════════════════════ */

.task-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease-out, visibility 0.15s ease-out;
}

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

.task-modal {
    width: min(700px, 90vw);
    max-height: 85vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.task-modal-overlay.open .task-modal {
    opacity: 1;
    transform: translateY(0);
}

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

.task-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.task-modal-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.task-modal-body::-webkit-scrollbar { width: 5px; }
.task-modal-body::-webkit-scrollbar-track { background: var(--bg-secondary); }
.task-modal-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* Textarea auto-resize — set via JS, but enforce limits */
.task-modal-body .task-form-textarea {
    resize: none;
    min-height: 80px;
    max-height: 260px;
    overflow-y: auto;
    transition: border-color 0.15s;
}

/* ═══════════════════════════════════════════════════════════
   FEATURE #2 — SENT_TO_HERA BADGE + TIMESTAMP
   ════════════════════════════════════════════════════════ */

.hera-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.hera-timestamp {
    font-size: 10px;
    color: #a78bfa;
    opacity: 0.85;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   FEATURE #6 — HERA REPLY ON TASK CARD
   ════════════════════════════════════════════════════════ */

.task-card-hera-reply {
    margin-top: 8px;
    padding: 7px 10px;
    border-left: 3px solid rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.06);
    border-radius: 0 6px 6px 0;
}

.hera-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.hera-reply-label {
    font-size: 11px;
    font-weight: 700;
    color: #a78bfa;
    letter-spacing: 0.2px;
    flex-shrink: 0;
}

.hera-reply-ts {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.75;
    flex-shrink: 0;
}

.hera-reply-text {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.hera-reply-more {
    background: none;
    border: none;
    color: #a78bfa;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 0 0;
    text-decoration: underline;
    opacity: 0.8;
}

.hera-reply-more:hover {
    opacity: 1;
    color: #c4b5fd;
}

/* ─────────────────────────────────────────────────────────
   Inbox Poller Toggle Button
   ───────────────────────────────────────────────────────── */
.inbox-poller-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, opacity 0.15s;
    white-space: nowrap;
    user-select: none;
}

.inbox-poller-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ON state — green */
.inbox-poller-btn.inbox-poller-on {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ade80;
}
.inbox-poller-btn.inbox-poller-on:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.28);
    border-color: #4ade80;
    color: #86efac;
}

/* OFF state — red */
.inbox-poller-btn.inbox-poller-off {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}
.inbox-poller-btn.inbox-poller-off:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: #f87171;
    color: #fca5a5;
}

/* Default (loading) — neutral */
.inbox-poller-btn:not(.inbox-poller-on):not(.inbox-poller-off) {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--text-secondary, #94a3b8);
}

.inbox-poller-icon {
    font-size: 11px;
    line-height: 1;
}

.inbox-poller-label {
    font-size: 12px;
    letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────
   Task Detail Modal Overlay
   ───────────────────────────────────────────────────────── */
.task-detail-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.task-detail-modal {
  background: #1a1d21;
  border: 1px solid #2a2e36;
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.15s ease;
}

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

/* Mobile: full screen */
@media (max-width: 640px) {
  .task-detail-modal-backdrop { align-items: flex-end; padding: 0; }
  .task-detail-modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 85vh; }
}

/* ─── Projects Page ──────────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 4px;
}

.project-card {
  background: #1f2329;
  border: 1px solid #2a2e36;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: #4a9eff;
}

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

.project-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-name {
  font-size: 15px;
  font-weight: 600;
  color: #e8eaed;
}

.project-dir {
  font-size: 12px;
  color: #888;
  font-family: monospace;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-meta {
  font-size: 12px;
  color: #666;
}
