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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.4;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    color: #2563eb;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 0.9em;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

section h2 {
    margin-bottom: 15px;
    color: #1e40af;
    font-size: 1.2em;
}

.prompt-input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#promptInput {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
    resize: vertical;
}

#promptInput:focus {
    outline: none;
    border-color: #2563eb;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75em;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.result-card {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.result-card h3 {
    color: #1e40af;
    margin-bottom: 10px;
    font-size: 1em;
}

/* Removed .result-content - now using .history-message for consistency */

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.thumbs-btn {
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s;
    min-width: 50px;
}

.thumbs-btn:hover {
    transform: scale(1.1);
}

.thumbs-up {
    border-color: #10b981;
    color: #10b981;
}

.thumbs-up:hover {
    background: #d1fae5;
}

.thumbs-up.active {
    background: #10b981;
    color: white;
}

.thumbs-down {
    border-color: #ef4444;
    color: #ef4444;
}

.thumbs-down:hover {
    background: #fee2e2;
}

.thumbs-down.active {
    background: #ef4444;
    color: white;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.stats-controls {
    margin-bottom: 20px;
}

.stats-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.85em;
}

th {
    background: #f9fafb;
    font-weight: 600;
    color: #1e40af;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid #e5e7eb;
}

tbody tr:nth-child(even) {
    background: #f9fafb;
}

tr:hover {
    background: #eff6ff;
}

.score-positive {
    color: #10b981;
    font-weight: 600;
}

.score-negative {
    color: #ef4444;
    font-weight: 600;
}

.percentage {
    font-weight: 600;
}

/* Conversation History */
.conversation-history {
    margin-bottom: 12px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9em;
    scroll-behavior: smooth;
}

.history-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    line-height: 1.5;
    word-wrap: break-word;
}

.history-message strong {
    display: inline-block;
    min-width: 70px;
    margin-right: 8px;
}

.history-user {
    background: #dbeafe;
    color: #1e40af;
}

.history-assistant {
    background: #f3f4f6;
    color: #374151;
}

.response-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: inherit;
    resize: vertical;
    margin-top: 10px;
    margin-bottom: 8px;
}

/* Golden Prompts Section */
.golden-prompts-section {
    margin-bottom: 20px;
}

.golden-prompts-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.golden-prompts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.golden-prompt-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s;
}

.golden-prompt-item:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

.golden-prompt-item.active {
    background: #fbbf24;
    color: white;
    border-color: #f59e0b;
}

