/* ═══════════════════════════════════════════════
   Dark Theme — Cool Slate palette
   
   Uses CSS custom properties so colors are defined
   ONCE and consumed everywhere. No duplication.
   
   Two activation paths:
     1. data-theme="dark" (explicit toggle)
     2. data-theme="system" + system prefers dark
   ═══════════════════════════════════════════════ */

/* ── Define palette ─────────────────────────── */
[data-theme="dark"] {
    color-scheme: dark;
    --dk-bg:         #0f172a;
    --dk-surface:    #1e293b;
    --dk-surface-2:  #334155;
    --dk-border:     #334155;
    --dk-border-dim: #475569;
    --dk-text:       #f1f5f9;
    --dk-text-2:     #e2e8f0;
    --dk-text-3:     #cbd5e1;
    --dk-text-dim:   #94a3b8;
    --dk-text-muted: #64748b;
    --dk-text-faint: #475569;
    --dk-accent:     #818cf8;
    --dk-accent-hover: #6366f1;
    --dk-accent-deep:  #4f46e5;
    --dk-accent-bg:    rgba(99,102,241,0.15);
    --dk-accent-bg-2:  rgba(99,102,241,0.2);
    --dk-green:      #6ee7b7;
    --dk-green-bg:   rgba(16,185,129,0.15);
    --dk-red:        #ef4444;
    --dk-red-soft:   #fca5a5;
    --dk-red-bg:     rgba(239,68,68,0.15);
    --dk-yellow:     #fcd34d;
    --dk-yellow-bg:  rgba(245,158,11,0.15);
    --dk-purple:     #c4b5fd;
    --dk-shadow:     rgba(0,0,0,0.3);
    --dk-shadow-lg:  rgba(0,0,0,0.4);
    --dk-overlay:    rgba(0,0,0,0.3);
    --finaya-primary: var(--dk-accent);
    --finaya-primary-hover: var(--dk-accent-hover);
    --finaya-primary-dark: var(--dk-accent-deep);
}

/*
   theme-toggle.js resolves data-theme="system" into
   data-theme="dark" or data-theme="light" at load time
   (before CSS renders), so all dark rules below only
   need [data-theme="dark"] — no duplication.
*/

/* ── HTML / Body ────────────────────────────── */
[data-theme="dark"],
[data-theme="dark"] body {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}

