/* Global dark theme — applied via html.theme-dark + data-bs-theme="dark" */

html.theme-dark {
  color-scheme: dark;

  --km-green: #6fc24d;
  --km-green-soft: #1a2e16;
  --km-blue: #3b82f6;
  --km-blue-hover: #60a5fa;
  --km-blue-soft: #1e3a5f;
  --km-sky: #3b82f6;
  --km-navy: #f1f5f9;
  --km-text: #e2e8f0;
  --km-muted: #94a3b8;
  --km-border: #2a3544;
  --km-border-strong: #3b4658;
  --km-bg: #0b1220;
  --km-white: #111827;
  --km-danger: #f87171;
  --km-warning: #fbbf24;

  --bg: #0b1220;
  --surface: #111827;
  --border: #2a3544;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --success: #6fc24d;
  --danger: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);

  --ind-info: #60a5fa;
  --ind-info-bg: #12233a;
  --ind-info-border: #1e3a5f;
  --ind-info-text: #93c5fd;

  --ind-success: #6fc24d;
  --ind-success-bg: #142318;
  --ind-success-border: #1f3a24;
  --ind-success-text: #bbf7d0;

  --ind-warning: #fbbf24;
  --ind-warning-bg: #2a2110;
  --ind-warning-border: #3f3014;
  --ind-warning-text: #fde68a;

  --ind-danger: #f87171;
  --ind-danger-bg: #2a1515;
  --ind-danger-border: #4a1f1f;
  --ind-danger-text: #fecaca;

  --ind-neutral: #94a3b8;
  --ind-neutral-bg: #1e293b;
  --ind-neutral-border: #334155;
  --ind-neutral-text: #cbd5e1;
}

html.theme-dark body.app-body {
  background: var(--bg);
  color: var(--text);
}

/* Shell */
html.theme-dark .app-sidebar {
  background: #0f172a;
  border-right-color: var(--km-border);
}

html.theme-dark .sidebar-brand,
html.theme-dark .sidebar-brand-link {
  background: #0f172a;
  border-color: var(--km-border);
}