.golden-prompt-name {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.golden-prompt-delete {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1em;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.golden-prompt-delete:hover {
    background: #fee2e2;
}

.golden-prompt-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.golden-prompt-input-group input {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85em;
    width: 200px;
}

/* --- Top Navigation --- */

.top-nav {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: #2563eb;
    background: #eff6ff;
}

.nav-link-active {
    color: #2563eb;
    background: #dbeafe;
}

/* --- Dashboard --- */

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-controls label {
    font-weight: 500;
    color: #374151;
    font-size: 0.85em;
}

.dashboard-controls select {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85em;
    background: white;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-card h2 {
    margin-bottom: 15px;
    color: #1e40af;
    font-size: 1.1em;
}

.dashboard-card-full {
    grid-column: 1 / -1;
}

.sub-heading {
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 600;
    margin: 12px 0 6px;
}

.placeholder {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85em;
}

/* Stat grid */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.stat-value {
    display: block;
    font-size: 1.6em;
    font-weight: 700;
    color: #1e40af;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.75em;
    color: #6b7280;
    margin-top: 4px;
}

/* Breakdown rows (traffic sources, LLM costs, domain events) */

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

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85em;
}

.breakdown-label {
    min-width: 100px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breakdown-bar-track {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 3px;
    transition: width 0.3s;
}

.breakdown-value {
    min-width: 70px;
    text-align: right;
    color: #6b7280;
    font-size: 0.9em;
}

.traffic-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Funnel */

.funnel-container {
    padding: 8px 0;
}

.funnel-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.funnel-bar-container {
    flex: 1;
    height: 24px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.funnel-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 4px;
    transition: width 0.3s;
}

.funnel-label {
    min-width: 200px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85em;
}

.funnel-label strong {
    min-width: 90px;
}

.funnel-dropoff {
    color: #ef4444;
    font-size: 0.8em;
}

/* Sessions */

.session-table {
    width: 100%;
}

.session-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Clickstream */

.clickstream-detail {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.clickstream-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0;
    max-height: 300px;
    overflow-y: auto;
}

.clickstream-event {
    display: flex;
    gap: 12px;
    padding: 6px 8px;
    font-size: 0.8em;
    background: white;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.clickstream-time {
    color: #6b7280;
    min-width: 150px;
}

.clickstream-type {
    font-weight: 600;
    color: #1e40af;
    min-width: 180px;
}

.clickstream-meta {
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* LLM Costs */

.llm-costs .stat-grid {
    margin-bottom: 8px;
}

/* --- App Selector in Nav --- */

.nav-separator {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    margin: 0 4px;
}

.app-selector {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85em;
    background: white;
    color: #374151;
}

/* --- Section Header with Controls --- */

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

.section-header h2 {
    margin-bottom: 0;
}

.section-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.section-controls select {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85em;
    background: white;
}

/* --- Sankey --- */

.sankey-container {
    min-height: 200px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    padding: 8px;
    overflow-x: auto;
}

.sankey-link:hover {
    stroke-opacity: 0.5;
}

.sankey-node:hover {
    opacity: 0.8;
}

/* --- App Cards Grid --- */

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

.app-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.app-card h3 {
    color: #1e40af;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.app-card-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.app-card-links {
    display: flex;
    gap: 8px;
}

.app-card-links .btn {
    text-decoration: none;
}

/* --- Health Indicators (Ops view) --- */

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

.health-card {
    text-align: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.health-label {
    display: block;
    font-size: 0.8em;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.health-value {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
}

.health-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #9ca3af;
}

.health-green { background: #10b981; }
.health-amber { background: #f59e0b; }
.health-red { background: #ef4444; }

/* --- Volume Chart (Ops view) --- */

.volume-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 120px;
    padding: 8px 0;
}

.volume-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.volume-bar {
    width: 100%;
    min-height: 2px;
    background: linear-gradient(180deg, #2563eb, #60a5fa);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s;
}

.volume-label {
    font-size: 0.6em;
    color: #9ca3af;
    margin-top: 4px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    max-height: 30px;
    overflow: hidden;
}

/* --- Cost Projection (Ops view) --- */

.projection-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.projection-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9em;
}

.projection-label {
    color: #6b7280;
}

.projection-value {
    font-weight: 600;
    color: #374151;
}

.projection-highlight {
    color: #2563eb;
    font-size: 1.1em;
}

/* --- Inline Scorer (Developer view) --- */

.scorer-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scorer-input {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.scorer-input textarea {
    flex: 1;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9em;
    resize: vertical;
}

.scorer-input textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.scorer-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.scorer-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #f9fafb;
}

.scorer-card h3 {
    color: #1e40af;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.scorer-response {
    font-size: 0.85em;
    line-height: 1.5;
    color: #374151;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
    word-wrap: break-word;
}

/* --- Error Log (Developer view) --- */

.error-log {
    max-height: 300px;
    overflow-y: auto;
}

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

.error-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    font-size: 0.8em;
    background: #fef2f2;
    border-radius: 4px;
    border: 1px solid #fecaca;
    cursor: pointer;
    transition: background 0.2s;
}

.error-item:hover {
    background: #fee2e2;
}

.error-time {
    color: #6b7280;
    min-width: 60px;
}

.error-model {
    font-weight: 600;
    color: #991b1b;
    min-width: 100px;
}

.error-msg {
    color: #7f1d1d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Trace Inspector (Developer view) --- */

.trace-inspector {
    max-height: 350px;
    overflow-y: auto;
}

.trace-header {
    font-weight: 600;
    color: #1e40af;
    font-size: 0.85em;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.trace-timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trace-event {
    display: flex;
    gap: 10px;
    padding: 4px 8px;
    font-size: 0.8em;
    background: #f9fafb;
    border-radius: 3px;
}

.trace-indent {
    margin-left: 20px;
}

.trace-time {
    color: #6b7280;
    min-width: 70px;
}

.trace-component {
    font-weight: 600;
    color: #1e40af;
    min-width: 120px;
}

.trace-event-name {
    color: #374151;
    min-width: 80px;
}

.trace-detail {
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Selected Row --- */

.row-selected {
    background: #dbeafe !important;
}

/* --- Readiness (Product view) --- */

.readiness-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #f9fafb;
}

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

.readiness-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ready-pass {
    background: #d1fae5;
    color: #065f46;
}

.ready-fail {
    background: #fee2e2;
    color: #991b1b;
}

.readiness-gates {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gate-item {
    display: flex;
    gap: 10px;
    padding: 4px 8px;
    font-size: 0.85em;
    border-radius: 3px;
}

.gate-pass {
    color: #065f46;
}

.gate-fail {
    color: #991b1b;
    background: #fef2f2;
}

.gate-check {
    font-family: monospace;
    min-width: 24px;
}

.gate-name {
    min-width: 150px;
}

.gate-actual {
    color: #6b7280;
}

.gate-blocking {
    color: #ef4444;
    font-weight: 600;
    font-size: 0.85em;
}

/* --- Confidence (Product view) --- */

.confidence-box {
    padding: 16px;
    border-radius: 6px;
    font-size: 0.9em;
}

.confidence-box p {
    margin-top: 6px;
    color: #374151;
}

.confidence-level {
    font-weight: 700;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

.confidence-high {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}
.confidence-high .confidence-level { color: #065f46; }

.confidence-moderate {
    background: #fef3c7;
    border: 1px solid #fbbf24;
}
.confidence-moderate .confidence-level { color: #92400e; }

.confidence-low {
    background: #fee2e2;
    border: 1px solid #fca5a5;
}
.confidence-low .confidence-level { color: #991b1b; }

/* --- Notifications / Toast --- */

.notification-feed {
    max-height: 200px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    font-size: 0.85em;
    border-bottom: 1px solid #f3f4f6;
}

.notification-message {
    color: #374151;
}

.notification-time {
    color: #9ca3af;
    font-size: 0.85em;
    min-width: 60px;
    text-align: right;
}

.notification-info { border-left: 3px solid #2563eb; }
.notification-error { border-left: 3px solid #ef4444; }
.notification-warning { border-left: 3px solid #f59e0b; }

.toast {
    padding: 10px 16px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.85em;
    color: #374151;
    transition: all 0.3s;
    border-left: 4px solid #2563eb;
}

.toast-info { border-left-color: #2563eb; }
.toast-error { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }

/* --- Responsive --- */

@media (max-width: 768px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    .traffic-split {
        grid-template-columns: 1fr;
    }
    .funnel-label {
        min-width: 120px;
    }
    .health-grid {
        grid-template-columns: 1fr;
    }
    .scorer-input {
        flex-direction: column;
    }
    .top-nav {
        flex-wrap: wrap;
    }
}


/* =============================================================================
   Unified Hybrid UI — 3-Panel Layout
   ============================================================================= */

.unified-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- Header --- */

.unified-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    z-index: 10;
    text-align: left;
    margin-bottom: 0;
    border-radius: 0;
}

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

.header-logo {
    font-size: 1.2em;
    color: #2563eb;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0;
}

.header-subtitle {
    font-size: 0.75em;
    color: #9ca3af;
}

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

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

/* --- Persona Tabs --- */

.persona-tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
}

.persona-tab {
    padding: 7px 20px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.persona-tab:hover {
    color: #374151;
    background: #e5e7eb;
}

.persona-tab.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* --- 3-Panel Grid --- */

.unified-panels {
    display: grid;
    grid-template-columns: 200px 350px 1fr;
    flex: 1;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}

.panel:last-child {
    border-right: none;
}

.panel-header {
    padding: 10px 16px;
    font-size: 0.8em;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Actions Panel --- */

.actions-panel {
    background: #f9fafb;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.action-btn {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    font-size: 0.8em;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.action-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

/* --- Chat Panel --- */

.chat-panel {
    background: white;
}

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

.chat-welcome {
    color: #6b7280;
    font-size: 0.85em;
    padding: 20px;
    text-align: center;
}

.chat-welcome strong {
    color: #374151;
}

.chat-message {
    display: flex;
}

.chat-user {
    justify-content: flex-end;
}

.chat-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 90%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-bubble-user {
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
    background: #f8f9fa;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.chat-bubble-assistant strong {
    color: #1e40af;
}

/* Thinking dots */
.thinking {
    display: flex;
    gap: 4px;
    padding: 10px 16px;
}

.thinking .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: thinking-bounce 1.2s infinite;
}

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

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.85em;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    background: #f9fafb;
    transition: border-color 0.15s, background 0.15s;
}

.chat-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    flex-shrink: 0;
}

.chat-send-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Canvas Panel --- */

.canvas-panel {
    background: #fafafa;
}

.data-canvas {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.canvas-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 0.9em;
    text-align: center;
}

.canvas-loading {
    font-size: 0.75em;
    color: #2563eb;
    font-weight: 400;
}

.canvas-section-title {
    font-size: 0.9em;
    color: #1e40af;
    font-weight: 600;
    margin: 16px 0 8px;
}

/* Health detail inside cards */
.health-detail {
    display: block;
    font-size: 0.75em;
    color: #9ca3af;
    margin-top: 4px;
}

/* Cost summary grid */
.cost-summary-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Latency report */
.latency-report {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Setting updated */
.setting-updated {
    padding: 8px;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .unified-panels {
        grid-template-columns: 1fr;
    }
    .actions-panel {
        display: none;
    }
    .canvas-panel {
        max-height: 40vh;
    }
}

@media (max-width: 768px) {
    .unified-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .persona-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

/* =============================================================================
   Guide / Explorer Layout (Product & Ops personas)
   ============================================================================= */

.layout-guide-explorer {
    grid-template-columns: 220px 350px 1fr;
}

/* --- Full-Canvas Layout (Agentic Flow) --- */

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

.flow-full-page {
    padding: 24px 32px;
}

.flow-cluster-section {
    margin-bottom: 32px;
}

.flow-cluster-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.flow-cluster-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #111827;
}

.flow-cluster-badge {
    font-size: 0.75em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

.sankey-full {
    min-height: 300px;
    border: none;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 12px;
}

/* --- Guide Panel --- */

.guide-category {
    padding: 14px 12px 4px;
    font-size: 0.75em;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guide-category:first-child {
    padding-top: 8px;
}

.guide-question {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 4px;
    transition: background 0.15s;
}

.guide-question:hover {
    background: #eff6ff;
}

.guide-question-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #374151;
}

.guide-question:hover .guide-question-label {
    color: #2563eb;
}

/* --- Explorer Cards --- */

.explorer-card {
    background: white;
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.explorer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
}

.explorer-card-title {
    font-size: 0.8em;
    font-weight: 600;
    color: #2563eb;
}

.explorer-card-time {
    font-size: 0.7em;
    color: #9ca3af;
}

.explorer-card-body {
    padding: 12px;
}

/* --- Clear Explorer Button --- */

.clear-explorer-btn {
    padding: 2px 8px;
    font-size: 0.7em;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    margin-right: 6px;
}

.clear-explorer-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* --- Churn Badges --- */

.churn-signals {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.churn-signal-card {
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.churn-signal-card .churn-user {
    font-weight: 600;
    font-size: 0.85em;
    color: #374151;
    min-width: 100px;
}

.churn-signal-card .churn-detail {
    font-size: 0.8em;
    color: #6b7280;
    flex: 1;
}

.churn-signal-card .churn-last-seen {
    font-size: 0.75em;
    color: #9ca3af;
    min-width: 80px;
    text-align: right;
}

.churn-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.churn-badge-inactive { background: #fef3c7; color: #92400e; }
.churn-badge-declining { background: #fee2e2; color: #991b1b; }
.churn-badge-error_spike { background: #fce7f3; color: #9d174d; }
.churn-badge-no_return { background: #f3e8ff; color: #6b21a8; }
.churn-badge-default { background: #f3f4f6; color: #6b7280; }

/* --- Retention Bars --- */

.retention-chart {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.retention-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.retention-label {
    min-width: 50px;
    font-size: 0.8em;
    color: #6b7280;
    text-align: right;
}

.retention-bar-track {
    flex: 1;
    height: 18px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.retention-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.retention-value {
    min-width: 60px;
    font-size: 0.8em;
    font-weight: 600;
    text-align: right;
}

.retention-cohort {
    min-width: 40px;
    font-size: 0.7em;
    color: #9ca3af;
    text-align: right;
}

/* --- Agent Timeseries Mini Charts --- */

.agent-ts-section {
    margin-bottom: 16px;
}

.agent-ts-section h4 {
    font-size: 0.85em;
    color: #374151;
    margin-bottom: 6px;
}

.agent-ts-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
}

.agent-ts-bar {
    flex: 1;
    min-height: 2px;
    background: linear-gradient(180deg, #2563eb, #60a5fa);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s;
}

.agent-ts-bar-error {
    background: linear-gradient(180deg, #ef4444, #fca5a5);
}

/* --- Agent Detail --- */

.agent-detail-section {
    margin-bottom: 16px;
}

.agent-detail-section h4 {
    font-size: 0.85em;
    color: #1e40af;
    margin-bottom: 8px;
}

.model-table td,
.model-table th {
    font-size: 0.8em;
}

.recent-errors-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.recent-error-item {
    padding: 6px 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    font-size: 0.8em;
    color: #991b1b;
}

/* --- Budget Status --- */

.budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.budget-card {
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    text-align: center;
}

.budget-card .budget-label {
    font-size: 0.75em;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.budget-card .budget-value {
    font-size: 1.4em;
    font-weight: 700;
    color: #374151;
    margin: 4px 0;
}

.budget-card .budget-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.budget-card .budget-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.budget-bar-green { background: #10b981; }
.budget-bar-amber { background: #f59e0b; }
.budget-bar-red { background: #ef4444; }

/* --- Custom Prompts (Developer Guide) --- */

.custom-prompt-add {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    margin: 2px 4px 0;
}

.custom-prompt-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: inherit;
}

.custom-prompt-input:focus {
    outline: none;
    border-color: #2563eb;
}

.custom-prompt-add-btn {
    padding: 4px 10px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: background 0.15s;
}

.custom-prompt-add-btn:hover {
    background: #1d4ed8;
}

.custom-prompt-item {
    position: relative;
    padding-right: 28px !important;
}

.custom-prompt-delete {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    font-size: 1.1em;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.15s;
}

.custom-prompt-delete:hover {
    color: #ef4444;
    background: #fee2e2;
}

.custom-prompt-empty {
    padding: 8px 12px;
    font-size: 0.75em;
    color: #9ca3af;
    font-style: italic;
}

/* =============================================================================
   Overview Dashboard
   ============================================================================= */

.overview-dashboard {
    padding: 16px;
    overflow-y: auto;
}

.overview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 0.9em;
}

.dashboard-section {
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

.dashboard-section-header:hover {
    background: #f9fafb;
}

.dashboard-section-title {
    font-size: 0.85em;
    font-weight: 500;
    color: #374151;
}

.dashboard-section-arrow {
    color: #9ca3af;
    font-size: 0.8em;
}

.dashboard-section-body {
    padding: 16px;
}

/* --- Dashboard Funnel --- */

.dash-funnel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-funnel-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-funnel-label {
    min-width: 120px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.8em;
}

.dash-funnel-label strong {
    min-width: 80px;
    color: #374151;
}

.dash-funnel-label span {
    color: #6b7280;
    font-size: 0.9em;
}

.dash-funnel-bar-track {
    flex: 1;
    height: 20px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.dash-funnel-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 4px;
    transition: width 0.3s;
}

.dash-funnel-dropoff {
    color: #ef4444;
    font-size: 0.75em;
    min-width: 50px;
    text-align: right;
}

/* --- Dashboard Cost Cards --- */

.dash-cost-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.dash-cost-card {
    text-align: center;
    padding: 12px 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.dash-cost-value {
    display: block;
    font-size: 1.3em;
    font-weight: 700;
    color: #1e40af;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-cost-label {
    display: block;
    font-size: 0.7em;
    color: #6b7280;
    margin-top: 4px;
}

/* --- Dashboard Health Cards --- */

.dash-health-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.dash-health-card {
    text-align: center;
    padding: 14px 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    position: relative;
}

.dash-health-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-bottom: 6px;
}

.dash-health-green { background: #10b981; }
.dash-health-amber { background: #f59e0b; }
.dash-health-red { background: #ef4444; }

.dash-health-value {
    display: block;
    font-size: 1.3em;
    font-weight: 700;
    color: #374151;
    line-height: 1.2;
}

.dash-health-label {
    display: block;
    font-size: 0.7em;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Dashboard Health Error List --- */

.dash-health-errors {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-health-error-item {
    display: flex;
    gap: 10px;
    padding: 6px 8px;
    font-size: 0.75em;
    background: #fef2f2;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

.dash-health-error-time {
    color: #6b7280;
    min-width: 55px;
}

.dash-health-error-model {
    font-weight: 600;
    color: #991b1b;
    min-width: 80px;
}

.dash-health-error-msg {
    color: #7f1d1d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-no-errors {
    padding: 12px 0;
    color: #9ca3af;
    font-size: 0.8em;
    text-align: center;
}

/* =============================================================================
   Standalone Analytics Dashboard
   ============================================================================= */

.analytics-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.analytics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    z-index: 10;
}

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

.analytics-title {
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    flex: 1;
    overflow: hidden;
}

.analytics-main {
    overflow-y: auto;
    padding: 16px;
}

.analytics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.analytics-main > .dashboard-section {
    margin-bottom: 16px;
}

/* --- Sidebar --- */

.analytics-sidebar {
    border-left: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.analytics-sidebar .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analytics-error-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-align: center;
}

.error-timeseries-container {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    min-height: 80px;
}

.analytics-error-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.analytics-error-list .error-item {
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}

.analytics-error-list .error-time {
    font-size: 0.7em;
}

.analytics-error-list .error-model {
    font-size: 0.75em;
}

.analytics-error-list .error-msg {
    font-size: 0.7em;
    white-space: normal;
    word-break: break-word;
}

/* --- Time Filter Tabs --- */

.time-tabs {
    display: flex;
    gap: 2px;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 2px;
}

.time-tab {
    padding: 3px 10px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.75em;
    font-weight: 500;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}

.time-tab:hover {
    color: #374151;
    background: #e5e7eb;
}

.time-tab.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* --- Stat Cards --- */

.analytics-stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.analytics-stat-card {
    text-align: center;
    padding: 16px 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.analytics-stat-big {
    display: block;
    font-size: 1.6em;
    font-weight: 700;
    color: #1e40af;
    line-height: 1.2;
}

.analytics-stat-label {
    display: block;
    font-size: 0.75em;
    color: #6b7280;
    margin-top: 4px;
}

.analytics-stat-sub {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 6px;
    font-size: 0.75em;
    color: #9ca3af;
}

/* --- Demo Users Table --- */

.demo-users-table {
    width: 100%;
    border-collapse: collapse;
}

.demo-users-table th {
    font-size: 0.8em;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.demo-users-table td {
    font-size: 0.85em;
}

.demo-users-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* --- Session Timeline --- */

.demo-timeline-section {
    margin-top: 16px;
    overflow-x: auto;
}

.demo-timeline-svg {
    display: block;
    max-width: 100%;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .analytics-body {
        grid-template-columns: 1fr;
    }
    .analytics-sidebar {
        max-height: 250px;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }
    .analytics-row {
        grid-template-columns: 1fr;
    }
    .analytics-stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Error Timeseries (inline in dashboard health) --- */

.dash-error-timeseries {
    margin-bottom: 12px;
    padding: 8px;
    min-height: 60px;
}

/* --- Funnel Time Tabs (inline in dashboard section) --- */

.dash-funnel-tabs {
    margin-bottom: 12px;
}

/* --- In-panel overrides: narrower canvas panel --- */

.overview-dashboard .analytics-stat-cards {
    grid-template-columns: repeat(4, 1fr);
}

.overview-dashboard .analytics-stat-card {
    padding: 10px 6px;
}

.overview-dashboard .analytics-stat-big {
    font-size: 1.2em;
}

.overview-dashboard .analytics-stat-label {
    font-size: 0.7em;
}

.overview-dashboard .demo-timeline-section {
    margin-top: 10px;
}

.overview-dashboard .demo-timeline-svg {
    max-width: 100%;
}

/* --- Responsive: Dashboard --- */

@media (max-width: 768px) {
    .dash-cost-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-health-cards {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   Drift Alerts (#7 completion)
   ============================================================================= */

.drift-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drift-alert-card {
    padding: 12px 14px;
    border-radius: 6px;
    border-left: 4px solid #e5e7eb;
}

.drift-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.drift-critical {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.drift-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.drift-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.drift-badge-critical {
    background: #fee2e2;
    color: #991b1b;
}

.drift-alert-body {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.drift-metric-label {
    color: #6b7280;
    min-width: 80px;
}

.drift-metric-current {
    font-weight: 700;
    color: #374151;
}

.drift-metric-baseline {
    color: #6b7280;
}

/* =============================================================================
   Trace Waterfall Timeline (#7 completion)
   ============================================================================= */

.trace-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85em;
    color: #374151;
}

.trace-timeline-header code {
    font-size: 0.9em;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    color: #1e40af;
}

.trace-waterfall {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wf-row {
    display: grid;
    grid-template-columns: 70px 120px 1fr 200px;
    gap: 6px;
    align-items: center;
    font-size: 0.8em;
    padding: 2px 0;
}

.wf-time {
    color: #6b7280;
    font-size: 0.9em;
}

.wf-label {
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wf-bar-track {
    position: relative;
    height: 16px;
    background: #f3f4f6;
    border-radius: 3px;
    overflow: hidden;
}

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

.wf-bar-llm {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.wf-bar-error {
    background: linear-gradient(90deg, #ef4444, #fca5a5);
}

.wf-bar-decision {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.wf-bar-agent {
    background: linear-gradient(90deg, #10b981, #6ee7b7);
}

.wf-detail {
    color: #6b7280;
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   Evaluation / LLM-as-Judge (#8)
   ============================================================================= */

/* Judge badges (inline colored labels) */

.judge-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    margin: 8px 0;
}

.judge-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-family: monospace;
}

.judge-high {
    background: #d1fae5;
    color: #065f46;
}

.judge-good {
    background: #dbeafe;
    color: #1e40af;
}

.judge-mid {
    background: #fef3c7;
    color: #92400e;
}

.judge-low {
    background: #fee2e2;
    color: #991b1b;
}

.judge-pending {
    background: #f3f4f6;
    color: #6b7280;
    font-style: italic;
}

.judge-total {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 700;
    margin-left: 4px;
}

/* Scenario status badges */

.scenario-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.scenario-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.scenario-status-judging {
    background: #dbeafe;
    color: #1e40af;
}

.scenario-status-scored {
    background: #d1fae5;
    color: #065f46;
}

.scenario-status-archived {
    background: #f3f4f6;
    color: #6b7280;
}

/* Scenario list rows */

.scenario-row {
    cursor: pointer;
    transition: background 0.15s;
}

.scenario-row:hover {
    background: #eff6ff !important;
}

/* Prompt cards (per-prompt in scenario detail) */

.prompt-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.prompt-text {
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85em;
    color: #374151;
    line-height: 1.5;
}

.prompt-text strong {
    color: #1e40af;
    margin-right: 4px;
}

.variant-responses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1px;
    background: #e5e7eb;
}

.variant-responses .scorer-card {
    border: none;
    border-radius: 0;
    background: white;
}

.thumbs-btn.has-votes {
    font-weight: 600;
}

/* =============================================================================
   Dynamic SQL Table
   ============================================================================= */

.sql-truncated {
    padding: 6px 10px;
    font-size: 0.78em;
    color: #9ca3af;
    text-align: right;
}
