/* LiberationBot Dashboard -- Dark-first styles with light mode support */

:root {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #162032;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-light: #475569;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --link: #6cb4ee;
    --link-hover: #93c5fd;
    --error: #f87171;
    --error-bg: #1c1017;
    --success: #4ade80;
    --success-bg: #0c1a12;
    --warning: #fbbf24;
    --warning-bg: #1a1708;
    --info-bg: #0c1929;
    --card-bg: #1e293b;
    --card-border: #334155;
    --input-bg: #162032;
    --input-border: #475569;
    --input-focus-border: #3b82f6;
    --nav-bg: #0f172a;
    --nav-text: #e2e8f0;
    --table-stripe: rgba(255, 255, 255, 0.03);
    --btn-secondary-bg: #334155;
    --btn-secondary-hover: #475569;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #ffffff;
        --bg-secondary: #f5f5f5;
        --bg-tertiary: #eef2f7;
        --text: #1a1a1a;
        --text-muted: #666666;
        --border: #dddddd;
        --border-light: #cccccc;
        --accent: #2563eb;
        --accent-hover: #1d4ed8;
        --link: #2563eb;
        --link-hover: #1d4ed8;
        --error: #dc2626;
        --error-bg: #fef2f2;
        --success: #16a34a;
        --success-bg: #f0fdf4;
        --warning: #d97706;
        --warning-bg: #fffbeb;
        --info-bg: #eff6ff;
        --card-bg: #ffffff;
        --card-border: #dddddd;
        --input-bg: #ffffff;
        --input-border: #cccccc;
        --input-focus-border: #2563eb;
        --nav-bg: #1e293b;
        --nav-text: #e2e8f0;
        --table-stripe: rgba(0, 0, 0, 0.03);
        --btn-secondary-bg: #e2e8f0;
        --btn-secondary-hover: #cbd5e1;
    }
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}

/* Navigation */
header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--nav-bg);
    color: var(--nav-text);
    flex-wrap: wrap;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 1rem;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--nav-text);
    text-decoration: none;
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.nav-links a:hover { background: rgba(255,255,255,0.1); }

.nav-actions { margin-left: auto; }

.logout-link {
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
}

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

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash.error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error); }
.flash.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.flash.info { background: var(--info-bg); color: var(--accent); border: 1px solid var(--accent); }

/* Cards */
.info-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.info-card p { margin: 0; }

/* Login page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    text-align: center;
}

.login-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

.login-form { text-align: left; }

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Standalone form inputs (not in .form-group) */
input, select, textarea {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Stacked form layout (vertical labels + inputs) */
.form-stacked .form-field {
    margin-bottom: 1rem;
}

.form-stacked .form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text);
}

.form-stacked .form-field input,
.form-stacked .form-field select,
.form-stacked .form-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}

.btn, button[type="submit"] {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    background: var(--accent);
    color: #ffffff;
    transition: background 0.15s ease;
}

.btn:hover, button[type="submit"]:hover {
    background: var(--accent-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--text);
}

.btn-secondary:hover { background: var(--btn-secondary-hover); }

.btn-danger {
    background: var(--error);
    color: #ffffff;
}

