/*-----------------------------------------------------------------------------
 * Dark Mode - Sagentic Development Dashboard
 *
 * Activated per page with <html class="fixed sidebar-left-collapsed dark">.
 * Every rule in here is scoped to html.dark, so this file is safe to load on
 * light pages and pages can be flipped one at a time during the rollout.
 *
 * LOAD LAST. css/skins/default.css loads after custom.css and sets things like
 * `.pagination > li > a { color: #958671 }` at a specificity that beats a
 * Bootstrap variable - dark overrides have to come after it AND out-specify it.
 *
 * Why this file is needed at all: the vendor Bootstrap is 5.3.3, but Porto's
 * theme.css ships Bootstrap-4-era dark rules. Anything 5.3 drives off CSS
 * variables (tables, pagination, cards) has no dark treatment at all, and
 * 5.3's light-mode defaults show through.
 *---------------------------------------------------------------------------*/

/* Tables
 *---------------------------------------------------------------------------*/

/* theme.css only sets a background-color on the striped (odd) rows. BS 5.3
   paints EVERY cell with --bs-table-bg (which resolves to the light
   --bs-body-bg) and draws stripes with an inset box-shadow, so even rows came
   through white. Remap the 5.3 variables to the theme's dark palette. */
html.dark .table {
	--bs-table-color: #c9ced8;			/* the body step - a cell is body text */
	--bs-table-bg: transparent;			/* let .card-body (#2e353e) show through */
	--bs-table-border-color: #262b33;
	--bs-table-striped-color: #c9ced8;	/* a stripe changes the BACKGROUND, not the text */
	--bs-table-striped-bg: #282d36;		/* opaque so it covers theme.css's own stripe */
	--bs-table-active-color: #c9ced8;
	--bs-table-active-bg: #313841;
	--bs-table-hover-color: #c9ced8;
	--bs-table-hover-bg: #343c47;
}

/* theme.css hard-codes color:#808697 on cells (3.41:1 on #2e353e), which beats
   the --bs-table-color variable - match its selector to win.

   A cell IS body text, so it takes the body step. This is a DECLARATION on the
   cell, which is why lifting `html.dark body` alone left every table dim: a
   matching declaration always beats an inherited color. */
html.dark .table > thead > tr > th,
html.dark .table > tbody > tr > th,
html.dark .table > tfoot > tr > th,
html.dark .table > thead > tr > td,
html.dark .table > tbody > tr > td,
html.dark .table > tfoot > tr > td {
	color: #c9ced8;					/* 7.85:1 on the card, 8.76:1 on a stripe */
}

html.dark .table > thead > tr > th {
	color: #c3c9d4;
	border-bottom-color: #1d2127;
}

@media screen and (max-width: 991px) {
	html.dark .table-responsive {
		border-color: #262b33;
	}
}

/* Cards & form labels
 *---------------------------------------------------------------------------*/

/* BS 5.3 hard-sets `.card { color: var(--bs-body-color) }` (#212529), so any
   plain text inside a card - the "Show:" spinner label, for one - stayed dark */
html.dark .card {
	color: #c9ced8;					/* the body step - 7.85:1 on the card body */
}

/* Form field labels get their own color so a label reads as a label and not as
   content. Violet, specifically: it is the ONLY hue this dashboard hasn't already
   assigned a meaning to. Yellow was tried first and had to go - it sits 9° from
   warning (temp/dev), 12° from gold (internal links) and 1° from desert, so a
   real warning stopped standing out. The unused arc runs 216°->355°; violet is
   its middle.

   Dark only - #ad99e5 on white is 1.85:1, so this can't move to custom.css.

   .form-check-label is excluded on purpose: the words beside a radio or
   checkbox are the *option*, not the field's name. .visually-hidden labels are
   excluded so nothing changes for screen-reader-only text. .btn labels (the
   <input class="btn-check"> + <label class="btn"> toggle pattern) are buttons,
   not field names - without the exclusion this rule outranks every button
   color and a checked or hovered toggle shows purple text on a purple fill. */
html.dark .form-label,
html.dark legend,
html.dark .card label:not(.form-check-label):not(.visually-hidden):not(.btn),
html.dark .tab-pane label:not(.form-check-label):not(.visually-hidden):not(.btn) {
	color: var(--medium-purple-light);		/* #ad99e5 - 4.99:1 on the card, 5.57:1 in a tab */
}

