/* Dark theme — overrides for app + marketing pages */
[data-theme="dark"] {
  --app-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 42%, #0f172a 100%);
  --app-surface: #1e293b;
  --app-border: #334155;
  --app-text: #f1f5f9;
  --app-muted: #94a3b8;
  --app-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --app-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --app-primary: #818cf8;
  --app-primary-dark: #6366f1;
  /* Page-local vars (invoice history, admin, etc.) */
  --light-bg: #0f172a;
  --card-bg: #1e293b;
  --border-color: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --primary-color: #818cf8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}

[data-theme="dark"] body.app-body {
  background: var(--app-bg);
  color: var(--app-text);
}

/* App navbar — surface tone so header reads above page bg */
[data-theme="dark"] .app-navbar {
  background: rgba(30, 41, 59, 0.98) !important;
  border-bottom-color: #475569 !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
}

/* Logo PNG is for light backgrounds */
[data-theme="dark"] .app-navbar-brand,
[data-theme="dark"] .navbar-brand {
  background: rgba(248, 250, 252, 0.96);
  padding: 0.3rem 0.65rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .app-navbar-brand:hover,
[data-theme="dark"] .navbar-brand:hover {
  background: #ffffff;
}

[data-theme="dark"] .app-nav-link {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .app-nav-link:hover,
[data-theme="dark"] .app-nav-link.active {
  color: #a5b4fc !important;
  background: rgba(99, 102, 241, 0.15) !important;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35) !important;
}

[data-theme="dark"] .app-user-pill {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] a.app-user-pill-link:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35);
}

[data-theme="dark"] .app-user-pill i {
  color: #94a3b8;
}

[data-theme="dark"] .navbar-toggler {
  border-color: #475569;
  filter: invert(1);
}

/* Marketing navbar */
[data-theme="dark"] .navbar {
  background: rgba(30, 41, 59, 0.98) !important;
  border-bottom: 1px solid #475569;
}

[data-theme="dark"] .navbar .nav-link {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .navbar.scrolled {
  background: rgba(30, 41, 59, 0.99) !important;
}

/* Bootstrap components */
[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .dropdown-item {
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background: #334155;
  color: #f8fafc;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background: #0f172a;
  border-color: #818cf8;
  color: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

[data-theme="dark"] .form-control::placeholder {
  color: #64748b;
}

[data-theme="dark"] .input-group-text {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e2e8f0;
  --bs-table-border-color: #334155;
  --bs-table-striped-bg: rgba(15, 23, 42, 0.5);
  --bs-table-hover-bg: rgba(51, 65, 85, 0.5);
}

[data-theme="dark"] .modal-content {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: #334155;
  background: #1e293b;
}

[data-theme="dark"] .modal-footer {
  background: #0f172a;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%);
}

[data-theme="dark"] .nav-tabs {
  border-color: #334155;
}

[data-theme="dark"] .nav-tabs .nav-link {
  color: #94a3b8;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
  background: #1e293b;
  border-color: #334155 #334155 #1e293b;
  color: #c7d2fe;
}

[data-theme="dark"] .alert-info {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.35);
  color: #bae6fd;
}

[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

[data-theme="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

/* App surfaces & tables */
[data-theme="dark"] .recent-table tr:hover td {
  background: rgba(51, 65, 85, 0.45);
}

[data-theme="dark"] .badge-soft {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

[data-theme="dark"] .stat-icon.primary { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
[data-theme="dark"] .stat-icon.success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
[data-theme="dark"] .stat-icon.warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
[data-theme="dark"] .stat-icon.info { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }

[data-theme="dark"] .page-hero-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(129, 140, 248, 0.15));
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.25);
}

[data-theme="dark"] .page-hero-badge {
  background: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .form-guide-box {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="dark"] .form-guide-title {
  color: #e2e8f0;
}

[data-theme="dark"] .form-guide-list {
  color: #cbd5e1;
}

[data-theme="dark"] .form-guide-close {
  color: #e2e8f0;
}

[data-theme="dark"] .help-icon {
  background-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .btn-app-secondary {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .btn-app-secondary:hover {
  background: #334155;
  border-color: #64748b;
}

/* Invoice form */
[data-theme="dark"] #invoice-form.invoice-form-premium label {
  color: #cbd5e1;
}

[data-theme="dark"] #invoice-form.invoice-form-premium .form-control,
[data-theme="dark"] #invoice-form.invoice-form-premium select {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] #invoice-form.invoice-form-premium .section-head i {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

[data-theme="dark"] #invoice-form.invoice-form-premium .product-block {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] #invoice-form.invoice-form-premium .address-panel,
[data-theme="dark"] #invoice-form.invoice-form-premium .company-details {
  background: #0f172a;
}

[data-theme="dark"] #invoice-form.invoice-form-premium .form-actions {
  background: #0f172a;
  border-top-color: #334155;
}

[data-theme="dark"] #invoice-form,
[data-theme="dark"] #invoice-form label {
  color: #cbd5e1;
}

[data-theme="dark"] .quick-quantity {
  background: #1e293b;
  border-color: #475569;
  color: #a5b4fc;
}

[data-theme="dark"] .quick-quantity:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="dark"] .quick-quantity.active {
  background: var(--app-primary);
  color: #fff;
  border-color: var(--app-primary);
}

[data-theme="dark"] #invoice-form.invoice-form-premium button.btn-outline-primary,
[data-theme="dark"] #invoice-form.invoice-form-premium .btn-add-product {
  background: #1e293b;
  border-color: #475569;
  color: #a5b4fc;
}

