/* ============================================================
   Cognitive Memory Layer - Dashboard Styles
   Dark-first theme with light mode toggle
   ============================================================ */

/* --- CSS Custom Properties (Dark Theme) --- */
:root, [data-theme="dark"] {
    --bg-primary: #0f1117;
    --bg-secondary: #161926;
    --bg-tertiary: #12151f;
    --bg-card: #1c2033;
    --bg-card-hover: #232840;
    --bg-input: #1c2033;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --border: #2a2f45;
    --border-light: #353b55;

    --text-primary: #e4e7f0;
    --text-secondary: #9197b3;
    --text-muted: #6b7194;
    --text-inverse: #0f1117;

    --accent: #6c8cff;
    --accent-hover: #8ba3ff;
    --accent-muted: rgba(108, 140, 255, 0.15);

    --success: #34d399;
    --success-muted: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-muted: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-muted: rgba(248, 113, 113, 0.15);
    --info: #38bdf8;
    --info-muted: rgba(56, 189, 248, 0.15);

    --purple: #a78bfa;
    --purple-muted: rgba(167, 139, 250, 0.15);
    --pink: #f472b6;
    --pink-muted: rgba(244, 114, 182, 0.15);
    --teal: #2dd4bf;
    --teal-muted: rgba(45, 212, 191, 0.15);
    --orange: #fb923c;
    --orange-muted: rgba(251, 146, 60, 0.15);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --sidebar-width: 240px;
    --topbar-height: 60px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef0f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f1f5;
    --bg-input: #f0f1f5;
    --bg-overlay: rgba(0, 0, 0, 0.4);

    --border: #dfe1ea;
    --border-light: #e8eaf0;

    --text-primary: #1a1d2e;
    --text-secondary: #5a6078;
    --text-muted: #8b90a5;
    --text-inverse: #ffffff;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5 {
    font-weight: 600;
    line-height: 1.3;
}

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* --- Hidden utility --- */
.hidden { display: none !important; }

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

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo { margin-bottom: 16px; }
.login-card h2 { margin-bottom: 8px; font-size: 1.5rem; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.95rem; }

.login-card input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--danger-muted);
    border-radius: var(--radius-sm);
}