html.dark .form-check-label {
	color: #c9ced8;
}

/* Pagination
 *---------------------------------------------------------------------------*/

/* Variables alone are NOT enough here: skins/default.css sets
   `.pagination > li > a { color: #958671 }` (0,1,2), which outranks
   `.page-link { color: var(--bs-pagination-color) }` (0,1,0) and loads later.
   The vars are kept for any pagination the selectors below miss. */
html.dark .pagination {
	--bs-pagination-color: #dee2e6;
	--bs-pagination-bg: #282d36;
	--bs-pagination-border-color: #242830;
	--bs-pagination-hover-color: #fff;
	--bs-pagination-hover-bg: #343c47;
	--bs-pagination-hover-border-color: #242830;
	--bs-pagination-focus-color: #fff;
	--bs-pagination-focus-bg: #343c47;
	--bs-pagination-focus-border-color: #242830;
	--bs-pagination-disabled-color: #6c727f;
	--bs-pagination-disabled-bg: #262b33;
	--bs-pagination-disabled-border-color: #242830;
}

/* (0,2,3) - beats the skin's (0,1,2) regardless of load order */
html.dark .pagination > li > a,
html.dark .pagination > li > span,
html.dark .pagination .page-link {
	color: #dee2e6;
	background-color: #282d36;
	border-color: #242830;
}

html.dark .pagination > li > a:hover,
html.dark .pagination > li > a:focus,
html.dark .pagination .page-link:hover,
html.dark .pagination .page-link:focus {
	color: #fff;
	background-color: #343c47;
	border-color: #242830;
}

/* active stays on the skin's tan - (0,3,3) so the rule above doesn't gray it */
html.dark .pagination > li.active > a,
html.dark .pagination > li.active > span,
html.dark .pagination .page-item.active .page-link {
	color: #fff;
	border-color: #958671;
}

/* theme.css sets background-color directly on .pagination > li.disabled > a,
   which outranks --bs-pagination-disabled-bg */
html.dark .pagination > li.disabled > a,
html.dark .pagination > li.disabled > span,
html.dark .pagination .page-item.disabled .page-link {
	color: #6c727f;
	background-color: #262b33;
	border-color: #242830;
}

/* Utility colors that die on a dark background
 *---------------------------------------------------------------------------*/

/* --blue is #012b5d: 1.13:1 against the dark card, i.e. effectively invisible.
   It's used 76 times across the dashboard - the "N Total Entries" line under
   every list (21 files), empty-state copy, icons - so remap the utility itself
   instead of touching that much markup. */
html.dark .text-blue,
html.dark .text-color-blue,
html.dark .heading-blue,
html.dark .lnk-blue {
	color: #fff !important;
}

html.dark .text-black,
html.dark .text-color-black,
html.dark .heading-black {
	color: #c9ced8 !important;
}

/* Palette families
 *---------------------------------------------------------------------------*/

/* Nothing here any more. The stat-tile tints that used to live in this block
   (peat -> #00b363 and friends) belonged to the pre-amethyst palette, and the
   markup no longer names those classes at all - it names the amethyst ones,
   which get their values from colors.css. See .guides/darkmode/README.md §5.6. */

/* Bootstrap grays
 *---------------------------------------------------------------------------*/

html.dark .text-dark,
html.dark .text-black {
	color: #c9ced8 !important;
}

html.dark .text-muted,
html.dark .text-secondary {
	color: #9aa1b0 !important;			/* BS #6c757d is 2.64:1 on the card */
}

/* .bg-light is used three ways: as UI chrome (card headers, panels), as a
   document surface (a rendered email, an XML dump), and as a DIVIDER inside a
   colored status card (`<hr class="my-1 bg-light">` on bg-blue/peat/red).
   Chrome goes dark; the other two are left alone - a preview should look like
   what it previews, and a divider on a colored panel still needs to be light. */
html.dark .bg-light:not(pre):not(hr):not(#preview_message) {
	background-color: #262b33 !important;
	border-color: #343c47 !important;
}