html.theme-dark .sidebar-brand-meta strong { color: #f8fafc; }
html.theme-dark .sidebar-brand-meta small { color: #94a3b8 !important; }
html.theme-dark .sidebar-section-label { color: #64748b; }

html.theme-dark .sidebar-link {
  color: #cbd5e1 !important;
}

html.theme-dark .sidebar-link:hover {
  background: #1e293b;
  color: #f8fafc !important;
}

html.theme-dark .sidebar-link.active {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd !important;
}

html.theme-dark .sidebar-user {
  border-top-color: var(--km-border);
}

html.theme-dark .sidebar-user-meta strong { color: #f8fafc; }
html.theme-dark .sidebar-user-meta small { color: #94a3b8; }

html.theme-dark .sidebar-switcher .form-select {
  background-color: #111827;
  border-color: var(--km-border-strong);
  color: var(--text);
}

/* Topbar */
html.theme-dark .topbar-search input {
  background: #111827;
  border-color: var(--km-border);
  color: var(--text);
  box-shadow: none;
}

html.theme-dark .topbar-search input::placeholder { color: #64748b; }
html.theme-dark .topbar-search i { color: #64748b; }

html.theme-dark .topbar-search .kbd {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

html.theme-dark .topbar-icon-btn,
html.theme-dark .topbar-user-btn {
  background: #111827;
  border-color: var(--km-border);
  color: #cbd5e1;
}

html.theme-dark .topbar-icon-btn:hover,
html.theme-dark .topbar-user-btn:hover {
  background: #1e293b;
  color: #f8fafc;
}

html.theme-dark .topbar-user-text strong { color: #f8fafc; }
html.theme-dark .topbar-user-text small { color: #94a3b8; }

html.theme-dark .theme-toggle {
  background: #111827;
  border-color: var(--km-border);
}

html.theme-dark .theme-toggle button { color: #94a3b8; }
html.theme-dark .theme-toggle button.active {
  background: #3b82f6;
  color: #fff;
}

/* Dashboard / cards */
html.theme-dark .dash-greeting h1 { color: #f8fafc; }
html.theme-dark .dash-greeting p,
html.theme-dark .dash-date { color: #94a3b8; }

html.theme-dark .dash-promo {
  background: linear-gradient(135deg, #12233a 0%, #142318 55%, #111827 100%);
  border-color: #1e3a5f;
}

html.theme-dark .dash-promo-copy strong { color: #f8fafc; }
html.theme-dark .dash-promo-copy span { color: #94a3b8; }

html.theme-dark .stat-card,
html.theme-dark .panel,
html.theme-dark .quick-actions {
  background: #111827;
  border-color: var(--km-border);
  box-shadow: none;
}

html.theme-dark .panel-header {
  background: #111827;
  border-bottom-color: var(--km-border);
}

html.theme-dark .panel-header .h6,
html.theme-dark .stat-value,
html.theme-dark .empty-state strong,
html.theme-dark .project-overview-item a,
html.theme-dark .quick-actions h2,
html.theme-dark .qa-item,
html.theme-dark .project-metric strong,
html.theme-dark .recent-project-row a {
  color: #f8fafc !important;
}

html.theme-dark .stat-label,
html.theme-dark .stat-delta,
html.theme-dark .empty-state,
html.theme-dark .project-metric span {
  color: #94a3b8;
}

html.theme-dark .stat-icon.blue { background: #1e3a5f; color: #60a5fa; }
html.theme-dark .stat-icon.red { background: #3f1d1d; color: #f87171; }
html.theme-dark .stat-icon.purple { background: #2e1f4d; color: #a78bfa; }
html.theme-dark .stat-icon.orange { background: #3f2a14; color: #fb923c; }
html.theme-dark .stat-icon.teal { background: #134e4a; color: #2dd4bf; }
html.theme-dark .stat-icon.green { background: #14532d; color: #4ade80; }

html.theme-dark .empty-state-icon {
  background: linear-gradient(145deg, #1e3a5f, #142318);
  color: #60a5fa;
}

html.theme-dark .status-badge.status-todo { background: #1e3a5f; color: #93c5fd; }
html.theme-dark .status-badge.status-in_progress { background: #3f2a14; color: #fdba74; }
html.theme-dark .status-badge.status-test_deployed { background: #422006; color: #fde68a; }
html.theme-dark .status-badge.status-production_deployed { background: #1e3a5f; color: #93c5fd; }
html.theme-dark .status-badge.status-completed { background: #14532d; color: #86efac; }

html.theme-dark .activity-list li,
html.theme-dark .project-overview-item,
html.theme-dark .recent-project-row {
  border-bottom-color: #1e293b;
}

html.theme-dark .project-metric {
  background: #0f172a;
}

html.theme-dark .progress {
  background: #1e293b;
}

html.theme-dark .quick-actions {
  background: linear-gradient(145deg, #12233a 0%, #1a1630 50%, #142318 100%);
  border-color: #1e3a5f;
}

html.theme-dark .qa-item {
  background: rgba(15, 23, 42, 0.75);
  border-color: #334155;
}

html.theme-dark .qa-item:hover {
  color: #93c5fd;
}

html.theme-dark .qa-item i { color: #60a5fa; }

/* Tables / forms / bootstrap surfaces */
html.theme-dark .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e2e8f0;
  --bs-table-border-color: #1e293b;
  --bs-table-hover-bg: #1e293b;
  --bs-table-striped-bg: #0f172a;
}

html.theme-dark .table thead th {
  background: #0f172a;
  color: #94a3b8;
}

html.theme-dark .form-control,
html.theme-dark .form-select,
html.theme-dark .login-input {
  background-color: #0f172a;
  border-color: var(--km-border-strong);
  color: #e2e8f0;
}

html.theme-dark .form-control::placeholder {
  color: #64748b;
}

html.theme-dark .form-control:focus,
html.theme-dark .form-select:focus {
  background-color: #0f172a;
  border-color: #3b82f6;
  color: #e2e8f0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

html.theme-dark .form-label,
html.theme-dark .page-header .h3,
html.theme-dark .page-header h1,
html.theme-dark .topbar-title {
  color: #f8fafc;
}

html.theme-dark .text-muted,
html.theme-dark .topbar-subtitle {
  color: #94a3b8 !important;
}

html.theme-dark .btn-outline-secondary {
  --bs-btn-color: #cbd5e1;
  --bs-btn-border-color: #334155;
  --bs-btn-hover-bg: #1e293b;
  --bs-btn-hover-border-color: #475569;
  --bs-btn-hover-color: #f8fafc;
  background: #111827;
}

html.theme-dark .btn-outline-primary {
  --bs-btn-color: #93c5fd;
  --bs-btn-border-color: #1e3a5f;
  --bs-btn-hover-bg: #1e3a5f;
  --bs-btn-hover-border-color: #3b82f6;
  --bs-btn-hover-color: #fff;
}

html.theme-dark .dropdown-menu {
  background: #111827;
  border-color: #334155;
  color: #e2e8f0;
}

html.theme-dark .dropdown-item {
  color: #e2e8f0;
}

html.theme-dark .dropdown-item:hover,
html.theme-dark .dropdown-item:focus {
  background: #1e293b;
  color: #f8fafc;
}

html.theme-dark .dropdown-divider {
  border-top-color: #334155;
}

html.theme-dark .user-menu.dropdown-menu {
  background: #111827;
  border-color: #334155;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

html.theme-dark .user-menu .dropdown-item {
  color: #e2e8f0;
}

html.theme-dark .user-menu .dropdown-item i {
  color: #94a3b8;
}

html.theme-dark .user-menu .dropdown-item:hover,
html.theme-dark .user-menu .dropdown-item:focus {
  background: #1e293b;
  color: #f8fafc;
}

html.theme-dark .user-menu .dropdown-item:hover i,
html.theme-dark .user-menu .dropdown-item:focus i {
  color: #cbd5e1;
}

html.theme-dark .user-menu .dropdown-item-danger,
html.theme-dark .user-menu .dropdown-item-danger:hover,
html.theme-dark .user-menu .dropdown-item-danger:focus {
  color: #f87171;
}

html.theme-dark .user-menu .dropdown-item-danger i {
  color: #f87171;
}

html.theme-dark .user-menu .dropdown-divider {
  border-top-color: #334155;
}

html.theme-dark .notification-menu.dropdown-menu {
  background: #111827;
  border-color: #334155;
}

html.theme-dark .modal-content,
html.theme-dark .offcanvas {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

html.theme-dark .modal-header,
html.theme-dark .modal-footer,
html.theme-dark .offcanvas-header {
  border-color: #334155;
}

html.theme-dark .modal-title,
html.theme-dark .offcanvas-title {
  color: #f8fafc;
}

html.theme-dark .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

html.theme-dark .list-group-item {
  background: transparent;
  color: #e2e8f0;
  border-color: #1e293b;
}

html.theme-dark .badge.text-bg-light {
  background: #1e293b !important;
  color: #cbd5e1 !important;
}

html.theme-dark .card {
  background: #111827;
  border-color: var(--km-border);
  color: var(--text);
}

html.theme-dark .alert-success {
  background: var(--ind-success-bg);
  border-color: var(--ind-success-border);
  color: var(--ind-success-text);
}

html.theme-dark .alert-danger,
html.theme-dark .alert-error {
  background: var(--ind-danger-bg);
  border-color: var(--ind-danger-border);
  color: var(--ind-danger-text);
}

html.theme-dark .alert-warning {
  background: var(--ind-warning-bg);
  border-color: var(--ind-warning-border);
  color: var(--ind-warning-text);
}

html.theme-dark .alert-info {
  background: var(--ind-info-bg);
  border-color: var(--ind-info-border);
  color: var(--ind-info-text);
}

/* Kanban */
html.theme-dark .kanban-column {
  background: #0f172a;
  border-color: var(--km-border);
}

html.theme-dark .kanban-column-header {
  background: #111827;
  border-bottom-color: var(--km-border);
}

html.theme-dark .kanban-column-header h2 {
  color: #f8fafc;
}

html.theme-dark .ticket-card {
  background: #111827;
  border-color: var(--km-border);
  color: #e2e8f0;
}

html.theme-dark .ticket-card:hover {
  border-color: #3b82f6;
}

/* Misc app surfaces */
html.theme-dark .page-header,
html.theme-dark .app-content {
  color: var(--text);
}

html.theme-dark a:not(.btn):not(.sidebar-link):not(.btn-create):not(.qa-item):not(.dropdown-item) {
  color: #60a5fa;
}

html.theme-dark a:not(.btn):not(.sidebar-link):not(.btn-create):not(.qa-item):not(.dropdown-item):hover {
  color: #93c5fd;
}

html.theme-dark .priority-pill {
  border-color: transparent;
}

html.theme-dark .notification-menu {
  background: #111827;
}

/* Soften logo on dark surfaces */
html.theme-dark .sidebar-brand-logo,
html.theme-dark .login-brand-logo,
html.theme-dark .login-card-logo {
  filter: brightness(1.08) contrast(1.05);
}

/* Ticket drawer / detail */
html.theme-dark .ticket-drawer,
html.theme-dark .ticket-drawer .offcanvas-header,
html.theme-dark .ticket-drawer-header,
html.theme-dark .ticket-drawer-body,
html.theme-dark .ticket-drawer .offcanvas-body {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

html.theme-dark .ticket-drawer-title,
html.theme-dark .ticket-detail-title,
html.theme-dark .ticket-section-title,
html.theme-dark .ticket-id-chip-num {
  color: #f8fafc;
}

html.theme-dark .ticket-drawer-subtitle,
html.theme-dark .ticket-detail-subtitle,
html.theme-dark .ticket-property-label,
html.theme-dark .ticket-empty-state {
  color: #94a3b8;
}

html.theme-dark .ticket-detail-hero,
html.theme-dark .ticket-section {
  background: #0f172a;
  border-color: #1e293b;
}

html.theme-dark .ticket-property-value,
html.theme-dark .ticket-description,
html.theme-dark .ticket-card-title {
  color: #e2e8f0;
}

html.theme-dark .ticket-id-chip {
  background: #1e293b;
  border-color: #334155;
}

html.theme-dark .ticket-status-pill.status-todo {
  background: #1e3a5f;
  color: #93c5fd;
  border-color: #1e3a5f;
}

html.theme-dark .ticket-status-pill.status-in_progress {
  background: #12233a;
  color: #60a5fa;
  border-color: #1e3a5f;
}

html.theme-dark .ticket-status-pill.status-test_deployed {
  background: #3f2a14;
  color: #fdba74;
  border-color: #3f2a14;
}

html.theme-dark .ticket-status-pill.status-production_deployed {
  background: #142318;
  color: #86efac;
  border-color: #14532d;
}

html.theme-dark .ticket-status-pill.status-completed {
  background: #14532d;
  color: #86efac;
  border-color: #14532d;
}

html.theme-dark .ticket-attachment-link {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

html.theme-dark .ticket-attachment-link:hover {
  background: #1e3a5f;
}

html.theme-dark .ticket-skeleton-line,
html.theme-dark .ticket-skeleton-block {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
}

html.theme-dark .kanban-column.drag-over {
  background: #12233a;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

html.theme-dark .ticket-card:hover {
  border-color: #475569;
}

/* Auth card pages (password reset etc.) */
html.theme-dark .auth-wrap {
  background: #0b1220;
}

html.theme-dark .auth-card {
  background: #111827;
  border-color: #334155;
}

html.theme-dark .auth-card .auth-heading,
html.theme-dark .auth-card h1 {
  color: #f8fafc;
}

html.theme-dark .auth-card .auth-subheading {
  color: #94a3b8;
}

html.theme-dark .auth-card input[type="text"],
html.theme-dark .auth-card input[type="email"],
html.theme-dark .auth-card input[type="password"] {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

/* Comment / activity panels */
html.theme-dark .comment-item,
html.theme-dark .activity-item {
  border-color: #1e293b;
}

html.theme-dark hr {
  border-color: #1e293b;
  opacity: 1;
}