/* --- App Layout --- */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.15s;
}

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

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.nav-icon { font-size: 1.15rem; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Main Content --- */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.page-title { font-size: 1.25rem; }

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.page { display: none; }
.page.active { display: block; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}
.btn-danger:hover { opacity: 0.9; }

.btn-warning {
    background: var(--warning);
    color: var(--text-inverse);
}
.btn-warning:hover { opacity: 0.9; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-full { width: 100%; }

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

/* --- Form Elements --- */
.select-sm, .input-sm {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.select-sm:focus, .input-sm:focus { border-color: var(--accent); }

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

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

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

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border-light); }

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Chart Grid --- */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.chart-card canvas {
    max-height: 280px;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
th:hover { color: var(--text-primary); }

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }

tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover { background: var(--bg-card-hover); }

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

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-type {
    background: var(--accent-muted);
    color: var(--accent);
}

.badge-status-active {
    background: var(--success-muted);
    color: var(--success);
}

.badge-status-silent {
    background: var(--warning-muted);
    color: var(--warning);
}

.badge-status-compressed {
    background: var(--info-muted);
    color: var(--info);
}

.badge-status-archived {
    background: var(--purple-muted);
    color: var(--purple);
}

.badge-status-deleted {
    background: var(--danger-muted);
    color: var(--danger);
}

.badge-labile {
    background: var(--orange-muted);
    color: var(--orange);
}

.badge-ok {
    background: var(--success-muted);
    color: var(--success);
}

.badge-error {
    background: var(--danger-muted);
    color: var(--danger);
}

.badge-unknown {
    background: var(--warning-muted);
    color: var(--warning);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.filter-bar .input-sm {
    min-width: 200px;
}

/* --- Component Health Cards --- */
.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.component-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

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

.component-name {
    font-weight: 600;
    font-size: 1rem;
}

.component-detail {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

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

.component-detail-label { color: var(--text-secondary); }
.component-detail-value { font-weight: 500; font-family: var(--font-mono); }

/* --- Detail View --- */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.detail-id {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

.detail-field-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-field-value {
    color: var(--text-primary);
    word-break: break-word;
}

.json-tree {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    padding: 2px 10px;
    background: var(--accent-muted);
    color: var(--accent);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
}

/* --- Gauge --- */
.gauge-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 4px;
}

.gauge-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.gauge-fill-accent { background: var(--accent); }
.gauge-fill-success { background: var(--success); }
.gauge-fill-warning { background: var(--warning); }
.gauge-fill-danger { background: var(--danger); }

/* --- Management Panels --- */
.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 20px;
}

.management-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.management-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

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

.management-form .form-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.management-form .form-row label {
    min-width: 110px;
}

.management-form .form-row input,
.management-form .form-row select {
    flex: 1;
}

.result-box {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* --- Event Row Expandable --- */
.event-payload {
    display: none;
    padding: 10px 14px;
    background: var(--bg-input);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    border-bottom: 1px solid var(--border);
}

.event-payload.expanded { display: table-cell; }

tr.event-expanded .event-payload { display: block; }

/* --- Loading spinner --- */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 12px;
    color: var(--text-secondary);
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* --- Notification toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }

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

/* --- Section Titles --- */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 24px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* --- Back button --- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    cursor: pointer;
}
.back-link:hover { color: var(--accent); }

/* --- Switch / Toggle --- */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active::after {
    transform: translateX(18px);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .management-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* =========================================================================
   NEW DASHBOARD COMPONENTS
   ========================================================================= */

/* --- Data Table (generic sortable/clickable) --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}
.table-responsive {
    overflow-x: auto;
}
.sortable-th:hover {
    color: var(--accent);
}

/* --- Action Buttons Row --- */
.action-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.btn-xs {
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* --- Graph Container --- */
.graph-container {
    width: 100%;
    height: 560px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.graph-empty-state {
    color: var(--text-secondary);
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.6;
}
.graph-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.graph-search-results {
    position: absolute;
    z-index: 10;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    width: 350px;
    box-shadow: var(--shadow-lg);
}
.search-result-item {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.search-result-item:hover {
    background: var(--bg-tertiary);
}
.search-result-item:last-child {
    border-bottom: none;
}

/* --- Config Page --- */
.config-section .config-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.config-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
    align-items: center;
}
.config-row:last-child {
    border-bottom: none;
}
.config-key {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}
.config-key-name {
    font-family: monospace;
}
.config-lock {
    font-size: 0.75rem;
    opacity: 0.6;
}
.config-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.config-value {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
}
.config-desc {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.config-default {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}
.config-edit-input {
    padding: 4px 8px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
}

/* --- Bulk Action Bar --- */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 0.88rem;
    color: var(--accent);
}
.bulk-action-bar.hidden {
    display: none;
}

/* --- Retrieval Form --- */
.retrieval-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.retrieval-form .form-row-inline {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.retrieval-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}
.retrieval-result-card {
    border-left: 3px solid var(--accent);
}

/* --- Gauge fill variant --- */
.gauge-fill-danger {
    background: linear-gradient(90deg, var(--danger), #ff4444);
}

/* --- Badge variants --- */
.badge-labile {
    background: var(--purple);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 6px;
}

/* --- Tenant ID cell --- */
.tenant-id-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Form improvements --- */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-row label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Job history detail row --- */
.job-detail-row td {
    background: var(--bg-tertiary);
    padding: 0 !important;
}
.job-detail-row .result-box {
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.82rem;
}

/* --- Checkbox in table --- */
.mem-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* --- Responsive for new sections --- */
@media (max-width: 900px) {
    .graph-container {
        height: 350px;
    }
    .graph-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .config-row {
        grid-template-columns: 1fr;
    }
    .retrieval-form .form-row-inline {
        flex-direction: column;
    }
    .graph-search-results {
        width: 100%;
    }
    .bulk-action-bar {
        flex-wrap: wrap;
    }
}