.btn-danger:hover { background: #ef4444; }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

/* Alternating row colors for readability */
tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Status section */
.status-section { margin-bottom: 2rem; }

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* Error page */
.error-container {
    text-align: center;
    margin: 4rem auto;
}

.error-container h1 { font-size: 2rem; }
.error-container a { color: var(--link); }

/* Card-like panels for dashboard sections */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.panel h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.panel h2:not(:first-child) {
    margin-top: 1.5rem;
}

/* Dashboard grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    .dashboard-grid > :first-child {
        grid-column: 1 / -1;
    }
}

/* Health banner */
.health-banner {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.health-banner.health-green {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

.health-banner.health-yellow {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

.health-banner.health-red {
    background: var(--error-bg);
    border-color: var(--error);
    color: var(--error);
}

.health-banner ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.health-summary {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Health indicator (in status partial) */
.health-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.health-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
}

.health-green .health-dot { background: var(--success); }
.health-yellow .health-dot { background: var(--warning); }
.health-red .health-dot { background: var(--error); }

.health-reasons {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.health-counts {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Status badges */
.status-badge, .badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-running, .badge-running { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.status-stopped, .badge-stopped { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.status-crashed, .badge-crashed { background: rgba(248, 113, 113, 0.15); color: var(--error); }
.status-paused, .badge-paused { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.status-suspended, .badge-suspended { background: rgba(59, 130, 246, 0.15); color: var(--accent); }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

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

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Empty state text */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

/* Review summary */
.review-summary p {
    margin: 0.25rem 0;
}

/* Queue totals */
.queue-total {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Action row colors */
.action-success { }
.action-failure td { color: var(--error); }

/* Nav link overrides -- keep nav links in nav-text color */
.nav-links a { color: var(--nav-text); text-decoration: none; }
.nav-links a:hover { color: #ffffff; text-decoration: none; background: rgba(255,255,255,0.1); }
.nav-links a.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
}
.logout-link { color: var(--nav-text); text-decoration: none; }
.logout-link:hover { color: #ffffff; text-decoration: none; }

/* Review stats cards -- flex row of small stat cards */
.review-stats-cards {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.review-stats-cards .stat-card {
    flex: 1 1 100px;
    min-width: 100px;
    text-align: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
}

.review-stats-cards .stat-card h3 {
    margin: 0 0 0.25rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-stats-cards .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

/* HTMX loading indicators */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
    opacity: 1;
}

#global-spinner {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.25rem 0;
}

/* ============================================================
   TWO-COLUMN PAGE LAYOUTS
   ============================================================ */

/* Shared two-column layout for messages, logs, knowledge, notes */
.messages-layout,
.knowledge-layout,
.notes-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Template page has wider sidebar for template list */
.template-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Filter/list sidebars */
.filter-sidebar,
.template-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    position: sticky;
    top: 1rem;
}

/* Main content area next to sidebar */
.messages-content,
.knowledge-detail,
.template-detail,
.note-detail-panel {
    min-width: 0; /* prevent grid blowout */
}

/* ============================================================
   FILTER GROUPS
   ============================================================ */

.filter-group {
    margin-bottom: 0.75rem;
}

.filter-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="datetime-local"] {
    width: 100%;
}

/* ============================================================
   MODAL (Review Edit)
   ============================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin: 0 0 1rem 0;
}

.modal-content textarea {
    width: 100%;
    font-family: monospace;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0.75rem;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* ============================================================
   REVIEW ACTION BUTTONS
   ============================================================ */

.btn-approve {
    background: var(--success);
    color: #ffffff;
}
.btn-approve:hover { background: #22c55e; }

.btn-edit {
    background: var(--warning);
    color: #000000;
}
.btn-edit:hover { background: #f59e0b; }

.btn-reject {
    background: var(--error);
    color: #ffffff;
}
.btn-reject:hover { background: #ef4444; }

.reject-reason {
    margin-top: 0.5rem;
}

.reject-reason input {
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   CLICKABLE ELEMENTS
   ============================================================ */

.clickable {
    cursor: pointer;
}

.clickable:hover {
    background: rgba(59, 130, 246, 0.08);
}

tr.clickable:hover {
    background: rgba(59, 130, 246, 0.08);
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination .btn {
    min-width: 80px;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================
   PREVIEW TEXT
   ============================================================ */

.preview {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* ============================================================
   LOG-SPECIFIC
   ============================================================ */

.log-timestamp {
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.log-extra {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 300px;
}

.log-extra pre {
    margin: 0;
    font-size: inherit;
    color: inherit;
}

.log-row.level-ERROR td,
.log-row.level-CRITICAL td {
    color: var(--error);
}

.log-row.level-WARNING td {
    color: var(--warning);
}

/* Log level badges */
.badge-ERROR { background: rgba(248, 113, 113, 0.15); color: var(--error); }
.badge-CRITICAL { background: rgba(248, 113, 113, 0.2); color: var(--error); }
.badge-WARNING { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-INFO { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-DEBUG { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ============================================================
   KNOWLEDGE-SPECIFIC
   ============================================================ */

.knowledge-list {
    /* list panel inside knowledge layout */
}

.knowledge-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.knowledge-stats .stat {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.stat-separator {
    color: var(--text-muted);
}

.knowledge-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.knowledge-controls input,
.knowledge-controls select {
    min-width: 200px;
}

.chunk-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.chunk-content {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.chunk-detail {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.chunk-detail h3 {
    margin: 0 0 1rem 0;
}

/* ============================================================
   DETAIL FIELDS (definition list used in knowledge & notes)
   ============================================================ */

.detail-fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.detail-fields dt {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-fields dd {
    margin: 0;
}

/* ============================================================
   NOTES-SPECIFIC
   ============================================================ */

.notes-list {
    /* container for notes list content */
}

.notes-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.note-detail {
    /* right panel for note detail */
}

.note-detail-view {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.note-detail-view h3 {
    margin: 0 0 1rem 0;
}

.note-content {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.dossier-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.dossier-card h3 {
    margin: 0 0 0.5rem 0;
}

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

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.todo-status {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ============================================================
   TEMPLATE EDITOR SPECIFIC
   ============================================================ */

.template-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.template-list li {
    border-bottom: 1px solid var(--border);
}

.template-list li:last-child {
    border-bottom: none;
}

.template-list li a {
    display: block;
    padding: 0.6rem 0.5rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
}

.template-list li a:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text);
    text-decoration: none;
}

.template-list li.active a {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.template-list .meta {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.template-variables {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.template-variables h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.template-variables ul {
    margin: 0;
    padding-left: 1.5rem;
}

.template-variables li {
    margin-bottom: 0.25rem;
}

.preview-result {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.preview-result.error {
    border-color: var(--error);
    color: var(--error);
}

.preview-result.success {
    border-color: var(--success);
    color: var(--text);
}

.diff-output {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}

/* ============================================================
   NOTIFICATION-SPECIFIC
   ============================================================ */

.notification-filters,
.filters {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.notification-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.notification-item.unread {
    border-left: 3px solid var(--accent);
}

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

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--error);
    color: #ffffff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 4px;
    margin-left: 4px;
}

/* Notification table row styles */
tr.notification.unread {
    border-left: 3px solid var(--accent);
}

tr.notification.critical td:first-child,
tr.notification.error td:first-child {
    color: var(--error);
}

tr.notification.warning td:first-child {
    color: var(--warning);
}

tr.notification.info td:first-child {
    color: var(--accent);
}

/* ============================================================
   PAGE HEADER WITH ACTIONS
   ============================================================ */

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.75rem 0;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ============================================================
   REVIEW DETAIL PANEL
   ============================================================ */

.review-detail-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}

.review-detail-panel h3 {
    margin: 0 0 1rem 0;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.detail-content {
    margin-bottom: 1rem;
}

.detail-content h4,
.detail-context h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
}

.content-full {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.content-preview {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-context {
    margin-bottom: 1rem;
}

.context-section {
    margin-bottom: 0.75rem;
}

.context-section pre {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ============================================================
   REVIEW TABLE & PRIORITY BADGES
   ============================================================ */

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

.review-item {
    /* base review item row */
}

.priority-high .badge,
.badge-high {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
}

.priority-medium .badge,
.badge-medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.priority-low .badge,
.badge-low {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.priority-critical .badge,
.badge-critical {
    background: rgba(248, 113, 113, 0.2);
    color: var(--error);
}

/* ============================================================
   MESSAGE TABLE & ROWS
   ============================================================ */

.message-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.message-row {
    cursor: pointer;
}

.message-row:hover {
    background: rgba(59, 130, 246, 0.08);
}

/* Platform badge */
.badge-platform {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

/* Message status badges */
.badge-pending { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-processing { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-completed { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-discarded { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge-expired { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ============================================================
   MESSAGE DETAIL PANEL
   ============================================================ */

.message-detail-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}

.message-detail-panel h3 {
    margin: 0 0 1rem 0;
}

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

.detail-table th {
    text-align: right;
    padding-right: 1rem;
    white-space: nowrap;
    width: 140px;
    vertical-align: top;
}

.detail-table td {
    word-break: break-word;
}

/* ============================================================
   THREAD VIEW
   ============================================================ */

.thread-view-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}

.thread-view-panel h3 {
    margin: 0 0 0.75rem 0;
}

.thread-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.thread-tree,
.thread-flat {
    /* container for thread nodes */
}

.thread-node {
    margin-bottom: 0.25rem;
}

.thread-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
}

.thread-message:hover {
    background: rgba(59, 130, 246, 0.08);
}

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

.msg-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* ============================================================
   PLACEHOLDER TEXT
   ============================================================ */

.placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================
   NOTE TYPE BADGES
   ============================================================ */

.badge-thought { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-dossier { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-todo { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-relationship { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-observation { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge-strategy { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

/* Stance badges for dossiers */
.badge-ally { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge-hostile { background: rgba(248, 113, 113, 0.15); color: var(--error); }
.badge-unknown { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* Todo status badges */
.badge-open { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-done, .badge-complete { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-cancelled { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* Scheduler job status */
.badge-active { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-inactive { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ============================================================
   RESPONSIVE BREAKPOINT FOR SIDEBAR LAYOUTS
   ============================================================ */

@media (max-width: 768px) {
    .messages-layout,
    .knowledge-layout,
    .notes-layout,
    .template-layout {
        grid-template-columns: 1fr;
    }

    .filter-sidebar,
    .template-sidebar {
        position: static;
    }

    .detail-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* ============================================================
   INTERACT PAGE
   ============================================================ */

.interact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

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

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

.interact-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.interact-panel h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.interact-result {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    word-break: break-word;
}

.interact-panel .form-field {
    margin-bottom: 0.5rem;
}

.interact-panel .form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.interact-panel .form-field input,
.interact-panel .form-field textarea {
    width: 100%;
}

.interact-panel .form-field textarea {
    resize: vertical;
    min-height: 60px;
}

.interact-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.interact-actions .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
}

.interact-mock-state {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.interact-mock-state strong {
    color: var(--text);
}

.interact-queue-stats dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.interact-queue-stats dd {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
}

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

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

.interact-log-entry {
    border-bottom: 1px solid var(--border);
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

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

.interact-log-entry .log-type {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.interact-log-entry .log-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Loading spinner text inside interact panels */
.interact-panel .htmx-indicator {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Clickable log entries in observation panel */
.interact-log-entry[data-entry-id] {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.interact-log-entry[data-entry-id]:hover {
    background-color: var(--bg-tertiary);
}

/* ============================================================
   Slide-out Viewer Panel (reusable across dashboard + chat)
   ============================================================ */

.viewer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
}
.viewer-backdrop.open {
    display: block;
}

.viewer-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 60%;
    max-width: 900px;
    min-width: 400px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    background: var(--bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.viewer-panel.open {
    transform: translateX(0);
}

@media (max-width: 768px) {
    .viewer-panel {
        width: 100%;
        min-width: unset;
    }
}

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

.viewer-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.viewer-close-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
.viewer-close-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

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

/* Viewer sections */
.viewer-section {
    margin-bottom: 1.25rem;
}
.viewer-section-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
}

/* Header meta row */
.viewer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}
.viewer-meta-item {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.viewer-meta-item strong {
    color: var(--text);
}

/* Method badge in viewer */
.viewer-method-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent);
    color: #fff;
}
.viewer-method-badge.error {
    background: var(--error);
}

/* Message bubble (reusable for question + answer) */
.viewer-message {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.viewer-message-role {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.viewer-message-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}
.viewer-message-content p {
    margin: 0 0 0.5rem 0;
}
.viewer-message-content p:last-child {
    margin-bottom: 0;
}
.viewer-message-content h1,
.viewer-message-content h2,
.viewer-message-content h3,
.viewer-message-content h4 {
    margin: 0.75rem 0 0.4rem 0;
    color: var(--text);
}
.viewer-message-content ul,
.viewer-message-content ol {
    margin: 0.25rem 0;
    padding-left: 1.5rem;
}
.viewer-message-content code {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
}
.viewer-message-content pre {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.viewer-message-content pre code {
    background: none;
    padding: 0;
}
.viewer-message-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
    margin: 0.5rem 0;
    color: var(--text-muted);
}

/* Retrieval chunk list */
.viewer-retrieval-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.viewer-retrieval-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.viewer-retrieval-item summary {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}
.viewer-retrieval-item summary:hover {
    background: var(--bg-tertiary);
}
.viewer-retrieval-score {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
}
.viewer-retrieval-source {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.viewer-retrieval-content {
    padding: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

/* Input parameters display */
.viewer-input-params {
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* Thinker queries section */
.viewer-thinker-queries {
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 6px;
    white-space: pre-wrap;
    line-height: 1.5;
    max-height: 250px;
    overflow-y: auto;
}

/* Scoring placeholder */
.viewer-scoring-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    text-align: center;
}

/* ============================================================
   REVIEW DETAIL -- RICH CONTEXT (Commit 4)
   ============================================================ */

/* Original message box in review detail */
.detail-original-message {
    margin-bottom: 1rem;
}

.detail-original-message h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.original-message-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.original-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.original-meta strong {
    color: var(--accent);
}

.original-content {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Thread context in review detail */
.detail-thread-context {
    margin-bottom: 1rem;
}

.detail-thread-context summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.thread-text {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

/* Agent reasoning section */
.detail-reasoning {
    margin-bottom: 1rem;
}

.detail-reasoning summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.detail-reasoning p {
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

/* Topic info for compose_post */
.detail-topic {
    margin-bottom: 1rem;
}

.detail-topic h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Key topics and response angles */
.detail-topics {
    margin-bottom: 1rem;
}

.detail-topics summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.topics-list {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.badge-topic {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    margin: 0.15rem 0.25rem 0.15rem 0;
}

.angles-list {
    margin-top: 0.25rem;
}

.angles-list ul {
    margin: 0.25rem 0;
    padding-left: 1.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

/* Knowledge sources section */
.detail-knowledge {
    margin-bottom: 1rem;
}

.detail-knowledge summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.detail-knowledge .knowledge-list {
    list-style: disc;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text);
}

/* Thinker draft section */
.detail-draft {
    margin-bottom: 1rem;
}

.detail-draft summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.detail-draft pre {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

/* ============================================================
   MESSAGE DETAIL -- CONTENT DISPLAY (Commit 4)
   ============================================================ */

.message-title {
    margin-bottom: 0.75rem;
}

.message-title h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}

.message-content {
    margin-bottom: 1rem;
}

.message-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.content-body {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.message-content.empty {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
}

.message-content.empty p {
    margin: 0;
    color: var(--text-muted);
}

/* Queue metadata collapsible */
.metadata-details {
    margin-top: 0.5rem;
}

.metadata-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.metadata-details .detail-table {
    margin-top: 0.5rem;
}

/* ============================================================
   Ask Dia Result Styles
   ============================================================ */

.ask-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.ask-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ask-section summary {
    cursor: pointer;
    padding: 0.5rem 0;
    user-select: none;
}

.ask-section summary:hover {
    color: var(--accent);
}

.ask-answer {
    margin-top: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.ask-pre {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.retrieval-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.retrieval-item {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.retrieval-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.retrieval-score {
    font-weight: 600;
    color: var(--success);
    font-family: monospace;
}

.retrieval-source {
    color: var(--accent);
    font-size: 0.8rem;
}

.retrieval-id {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: monospace;
}

.retrieval-preview {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    max-height: 3em;
    overflow: hidden;
}

/* Badge for phases */
.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-family: monospace;
}

/* ------------------------------------------------------------ */
/* Navigation hamburger (hidden on desktop)                      */
/* ------------------------------------------------------------ */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

/* ------------------------------------------------------------ */
/* Mobile navigation: <= 768px                                   */
/* ------------------------------------------------------------ */
@media (max-width: 768px) {
    .nav-hamburger {
        display: block;
    }

    header nav {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
        gap: 0;
    }

    .nav-brand {
        flex: 1;
        margin-right: 0;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0.5rem 0 0 0;
        gap: 0;
        order: 10;  /* push below brand + hamburger + logout */
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 0.95rem;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(255,255,255,0.12);
    }

    .nav-actions {
        margin-left: 0;
    }

    .logout-link {
        padding: 0.5rem;
        display: inline-block;
    }

    main {
        padding: 1rem;
    }

    footer {
        margin-top: 1rem;
    }
}
