/**
 * Light and dark theme for Emiweb.
 *
 * The site is built with light Tailwind classes (bg-white, text-gray-900,
 * bg-indigo-600 ...). When <html> has the class "theme-dark", this file maps
 * those classes to a dark palette. partials/_theme-init sets the class from
 * the visitor's choice in the account menu (Light / Dark / Auto, saved in
 * localStorage "emiweb_theme"; Auto follows the OS / browser).
 *
 * Why a real dark theme: with no dark colours, Chrome's own "auto dark
 * mode" darkens the page but leaves the purple header and buttons, and a
 * dark browser with color-scheme "light dark" showed white text on white
 * (customer report 2026-11-16).
 *
 * Print always stays light (the dark rules are screen only).
 * Loaded after css/app.css in layouts/app, guest and admin.
 */

:root {
	color-scheme: light;
}

html {
	color: #000;
}

@media screen {
	html.theme-dark {
		color-scheme: dark;
		/* Palette */
		--dk-page: #0f141c;
		--dk-surface: #182029;
		--dk-surface-2: #1e2733;
		--dk-hover: #26313f;
		--dk-input: #111821;
		--dk-line: #2f3b4a;
		--dk-line-strong: #3d4a5c;
		--dk-text: #e6e9ef;
		--dk-text-2: #c5ccd6;
		--dk-text-3: #9aa5b4;
		--dk-text-4: #7b8696;
		--dk-header: #222a3d;
		--dk-header-org: #13303f;
		/* Accent: calm steel blue instead of Emiweb's purple, which clashes
		   with the dark slate surfaces */
		--dk-brand: #3a6ea5;
		--dk-brand-hover: #4a80ba;
		--dk-brand-text: #8fbdeb;
		--dk-brand-soft: rgba(58, 110, 165, 0.22);
		--dk-brand-line: rgba(58, 110, 165, 0.55);
	}

	html.theme-dark {
		color: var(--dk-text);
		background-color: var(--dk-page);
	}

	/* Page and surfaces */
	html.theme-dark .bg-gray-100, html.theme-dark.bg-gray-100, html.theme-dark.bg-gray-50, html.theme-dark.bg-white { background-color: var(--dk-page); }
	html.theme-dark .bg-white { background-color: var(--dk-surface); }
	html.theme-dark .bg-gray-50 { background-color: var(--dk-surface-2); }
	html.theme-dark .bg-gray-200 { background-color: var(--dk-hover); }
	html.theme-dark .odd\:bg-white:nth-child(odd) { background-color: var(--dk-surface); }
	html.theme-dark .even\:bg-gray-100:nth-child(even),
	html.theme-dark .even\:bg-gray-50:nth-child(even) { background-color: var(--dk-surface-2); }
	html.theme-dark .active\:bg-gray-100:active { background-color: var(--dk-hover); }
	html.theme-dark .hover\:bg-gray-50:hover,
	html.theme-dark .hover\:bg-gray-100:hover { background-color: var(--dk-hover); }

	/* Header: deep slate instead of the bright purple */
	html.theme-dark header.bg-indigo-600 {
		background-color: var(--dk-header);
		border-bottom: 1px solid var(--dk-line);
	}
	html.theme-dark header.bg-sky-800 {
		background-color: var(--dk-header-org);
		border-bottom: 1px solid var(--dk-line);
	}

	/* Text */
	html.theme-dark .text-black,
	html.theme-dark .text-gray-900,
	html.theme-dark .text-gray-800 { color: var(--dk-text); }
	html.theme-dark .text-gray-700,
	html.theme-dark .text-gray-600 { color: var(--dk-text-2); }
	html.theme-dark .text-gray-500 { color: var(--dk-text-3); }
	html.theme-dark .text-gray-400 { color: var(--dk-text-3); }
	html.theme-dark .text-gray-300 { color: var(--dk-text-4); }
	html.theme-dark .hover\:text-gray-900:hover,
	html.theme-dark .hover\:text-gray-800:hover,
	html.theme-dark .hover\:text-gray-700:hover { color: var(--dk-text); }
	html.theme-dark .placeholder-gray-400::placeholder,
	html.theme-dark ::placeholder { color: var(--dk-text-4); }

	/* Borders, dividers, rings */
	html.theme-dark .border-gray-100,
	html.theme-dark .border-gray-200,
	html.theme-dark .border-gray-300 { border-color: var(--dk-line); }
	html.theme-dark .hover\:border-gray-300:hover { border-color: var(--dk-line-strong); }
	html.theme-dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
	html.theme-dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
	html.theme-dark .divide-gray-300 > :not([hidden]) ~ :not([hidden]) { border-color: var(--dk-line); }
	html.theme-dark .ring-gray-200,
	html.theme-dark .ring-gray-300 { --tw-ring-color: var(--dk-line); }
	html.theme-dark .ring-black { --tw-ring-color: rgba(0, 0, 0, 0.6); }

	/* Brand (indigo): calmer tone that sits on the dark surfaces */
	html.theme-dark .bg-indigo-600,
	html.theme-dark .bg-indigo-500,
	html.theme-dark .hover\:bg-indigo-600:hover { background-color: var(--dk-brand); }
	html.theme-dark .hover\:bg-indigo-700:hover,
	html.theme-dark .hover\:bg-indigo-500:hover { background-color: var(--dk-brand-hover); }
	html.theme-dark .bg-indigo-50,
	html.theme-dark .bg-indigo-100,
	html.theme-dark .hover\:bg-indigo-100:hover { background-color: var(--dk-brand-soft); }
	html.theme-dark .text-indigo-500,
	html.theme-dark .text-indigo-600,
	html.theme-dark .text-indigo-700,
	html.theme-dark .text-indigo-800,
	html.theme-dark .text-indigo-900,
	html.theme-dark .hover\:text-indigo-600:hover,
	html.theme-dark .hover\:text-indigo-700:hover,
	html.theme-dark .hover\:text-indigo-800:hover,
	html.theme-dark .hover\:text-indigo-900:hover { color: var(--dk-brand-text); }
	html.theme-dark .group:hover .group-hover\:text-indigo-400,
	html.theme-dark .group:hover .group-hover\:text-indigo-600,
	html.theme-dark .group:hover .group-hover\:text-indigo-700 { color: var(--dk-brand-text); }
	html.theme-dark .group:hover .group-hover\:text-white { color: #fff; }
	html.theme-dark .group:hover .group-hover\:bg-indigo-100 { background-color: var(--dk-brand-soft); }
	html.theme-dark .text-black-900 { color: var(--dk-text); }
	html.theme-dark .border-indigo-200 { border-color: var(--dk-brand-line); }
	html.theme-dark .border-indigo-500 { border-color: var(--dk-brand-text); }

	/* Status colours: soft tinted backgrounds, light text */
	html.theme-dark .bg-blue-50,
	html.theme-dark .bg-blue-100 { background-color: rgba(59, 130, 246, 0.18); }
	html.theme-dark .text-blue-700,
	html.theme-dark .text-blue-800 { color: #bcd4ff; }
	html.theme-dark .bg-red-50,
	html.theme-dark .bg-red-100 { background-color: rgba(239, 68, 68, 0.15); }
	html.theme-dark .text-red-500,
	html.theme-dark .text-red-600 { color: #f58c8c; }
	html.theme-dark .text-red-700,
	html.theme-dark .text-red-800 { color: #fbb4b4; }
	html.theme-dark .border-red-200,
	html.theme-dark .border-red-300 { border-color: rgba(239, 68, 68, 0.4); }
	html.theme-dark .bg-green-50,
	html.theme-dark .bg-green-100 { background-color: rgba(34, 197, 94, 0.15); }
	html.theme-dark .text-green-500,
	html.theme-dark .text-green-600 { color: #6ee7a0; }
	html.theme-dark .text-green-700,
	html.theme-dark .text-green-800 { color: #a7f3c4; }
	html.theme-dark .border-green-200 { border-color: rgba(34, 197, 94, 0.4); }
	html.theme-dark .bg-yellow-50,
	html.theme-dark .bg-yellow-100,
	html.theme-dark .bg-amber-50,
	html.theme-dark .bg-amber-100 { background-color: rgba(234, 179, 8, 0.14); }
	html.theme-dark .text-yellow-600,
	html.theme-dark .text-yellow-700,
	html.theme-dark .text-yellow-800,
	html.theme-dark .text-amber-700,
	html.theme-dark .text-amber-800 { color: #f5d77a; }
	html.theme-dark .text-amber-900,
	html.theme-dark .text-yellow-900 { color: #fbe3a0; }
	html.theme-dark .text-amber-500,
	html.theme-dark .text-yellow-500 { color: #f5c451; }
	html.theme-dark .border-yellow-200,
	html.theme-dark .border-amber-200 { border-color: rgba(234, 179, 8, 0.4); }
	html.theme-dark .border-amber-300,
	html.theme-dark .border-yellow-300 { border-color: rgba(234, 179, 8, 0.6); }
	html.theme-dark .text-red-900 { color: #fbb4b4; }
	html.theme-dark .text-green-900,
	html.theme-dark .text-emerald-900 { color: #a7f3c4; }
	html.theme-dark .text-blue-900 { color: #bcd4ff; }

	/* Form fields (@tailwindcss/forms sets a white background) */
	html.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]):not([type="color"]),
	html.theme-dark select,
	html.theme-dark textarea {
		background-color: var(--dk-input);
		color: var(--dk-text);
		border-color: var(--dk-line-strong);
	}
	html.theme-dark input[type="checkbox"],
	html.theme-dark input[type="radio"] {
		background-color: var(--dk-input);
		border-color: var(--dk-line-strong);
	}
	html.theme-dark input[type="checkbox"]:checked,
	html.theme-dark input[type="radio"]:checked { background-color: var(--dk-brand); }
	html.theme-dark .focus\:border-indigo-500:focus { border-color: var(--dk-brand-text); }
	html.theme-dark .focus\:ring-indigo-500:focus { --tw-ring-color: var(--dk-brand); }

	/* Rich text (news, terms; partials/_prose-styles) */
	html.theme-dark .prose h1, html.theme-dark .prose h2, html.theme-dark .prose h3, html.theme-dark .prose h4,
	html.theme-dark .prose strong, html.theme-dark .prose b { color: var(--dk-text); }
	html.theme-dark .prose a { color: var(--dk-brand-text); }
	html.theme-dark .prose a:hover { color: #c9d0ff; }
	html.theme-dark .prose blockquote { color: var(--dk-text-2); border-left-color: var(--dk-line); }
	html.theme-dark .prose hr, html.theme-dark .prose th, html.theme-dark .prose td { border-color: var(--dk-line); }
	html.theme-dark .prose pre { background: var(--dk-surface-2); }

	/* Cookie banner (components/cookie-consent) has inline light styles */
	html.theme-dark #cookie-consent {
		background: var(--dk-surface) !important;
		border-top-color: var(--dk-line) !important;
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5) !important;
	}
	html.theme-dark #cookie-consent [style*="color:#374151"] { color: var(--dk-text-2) !important; }
	html.theme-dark #cookie-consent [style*="color:#6b7280"] { color: var(--dk-text-3) !important; }
	html.theme-dark #cookie-consent button[style*="background:#4f46e5"] { background: var(--dk-brand) !important; }
	html.theme-dark #cookie-consent button[style*="background:#fff"] {
		background: var(--dk-surface-2) !important;
		color: var(--dk-text) !important;
		border-color: var(--dk-line-strong) !important;
	}
	html.theme-dark #cookie-consent button[style*="color:#4338ca"] { color: var(--dk-brand-text) !important; }

	/* Archive search form (.sf-grid): its own styles set dark text with !important */
	html.theme-dark .sf-grid > div:not(.col-span-2) > label:first-child,
	html.theme-dark .sf-grid > div > div.flex > label,
	html.theme-dark .sf-grid label { color: var(--dk-text-2) !important; }
	html.theme-dark .sf-grid input[type=text],
	html.theme-dark .sf-grid select { color: var(--dk-text); }
	html.theme-dark .sf-grid input::placeholder { color: var(--dk-text-4); }

	/* Search results (.results-table-wrap): own styles with dark text and light header */
	html.theme-dark .results-table-wrap thead,
	html.theme-dark .results-table-wrap thead th,
	html.theme-dark .results-table-wrap.is-two-rows thead {
		background-color: var(--dk-surface-2) !important;
		color: var(--dk-text);
	}
	html.theme-dark .results-table-wrap tbody td,
	html.theme-dark .results-table-wrap.is-two-rows th,
	html.theme-dark .results-table-wrap.is-two-rows td.rl-stack,
	html.theme-dark .results-table-wrap.is-two-rows td.rl-single,
	html.theme-dark .results-table-wrap.is-two-rows td.rl-stack-name .rl-grp,
	html.theme-dark .results-table-wrap a.rl-sort { color: var(--dk-text); }
	html.theme-dark .results-table-wrap.is-two-rows th .rl-grp,
	html.theme-dark .results-table-wrap.is-two-rows td.rl-stack .rl-grp,
	html.theme-dark .results-table-wrap.is-two-rows td.rl-below,
	html.theme-dark .results-table-wrap.is-two-rows th.rl-below { color: var(--dk-text-2); }
	html.theme-dark .results-table-wrap.is-two-rows td.rl-stack-name .rl-grp { color: var(--dk-text); }
	html.theme-dark .results-table-wrap .rl-sort-ico { color: var(--dk-text-3); }
	html.theme-dark .results-table-wrap a.rl-sort.is-active,
	html.theme-dark .results-table-wrap a.rl-sort.is-active .rl-sort-ico { color: var(--dk-brand-text); }
	html.theme-dark .results-table-wrap a.rl-sort:hover,
	html.theme-dark .results-table-wrap a.rl-sort:focus-visible { background-color: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .results-table-wrap a.rl-sort:hover .rl-sort-ico { color: var(--dk-brand-text); }
	/* Sort and value tooltips: a raised surface instead of near-black on dark */
	html.theme-dark .results-table-wrap a.rl-sort[data-tip]:hover::after,
	html.theme-dark .results-table-wrap a.rl-sort[data-tip]:focus-visible::after,
	html.theme-dark .results-table-wrap .rl-val[data-tip]:hover::after {
		background: #2c3a4f;
		color: var(--dk-text);
		box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--dk-line-strong);
	}
	html.theme-dark .results-table-wrap a.rl-sort[data-tip]:hover::before,
	html.theme-dark .results-table-wrap a.rl-sort[data-tip]:focus-visible::before { border-bottom-color: #2c3a4f; }
	html.theme-dark .results-table-wrap .rl-val[data-tip]:hover::before { border-top-color: #2c3a4f; }
	html.theme-dark .results-table-wrap.is-two-rows tr { border-bottom-color: var(--dk-line); }
	/* Row under the pointer: the header colour, with a brand edge */
	html.theme-dark .results-table-wrap tbody tr:hover {
		background-color: var(--dk-header) !important;
		box-shadow: inset 4px 0 0 var(--dk-brand);
	}
	html.theme-dark .results-table-wrap tbody tr:hover td,
	html.theme-dark .results-table-wrap tbody tr:hover td .rl-grp { color: #fff !important; }
	html.theme-dark .rl-sortbar,
	html.theme-dark .results-table-wrap.is-two-rows.is-collapsible .rl-sortbar {
		background: var(--dk-surface-2) !important;
		border-bottom-color: var(--dk-line) !important;
	}
	html.theme-dark .rl-sortbar label { color: var(--dk-text); }
	html.theme-dark .rl-sortbar select {
		background-color: var(--dk-input);
		color: var(--dk-text);
		border-color: var(--dk-line-strong);
	}

	/* Result details, paging and buttons in the results list */
	html.theme-dark .rl-details dt,
	html.theme-dark .rp-ell { color: var(--dk-text-2); }
	html.theme-dark .rl-details dd,
	html.theme-dark .rp-info { color: var(--dk-text); }
	html.theme-dark .rl-details .rl-open { background: var(--dk-surface-2); color: var(--dk-brand-text) !important; }
	html.theme-dark .rl-details .rl-open:hover,
	html.theme-dark .rl-details .rl-open:focus-visible { background: var(--dk-brand); color: #fff !important; box-shadow: 0 0 0 3px var(--dk-brand-line); }
	html.theme-dark .rl-toggle-btn { background: var(--dk-surface-2); color: var(--dk-text-2); border-color: var(--dk-line-strong); }
	html.theme-dark .rl-toggle-btn:hover,
	html.theme-dark .rl-toggle-btn:focus-visible { background: var(--dk-brand-soft); color: var(--dk-brand-text); border-color: var(--dk-brand-line); }
	html.theme-dark .rl-search-btn:hover,
	html.theme-dark .rl-search-btn:focus-visible { background: var(--dk-brand-hover); box-shadow: 0 0 0 3px var(--dk-brand-line); }
	html.theme-dark .rp-btn { color: var(--dk-text); background: var(--dk-surface-2); border-color: var(--dk-line-strong); }
	html.theme-dark a.rp-btn:hover,
	html.theme-dark a.rp-btn:focus-visible,
	html.theme-dark .rp-btn.is-current { background: var(--dk-brand); border-color: var(--dk-brand); color: #fff; }

	/* Record page: actions menu, record navigation, field cells */
	html.theme-dark .ra-panel,
	html.theme-dark .rn-list { background: var(--dk-surface) !important; border-color: var(--dk-line) !important; }
	html.theme-dark .ra-item,
	html.theme-dark .rn-item,
	html.theme-dark .ra-crumb-current { color: var(--dk-text); }
	html.theme-dark .ra-item:hover,
	html.theme-dark .rn-item:hover { background: var(--dk-hover); }
	html.theme-dark .rn-item.is-on { color: var(--dk-brand-text); background: var(--dk-brand-soft); }
	html.theme-dark .rn-btn:hover { background: var(--dk-hover); }
	html.theme-dark .rn-toggle { background: var(--dk-brand); }
	html.theme-dark .record-cell > dd { color: var(--dk-text); }
	html.theme-dark .record-cell,
	html.theme-dark .record-cell + .record-cell,
	html.theme-dark .record-cell + .record-cell-empty { border-color: var(--dk-line) !important; }

	/* Search-in-all-archives autocomplete */
	html.theme-dark .global-ac-list { background: var(--dk-surface); border-color: var(--dk-line); }
	html.theme-dark .global-ac-option { color: var(--dk-text); }
	html.theme-dark .global-ac-option.is-active { background: var(--dk-brand); color: #fff; }
	html.theme-dark .global-ac-option + .global-ac-note { border-top-color: var(--dk-line); }

	/* Customer account page: sticky section menu has an inline white background */
	html.theme-dark #account-menu {
		background-color: rgba(24, 32, 41, 0.95) !important;
		border-color: var(--dk-line);
	}

	/* Account menu: zoom buttons and language list have light inline styles */
	html.theme-dark .menu-zoom-btn { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .menu-zoom-btn:hover { background: rgba(58, 110, 165, 0.35); }
	html.theme-dark .zoom-title { color: var(--dk-text-3); }
	html.theme-dark .lang-picker .lang-list { background: var(--dk-surface); }
	html.theme-dark .lang-picker .lang-list button,
	html.theme-dark .lang-inline button { color: var(--dk-text-2); }
	html.theme-dark .lang-picker .lang-list button:hover,
	html.theme-dark .lang-picker .lang-list button:focus,
	html.theme-dark .lang-inline button:hover { background: var(--dk-hover); }
	html.theme-dark .lang-picker .lang-list button[aria-current="true"],
	html.theme-dark .lang-inline button[aria-current="true"] {
		color: var(--dk-brand-text);
		background: var(--dk-brand-soft);
		border-color: var(--dk-brand-line);
	}
	html.theme-dark .lang-picker .lang-flag-code,
	html.theme-dark .lang-inline .lang-flag-code { background: var(--dk-hover); color: var(--dk-text-2); }
	html.theme-dark .lang-support { color: var(--dk-text-3); }

	/* Remaining indigo / purple classes -> the steel-blue accent */
	html.theme-dark .bg-indigo-400,
	html.theme-dark .bg-indigo-700,
	html.theme-dark .bg-indigo-800,
	html.theme-dark .group:hover .group-hover\:bg-indigo-400 { background-color: var(--dk-brand); }
	html.theme-dark .hover\:bg-indigo-50:hover,
	html.theme-dark .hover\:bg-indigo-200:hover,
	html.theme-dark .hover\:bg-indigo-50\/30:hover,
	html.theme-dark .bg-purple-50,
	html.theme-dark .bg-purple-100,
	html.theme-dark .file\:bg-indigo-50::file-selector-button,
	html.theme-dark .file\:bg-indigo-100::file-selector-button { background-color: var(--dk-brand-soft); }
	html.theme-dark .text-indigo-100,
	html.theme-dark .text-indigo-200,
	html.theme-dark .text-indigo-300,
	html.theme-dark .text-indigo-400,
	html.theme-dark .text-purple-600,
	html.theme-dark .text-purple-700,
	html.theme-dark .text-purple-800,
	html.theme-dark .hover\:text-indigo-500:hover,
	html.theme-dark .group:hover .group-hover\:text-indigo-500,
	html.theme-dark .file\:text-indigo-700::file-selector-button { color: var(--dk-brand-text); }
	html.theme-dark .border-indigo-100,
	html.theme-dark .border-indigo-300,
	html.theme-dark .border-indigo-400,
	html.theme-dark .hover\:border-indigo-300:hover,
	html.theme-dark .hover\:border-indigo-400:hover { border-color: var(--dk-brand-line); }
	html.theme-dark .border-indigo-600,
	html.theme-dark .border-indigo-700,
	html.theme-dark .hover\:border-indigo-700:hover { border-color: var(--dk-brand); }
	html.theme-dark .focus\:border-indigo-400:focus { border-color: var(--dk-brand-text); }
	html.theme-dark .focus\:ring-indigo-400:focus,
	html.theme-dark .focus-within\:ring-indigo-500:focus-within,
	html.theme-dark .hover\:ring-indigo-400:hover { --tw-ring-color: var(--dk-brand); }
	html.theme-dark .ring-indigo-100,
	html.theme-dark .ring-indigo-200 { --tw-ring-color: var(--dk-brand-soft); }
	html.theme-dark .accent-indigo-600 { accent-color: var(--dk-brand); }
	html.theme-dark .focus-visible\:outline-indigo-900:focus-visible { outline-color: var(--dk-brand-text); }

	/* Hard-coded purple in view styles (search results, record page, menus) */
	html.theme-dark .results-table-wrap a.rl-sort:focus-visible { box-shadow: 0 0 0 2px var(--dk-brand); }
	html.theme-dark .rl-sortbar select:focus { border-color: var(--dk-brand); box-shadow: 0 0 0 2px var(--dk-brand-soft); }
	html.theme-dark tr.is-open .rl-toggle-btn { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .results-table-wrap.is-two-rows.is-collapsible tbody tr.is-open { background-color: var(--dk-surface-2); }
	html.theme-dark .results-table-wrap.is-two-rows.is-collapsible tbody tr.is-open:hover { background-color: var(--dk-header); }
	html.theme-dark .results-table-wrap tbody tr:hover .rl-details .rl-open { background: var(--dk-brand); color: #fff !important; }
	html.theme-dark .results-table-wrap.is-two-rows.is-collapsible tr.is-open td.rl-details { border-top-color: var(--dk-line) !important; }
	html.theme-dark .rl-search-btn,
	html.theme-dark .rn-toggle,
	html.theme-dark .ra-toggle,
	html.theme-dark .nc-btn,
	html.theme-dark .global-ac-unexact { background: var(--dk-brand); border-color: var(--dk-brand); color: #fff; }
	html.theme-dark .ra-toggle:hover,
	html.theme-dark .nc-btn:hover,
	html.theme-dark .global-ac-unexact:hover,
	html.theme-dark .global-ac-unexact:focus { background: var(--dk-brand-hover); border-color: var(--dk-brand-hover); }
	html.theme-dark .rn-btn:focus-visible { outline-color: var(--dk-brand); }
	html.theme-dark .ra-item:focus-visible { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .ra-crumb-link,
	html.theme-dark .global-ac-exact,
	html.theme-dark .nc-link { color: var(--dk-brand-text); }
	html.theme-dark .nc-like:hover { border-color: var(--dk-brand-text); color: var(--dk-brand-text); }
	html.theme-dark .nc-replies { border-left-color: var(--dk-brand-soft); }
	html.theme-dark .nc-staff { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .nc-meta strong,
	html.theme-dark .nc-body { color: var(--dk-text); }
	html.theme-dark .hdr-zoom-panel { background: var(--dk-surface); color: var(--dk-text); }
	html.theme-dark .hdr-zoom-panel > button { background: var(--dk-brand-soft) !important; color: var(--dk-brand-text) !important; }
	html.theme-dark .zoom-lang { color: var(--dk-brand-text); border-top-color: var(--dk-line); }
	html.theme-dark button[style*="background:#4f46e5"] { background: var(--dk-brand) !important; }

	/* Help page */
	html.theme-dark .help-toc,
	html.theme-dark .help-section { background: var(--dk-surface); }
	html.theme-dark .help-toc a,
	html.theme-dark .help-crumbs { color: var(--dk-text-2); }
	html.theme-dark .help-main h1,
	html.theme-dark .help-section > h2 { color: var(--dk-text); }
	html.theme-dark .help-toc a:hover,
	html.theme-dark .help-toc a:focus,
	html.theme-dark .help-print:hover,
	html.theme-dark .help-print:focus { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .help-toc a.is-current { background: var(--dk-brand); color: #fff; }
	html.theme-dark .help-section:target { border-left-color: var(--dk-brand); }
	html.theme-dark .help-section > h2 i,
	html.theme-dark .help-crumbs a { color: var(--dk-brand-text); }
	html.theme-dark .help-example code,
	html.theme-dark .help-section code { background: var(--dk-brand-soft); color: var(--dk-brand-text); }
	html.theme-dark .help-contact { background: var(--dk-brand-soft); }
	html.theme-dark .help-print { background: var(--dk-surface-2); color: var(--dk-brand-text); border-color: var(--dk-brand-line); }
	html.theme-dark .help-example { background: var(--dk-surface-2); border-color: var(--dk-line); color: var(--dk-text-2); }
	html.theme-dark .help-tip { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: var(--dk-text-2); }
	html.theme-dark .help-lead { color: var(--dk-text-2); }
	html.theme-dark .help-toc h2,
	html.theme-dark .help-top,
	html.theme-dark .help-figure figcaption { color: var(--dk-text-3); }
	html.theme-dark .help-section details { border-top-color: var(--dk-line); }
	html.theme-dark .help-section details summary { color: var(--dk-text); }
	html.theme-dark .help-figure img { border-color: var(--dk-line); }

	/* Stripe card fields: Chrome paints an opaque box behind an iframe whose
	   colour scheme differs from the page's. Stripe's frames are light, so
	   the frame elements say light too and stay transparent. Their text
	   colour is set in JS (emiwebCardColors in partials/_theme-init). */
	html.theme-dark iframe[name^="__privateStripeFrame"],
	html.theme-dark iframe[src*="js.stripe.com"] { color-scheme: light; }

	/* Dialog backdrops: black, not a light grey veil over the dark page */
	html.theme-dark .fixed.inset-0.bg-gray-500,
	html.theme-dark .fixed.inset-0.bg-black.bg-opacity-25 { background-color: rgba(0, 0, 0, 0.7); }
	html.theme-dark .fixed.inset-0.bg-black\/40 { background-color: rgba(0, 0, 0, 0.7); }

	/* Shadows read as dark halos on dark surfaces */
	html.theme-dark .shadow, html.theme-dark .shadow-sm, html.theme-dark .shadow-md, html.theme-dark .shadow-lg {
		--tw-shadow-color: rgba(0, 0, 0, 0.5);
	}
}

/* Print is always light: the dark scheme set on <html> (inline, by
   partials/_theme-init) would otherwise turn the page margins black. */
@media print {
	:root,
	html.theme-dark {
		color-scheme: only light !important;
		background-color: #fff !important;
		color: #000 !important;
	}
	html.theme-dark body { background-color: #fff !important; }
}