[data-theme="dark"] #invoice-form.invoice-form-premium button.btn-outline-primary:hover,
[data-theme="dark"] #invoice-form.invoice-form-premium .btn-add-product:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

[data-theme="dark"] #invoice-form .modal-content {
  background-color: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}

[data-theme="dark"] .invoice-btn--ghost {
  color: #e2e8f0;
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .invoice-btn--ghost:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
}

[data-theme="dark"] .invoice-btn--text {
  color: #94a3b8;
}

[data-theme="dark"] .invoice-btn--text:hover {
  color: #e2e8f0;
}

[data-theme="dark"] .supplier-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .supplier-card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .supplier-card.selected,
[data-theme="dark"] .supplier-card.active {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.35);
}

[data-theme="dark"] .category-chip,
[data-theme="dark"] #invoice-form .supplier-category-chip {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
  opacity: 1 !important;
}

[data-theme="dark"] .category-chip.active,
[data-theme="dark"] .category-chip:hover,
[data-theme="dark"] #invoice-form .supplier-category-chip.active,
[data-theme="dark"] #invoice-form .supplier-category-chip:hover {
  background: rgba(99, 102, 241, 0.22) !important;
  border-color: #6366f1 !important;
  color: #c7d2fe !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35) !important;
}

[data-theme="dark"] #invoice-form .supplier-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
  opacity: 1 !important;
}

[data-theme="dark"] #invoice-form .supplier-card:hover {
  border-color: #6366f1 !important;
  background: #263449 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] #invoice-form .supplier-card.active {
  border-color: #818cf8 !important;
  background: rgba(99, 102, 241, 0.15) !important;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.35) !important;
}

[data-theme="dark"] #invoice-form .supplier-card-name {
  color: #94a3b8 !important;
}

[data-theme="dark"] #invoice-form .supplier-card.active .supplier-card-name {
  color: #a5b4fc !important;
}

[data-theme="dark"] .supplier-card-logo--placeholder,
[data-theme="dark"] #invoice-form .supplier-card-logo--placeholder {
  background: linear-gradient(135deg, #312e81, #1e293b) !important;
  color: #a5b4fc !important;
}