html.dark .bg-light:not(pre):not(hr):not(#preview_message),
html.dark .bg-light:not(pre):not(hr):not(#preview_message) .text-dark,
html.dark .bg-light.text-dark {
	color: #c9ced8 !important;
}

/* only the dividers on plain cards - the ones on colored status cards keep
   their light rule, where #3a424e would be invisible */
html.dark .card-body > hr.bg-light {
	background-color: #3a424e !important;
}

/* …but keep dark text where the surface really is light. status-info-bars.php
   switches to text-black exactly when the panel is bg-yellow (and the Temporary
   Domain alert is alert-yellow), so that pairing has to survive the text-black
   remap above. */
html.dark .alert-yellow.text-black,
html.dark .alert-yellow .text-black,
html.dark .bg-white .text-dark,
html.dark .bg-white.text-dark,
html.dark .bg-white .text-black,
html.dark .bg-white.text-black,
html.dark .bg-yellow .text-dark,
html.dark .bg-yellow.text-dark,
html.dark .bg-yellow .text-black,
html.dark .bg-yellow.text-black,
html.dark .bg-silver .text-black,
html.dark .bg-silver.text-black,
html.dark pre.bg-light,
html.dark pre.bg-light .text-dark,
html.dark #preview_message,
html.dark #preview_message .text-dark {
	color: #212529 !important;
}

/* Borders
 *---------------------------------------------------------------------------*/

/* BS 5.3 draws every plain `border` / `border-2` from these, and they're the
   light-mode grays. Redefining them on html.dark (0,1,1 beats :root's 0,1,0)
   catches every bordered panel at once. */
html.dark {
	--bs-border-color: #3a424e;
	--bs-border-color-translucent: rgba(255, 255, 255, 0.12);
}

/* .card itself is --bs-card-bg = --bs-body-bg = white; theme.css only darkens
   .card-body, so the white peeks out at the rounded corners */
html.dark .card {
	--bs-card-bg: transparent;
	--bs-card-border-color: #262b33;
}

/* .card-modern repaints itself white AFTER theme.css's dark rules and at higher
   specificity: `html.dark .card-body` is (0,2,1) at theme.css:7749, but
   `.card.card-modern .card-body` is (0,3,0) at :7970 and wins on both counts.
   The table inside is transparent, so its unstriped rows and its <thead> show
   the white through while the striped rows stay dark - which is exactly the
   half-converted table it looks like. Same for the header.

   Values are theme.css's own dark pair, so a card-modern matches a plain card.
   The literal 7px radii are here too: square-borders.css zeroes the Bootstrap
   radius VARIABLES, and these don't go through them. */
html.dark .card.card-modern .card-body {
	background: #2e353e;
}

html.dark .card.card-modern .card-header {
	background: #282d36;
}

html.dark .card.card-modern,
html.dark .card.card-modern .widget-user-info .widget-user-info-header,
html.dark .card.card-modern .widget-user-info .widget-user-info-body {
	border-radius: 0;
}

/* Dividers.
   A bare <hr> is a black gradient in theme.css - invisible on dark. The house
   divider is `<hr class="my-4 solid bg-light" />`, but note that `hr.solid` is
   `height: 0`, so .bg-light's BACKGROUND paints nothing: the visible line is
   the border-bottom. theme.css's dark override sets it to #4C4C4C, which is
   1.44:1 against the card - technically visible, practically not.
   Make the class mean what it reads as. */
html.dark hr.solid.bg-light {
	border-bottom-color: #565f6b;		/* 1.91:1 - a divider, not a rule */
}

/* Field helper text.
   Bootstrap's `.form-text` is `color: var(--bs-secondary-color)`, and that
   variable is `rgba(33, 37, 41, .75)` at :root - near-black. BS only swaps it
   under [data-bs-theme=dark], which this dashboard doesn't use (see the guide
   §1), so every hint under every form field has been dark-on-dark. 16 of them. */
html.dark .form-text {
	color: #9aa1b0;					/* 4.78:1 - a hint, quieter than the field */
}

/* Duotone icons inside a label.
   An <i class="fa-duotone"> with no color class inherits the label's purple,
   but FontAwesome renders the SECONDARY layer at --fa-secondary-opacity, which
   defaults to 0.4. On a light page that reads as a tint; on a dark one the
   40% layer sinks into the background and the icon looks black. */
html.dark .form-label .fa-duotone,
html.dark label .fa-duotone,
html.dark legend .fa-duotone {
	--fa-secondary-opacity: 0.75;
}

/* Rich text from the database.
   Round 73 swept every bare <hr> out of the PHP, but WYSIWYG content lives in
   the DB and none of that was reachable: 10 of 10 plugin descriptions, 16
   knowledge-base articles, 5 AI prompts and 2 accessibility guides all contain
   bare <hr> and bare <table>. Editing 33 records by hand would only hold until
   the next edit in the CMS, so these are handled in CSS instead.

   theme.css paints `hr` with a BLACK gradient, which is invisible on dark.
   Flip it to the same white gradient theme.css uses for `hr.light`. Rules that
   set border-bottom (hr.solid, hr.dotted) are unaffected - this only touches
   the gradient. */
html.dark hr {
	background-image: linear-gradient(to left, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

/* A WYSIWYG table has no .table class, so it gets no Bootstrap styling at all -
   no borders, no header emphasis. Give it enough to read on a dark surface
   without pretending to be a data table. */
html.dark .card table:not(.table),
html.dark .tab-pane table:not(.table),
html.dark .modal-body table:not(.table) {
	border-color: #3a424e;
}

html.dark .card table:not(.table) th,
html.dark .tab-pane table:not(.table) th,
html.dark .modal-body table:not(.table) th {
	color: var(--medium-purple-light);	/* 4.99:1 - same step as a field label */
	border-bottom: 1px solid #3a424e;
	padding: 0.4rem 0.5rem;
	text-align: left;
}

html.dark .card table:not(.table) td,
html.dark .tab-pane table:not(.table) td,
html.dark .modal-body table:not(.table) td {
	border-top: 1px solid #262b33;
	padding: 0.4rem 0.5rem;
}

/* …except an email in the notification preview, which is laid out with tables and
   must look the way a mail client shows it: no row rules, only its inline padding. */
html.dark #preview_message table th,
html.dark #preview_message table td {
	border-top: 0;
	border-bottom: 0;
	padding: 0;
	color: inherit;
}

/* Rich-text containers: pin the body step on the elements themselves.
   The cascade already resolves to #c9ced8 by inheritance from `html.dark .card`
   - but inheritance is fragile here: Bootstrap's `.card-body` carries
   `color: var(--bs-card-color)` with --bs-card-color EMPTY, and any component
   that later declares a color on a closer ancestor silently wins over the
   card. Declaring it on the text elements removes that whole class of
   surprise for WYSIWYG output, which is the content we can't edit.

   No !important, and classed elements are excluded, so `.content-lead`
   (purple) and semantic spans like `.text-success` keep their own color. */
html.dark .plugin-description,
html.dark .plugin-description p:not([class]),
html.dark .plugin-description li,
html.dark .plugin-description td,
html.dark .plugin-description dd,
html.dark .plugin-description strong:not([class]),
html.dark .plugin-description em:not([class]) {
	color: #c9ced8;
}

html.dark .plugin-description th {
	color: var(--medium-purple-light);
}

/* Form selects
 *---------------------------------------------------------------------------*/

/* theme.css dresses .form-control for dark but predates .form-select, so every
   select on the dashboard renders as a white pill. Matched to .form-control's
   dark treatment (#282d36 / #EEE), with the caret SVG restroked light - the
   stock one is #343a40 and disappears. */
html.dark .form-select {
	--bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
	background-color: #282d36;
	border-color: #282d36;
	color: #eee;
}

html.dark .form-select:focus {
	background-color: #282d36;
	border-color: #3a424e;
	color: #eee;
	box-shadow: none;
}

html.dark .form-select option {
	background-color: #282d36;
	color: #eee;
}

html.dark .form-select:disabled {
	background-color: #21262d;
	color: #808697;
}

/* List groups
 *---------------------------------------------------------------------------*/

html.dark .list-group {
	--bs-list-group-bg: transparent;
	--bs-list-group-color: #c9ced8;
	--bs-list-group-border-color: #3a424e;
	--bs-list-group-action-color: #c9ced8;
	--bs-list-group-action-hover-color: #dee2e6;
	--bs-list-group-action-hover-bg: #343c47;
	--bs-list-group-action-active-bg: #343c47;
	--bs-list-group-action-active-color: #dee2e6;
}

/* Tabs
 *---------------------------------------------------------------------------*/

/* custom.css styles the active tab for LIGHT mode - `background-color: #fff`
   with `border-bottom-color: #fff !important` - at (0,4,0), which outranks
   theme.css's dark rule `html.dark .nav-tabs li.active .nav-link` (0,2,3).
   That is why the initially-active tab renders white: on first paint `active`
   is on the <a> (server-rendered), so custom.css matches. Porto's tab JS then
   moves `active` onto the <li>, custom.css stops matching, and the tab
   suddenly looks right - hence "click away and back and it fixes itself".
   html.dark + these selectors = (0,5,0), which wins in both states. */
html.dark .tabs-primary .nav-tabs .nav-link.active,
html.dark .nav-tabs.tabs-primary .nav-link.active,
html.dark .tabs .nav-tabs li.active .nav-link {
	background-color: #21262d;			/* matches .tab-content */
	border-top-color: var(--medium-purple-light) !important;
	border-bottom-color: #21262d !important;
	color: var(--medium-purple-light) !important;
}

html.dark .tabs-primary .nav-tabs .nav-link,
html.dark .nav-tabs.tabs-primary .nav-link {
	color: #c9ced8 !important;			/* custom.css sets #333 !important */
	background-color: #282d36;
}

html.dark .tabs-primary .nav-tabs .nav-link:hover,
html.dark .nav-tabs.tabs-primary .nav-link:hover {
	color: #dee2e6 !important;
	background-color: #343c47;
	border-top-color: var(--medium-purple-light) !important;
}

/* Tab body copy. Content inside a tab pane (rich text from the DB, for one)
   has no color class and inherits the body color - the
   dim brown-gray the notes rendered in. Tab panes aren't cards, so the
   `html.dark .card` rule above never reached them. */
html.dark .tab-content,
html.dark .tab-pane {
	color: #c9ced8;
}

/* Paragraphs
 *---------------------------------------------------------------------------*/

/* theme.css sets `p { color: #444 }` as a bare element rule and ships NO dark
   override for it. A declaration that matches the element always beats a color
   inherited from an ancestor, no matter the specificity - so setting a color on
   .tab-pane / .card never reached the <p> inside it. This is why DB rich text
   (project_notes and friends) stayed near-black on every dark page. */
html.dark p {
	color: #c9ced8;
}

/* Body text.
   theme.css sets `html.dark body { color: #808697 }` - 4.45:1 against the page
   but only 3.41:1 on a card, and cards are where nearly all the text lives.
   The <p> rule above already lifts paragraphs to #c9ced8; everything else
   (<div>, <li>, <td>, bare <span>) was still on the dim gray, which is why a
   paragraph looked fine next to a list that didn't. Same specificity as
   theme.css's rule (0,1,2) - this file loads later, so it wins.

   text-muted / .form-text stay at #9aa1b0, so the quiet tier is still quieter. */
html.dark body {
	color: #c9ced8;					/* 10.24:1 on the page, 7.85:1 on a card */
}

/* Card subtitles. theme.css gives them the same #808697 as the old body
   default - 3.41:1 on a card. They should stay QUIETER than the title, so they
   take the muted step rather than the full body color. 30 of them, most in the
   tools section where every panel carries one. */
html.dark .card-subtitle {
	color: #9aa1b0;					/* 4.78:1 - a subtitle, not a heading */
}

/* alerts carry their own color scheme - let the paragraph follow it */
html.dark .alert p {
	color: inherit;
}

/* the deliberately-light surfaces (§8 of the dark-mode guide) */
html.dark .bg-white p,
html.dark #preview_message,
html.dark #preview_message p,
html.dark pre.bg-light p,
html.dark .bg-yellow p,
html.dark .bg-silver p {
	color: #212529;
}

/* Bootstrap semantic text colors
 *---------------------------------------------------------------------------*/

/* BS 5.3 ships its own dark-theme values for these under [data-bs-theme=dark],
   which we don't use (see the guide §1) - so borrow them. They're the vendor's
   own answer to "this hue, but on a dark surface", and they all clear 4.5:1.

   NOT remapped on purpose:
     .text-info    #0dcaf0 = 6.33:1 already, AND it is the click-to-copy signal
     .text-warning #ffc107 = 7.60:1 already
     .text-primary skins/default.css already forces #ad99e5 = 4.99:1 */
html.dark .text-success {
	color: #75b798 !important;			/* BS --bs-success-text-emphasis; was #198754, 2.73:1 */
}

html.dark .text-danger {
	color: #ea868f !important;			/* BS --bs-danger-text-emphasis; was #dc3545, 2.74:1 */
}

/* …but a semantic color sitting on its own alert keeps the alert's scheme */
html.dark .alert-success .text-success,
html.dark .alert-danger .text-danger,
html.dark .bg-white .text-success,
html.dark .bg-white .text-danger {
	color: inherit !important;
}

/* Links
 *---------------------------------------------------------------------------*/

/* skins/default.css uses Bootstrap's light link palette (#0d6efd / #0a58ca),
   which is 2.75:1 and 1.92:1 on the dark card. Swap in BS's OWN dark-theme
   pair - the values it ships under [data-bs-theme=dark].

   :not([class*="btn"]) is essential: an <a> styled as a button gets its color
   from btn-outline-*, and a bare `html.dark a` rule (which loads last) would
   repaint every button's text blue. Buttons are handled below. */
html.dark a:not([class*="btn"]) {
	color: var(--hyperlink-light);			/* #66a3ff - 4.87:1 */
}

html.dark a:not([class*="btn"]):hover,
html.dark a:not([class*="btn"]):focus {
	color: var(--hyperlink-light-hover);	/* #99c2ff - 6.79:1 */
}

html.dark a:not([class*="btn"]):active {
	color: #a5c8fe;
}

/* links that carry their own palette utility keep it - those are !important
   and already remapped in the utility sections above */

/* The ACCESSIBILITY icon color. --accessibility-blue-light #1a7fb3 is 2.79:1
   here, which fails even the 3:1 bar for a graphical object - on the one icon
   that flags a site as needing accessibility work. Same hue (200), same 75%
   saturation, lightness 40% -> 58%, so it still reads as the accessibility
   blue and stays distinct from the periwinkle hyperlink blue at hue 217. */
html.dark .text-accessibility-blue,
html.dark .text-color-accessibility-blue,
html.dark .heading-accessibility-blue,
html.dark .lnk-accessibility-blue,
html.dark .text-accessibility-blue-light,
html.dark .text-color-accessibility-blue-light,
html.dark .heading-accessibility-blue-light,
html.dark .lnk-accessibility-blue-light {
	color: #44ade4 !important;		/* 4.92:1 */
}

/* The hyperlink FUNCTION color (colors.css) - navigation buttons. Light-mode
   #0d6efd is 2.75:1 here, so the whole family moves to BS's dark-theme pair. */
html.dark .btn-outline-hyperlink,
html.dark .text-hyperlink,
html.dark .text-color-hyperlink,
html.dark .heading-hyperlink,
html.dark .lnk-hyperlink {
	color: var(--hyperlink-light) !important;	/* #66a3ff - 4.87:1 */
}

html.dark .btn-outline-hyperlink {
	border-color: var(--hyperlink-light);
}

html.dark .btn-outline-hyperlink:hover,
html.dark .btn-outline-hyperlink.hover {
	background-color: var(--hyperlink-light);
	border-color: var(--hyperlink-light);
	color: #1d2127 !important;		/* 4.87:1 the other way round */
}

html.dark .btn-hyperlink {
	background-color: var(--hyperlink-light);
	border-color: var(--hyperlink-light);
	color: #1d2127;
}

html.dark .btn-hyperlink:hover,
html.dark .btn-hyperlink.hover {
	background-color: var(--hyperlink-light-hover);
	border-color: var(--hyperlink-light-hover);
	color: #1d2127;
}

html.dark .btn-link {
	color: var(--hyperlink-light);
}

html.dark .border-hyperlink {
	border-color: var(--hyperlink-light) !important;
}

html.dark .card-featured-hyperlink,
html.dark .card-featured-hyperlink .card-title {
	border-color: var(--hyperlink-light);
	color: var(--hyperlink-light);
}

/* THE EARTH TONES, RETIRED
 *---------------------------------------------------------------------------*/

/* The remap that used to live here is gone: the markup now names the amethyst
   classes directly (943 references migrated), so there is nothing left to
   translate. The palette rationale is in .guides/darkmode/README.md §5.6.

   If an earth-tone class ever reappears - an old page, a plugin, a paste from
   the archive - it will render in its original USMC color, which is the honest
   outcome: it's a class that no longer belongs to this theme. */

/* Amethyst accents — card titles, tab edges, bar text
 *---------------------------------------------------------------------------*/

/* The card title now matches its own accent border. plum-light itself is
   3.50:1 on the card header, which passes only as large text; plum-light-hover
   is the same hue at 4.74:1 and reads as the same color next to the border,
   so the title takes that step and the border keeps plum-light.
   !important is needed because the markup carries .text-white (§5.3). */
html.dark .card-featured .card-title,
html.dark .card-header .card-title {
	color: var(--cyber-grape-light-hover) !important;		/* 3.77:1 - UI/graphical, over the 3:1 bar */
}

/* Tabs: the active tab's top edge and label pick up the same accent, so the
   open tab reads as part of the panel below it. Overrides the skin's tan. */
html.dark .tabs-primary .nav-tabs .nav-link.active,
html.dark .nav-tabs.tabs-primary .nav-link.active,
html.dark .tabs .nav-tabs li.active .nav-link {
	border-top-color: var(--cyber-grape-light-hover) !important;
	color: var(--cyber-grape-light-hover) !important;
}

html.dark .tabs-primary .nav-tabs .nav-link:hover,
html.dark .nav-tabs.tabs-primary .nav-link:hover {
	border-top-color: var(--cyber-grape-light-hover) !important;
}

/* Section bars: amethyst instead of flat white. The bar background is #212529,
   so this is 8.36:1 - brighter than it looks, and it stops every bar on the
   page reading as pure white. Badges and buttons sitting on the bar keep their
   own colors (they set them at a higher specificity). */
html.dark .bg-dark.text-white,
html.dark .bg-dark.text-white .alt-font4,
html.dark .modal-header.bg-dark.text-white {
	color: var(--medium-purple-light) !important;		/* 6.22:1 on the #212529 bar */
}

/* the edit pencil and other icons on a bar keep the softer tint rather than
   competing with the title */
html.dark .bg-dark.text-white .fa-duotone,
html.dark .bg-dark.text-white .fa-solid,
html.dark .bg-dark.text-white .fa-brands {
	color: var(--cyber-grape-light-hover);
}

/* Key labels that aren't <label> elements
 *---------------------------------------------------------------------------*/

/* The dashboard writes field labels three ways. <label> is handled above; these
   two are the same thing wearing different tags, so they take the same color:

     <strong class="text-uppercase">Period:</strong>          inline key/value
     <span class="title font-weight-bold text-uppercase">     list-item key

   text-blue on the .title spans is !important (colors.css), hence !important
   here - those 19 spans are stripped in markup as pages convert. */
html.dark .card strong.text-uppercase,
html.dark .tab-pane strong.text-uppercase,
html.dark .card .title.text-uppercase,
html.dark .tab-pane .title.text-uppercase,
html.dark .simple-user-list .title,
html.dark .simple-card-list .title {
	color: var(--medium-purple-light) !important;		/* 4.99:1 */
}

/* an alert or a colored panel owns its own scheme - a key inside one follows
   the panel, not the label rule */
html.dark .alert strong.text-uppercase,
html.dark .alert .title.text-uppercase,
html.dark [class*="bg-"] .title.text-uppercase {
	color: inherit !important;
}

/* Two utilities the earth-tone sweep couldn't see by name
 *---------------------------------------------------------------------------*/

/* skins/default.css defines `.bg-secondary` as a PALETTE color (it was clay
   #9d7947, now the amethyst #a855c7). Either way the class name says gray and
   the paint says otherwise, so a `badge bg-secondary` reads as a status chip
   rather than the neutral it claims to be. Pin it to the neutral house purple. */
html.dark .bg-secondary,
html.dark .background-color-secondary {
	background-color: var(--cyber-grape) !important;
	color: #fff !important;							/* 9.67:1 */
}

/* .bg-warning / .bg-info are LIGHT surfaces (#ffc107 is 1.63:1 against white,
   #0dcaf0 is 1.96:1). Their markup already says text-dark - but the dark-mode
   remap turns .text-dark into #c9ced8 !important, which wiped it out. Put the
   dark text back wherever the surface underneath is genuinely light. */
html.dark .bg-warning,
html.dark .bg-warning.text-dark,
html.dark .bg-warning .text-dark,
html.dark .bg-warning .text-black,
html.dark .bg-info,
html.dark .bg-info.text-dark,
html.dark .bg-info .text-dark,
html.dark .badge.bg-warning,
html.dark .badge.bg-info {
	color: #212529 !important;						/* 11.0:1 on #ffc107 */
}

/* Bootstrap table row variants
 *---------------------------------------------------------------------------*/

/* .table-secondary and friends set the whole --bs-table-* block to LIGHT values
   (secondary is #e2e3e5 with #000 text), which is how the weekend rows on the
   intake Hours tab ended up as two white bands in a dark table. Remap each
   variant to a tint of the surface it sits on, keeping the row's own striping. */
/* A neutral gray tint can't do this job in a dark table - #343c47 against the
   #2e353e row is 1.11:1, i.e. invisible. The highlight leans on HUE instead:
   plum reads as a different row immediately, and it ties the highlight to the
   palette rather than looking like a rendering artefact. */
html.dark .table-secondary {
	--bs-table-color: #dee2e6;
	--bs-table-bg: var(--cyber-grape);						/* #4a3d6b - text 7.43:1 */
	--bs-table-border-color: #5a4c80;
	--bs-table-striped-color: #dee2e6;
	--bs-table-striped-bg: #514476;
	--bs-table-active-color: #fff;
	--bs-table-active-bg: #574a7d;
	--bs-table-hover-color: #fff;
	--bs-table-hover-bg: #574a7d;
	color: var(--bs-table-color);
}

/* the semantic variants keep their meaning, just at dark-surface weight */
html.dark .table-warning {
	--bs-table-color: #ffda6a;
	--bs-table-bg: #3a3323;
	--bs-table-border-color: #4a4130;
	--bs-table-striped-color: #ffda6a;
	--bs-table-striped-bg: #403828;
	--bs-table-hover-color: #ffe08a;
	--bs-table-hover-bg: #453c2b;
	color: var(--bs-table-color);
}

html.dark .table-danger {
	--bs-table-color: #ea868f;
	--bs-table-bg: #3b2a2d;
	--bs-table-border-color: #4b3639;
	--bs-table-striped-color: #ea868f;
	--bs-table-striped-bg: #412f32;
	--bs-table-hover-color: #f0a3aa;
	--bs-table-hover-bg: #463336;
	color: var(--bs-table-color);
}

html.dark .table-success {
	--bs-table-color: #75b798;
	--bs-table-bg: #24352c;
	--bs-table-border-color: #2f4439;
	--bs-table-striped-color: #75b798;
	--bs-table-striped-bg: #283b31;
	--bs-table-hover-color: #90c9ac;
	--bs-table-hover-bg: #2c4035;
	color: var(--bs-table-color);
}

html.dark .table-info {
	--bs-table-color: #6edff6;
	--bs-table-bg: #1e3438;
	--bs-table-border-color: #2a4449;
	--bs-table-striped-color: #6edff6;
	--bs-table-striped-bg: #22393e;
	--bs-table-hover-color: #8ee7f8;
	--bs-table-hover-bg: #263f44;
	color: var(--bs-table-color);
}

/* Table header labels
 *---------------------------------------------------------------------------*/

/* .table-label (custom.css) uses --amethyst, which is 2.83:1 on a dark table row.
   The -light step is 4.86:1 and reads as the same color. The rule has to beat
   theme.css's `html.dark .table > thead > tr > th { color: #808697 }`, hence
   the matching selector shape. */
html.dark .table > thead > tr > th.table-label,
html.dark .table-label {
	color: var(--amethyst-light);
}

/* Status-card values
 *---------------------------------------------------------------------------*/

/* theme.css fades every value in a status card: `ul.simple-card-list li p
   { opacity: .7 }`. On a light page that reads as a soft secondary line; on a
   colored card in dark mode it just makes the value hard to read - a tracking
   ID at .7 over plum is 5.47:1 where the same text at full strength is 9.18:1.
   The hierarchy is already carried by size and by text-light vs the white
   heading, so the fade isn't doing any work here. */
html.dark ul.simple-card-list li p,
html.dark div.simple-card-list .card p {
	opacity: 1;
}