/* ── Tailwind utility overrides ─────────────── */
[data-theme="dark"] .bg-white { background-color: #1e293b !important; }
[data-theme="dark"] .bg-gray-50 { background-color: #1e293b !important; }
[data-theme="dark"] .bg-gray-100 { background-color: #334155 !important; }
[data-theme="dark"] .text-gray-900 { color: #f1f5f9 !important; }
[data-theme="dark"] .text-gray-800 { color: #f1f5f9 !important; }
[data-theme="dark"] .text-gray-700 { color: #94a3b8 !important; }
[data-theme="dark"] .text-gray-600 { color: #94a3b8 !important; }
[data-theme="dark"] .text-gray-500 { color: #64748b !important; }
[data-theme="dark"] .text-gray-400 { color: #64748b !important; }
[data-theme="dark"] .border-gray-200 { border-color: #334155 !important; }
[data-theme="dark"] .border-gray-300 { border-color: #334155 !important; }
[data-theme="dark"] .divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: #334155 !important; }
[data-theme="dark"] .divide-gray-300 > :not([hidden]) ~ :not([hidden]) { border-color: #334155 !important; }
[data-theme="dark"] .ring-gray-300 { --tw-ring-color: #334155 !important; }
[data-theme="dark"] .hover\:bg-gray-50:hover { background-color: #334155 !important; }
[data-theme="dark"] .text-indigo-600 { color: #818cf8 !important; }
[data-theme="dark"] .bg-indigo-600 { background-color: #818cf8 !important; }
[data-theme="dark"] .bg-indigo-50 { background-color: rgba(99, 102, 241, 0.15) !important; }

/* ── Form elements ──────────────────────────── */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] textarea,
[data-theme="dark"] select:not([multiple]) {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25) !important;
    --tw-ring-color: rgba(129, 140, 248, 0.25) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #64748b !important; }

/* Multi-select */
[data-theme="dark"] select[multiple] {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}
[data-theme="dark"] select[multiple] option { background: #1e293b; color: #e2e8f0; padding: 0.25rem 0.5rem; }
[data-theme="dark"] select[multiple] option:checked,
[data-theme="dark"] select[multiple] option:active {
    background: #818cf8 linear-gradient(0deg, #818cf8 0%, #818cf8 100%) !important;
    color: #0f172a !important;
}
[data-theme="dark"] select[multiple] option:hover { background: #334155; }

/* Checkboxes & radios */
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] { background-color: #1e293b !important; border-color: #475569 !important; }
[data-theme="dark"] input[type="checkbox"]:checked,
[data-theme="dark"] input[type="radio"]:checked { background-color: #818cf8 !important; border-color: #818cf8 !important; }

/* Labels & help text */
[data-theme="dark"] label { color: #e2e8f0; }
[data-theme="dark"] .help-text,
[data-theme="dark"] .helptext,
[data-theme="dark"] p.help { color: #64748b; }

/* Django form cards / sections */
[data-theme="dark"] .card,
[data-theme="dark"] [class*="rounded-lg"][class*="border"],
[data-theme="dark"] [class*="rounded-md"][class*="shadow"] { background-color: #1e293b; border-color: #334155; }

/* Enrichment rules builder */
[data-theme="dark"] .enrichment-rule-card,
[data-theme="dark"] [id*="rule-card"],
[data-theme="dark"] .border.rounded-lg.p-4,
[data-theme="dark"] .border.rounded-lg.p-6 { background-color: #1e293b !important; border-color: #334155 !important; }

/* SQL fields */
[data-theme="dark"] .sql-field { background-color: #0f172a !important; color: #e2e8f0 !important; border-color: #334155 !important; }
[data-theme="dark"] .sql-field:focus { border-color: #818cf8 !important; box-shadow: 0 0 0 1px #818cf8 !important; }
[data-theme="dark"] #sql-fields-section { background-color: #1e293b !important; border-color: #334155 !important; }

/* Inline code / kbd badges */
[data-theme="dark"] code,
[data-theme="dark"] kbd { background-color: #334155; color: #c4b5fd; border-color: #475569; }

/* Collapsible sections / fieldsets */
[data-theme="dark"] fieldset { border-color: #334155; }
[data-theme="dark"] legend { color: #e2e8f0; }

/* Buttons — secondary / outline */
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] button[class*="border"][class*="rounded"] { border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] a[class*="dashed"] { border-color: #475569 !important; color: #818cf8 !important; }

/* ── Enrichment rules builder ───────────────── */
[data-theme="dark"] .erb-mode-toggle { border-color: #334155; }
[data-theme="dark"] .erb-mode-btn { color: #94a3b8; }
[data-theme="dark"] .erb-mode-btn:first-child { border-color: #334155; }
[data-theme="dark"] .erb-mode-btn--on { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .erb-mode-btn:hover:not(.erb-mode-btn--on) { background: #334155; }
[data-theme="dark"] .erb-toggle label { color: #e2e8f0; }
[data-theme="dark"] .erb-field-label { color: #e2e8f0; }
[data-theme="dark"] .erb-field-hint { color: #64748b; }
[data-theme="dark"] .erb-field-hint code { background: #334155; color: #c4b5fd; }
[data-theme="dark"] .erb-input { background: #1e293b; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .erb-input:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2); background-color: #1e293b; }
[data-theme="dark"] .erb-select { background: #1e293b; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .erb-select:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2); background-color: #1e293b; }
[data-theme="dark"] .erb-slot { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .erb-slot:hover { border-color: #818cf8; box-shadow: 0 2px 8px rgba(129,140,248,0.1); }
[data-theme="dark"] .erb-slot__name { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .erb-slot__name:focus { border-color: #818cf8; background-color: #0f172a; }
[data-theme="dark"] .erb-slot__status-text { color: #94a3b8; }
[data-theme="dark"] .erb-slot__remove:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
[data-theme="dark"] .erb-slot__fields { border-top-color: #334155; }
[data-theme="dark"] .erb-slot__textarea { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .erb-slot__textarea:focus { border-color: #818cf8; background-color: #0f172a; }
[data-theme="dark"] .erb-empty { color: #94a3b8; }
[data-theme="dark"] .erb-empty__icon { color: #475569; }
[data-theme="dark"] .erb-empty__text { color: #f1f5f9; }
[data-theme="dark"] .erb-empty__sub { color: #64748b; }
[data-theme="dark"] .erb-add-btn { border-color: #334155; color: #818cf8; }
[data-theme="dark"] .erb-add-btn:hover { border-color: #818cf8; background: rgba(99,102,241,0.1); }
[data-theme="dark"] .erb-webhook__title svg { color: #94a3b8; }
[data-theme="dark"] .erb-webhook__header-remove:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
[data-theme="dark"] .erb-webhook__add-header:hover { border-color: #818cf8; color: #818cf8; }
[data-theme="dark"] .erb-webhook__kv-table input { background: #1e293b; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .erb-webhook__kv-table input:focus { border-color: #818cf8; }
[data-theme="dark"] .erb-webhook__kv-remove:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
[data-theme="dark"] .erb-webhook__badge--on { background: rgba(16,185,129,0.15); color: #6ee7b7; }

/* ── Scenario detail/form sections ──────────── */
[data-theme="dark"] .border-t { border-color: #334155 !important; }
[data-theme="dark"] hr { border-color: #334155; }
[data-theme="dark"] .shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.3) !important; }

/* ── Icon Sidebar ───────────────────────────── */
[data-theme="dark"] .icon-sidebar { background: #0f172a; border-color: #1e293b; }
[data-theme="dark"] .icon-sidebar__btn { color: #94a3b8; }
[data-theme="dark"] .icon-sidebar__btn:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .icon-sidebar__btn--active { background: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .icon-sidebar__btn[data-tooltip]::after { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .icon-sidebar__avatar { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .icon-sidebar__avatar:hover { box-shadow: 0 0 0 2px rgba(129,140,248,0.4); }

/* ── Customize / New Chat panels ────────────── */
[data-theme="dark"] .customize-panel { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .customize-panel__back { color: #94a3b8; }
[data-theme="dark"] .customize-panel__back:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .customize-panel__title { color: #f1f5f9; }
[data-theme="dark"] .customize-panel__item { color: #94a3b8; }
[data-theme="dark"] .customize-panel__item:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .customize-panel__item--active { background: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .customize-panel__item svg { color: #64748b; }
[data-theme="dark"] .customize-panel__item--active svg,
[data-theme="dark"] .customize-panel__item:hover svg { color: #818cf8; }
[data-theme="dark"] .new-chat-panel__item { color: #94a3b8; }
[data-theme="dark"] .new-chat-panel__item:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .new-chat-panel__item-name { color: #f1f5f9; }
[data-theme="dark"] .new-chat-panel__item:hover .new-chat-panel__item-name { color: #818cf8; }
[data-theme="dark"] .new-chat-panel__item-type { color: #64748b; }
[data-theme="dark"] .new-chat-panel__empty { color: #64748b; }

/* ── Profile popup ──────────────────────────── */
[data-theme="dark"] .profile-popup { background: #1e293b; box-shadow: 0 10px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06); }
[data-theme="dark"] .profile-popup__section { color: #64748b; }
[data-theme="dark"] .profile-popup__item { color: #f1f5f9; }
[data-theme="dark"] .profile-popup__item:hover { background: #334155; }
[data-theme="dark"] .profile-popup__item--active { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .profile-popup__item--danger { color: #ef4444; }
[data-theme="dark"] .profile-popup__item--danger:hover { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .profile-popup__item svg { color: #64748b; }
[data-theme="dark"] .profile-popup__item:hover svg { color: #94a3b8; }
[data-theme="dark"] .profile-popup__item--active svg { color: #818cf8; }
[data-theme="dark"] .profile-popup__item--danger svg { color: #fca5a5; }
[data-theme="dark"] .profile-popup__divider { background: #334155; }
[data-theme="dark"] .profile-popup__user-avatar { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .profile-popup__user-name { color: #f1f5f9; }
[data-theme="dark"] .profile-popup__user-email { color: #64748b; }

/* ── Theme toggle ───────────────────────────── */
[data-theme="dark"] .theme-toggle { color: #f1f5f9; }
[data-theme="dark"] .theme-toggle:hover { background: #334155; }
[data-theme="dark"] .theme-toggle svg { color: #64748b; }
[data-theme="dark"] .theme-toggle:hover svg { color: #94a3b8; }
[data-theme="dark"] .theme-toggle__value { color: #64748b; }

/* ── Nav overlay ────────────────────────────── */
[data-theme="dark"] .nav-overlay { background: rgba(0,0,0,0.3); }

/* ── Scenario list cards ────────────────────── */
[data-theme="dark"] .sl-title { color: #f1f5f9; }
[data-theme="dark"] .sl-search__icon { color: #64748b; }
[data-theme="dark"] .sl-search__input { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .sl-search__input:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2); }
[data-theme="dark"] .sl-search__input::placeholder { color: #64748b; }
[data-theme="dark"] .sl-count { color: #94a3b8; }
[data-theme="dark"] .sl-sort { color: #94a3b8; }
[data-theme="dark"] .sl-sort select { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .sl-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .sl-card:hover { border-color: #818cf8; box-shadow: 0 2px 12px rgba(129,140,248,0.1); }
[data-theme="dark"] .sl-card__name { color: #f1f5f9; }
[data-theme="dark"] .sl-card__desc { color: #94a3b8; }
[data-theme="dark"] .sl-card__badge--type { background: #334155; color: #94a3b8; }
[data-theme="dark"] .sl-card__badge--enabled { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .sl-card__badge--disabled { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .sl-card__time { color: #64748b; }
[data-theme="dark"] .sl-card__action { background: #1e293b; color: #94a3b8; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
[data-theme="dark"] .sl-card__action:hover { background: #334155; color: #f1f5f9; }
[data-theme="dark"] .sl-card__action--danger:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
[data-theme="dark"] .sl-card__action--interact { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .sl-card__action--interact:hover { background: #6366f1; color: white; }
[data-theme="dark"] .sl-empty { color: #94a3b8; }
[data-theme="dark"] .sl-empty__icon { color: #475569; }
[data-theme="dark"] .sl-empty__title { color: #f1f5f9; }
[data-theme="dark"] .sl-empty__desc { color: #64748b; }
[data-theme="dark"] .sl-pagination a, [data-theme="dark"] .sl-pagination span { color: #f1f5f9; }
[data-theme="dark"] .sl-pagination a:hover { background: #334155; }
[data-theme="dark"] .sl-pagination .sl-pagination__active { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .sl-pagination .sl-pagination__disabled { color: #475569; }
[data-theme="dark"] .sl-page-size select { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .sl-modal-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .sl-modal { background: #1e293b; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
[data-theme="dark"] .sl-modal__title { color: #f1f5f9; }
[data-theme="dark"] .sl-modal__desc { color: #94a3b8; }
[data-theme="dark"] .sl-modal__btn--cancel { background: #334155; color: #f1f5f9; }
[data-theme="dark"] .sl-modal__btn--cancel:hover { background: #475569; }

/* ── Chat thread list ───────────────────────── */
[data-theme="dark"] .tl-title { color: #f1f5f9; }
[data-theme="dark"] .tl-count { color: #94a3b8; }
[data-theme="dark"] .tl-search__icon { color: #64748b; }
[data-theme="dark"] .tl-search__input { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .tl-search__input:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2); }
[data-theme="dark"] .tl-search__input::placeholder { color: #64748b; }
[data-theme="dark"] .tl-search__clear { background: #334155; color: #94a3b8; }
[data-theme="dark"] .tl-search__clear:hover { background: #475569; color: #f1f5f9; }
[data-theme="dark"] .tl-row:hover { background: #334155; }
[data-theme="dark"] .tl-row__icon { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .tl-row__title { color: #f1f5f9; }
[data-theme="dark"] .tl-row__scenario { color: #818cf8; }
[data-theme="dark"] .tl-row__dot { background: #475569; }
[data-theme="dark"] .tl-row__messages { color: #64748b; }
[data-theme="dark"] .tl-row__time { color: #64748b; }
[data-theme="dark"] .tl-empty__icon { color: #475569; }
[data-theme="dark"] .tl-empty__title { color: #f1f5f9; }
[data-theme="dark"] .tl-empty__desc { color: #64748b; }
[data-theme="dark"] .tl-pagination a, [data-theme="dark"] .tl-pagination span { color: #f1f5f9; }
[data-theme="dark"] .tl-pagination a:hover { background: #334155; }
[data-theme="dark"] .tl-pagination .tl-pagination__active { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .tl-pagination .tl-pagination__disabled { color: #475569; }

/* ── List pages (models, knowledge, behaviors, prompts, etc.) ── */
[data-theme="dark"] .lp-title { color: #f1f5f9; }
[data-theme="dark"] .lp-table thead th { color: #64748b; border-bottom-color: #334155; }
[data-theme="dark"] .lp-table thead th a:hover { color: #94a3b8; }
[data-theme="dark"] .lp-table thead th .lp-sort-active { color: #818cf8; }
[data-theme="dark"] .lp-table tbody tr:hover { background: #334155; }
[data-theme="dark"] .lp-table tbody td { color: #cbd5e1; border-bottom-color: rgba(51,65,85,0.5); }
[data-theme="dark"] .lp-table tbody td:first-child { color: #f1f5f9; }
[data-theme="dark"] .lp-action-btn { color: #64748b; }
[data-theme="dark"] .lp-action-btn:hover { background: #334155; color: #f1f5f9; }
[data-theme="dark"] .lp-action-btn--danger:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
[data-theme="dark"] .lp-badge { background: #334155; color: #94a3b8; }
[data-theme="dark"] .lp-status--available { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .lp-status--updating { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .lp-status--error { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .lp-empty__icon { color: #475569; }
[data-theme="dark"] .lp-empty__title { color: #f1f5f9; }
[data-theme="dark"] .lp-empty__desc { color: #64748b; }
[data-theme="dark"] .lp-pagination a, [data-theme="dark"] .lp-pagination span { color: #f1f5f9; }
[data-theme="dark"] .lp-pagination a:hover { background: #334155; }
[data-theme="dark"] .lp-pagination .lp-pagination__active { background: #818cf8; color: #0f172a; }
[data-theme="dark"] .lp-pagination .lp-pagination__disabled { color: #475569; }
[data-theme="dark"] .lp-page-size select { background: #0f172a; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .lp-modal-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .lp-modal { background: #1e293b; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
[data-theme="dark"] .lp-modal__title { color: #f1f5f9; }
[data-theme="dark"] .lp-modal__desc { color: #94a3b8; }
[data-theme="dark"] .lp-modal__btn--cancel { background: #334155; color: #f1f5f9; }
[data-theme="dark"] .lp-modal__btn--cancel:hover { background: #475569; }

/* ── Operations / Logs page ─────────────────── */
[data-theme="dark"] table.min-w-full { border-color: #334155; }
[data-theme="dark"] table.min-w-full thead tr { background: #1e293b !important; }
[data-theme="dark"] table.min-w-full tbody { background: #0f172a !important; }
[data-theme="dark"] table.min-w-full tbody tr td { color: #cbd5e1; }
[data-theme="dark"] #detailsModal .bg-white { background: #1e293b !important; }
[data-theme="dark"] #detailsModal .bg-gray-50 { background: #0f172a !important; }
[data-theme="dark"] #detailsModal pre { background: #0f172a !important; color: #f1f5f9 !important; border-color: #334155 !important; }

/* ── Chat / Playground ───────────────────────── */
[data-theme="dark"] .chat-sidebar { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .sidebar-title { color: #f1f5f9; }
[data-theme="dark"] .new-chat-btn { color: #94a3b8; }
[data-theme="dark"] .new-chat-btn:hover { color: #818cf8; background: rgba(99,102,241,0.15); }
[data-theme="dark"] .chat-session-item { color: #94a3b8; }
[data-theme="dark"] .chat-session-item:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .chat-session-item.active { background: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .session-date { color: #64748b; }
[data-theme="dark"] .no-sessions { color: #64748b; }
[data-theme="dark"] .chat-main { background: #0f172a; }
[data-theme="dark"] .chat-topbar { border-bottom-color: #334155; }
[data-theme="dark"] .back-link { color: #94a3b8; border-color: #334155; background: #1e293b; }
[data-theme="dark"] .back-link:hover { color: #f1f5f9; background: #334155; }
[data-theme="dark"] .chat-scenario-title { color: #f1f5f9; }
[data-theme="dark"] .message-user { background-color: #334155; }
[data-theme="dark"] .message-ai { background-color: #1e293b; border: 1px solid #334155; }
[data-theme="dark"] .message-header { color: #f1f5f9; }
[data-theme="dark"] .message-date { color: #64748b; }
[data-theme="dark"] .message-content { color: #e2e8f0; }
[data-theme="dark"] .chat-input-container { border-top-color: #334155; background: #0f172a; }
[data-theme="dark"] .chat-input-container textarea { background-color: #1e293b !important; color: #f1f5f9 !important; border-color: #334155 !important; }
[data-theme="dark"] .chat-input-container textarea:focus { border-color: #818cf8 !important; box-shadow: 0 0 0 2px rgba(129,140,248,0.25) !important; }
[data-theme="dark"] .chat-input-container textarea::placeholder { color: #64748b !important; }
[data-theme="dark"] .file-upload-btn { color: #64748b; }
[data-theme="dark"] .file-upload-btn:hover { color: #818cf8; }
[data-theme="dark"] .file-preview-item { background-color: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .file-preview-item .remove-file { color: #818cf8; }
[data-theme="dark"] .file-preview-item .remove-file:hover { color: #ef4444; }

/* ── Colored Tailwind variants (used in badges, timeline, agent sessions) ── */

/* Blue */
[data-theme="dark"] .bg-blue-50  { background-color: rgba(59,130,246,0.12) !important; }
[data-theme="dark"] .bg-blue-100 { background-color: rgba(59,130,246,0.2)  !important; }
[data-theme="dark"] .border-blue-200 { border-color: rgba(59,130,246,0.35) !important; }
[data-theme="dark"] .text-blue-900 { color: #93c5fd !important; }
[data-theme="dark"] .text-blue-800 { color: #93c5fd !important; }
[data-theme="dark"] .text-blue-700 { color: #93c5fd !important; }
[data-theme="dark"] .text-blue-600 { color: #60a5fa !important; }
[data-theme="dark"] .text-blue-500 { color: #60a5fa !important; }

/* Green */
[data-theme="dark"] .bg-green-50  { background-color: rgba(16,185,129,0.12) !important; }
[data-theme="dark"] .bg-green-100 { background-color: rgba(16,185,129,0.2)  !important; }
[data-theme="dark"] .border-green-200 { border-color: rgba(16,185,129,0.35) !important; }
[data-theme="dark"] .border-green-100 { border-color: rgba(16,185,129,0.2)  !important; }
[data-theme="dark"] .text-green-900 { color: #6ee7b7 !important; }
[data-theme="dark"] .text-green-700 { color: #6ee7b7 !important; }
[data-theme="dark"] .text-green-600 { color: #34d399 !important; }

/* Yellow / Amber */
[data-theme="dark"] .bg-yellow-50  { background-color: rgba(245,158,11,0.12) !important; }
[data-theme="dark"] .bg-yellow-100 { background-color: rgba(245,158,11,0.2)  !important; }
[data-theme="dark"] .border-yellow-200 { border-color: rgba(245,158,11,0.35) !important; }
[data-theme="dark"] .border-yellow-100 { border-color: rgba(245,158,11,0.2)  !important; }
[data-theme="dark"] .text-yellow-900 { color: #fcd34d !important; }
[data-theme="dark"] .text-yellow-800 { color: #fcd34d !important; }
[data-theme="dark"] .text-yellow-700 { color: #fcd34d !important; }
[data-theme="dark"] .text-yellow-600 { color: #fbbf24 !important; }

/* Purple */
[data-theme="dark"] .bg-purple-50  { background-color: rgba(139,92,246,0.12) !important; }
[data-theme="dark"] .bg-purple-100 { background-color: rgba(139,92,246,0.2)  !important; }
[data-theme="dark"] .border-purple-200 { border-color: rgba(139,92,246,0.35) !important; }
[data-theme="dark"] .text-purple-900 { color: #c4b5fd !important; }
[data-theme="dark"] .text-purple-700 { color: #c4b5fd !important; }
[data-theme="dark"] .text-purple-600 { color: #a78bfa !important; }

/* Orange */
[data-theme="dark"] .bg-orange-50  { background-color: rgba(249,115,22,0.12) !important; }
[data-theme="dark"] .border-orange-200 { border-color: rgba(249,115,22,0.35) !important; }
[data-theme="dark"] .text-orange-900 { color: #fdba74 !important; }
[data-theme="dark"] .text-orange-700 { color: #fdba74 !important; }
[data-theme="dark"] .text-orange-500 { color: #fb923c !important; }

/* Indigo (extends existing bg-indigo-50 override) */
[data-theme="dark"] .border-indigo-200 { border-color: rgba(99,102,241,0.35) !important; }
[data-theme="dark"] .bg-indigo-400    { background-color: #818cf8 !important; }
[data-theme="dark"] .text-indigo-900  { color: #a5b4fc !important; }
[data-theme="dark"] .text-indigo-700  { color: #a5b4fc !important; }

/* pre / code blocks inside colored cards */
[data-theme="dark"] pre { background-color: #0f172a !important; color: #e2e8f0 !important; border-color: #334155 !important; }

/* ── Guardrail type pills ────────────────────── */
[data-theme="dark"] .guardrail-type-pill { background: #1e293b; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .guardrail-type-pill:hover { background: rgba(99,102,241,0.1); border-color: #818cf8; color: #e2e8f0; }
[data-theme="dark"] .guardrail-type-pill:has(input:checked) { background: rgba(99,102,241,0.15); border-color: #818cf8; color: #818cf8; }

/* ── Scrollbar ──────────────────────────────── */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ══════════════════════════════════════════════
   Agent config form — dark theme
   (intro, type picker, section groups/headers,
    badges, create note). Matches the slate palette.
   ══════════════════════════════════════════════ */

/* Section cards */
[data-theme="dark"] .agent-config-form .border.rounded-md {
  background-color: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .agent-config-form .border.rounded-md:hover {
  border-color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .agent-config-form .bb-1 { border-color: #334155; }

/* Intro banner */
[data-theme="dark"] .agent-form-intro {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14) 0%, rgba(99, 102, 241, 0.06) 100%);
  border-color: rgba(99, 102, 241, 0.35);
}
[data-theme="dark"] .agent-form-intro__icon { background: #6366f1; color: #fff; }
[data-theme="dark"] .agent-form-intro__title { color: #e2e8f0; }
[data-theme="dark"] .agent-form-intro__text { color: #cbd5e1; }
[data-theme="dark"] .agent-form-intro__text strong { color: #e2e8f0; }

/* Type picker */
[data-theme="dark"] .agent-type-picker__label { color: #f1f5f9; }
[data-theme="dark"] .agent-type-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .agent-type-card:hover {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
}
[data-theme="dark"] .agent-type-card__title { color: #f1f5f9; }
[data-theme="dark"] .agent-type-card__icon { color: #818cf8; }
[data-theme="dark"] .agent-type-card__desc { color: #94a3b8; }
[data-theme="dark"] .agent-type-card:has(input:checked) {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 0 1px #818cf8;
}
[data-theme="dark"] .agent-type-card:has(input:checked) .agent-type-card__desc { color: #c7d2fe; }
[data-theme="dark"] .agent-type-card__check { background: #6366f1; color: #fff; }

/* Essentials / Advanced group separators */
[data-theme="dark"] .agent-section-group__title { color: #818cf8; }
[data-theme="dark"] .agent-section-group--advanced .agent-section-group__title { color: #94a3b8; }
[data-theme="dark"] .agent-section-group__hint { color: #64748b; }
[data-theme="dark"] .agent-section-group__rule { background: #334155; }

/* Section headers */
[data-theme="dark"] .agent-section-header__title { color: #f1f5f9; }
[data-theme="dark"] .agent-section-header__desc { color: #94a3b8; }
[data-theme="dark"] .agent-section-chevron { color: #64748b; }

/* Section badges */
[data-theme="dark"] .agent-section-badge--optional { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .agent-section-badge--required { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }

/* "Advanced settings live on the detail page" note */
[data-theme="dark"] .agent-create-note {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}
[data-theme="dark"] .agent-create-note svg { color: #64748b; }

/* ── Agent config tabs (detail page) ─────────── */
[data-theme="dark"] .agent-tabs { border-bottom-color: #334155; }
[data-theme="dark"] .agent-tab { color: #94a3b8; }
[data-theme="dark"] .agent-tab:hover { color: #818cf8; }
[data-theme="dark"] .agent-tab--active { color: #818cf8; border-bottom-color: #818cf8; }
[data-theme="dark"] .agent-tab__hint { color: #94a3b8; background: #334155; }
[data-theme="dark"] .agent-tab--active .agent-tab__hint { color: #cbd5e1; }
[data-theme="dark"] .agent-tab-panel__intro { background: #1e293b; border-color: #334155; color: #94a3b8; }
