/* Basic dark theme overrides (class-based: body.dark) */
body.dark { background: #0b1220 !important; color: #e6eef8 !important; }
body.dark .bg-white { background-color: #0b1220 !important; }
body.dark .text-gray-900, body.dark .text-slate-800, body.dark .text-slate-900 { color: #e6eef8 !important; }
body.dark .text-gray-700, body.dark .text-slate-700 { color: #cbd5e1 !important; }
body.dark .bg-gray-100 { background-color: #0f1724 !important; }
body.dark .bg-green-50 { background-color: #072014 !important; }
body.dark .bg-green-100 { background-color: #08321a !important; }
body.dark .bg-blue-50 { background-color: #071430 !important; }
/* Make borders in dark mode subtle to blend with page gradient */
body.dark .border-gray-200, body.dark .border-slate-100, body.dark .border-gray-300 { border-color: rgba(255,255,255,0.04) !important; }
body.dark .shadow-xl { box-shadow: 0 10px 30px rgba(2,6,23,0.6) !important; }
body.dark a { color: #93c5fd !important; }
body.dark .hover\:bg-slate-100:hover { background-color: rgba(255,255,255,0.02) !important; }
body.dark .glass-effect { background: rgba(6,8,16,0.6) !important; }
/* Buttons */
body.dark .bg-blue-500 { background-color: #0b5bd7 !important; }
body.dark .bg-green-500 { background-color: #0f9d58 !important; }
body.dark .bg-purple-500 { background-color: #6b21a8 !important; }
/* Tables */
body.dark table { color: #e6eef8; }
body.dark .bg-gray-50 { background-color: #071122 !important; }

/* Fallback for elements that rely on inline light colors */
body.dark .text-red-600 { color: #ff8b8b !important; }
body.dark .text-green-600 { color: #a3e635 !important; }
body.dark .text-blue-600 { color: #60a5fa !important; }

/* Headings */
body.dark .text-3xl, body.dark .text-2xl, body.dark .text-xl, body.dark .text-lg { color: #e6eef8 !important; }
body.dark .font-bold, body.dark .font-semibold { color: #e6eef8 !important; }
body.dark .text-gray-800 { color: #e6eef8 !important; }

/* Inputs, selects, textareas */
body.dark input, body.dark textarea, body.dark select {
	background-color: #071226 !important;
	color: #e6eef8 !important;
	border-color: #22303b !important;
}
body.dark input::placeholder, body.dark textarea::placeholder { color: #9fb0c7 !important; }
body.dark input:focus, body.dark textarea:focus, body.dark select:focus {
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(96,165,250,0.12) !important;
	border-color: #60a5fa !important;
}

/* Quick actions / small icon badges */
body.dark .w-12.h-12, body.dark .w-10.h-10 { background-color: rgba(255,255,255,0.03) !important; }
body.dark .rounded-xl > svg, body.dark .w-12.h-12 svg { color: #93c5fd !important; }

/* Card / quick action backgrounds */
body.dark .rounded-2xl, body.dark .rounded-md { background-color: #07122a !important; border-color: #172033 !important; }

/* Recent activity lists */
body.dark .recent-activity, body.dark .activity-list, body.dark .activity-item {
	background: transparent !important;
	color: #cfe7ff !important;
	border-color: #172033 !important;
}
body.dark .activity-item + .activity-item { border-top: 1px solid rgba(255,255,255,0.03) !important; }

/* Small utility tweaks for buttons/links in dark */
body.dark .text-blue-600 { color: #93c5fd !important; }
body.dark .text-green-600 { color: #a3e635 !important; }
body.dark .text-red-600 { color: #ff8b8b !important; }

/* Fixes for remaining Tailwind utility classes that are light-theme specific */
body.dark .text-slate-600 { color: #9fb0c7 !important; }
body.dark .text-slate-700 { color: #b8cfe6 !important; }

/* Backgrounds used for cards/quick actions */
body.dark .bg-slate-50 { background-color: #071226 !important; color: #e6eef8 !important; }
body.dark .bg-slate-100 { background-color: #08162a !important; color: #e6eef8 !important; }

/* Sidebar and general hover tweaks for dark mode */
/* Sidebar and general hover tweaks for dark mode (high specificity) */
body.dark aside#sidebar a, body.dark aside#sidebar a * { transition: background-color 180ms ease, color 180ms ease, transform 180ms ease !important; }
body.dark aside#sidebar a { color: #9fb0c7 !important; background-color: transparent !important; }
body.dark aside#sidebar a:hover, body.dark aside#sidebar a:focus { background-color: rgba(255,255,255,0.03) !important; color: #ffffff !important; }
body.dark aside#sidebar a svg, body.dark aside#sidebar a .ti { color: #9fb0c7 !important; }
body.dark aside#sidebar a:hover svg, body.dark aside#sidebar a:hover .ti { color: #ffffff !important; }

/* Make primary action buttons slightly brighten on hover in dark mode */
body.dark a.bg-blue-500:hover, body.dark .bg-blue-500:hover, body.dark a.bg-green-500:hover, body.dark .bg-green-500:hover, body.dark a.bg-purple-500:hover, body.dark .bg-purple-500:hover {
	filter: brightness(1.06) !important;
}

/* Table row coloring for debts (red) and collections (green) in dark mode */
/* Strong overrides for debts/collections text colors (target table IDs and utility classes) */
body.dark td.text-red-600, body.dark #debtsCollectionsTable td.text-red-600, body.dark #debtsTableBody td.text-red-600, body.dark #debtsTableFooter td.text-red-600 { color: #ff8b8b !important; }
body.dark td.text-green-600, body.dark #debtsCollectionsTable td.text-green-600, body.dark #debtsTableBody td.text-green-600, body.dark #debtsTableFooter td.text-green-600 { color: #86efac !important; }

/* Collections rows: subtle green tint background and hover (apply to row cells too) */
body.dark tr.bg-green-50 { background-color: rgba(34,197,94,0.06) !important; }
body.dark tr.bg-green-50 td, body.dark tr.bg-green-50 th { background-color: rgba(34,197,94,0.06) !important; }
body.dark tr.bg-green-50:hover, body.dark tr.bg-green-100:hover { background-color: rgba(34,197,94,0.09) !important; }
body.dark tr.bg-green-50:hover td, body.dark tr.bg-green-100:hover td { background-color: rgba(34,197,94,0.09) !important; }

/* Debt rows hover subtle darken */
body.dark tr:hover { background-color: rgba(255,255,255,0.01) !important; }

/* Ensure subtle transitions on table rows */
body.dark table tr { transition: background-color 140ms ease; }

/* Hover variants often used on list items / quick actions */
body.dark .hover\:bg-slate-100:hover { background-color: rgba(255,255,255,0.02) !important; }
body.dark .hover\:bg-slate-50:hover { background-color: rgba(255,255,255,0.02) !important; }

/* Group-hover helpers (common pattern: parent .group + child .group-hover:class) */
body.dark .group:hover .group-hover\:bg-slate-100 { background-color: rgba(255,255,255,0.02) !important; }
body.dark .group:hover .group-hover\:bg-slate-50 { background-color: rgba(255,255,255,0.02) !important; }

/* Ensure padded rounded elements remain visible in dark */
body.dark .p-3.rounded-xl, body.dark .p-3.rounded-md { background-color: rgba(255,255,255,0.02) !important; border: 1px solid rgba(255,255,255,0.03) !important; }

/* Make small text with font-medium readable 
body.dark .text-sm.font-medium, body.dark .text-sm.font-semibold { color: #cbd5e1 !important; }
*/

/* Fix icon badge contrast inside quick-action circles */
body.dark .h-10.w-10, body.dark .h-12.w-12 { background-color: rgba(255,255,255,0.03) !important; }

/* Misc fallback for slate hover/bg combos that may appear in components */
body.dark .bg-gray-50, body.dark .bg-slate-50, body.dark .bg-slate-100 { background-color: #071226 !important; }



/* Communication Preferences Chips - Overriding global !important */
body.dark .peer:checked + div.peer-checked\:bg-blue-50 {
    background-color: rgba(30, 64, 175, 0.4) !important;
    color: #93c5fd !important;
    border-color: #3b82f6 !important;
}
body.dark .peer:checked + div.peer-checked\:bg-green-50 {
    background-color: rgba(21, 128, 61, 0.4) !important;
    color: #86efac !important;
    border-color: #22c55e !important;
}
body.dark .group:hover .dark\:hover\:border-slate-600 {
    border-color: #475569 !important;
}