[data-theme="dark"] .supplier-category-label,
[data-theme="dark"] .supplier-cards-label,
[data-theme="dark"] #invoice-form .supplier-category-label,
[data-theme="dark"] #invoice-form .supplier-cards-label {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .supplier-cards-empty,
[data-theme="dark"] #invoice-form .supplier-cards-empty {
  background: #0f172a;
  border-color: #475569;
  color: #94a3b8;
}

/* Admin — override page-local CSS variables + hardcoded light surfaces */
[data-theme="dark"] .admin-page {
  --light-bg: #0f172a;
  --card-bg: #1e293b;
  --border-color: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --primary-color: #818cf8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

[data-theme="dark"] .admin-page .admin-header-premium,
[data-theme="dark"] .admin-page .admin-header-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-page .admin-title {
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="dark"] .admin-page .admin-subtitle,
[data-theme="dark"] .admin-page .section-title {
  color: var(--text-secondary);
}

[data-theme="dark"] .admin-page .stat-card {
  background: var(--light-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-page .stat-number {
  color: #a5b4fc;
}

[data-theme="dark"] .admin-page .stat-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .admin-page .admin-tabs-premium,
[data-theme="dark"] .admin-page .nav-tabs {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-page .admin-tabs-premium .nav-link {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .admin-page .admin-tabs-premium .nav-link:hover {
  background: #334155;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .admin-page .admin-tabs-premium .nav-link.active {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #c7d2fe !important;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35);
}

[data-theme="dark"] .admin-page .admin-tab-panel,
[data-theme="dark"] .admin-page .tab-content {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .admin-page .admin-kpi {
  background: var(--light-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-page .admin-kpi-value {
  color: #f1f5f9;
}

[data-theme="dark"] .admin-page .admin-kpi-label {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .admin-filter-bar {
  background: var(--light-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-page .admin-filter-bar .form-label {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .admin-filter-bar .form-control,
[data-theme="dark"] .admin-page .admin-filter-bar .form-select {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .admin-page .search-input {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .admin-page .search-input:focus {
  background: #0f172a;
  border-color: #818cf8;
  color: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

[data-theme="dark"] .admin-page .admin-table-shell,
[data-theme="dark"] .admin-page .table-container {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .admin-page .admin-data-table thead th,
[data-theme="dark"] .admin-page .table th {
  background: #0f172a;
  color: #94a3b8;
  border-bottom-color: #334155;
}

[data-theme="dark"] .admin-page .admin-data-table tbody td,
[data-theme="dark"] .admin-page .table td {
  color: #f1f5f9;
  border-bottom-color: #334155;
}

[data-theme="dark"] .admin-page .admin-data-table tbody tr:hover td,
[data-theme="dark"] .admin-page .table tbody tr:hover {
  background: rgba(51, 65, 85, 0.45);
}

[data-theme="dark"] .admin-page .sortable:hover {
  background-color: #334155 !important;
  color: #a5b4fc;
}

[data-theme="dark"] .admin-page .admin-cell-email,
[data-theme="dark"] .admin-page .admin-cell-date {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .admin-cell-amt {
  color: #6ee7b7;
}

[data-theme="dark"] .admin-page .admin-cell-user code {
  background: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .admin-page .admin-pill-co {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

[data-theme="dark"] .admin-page .admin-toolbar {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .admin-icon-btn {
  background: #0f172a;
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .admin-icon-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="dark"] .admin-page .admin-icon-btn.success:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #6ee7b7;
}

[data-theme="dark"] .admin-page .btn-outline-primary {
  background: #1e293b;
  color: #a5b4fc;
  border-color: #6366f1;
}

[data-theme="dark"] .admin-page .btn-outline-primary:hover {
  background: #6366f1;
  color: #fff;
}

[data-theme="dark"] .admin-page .btn-outline-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #475569;
}

[data-theme="dark"] .admin-page .btn-outline-secondary:hover {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .admin-page .btn-outline-success {
  background: #1e293b;
  color: #6ee7b7;
  border-color: #10b981;
}

[data-theme="dark"] .admin-page .btn-outline-success:hover {
  background: #10b981;
  color: #fff;
}

[data-theme="dark"] .admin-page .btn-outline-info {
  background: #1e293b;
  color: #67e8f9;
  border-color: #06b6d4;
}

[data-theme="dark"] .admin-page .btn-outline-info:hover {
  background: #06b6d4;
  color: #fff;
}

[data-theme="dark"] .admin-page .btn-outline-danger {
  background: #1e293b;
  color: #fca5a5;
  border-color: #ef4444;
}

[data-theme="dark"] .admin-page .btn-outline-danger:hover {
  background: #ef4444;
  color: #fff;
}

[data-theme="dark"] .admin-page .pagination .page-link {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .admin-page .pagination .page-link:hover {
  background: #334155;
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="dark"] .admin-page .pagination .page-item.disabled .page-link {
  background: #0f172a;
  color: #64748b;
}

[data-theme="dark"] .admin-page .pagination-info {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .log-details-preview {
  color: #94a3b8;
}

[data-theme="dark"] .admin-page .log-details-wrap:hover .log-details-preview {
  color: #f1f5f9;
}

[data-theme="dark"] .admin-page .migration-status {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

[data-theme="dark"] .admin-page .migration-status.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

[data-theme="dark"] .admin-user-modal {
  background: #1e293b;
}

[data-theme="dark"] .admin-user-modal__hero {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(99, 102, 241, 0.25) 0%, transparent 55%),
    linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom-color: #334155;
}

[data-theme="dark"] .admin-user-modal__name { color: #f1f5f9; }
[data-theme="dark"] .admin-user-modal__email { color: #94a3b8; }
[data-theme="dark"] .admin-user-modal__uid {
  background: rgba(15, 23, 42, 0.5);
  color: #cbd5e1;
}

[data-theme="dark"] .admin-user-modal__nav,
[data-theme="dark"] .admin-user-modal__footer {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .admin-user-modal__tab { color: #94a3b8; }
[data-theme="dark"] .admin-user-modal__tab:hover {
  background: #334155;
  color: #e2e8f0;
}
[data-theme="dark"] .admin-user-modal__tab.active {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.45);
}

[data-theme="dark"] .admin-user-modal__body { background: #0f172a; }
[data-theme="dark"] .admin-user-section {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .admin-user-section__head h6 { color: #f1f5f9; }
[data-theme="dark"] .admin-user-toggle {
  background: #0f172a;
  border-color: #334155;
}
[data-theme="dark"] .admin-user-toggle:hover {
  background: #1e293b;
  border-color: #6366f1;
}
[data-theme="dark"] .admin-user-toggle__text strong { color: #f1f5f9; }
[data-theme="dark"] .admin-plan-card {
  background: #0f172a;
  border-color: #334155;
}
[data-theme="dark"] .admin-plan-card.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: #818cf8;
}
[data-theme="dark"] .admin-plan-card__name { color: #f1f5f9; }
[data-theme="dark"] .admin-user-stat {
  background: #0f172a;
  border-color: #334155;
}
[data-theme="dark"] .admin-user-stat--accent {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(129, 140, 248, 0.35);
}
[data-theme="dark"] .admin-user-stat__value,
[data-theme="dark"] .admin-user-stat__input { color: #f1f5f9; }

/* Check invoice page */
[data-theme="dark"] .check-hero h1 {
  color: #f1f5f9;
}

[data-theme="dark"] .check-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .check-hero p {
  color: #94a3b8;
}

/* Auth pages (login, register) — override inline white card / light gradient */
[data-theme="dark"] body:not(.app-body) {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 42%, #0f172a 100%) !important;
  color: #e2e8f0;
}

[data-theme="dark"] .login-container,
[data-theme="dark"] .register-container,
[data-theme="dark"] .site-card,
[data-theme="dark"] .success-container,
[data-theme="dark"] .forgot-container,
[data-theme="dark"] .reset-container,
[data-theme="dark"] .verify-container,
[data-theme="dark"] .error-container {
  background: #1e293b !important;
  border: 1px solid #334155;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .login-header h1,
[data-theme="dark"] .register-header h1,
[data-theme="dark"] .site-card-title,
[data-theme="dark"] .success-title,
[data-theme="dark"] .error-title {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .site-card-text,
[data-theme="dark"] .success-message,
[data-theme="dark"] .error-message {
  color: #94a3b8 !important;
}

[data-theme="dark"] .login-container .form-label,
[data-theme="dark"] .register-container .form-label,
[data-theme="dark"] .site-card .form-label {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .register-link,
[data-theme="dark"] .login-link,
[data-theme="dark"] .site-link-row {
  color: #94a3b8;
}

[data-theme="dark"] .register-link a,
[data-theme="dark"] .login-link a,
[data-theme="dark"] .site-link-row a {
  color: #a5b4fc !important;
}

[data-theme="dark"] .register-link a:hover,
[data-theme="dark"] .login-link a:hover,
[data-theme="dark"] .site-link-row a:hover {
  color: #c7d2fe !important;
}

[data-theme="dark"] .password-toggle {
  color: #94a3b8;
}

[data-theme="dark"] .password-toggle:hover {
  color: #c7d2fe;
}

[data-theme="dark"] .footer {
  background-color: #111827 !important;
  color: #94a3b8;
  border-top: 1px solid #334155;
}

[data-theme="dark"] .footer-title {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .footer-link {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .footer-link:hover {
  color: #fff !important;
}

[data-theme="dark"] .footer-bottom {
  border-top-color: #334155;
}

[data-theme="dark"] .forgot-header h1 {
  color: #f1f5f9 !important;
}

/* Marketing body (base.html pages without app-body) */

[data-theme="dark"] body:not(.app-body) main {
  color: #e2e8f0;
}

/* Welcome / About / Pricing / Contact — light inline sections */
[data-theme="dark"] .features-section,
[data-theme="dark"] .content-section,
[data-theme="dark"] .team-section,
[data-theme="dark"] .pricing-section,
[data-theme="dark"] .faq-section,
[data-theme="dark"] .contact-section,
[data-theme="dark"] .map-section {
  background-color: #0f172a !important;
}

[data-theme="dark"] .values-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%) !important;
}

[data-theme="dark"] .section-title,
[data-theme="dark"] .feature-title,
[data-theme="dark"] .team-name,
[data-theme="dark"] .value-title,
[data-theme="dark"] .pricing-name,
[data-theme="dark"] .faq-title,
[data-theme="dark"] .contact-info-content h5,
[data-theme="dark"] .contact-social-title {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .feature-description,
[data-theme="dark"] .team-bio,
[data-theme="dark"] .value-description,
[data-theme="dark"] .pricing-description,
[data-theme="dark"] .pricing-feature,
[data-theme="dark"] .content-section p,
[data-theme="dark"] .contact-info-content p {
  color: #94a3b8 !important;
}

[data-theme="dark"] .feature-card,
[data-theme="dark"] .value-card,
[data-theme="dark"] .pricing-card,
[data-theme="dark"] .contact-form,
[data-theme="dark"] .contact-info {
  background-color: #1e293b !important;
  border: 1px solid #334155;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
  color: #e2e8f0;
}

[data-theme="dark"] .feature-card:hover,
[data-theme="dark"] .value-card:hover,
[data-theme="dark"] .pricing-card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .pricing-card.popular {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .pricing-price {
  color: #f1f5f9;
}

[data-theme="dark"] .accordion-item {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

[data-theme="dark"] .accordion-button,
[data-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
  color: #a5b4fc !important;
}

[data-theme="dark"] .accordion-body {
  background-color: #0f172a !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .team-position {
  color: #a5b4fc !important;
}

[data-theme="dark"] .team-image {
  border-color: #334155 !important;
}

[data-theme="dark"] .card {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 {
  color: #f1f5f9;
}

/* Clients / templates page */
[data-theme="dark"] .client-create-card {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .client-create-card:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: #818cf8;
  color: #c7d2fe;
}

[data-theme="dark"] .clients-search input {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .client-card-date {
  background: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .client-meta-row {
  border-bottom-color: #334155;
}

[data-theme="dark"] .address-toggle-btn {
  background: #0f172a;
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .address-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="dark"] .clients-page .address-panel,
[data-theme="dark"] .client-card .address-panel {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-app-sm {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-app-sm.danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

/* Profile page */
[data-theme="dark"] .profile-hero-card {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .profile-danger-zone {
  background: linear-gradient(180deg, #1e293b 0%, rgba(127, 29, 29, 0.18) 100%);
  border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .profile-stat-row {
  border-bottom-color: #334155;
}

[data-theme="dark"] .profile-form .form-label {
  color: #cbd5e1;
}

[data-theme="dark"] .profile-stat-value {
  color: #f1f5f9;
}

/* Invoice history — hardcoded light surfaces in page styles */
[data-theme="dark"] .history-container .history-header,
[data-theme="dark"] .history-container .content-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .history-container .stat-card,
[data-theme="dark"] .history-container .filters-section,
[data-theme="dark"] .history-container .results-info {
  background: var(--light-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .history-container .search-input {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .history-container .search-input:focus {
  background: #0f172a;
  border-color: #818cf8;
  color: #f1f5f9;
}

[data-theme="dark"] .history-container .table-container {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .history-container .table th {
  background: #0f172a;
  color: #94a3b8;
  border-bottom-color: #334155;
}

[data-theme="dark"] .history-container .table td {
  color: #f1f5f9;
  border-bottom-color: #334155;
}

[data-theme="dark"] .history-container .table tbody tr:hover {
  background-color: rgba(51, 65, 85, 0.45);
}

[data-theme="dark"] .history-container .sortable:hover {
  background-color: #334155 !important;
  color: #a5b4fc;
}

[data-theme="dark"] .history-container .btn-outline-primary {
  background: #1e293b;
  color: #a5b4fc;
  border-color: #6366f1;
}

[data-theme="dark"] .history-container .btn-outline-primary:hover {
  background: #6366f1;
  color: #fff;
}

[data-theme="dark"] .history-container .btn-outline-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #475569;
}

[data-theme="dark"] .history-container .btn-outline-secondary:hover {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .history-container .reset-btn {
  background: #1e293b;
}

[data-theme="dark"] .history-container .reset-btn:hover {
  background: #ef4444;
  color: #fff;
}

[data-theme="dark"] .history-container .pagination .page-link {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .history-container .pagination .page-link:hover {
  background: #334155;
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="dark"] .history-container .pagination .page-item.disabled .page-link {
  background: #0f172a;
  color: #64748b;
}

[data-theme="dark"] .history-container .text-success {
  color: #6ee7b7 !important;
}

[data-theme="dark"] .history-container .history-title {
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="dark"] .history-container .empty-state h3 {
  color: #f1f5f9;
}

[data-theme="dark"] .history-container .empty-state-icon-wrap {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(168, 85, 247, 0.14));
  border-color: rgba(129, 140, 248, 0.28);
  color: #a5b4fc;
}

[data-theme="dark"] .clients-guide-box {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="dark"] .clients-guide-title {
  color: #e2e8f0;
}

[data-theme="dark"] .clients-guide-text {
  color: #cbd5e1;
}

[data-theme="dark"] .clients-guide-path {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

[data-theme="dark"] .clients-guide-close {
  color: #e2e8f0;
}
