/* ═══════════════════════════════════════════
   Dark Mode Overrides
   Applied when <html data-theme="dark">
   ═══════════════════════════════════════════ */

[data-theme="dark"] {
  color-scheme: dark;
}

/* ── Body & shell ── */
[data-theme="dark"] body {
  background: #0D1117;
  color: #C9D1D9;
}

[data-theme="dark"] .agent-body {
  background: #0D1117;
}

/* ── Sidebar ── */
[data-theme="dark"] .sidebar {
  background: #161B22;
  border-right-color: #30363D;
}
[data-theme="dark"] .sidebar-logo {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .nav-item {
  color: #8B949E;
}
[data-theme="dark"] .nav-item:hover {
  background: #1C2128;
  color: #C9D1D9;
}
[data-theme="dark"] .nav-item.active {
  background: #1A2332;
  color: #58A6FF;
}
[data-theme="dark"] .sidebar-footer {
  border-top-color: #30363D;
}
[data-theme="dark"] .agent-name {
  color: #C9D1D9;
}

/* ── Login ── */
[data-theme="dark"] .login-card {
  background: #161B22;
  border: 1px solid #30363D;
}
[data-theme="dark"] .login-logo h1 {
  color: #C9D1D9;
}

/* ── Cards & surfaces ── */
[data-theme="dark"] .card {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .stat-card {
  background: #161B22;
  border-color: #30363D;
}

/* ── Forms ── */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  border-color: #58A6FF;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
[data-theme="dark"] .form-group label {
  color: #8B949E;
}
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .search-input:focus {
  border-color: #58A6FF;
}

/* ── Buttons ── */
[data-theme="dark"] .btn-secondary {
  background: #21262D;
  color: #C9D1D9;
  border-color: #30363D;
}
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background: #30363D;
}
[data-theme="dark"] .btn-ghost {
  color: #8B949E;
}
[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  color: #C9D1D9;
  background: #21262D;
}
[data-theme="dark"] .btn-outline {
  color: #58A6FF;
  border-color: #58A6FF;
}
[data-theme="dark"] .btn-outline:hover:not(:disabled) {
  background: #1A2332;
}

/* ── Tickets table ── */
[data-theme="dark"] .tickets-table {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .tickets-table thead {
  background: #21262D;
}
[data-theme="dark"] .tickets-table th {
  color: #8B949E;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .tickets-table td {
  border-bottom-color: #21262D;
  color: #C9D1D9;
}
[data-theme="dark"] .tickets-table tbody tr:hover {
  background: #1C2128;
}
[data-theme="dark"] .email-sm,
[data-theme="dark"] .time-cell {
  color: #6E7681;
}

/* ── Tickets view header ── */
[data-theme="dark"] .tickets-view-header {
  background: #161B22;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .tickets-view-header h2 {
  color: #C9D1D9;
}
[data-theme="dark"] .tickets-filters-row {
  background: #0D1117;
  border-bottom-color: #30363D;
}

/* ── Ticket detail (fdt-*) ── */
[data-theme="dark"] .fdt-toolbar,
[data-theme="dark"] .fdt-subject-bar {
  background: #161B22;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fdt-subject {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-body {
  background: #161B22;
}
[data-theme="dark"] .fdt-main {
  background: #0D1117;
}
[data-theme="dark"] .fdt-sidebar {
  background: #161B22;
  border-left-color: #30363D;
}
[data-theme="dark"] .fdt-sidebar-section-header {
  color: #8B949E;
}
[data-theme="dark"] .fdt-contact-name {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-contact-email {
  color: #8B949E;
}
[data-theme="dark"] .fdt-msg-bubble {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .fdt-msg-header {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fdt-msg-sender {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-msg-time {
  color: #6E7681;
}
[data-theme="dark"] .fdt-msg-body {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-msg.fdt-msg-private .fdt-msg-bubble {
  background: #1F1A0A;
  border-color: #553A00;
}
[data-theme="dark"] .fdt-msg.fdt-msg-private .fdt-msg-header {
  background: #261E09;
  border-bottom-color: #553A00;
}
[data-theme="dark"] .fdt-editor {
  background: #161B22;
  border-top-color: #30363D;
}
[data-theme="dark"] .fdt-editor-header {
  border-bottom-color: #30363D;
  color: #8B949E;
}
[data-theme="dark"] .fdt-cc-row {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fdt-cc-field label {
  color: #8B949E;
}
[data-theme="dark"] .fdt-cc-field input {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-editor-footer {
  background: #1C2128;
  border-top-color: #30363D;
}
[data-theme="dark"] .fdt-ticket-num-chip {
  background: #21262D;
  color: #8B949E;
}
[data-theme="dark"] .fdt-action-tabs {
  background: #21262D;
}
[data-theme="dark"] .fdt-action-tab {
  color: #8B949E;
}
[data-theme="dark"] .fdt-action-tab.active {
  background: #161B22;
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-contact-extended {
  background: #1C2128;
  border-color: #30363D;
  color: #8B949E;
}
[data-theme="dark"] .fdt-cx-lbl {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-cx-social {
  border-top-color: #30363D;
}
[data-theme="dark"] .fdt-sidebar-meta {
  border-top-color: #30363D;
}
[data-theme="dark"] .fdt-meta-label {
  color: #8B949E;
}
[data-theme="dark"] .fdt-meta-value {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-prop-group {
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-prop-label {
  color: #8B949E;
}
[data-theme="dark"] .fdt-prop-select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-prop-select:focus {
  border-color: #58A6FF;
}
[data-theme="dark"] .fdt-prop-actions {
  border-top-color: #30363D;
}
[data-theme="dark"] .fdt-contact-form {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .fdt-contact-form .form-group-sm label {
  color: #8B949E;
}
[data-theme="dark"] .fdt-input {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .fdt-input:focus {
  border-color: #58A6FF;
}
[data-theme="dark"] .fdt-private-label {
  color: #8B949E;
}
[data-theme="dark"] .fdt-edit-btn {
  color: #58A6FF;
}
[data-theme="dark"] .fdt-breadcrumb-sep {
  color: #484F58;
}
[data-theme="dark"] .fdt-back-btn {
  background: #1A3A8A;
}
[data-theme="dark"] .fdt-back-btn:hover {
  background: #1D4ED8;
}
[data-theme="dark"] .fdt-transcript-box {
  background: #1C2128;
  border-color: #30363D;
  border-left-color: #484F58;
  color: #8B949E;
}

/* ── Dashboard layout ── */
[data-theme="dark"] #view-dashboard {
  background: #0D1117;
}
[data-theme="dark"] .fd-page-title {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-stat-card {
  background: #161B22;
  border-color: #30363D;
  border-top-color: #30363D;
  color: #C9D1D9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="dark"] .fd-stat-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
[data-theme="dark"] .fd-stat-label {
  color: #8B949E;
}
[data-theme="dark"] .fd-chart-section {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .fd-chart-title {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-chart-sub {
  color: #6E7681;
}
[data-theme="dark"] .fd-chart-kpis {
  border-top-color: #30363D;
}
[data-theme="dark"] .fd-kpi {
  border-right-color: #30363D;
}
[data-theme="dark"] .fd-kpi-label {
  color: #8B949E;
}
[data-theme="dark"] .fd-kpi-value {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-op-card {
  background: #161B22;
  border-color: #30363D;
  border-left-color: #3B82F6;
}
[data-theme="dark"] .fd-op-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
[data-theme="dark"] .fd-op-label {
  color: #8B949E;
}
[data-theme="dark"] .fd-op-value {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-op-sub {
  color: #6E7681;
}
[data-theme="dark"] .fd-op-danger { border-left-color: #DC2626; }
[data-theme="dark"] .fd-op-danger .fd-op-value { color: #F87171; }
[data-theme="dark"] .fd-op-warning { border-left-color: #D97706; }
[data-theme="dark"] .fd-op-warning .fd-op-value { color: #FCD34D; }
[data-theme="dark"] .fd-op-ai { border-left-color: #0F766E; }
[data-theme="dark"] .fd-op-ai .fd-op-value { color: #34D399; }
[data-theme="dark"] .fd-widgets-grid .fd-widget {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .fd-widget-header {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-widget-title {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-widget-sub {
  color: #8B949E;
}
[data-theme="dark"] .fd-widget-link {
  color: #58A6FF;
}
[data-theme="dark"] .fd-widget-table-header {
  color: #8B949E;
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-widget-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-empty-row {
  color: #6E7681;
}
[data-theme="dark"] .recent-ticket-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .recent-ticket-row:hover {
  background: #1C2128;
}
[data-theme="dark"] .recent-subject {
  color: #C9D1D9;
}
[data-theme="dark"] .ticket-num-sm,
[data-theme="dark"] .meta-sm {
  color: #8B949E;
}
[data-theme="dark"] .fd-metric {
  border-right-color: #30363D;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-metric-value {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-metric-label {
  color: #8B949E;
}
[data-theme="dark"] .fd-recent-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-recent-row:hover {
  background: #1C2128;
}
[data-theme="dark"] .fd-recent-num {
  color: #8B949E;
}
[data-theme="dark"] .fd-recent-subject {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-recent-time {
  color: #6E7681;
}
[data-theme="dark"] .fd-unresolved-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-unresolved-row:hover {
  background: #1C2128;
}
[data-theme="dark"] .fd-unresolved-agent {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-unresolved-count {
  background: #1A2332;
  color: #58A6FF;
}
[data-theme="dark"] .fd-chat-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-chat-row:hover {
  background: #1C2128;
}
[data-theme="dark"] .fd-chat-name {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-chat-time {
  color: #6E7681;
}
[data-theme="dark"] .fd-risk-row,
[data-theme="dark"] .fd-reply-row {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-risk-row:hover,
[data-theme="dark"] .fd-reply-row:hover,
[data-theme="dark"] .fd-recent-row:hover {
  background: #1C2128;
}
[data-theme="dark"] .fd-risk-title,
[data-theme="dark"] .fd-reply-subject {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-risk-meta {
  color: #8B949E;
}
[data-theme="dark"] .fd-reply-name {
  color: #8B949E;
}
[data-theme="dark"] .fd-reply-preview {
  color: #6E7681;
}

/* ── TODO widget ── */
[data-theme="dark"] .fd-todo-add {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-todo-plus {
  color: #58A6FF;
}
[data-theme="dark"] .fd-todo-input {
  background: transparent;
  color: #C9D1D9;
}
[data-theme="dark"] .fd-todo-item {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .fd-todo-item span {
  color: #C9D1D9;
}
[data-theme="dark"] .fd-todo-item.done span:not(.fd-todo-delete) {
  color: #484F58;
}
[data-theme="dark"] .fd-todo-empty {
  color: #6E7681;
}
[data-theme="dark"] .fd-todo-empty-icon {
  color: #30363D;
}

/* ── Live chat ── */
[data-theme="dark"] .livechat-layout {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .chat-sessions-panel {
  border-right-color: #30363D;
}
[data-theme="dark"] .sessions-tab-bar {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .sessions-tab {
  color: #8B949E;
}
[data-theme="dark"] .sessions-tab.active {
  background: #161B22;
}
[data-theme="dark"] .session-item {
  border-bottom-color: #21262D;
}
[data-theme="dark"] .session-item:hover {
  background: #1C2128;
}
[data-theme="dark"] .session-item-active {
  background: #1A2332;
}
[data-theme="dark"] .session-name {
  color: #C9D1D9;
}
[data-theme="dark"] .session-preview,
[data-theme="dark"] .session-time {
  color: #6E7681;
}
[data-theme="dark"] .convo-header {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .convo-email {
  color: #6E7681;
}
[data-theme="dark"] .convo-messages {
  background: #0D1117;
}
[data-theme="dark"] .convo-msg-customer .convo-bubble {
  background: #21262D;
  color: #C9D1D9;
}
[data-theme="dark"] .convo-system {
  color: #8B949E;
  background: #21262D;
}
[data-theme="dark"] .convo-input-area {
  border-top-color: #30363D;
  background: #161B22;
}
[data-theme="dark"] .convo-input-area textarea {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .convo-input-area textarea:focus {
  border-color: #58A6FF;
}
[data-theme="dark"] .chat-convo-empty {
  color: #6E7681;
  background: #0D1117;
}
[data-theme="dark"] .transfer-dropdown {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .transfer-dropdown-title {
  color: #8B949E;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .transfer-agent-item {
  color: #C9D1D9;
}
[data-theme="dark"] .transfer-agent-item:hover {
  background: #1C2128;
}
[data-theme="dark"] .transfer-agent-item .ta-status {
  color: #6E7681;
}

/* ── Settings ── */
[data-theme="dark"] .settings-tabs {
  background: #161B22;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .settings-tab {
  color: #8B949E;
}
[data-theme="dark"] .settings-tab.active {
  color: #58A6FF;
  border-bottom-color: #58A6FF;
}
[data-theme="dark"] .settings-tab:hover:not(.active) {
  color: #C9D1D9;
}
[data-theme="dark"] .bh-day-block {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .bh-start,
[data-theme="dark"] .bh-end {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .bh-to {
  color: #8B949E;
}
[data-theme="dark"] .bh-remove-slot {
  color: #6E7681;
}
[data-theme="dark"] .bh-timezone-row {
  color: #8B949E;
}
[data-theme="dark"] .bh-tz-select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .notif-sound-option {
  border-color: #30363D;
}
[data-theme="dark"] .notif-sound-option:has(input:checked) {
  border-color: #58A6FF;
  background: #1A2332;
}
[data-theme="dark"] .notif-sound-option:hover {
  border-color: #484F58;
  background: #1C2128;
}
[data-theme="dark"] .notif-sound-name {
  color: #C9D1D9;
}
[data-theme="dark"] .notif-sound-desc {
  color: #6E7681;
}
[data-theme="dark"] .detail-controls select,
[data-theme="dark"] .fdt-prop-select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}

/* ── Modals ── */
[data-theme="dark"] .modal-overlay,
[data-theme="dark"] .resolve-modal-overlay {
  background: rgba(0,0,0,0.7);
}
[data-theme="dark"] .modal-box {
  background: #161B22;
  border: 1px solid #30363D;
}
[data-theme="dark"] .modal-header {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .modal-header h3 {
  color: #C9D1D9;
}
[data-theme="dark"] .modal-close {
  color: #6E7681;
}
[data-theme="dark"] .modal-close:hover {
  color: #C9D1D9;
}
[data-theme="dark"] .modal-footer {
  border-top-color: #30363D;
}
[data-theme="dark"] .resolve-modal-card {
  background: #161B22;
  border: 1px solid #30363D;
}
[data-theme="dark"] .resolve-modal-header {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .resolve-modal-header h2 {
  color: #C9D1D9;
}
[data-theme="dark"] .resolve-modal-header p {
  color: #8B949E;
}
[data-theme="dark"] .resolve-radio-btn {
  color: #C9D1D9;
}
[data-theme="dark"] .resolve-field label {
  color: #8B949E;
}
[data-theme="dark"] .resolve-input,
[data-theme="dark"] .resolve-select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .resolve-modal-footer {
  background: #1C2128;
  border-top-color: #30363D;
}

/* ── User management ── */
[data-theme="dark"] .view-header {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .view-header h2 {
  color: #C9D1D9;
}
[data-theme="dark"] .um-table th {
  color: #8B949E;
  border-bottom-color: #30363D;
  background: #1C2128;
}
[data-theme="dark"] .um-table td {
  border-bottom-color: #21262D;
  color: #C9D1D9;
}
[data-theme="dark"] .um-table tbody tr:hover {
  background: #1C2128;
}

/* ── Canned responses ── */
[data-theme="dark"] .canned-item {
  border-color: #30363D;
  background: #161B22;
}
[data-theme="dark"] .canned-item:hover {
  background: #1A2332;
  border-color: #58A6FF;
}
[data-theme="dark"] .canned-item-title,
[data-theme="dark"] .canned-title {
  color: #C9D1D9;
}
[data-theme="dark"] .canned-item-preview,
[data-theme="dark"] .canned-preview {
  color: #6E7681;
}
[data-theme="dark"] .canned-settings-item {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .canned-settings-title {
  color: #C9D1D9;
}
[data-theme="dark"] .canned-modal-search {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .canned-modal-search:focus {
  border-color: #58A6FF;
}

/* ── Merge ticket ── */
[data-theme="dark"] .merge-search-results {
  border-color: #30363D;
}
[data-theme="dark"] .merge-result-item {
  border-bottom-color: #21262D;
  color: #C9D1D9;
}
[data-theme="dark"] .merge-result-item:hover {
  background: #1A2332;
}
[data-theme="dark"] .merge-no-results {
  color: #6E7681;
}

/* ── Mention dropdown ── */
[data-theme="dark"] .mention-dropdown {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .mention-item {
  color: #C9D1D9;
}
[data-theme="dark"] .mention-item:hover {
  background: #1C2128;
}

/* ── Bulk action bar ── */
[data-theme="dark"] .bulk-action-bar {
  background: #1A2332;
  border-bottom-color: #30363D;
  color: #58A6FF;
}

/* ── Tags input ── */
[data-theme="dark"] .fdt-tags-input-wrap {
  background: #0D1117;
  border-color: #30363D;
}
[data-theme="dark"] .fdt-tags-input-wrap:focus-within {
  border-color: #58A6FF;
}
[data-theme="dark"] .fdt-tag-chip {
  background: #1A2332;
  color: #58A6FF;
  border-color: #2C4A7A;
}
[data-theme="dark"] .fdt-tag-text-input {
  color: #C9D1D9;
}

/* ── Shortcuts popup ── */
[data-theme="dark"] .shortcuts-popup {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .shortcuts-popup-header {
  border-bottom-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .shortcuts-popup-close {
  color: #6E7681;
}
[data-theme="dark"] .shortcuts-popup-close:hover {
  color: #C9D1D9;
}
[data-theme="dark"] .sc-key {
  background: #30363D;
  border-color: #484F58;
  color: #C9D1D9;
}
[data-theme="dark"] .sc-desc {
  color: #8B949E;
}

/* ── Push notification banner ── */
[data-theme="dark"] .push-banner {
  background: #1A2332;
  border-color: #2C4A7A;
  color: #C9D1D9;
}

/* ── Quill editor ── */
[data-theme="dark"] .ql-toolbar {
  background: #1C2128 !important;
  border-color: #30363D !important;
}
[data-theme="dark"] .ql-toolbar .ql-stroke {
  stroke: #8B949E;
}
[data-theme="dark"] .ql-toolbar .ql-fill {
  fill: #8B949E;
}
[data-theme="dark"] .ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-toolbar .ql-active .ql-stroke {
  stroke: #58A6FF;
}
[data-theme="dark"] .ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-toolbar .ql-active .ql-fill {
  fill: #58A6FF;
}
[data-theme="dark"] .ql-container {
  background: #0D1117 !important;
  border-color: #30363D !important;
  color: #C9D1D9 !important;
}
[data-theme="dark"] .ql-editor {
  color: #C9D1D9;
}
[data-theme="dark"] .ql-editor.ql-blank::before {
  color: #484F58;
}
[data-theme="dark"] .ql-snow .ql-picker-label {
  color: #8B949E;
}
[data-theme="dark"] .ql-snow .ql-picker-options {
  background: #21262D;
  border-color: #30363D;
}
[data-theme="dark"] .ql-snow .ql-picker-item {
  color: #C9D1D9;
}
[data-theme="dark"] .ql-snow .ql-picker-item:hover {
  color: #58A6FF;
}

/* ── Compose mail ── */
[data-theme="dark"] #composeModal .modal-box {
  background: #161B22;
}
[data-theme="dark"] .compose-editor .ql-editor {
  background: #0D1117;
}

/* ── CSAT widget ── */
[data-theme="dark"] .csat-score {
  color: #C9D1D9;
}
[data-theme="dark"] .csat-sub {
  color: #6E7681;
}
[data-theme="dark"] .csat-bar {
  background: #30363D;
}

/* ── Location / IP badges ── */
[data-theme="dark"] .convo-location {
  background: #21262D;
  color: #8B949E;
}
[data-theme="dark"] .convo-ip {
  color: #6E7681;
}
[data-theme="dark"] .session-location {
  color: #6E7681;
}

/* ── Detail (old-style ticket detail) ── */
[data-theme="dark"] .ticket-detail {
  background: #161B22;
  border-color: #30363D;
}
[data-theme="dark"] .detail-header {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .detail-messages {
  border-bottom-color: #30363D;
}
[data-theme="dark"] .detail-msg-customer {
  background: #1A2332;
  border-left-color: var(--primary);
}
[data-theme="dark"] .detail-msg-agent {
  background: #0F2218;
  border-left-color: var(--success);
}
[data-theme="dark"] .detail-msg.is-private {
  background: #1F1A0A;
  border-left-color: var(--warning);
}
[data-theme="dark"] .msg-system-entry {
  background: #21262D;
  color: #8B949E;
}
[data-theme="dark"] .detail-reply textarea {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .detail-controls select {
  background: #0D1117;
  border-color: #30363D;
  color: #C9D1D9;
}
[data-theme="dark"] .checkbox-label {
  color: #8B949E;
}

/* ── Track card (customer portal ticket view) ── */
[data-theme="dark"] .track-card {
  border-color: #30363D;
}
[data-theme="dark"] .track-header {
  background: #1C2128;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .track-meta {
  background: #161B22;
  border-bottom-color: #30363D;
}
[data-theme="dark"] .track-msg-customer {
  background: #1A2332;
}
[data-theme="dark"] .track-msg-agent {
  background: #0F2218;
}
[data-theme="dark"] .track-msg-system {
  background: #21262D;
  color: #8B949E;
}

/* ── Alerts ── */
[data-theme="dark"] .alert-success {
  background: #0F2218;
  border-color: #166534;
}
[data-theme="dark"] .alert-error {
  background: #1F0A0A;
  border-color: #7F1D1D;
}
[data-theme="dark"] .alert-warning {
  background: #1F1A0A;
  border-color: #78350F;
}

/* ── Mobile bottom tab bar ── */
@media (max-width: 640px) {
  [data-theme="dark"] .sidebar {
    background: #161B22;
    border-top-color: #30363D;
  }
  [data-theme="dark"] .fdt-sidebar {
    border-top-color: #30363D;
  }
}

/* ── Theme toggle button ── */
#themeToggle {
  font-size: 1rem;
  padding: 0.3rem 0.5rem;
  line-height: 1;
  transition: opacity 0.15s;
}
#themeToggle:hover {
  transform: none !important;
  background: transparent !important;
  opacity: 0.75;
}
