/* ─────────────────────────────────────────────────────────────
   public/css/ui-new.css — the back office's "New look" (Nov 2026).

   Loaded by layouts/admin.ejs only when res.locals.uiNew is true
   (services/uiLook.service.js), and every rule is scoped under
   body.ui-new, so the classic look is untouched.

   The rules:
   • A light grey canvas with white panels; thin borders, no drop shadows.
   • One accent: the agency's own colour (--brand-primary for fills,
     --brand-ink for words and lines on white) — only on the active menu
     item, the main button, links, focus rings and switches. Everything
     else is near-black or grey.
   • A few text sizes in sentence case; numbers line up (tabular figures).
   • Status labels are soft tints with dark text.
   Every text colour here reads at ≥ 4.5:1 on the surface it sits on
   (--ui-text-3 #626a77 is 5.4:1 on white, 5.0:1 on the canvas and 4.9:1 on #f3f4f6).
   ───────────────────────────────────────────────────────────── */

body.ui-new {
  --ui-canvas: #f6f7f9;
  --ui-surface: #ffffff;
  --ui-raised: #f9fafb;
  --ui-border: #e5e7eb;
  --ui-border-soft: #eef0f3;
  --ui-text: #111827;
  --ui-text-2: #374151;
  --ui-text-3: #626a77;
  --ui-radius: 12px;
  --ui-accent: var(--brand-ink);
  --ui-accent-fill: var(--brand-primary);
  --ui-accent-on: var(--brand-on-primary);
  --ui-accent-soft: color-mix(in srgb, var(--brand-primary) 7%, #ffffff);
  --ui-ring: color-mix(in srgb, var(--brand-ink) 22%, transparent);

  background: var(--ui-canvas);
  color: var(--ui-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) { background: var(--ui-canvas); }

/* ── Sidebar: light, sentence case, the agency colour on the active item ── */
body.ui-new .admin-sidebar {
  background: var(--ui-surface);
  border-right: 1px solid var(--ui-border);
  /* the sidebar's own text tokens, so every existing rule reads on white */
  --brand-on-secondary: #111827;
  --brand-on-secondary-muted: #4b5563;
  --brand-on-secondary-rgb: 17, 24, 39;
  --brand-accent-on-secondary: var(--brand-ink);
  --brand-secondary-tint: var(--ui-accent-soft);
  color: var(--ui-text);
}
body.ui-new .admin-sidebar .brand { border-bottom: 1px solid var(--ui-border-soft); }
body.ui-new .admin-sidebar .nav-link {
  border-left: 0; margin: 1px 10px; padding: 7px 10px; border-radius: 8px;
  font-size: .875rem; color: var(--ui-text-2);
}
body.ui-new .admin-sidebar .nav-link i { color: var(--ui-text-3); }
body.ui-new .admin-sidebar .nav-link:hover { background: var(--ui-raised); color: var(--ui-text); border-left: 0; }
body.ui-new .admin-sidebar .nav-link.active {
  background: var(--ui-accent-soft); color: var(--brand-ink); font-weight: 600; border-left: 0;
}
body.ui-new .admin-sidebar .nav-link.active i { color: var(--brand-ink); }
body.ui-new .admin-sidebar .nav-group-toggle {
  text-transform: none; letter-spacing: 0; font-size: .78rem; font-weight: 600;
  color: var(--ui-text-3); padding: 14px 20px 4px;
}
body.ui-new .admin-sidebar .nav-group-toggle:hover { color: var(--ui-text); }
body.ui-new .admin-sidebar .nav-section { text-transform: none; letter-spacing: 0; font-size: .75rem; color: var(--ui-text-3); }
body.ui-new .admin-sidebar .nav-link .nav-badge,
body.ui-new .admin-sidebar .nav-group-toggle .grp-badge {
  background: #eef0f3; color: var(--ui-text-2); font-weight: 600;
}
body.ui-new .admin-sidebar .bottom-links { border-top: 1px solid var(--ui-border-soft); }
body.ui-new .admin-sidebar .bottom-links .nav-link { margin: 0; padding: 6px 0; }
body.ui-new .admin-sidebar .nav-divider { background: var(--ui-border-soft); }

/* ── Top bar ── */
body.ui-new .admin-topbar {
  background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); box-shadow: none;
}
body.ui-new .admin-topbar h6 { font-weight: 600; color: var(--ui-text); }
body.ui-new .rx-attn-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ui-border);
  background: var(--ui-surface); color: var(--ui-text-2); border-radius: 999px;
  font-size: .8rem; font-weight: 500; padding: 4px 10px; line-height: 1.4;
}
body.ui-new .rx-attn-btn:hover { background: var(--ui-raised); color: var(--ui-text); }
body.ui-new .rx-attn-btn .rx-attn-count {
  background: #b42318; color: #ffffff; border-radius: 999px; font-size: .7rem; font-weight: 600; padding: 0 6px;
}
body.ui-new .rx-attn-menu .dropdown-item { display: flex; justify-content: space-between; gap: 16px; font-size: .85rem; padding: .5rem .9rem; }
body.ui-new .rx-attn-menu .dropdown-item .rx-attn-n { font-weight: 600; color: var(--ui-text); font-variant-numeric: tabular-nums; }

/* ── Panels ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card.border-0 {
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius);
  box-shadow: none !important;
  background: var(--ui-surface);
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .shadow-sm,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .shadow { box-shadow: none !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card-header,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card-footer {
  background: transparent; border-color: var(--ui-border-soft);
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card {
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: none; padding: 18px 20px;
}
/* coloured stripes, coloured figures and coloured icons read as noise; the label says what it is
   (a red figure — overdue, waiting — keeps its red) */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card[class*="border"] { border: 1px solid var(--ui-border) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) a:hover > .stat-card,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card:hover { border-color: #d1d5db !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card .bi { color: var(--ui-text-3) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .rx-section-label { font-size: .8rem !important; font-weight: 600 !important; color: var(--ui-text-2) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card :is(h2, h3, h4, h5, .fw-bold):is(.text-warning, .text-info, .text-success, .text-primary) { color: var(--ui-text) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card .icon { background: var(--ui-raised) !important; color: var(--ui-text-3) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .stat-card .icon i { color: var(--ui-text-3) !important; }

/* ── Text ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(h1, h2, h3, h4, h5, h6) { color: var(--ui-text); letter-spacing: -0.01em; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card :is(h5, h6).fw-bold { font-weight: 600 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .card h5 { font-size: 1.05rem; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(h4, h5, h6) > i.bi:first-child { color: var(--ui-text-3) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-muted,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-secondary { color: var(--ui-text-3) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-uppercase,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) [style*="text-transform:uppercase"],
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) [style*="text-transform: uppercase"] { text-transform: none !important; letter-spacing: normal !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(td, .stat-card, .fw-bold) { font-variant-numeric: tabular-nums; }
/* links in the agency's colour (not buttons, tabs, menu rows or links that set their own colour) */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) a:not(.btn):not(.nav-link):not(.dropdown-item):not(.badge):not(.list-group-item):not(.page-link):not(.rx-shortcut):not(.stretched-link):not([class*="chip"]):not([class*="pill"]):not([class*="tag"]):not(:is(.text-muted, .text-dark, .text-body, .text-white, .text-secondary, .text-danger, .text-success, .text-warning, .text-info, .text-primary, .text-reset, .text-brand)),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-link { color: var(--brand-ink); }

/* ── Buttons: the agency colour for the main action only ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn { border-radius: 8px; font-weight: 500; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn.fw-bold { font-weight: 600 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.btn-warning, .btn-primary, .btn-success) {
  --bs-btn-bg: var(--ui-accent-fill); --bs-btn-border-color: var(--ui-accent-fill); --bs-btn-color: var(--ui-accent-on);
  --bs-btn-hover-bg: var(--ui-accent-fill); --bs-btn-hover-border-color: var(--ui-accent-fill); --bs-btn-hover-color: var(--ui-accent-on);
  --bs-btn-active-bg: var(--ui-accent-fill); --bs-btn-active-border-color: var(--ui-accent-fill); --bs-btn-active-color: var(--ui-accent-on);
  --bs-btn-disabled-bg: var(--ui-accent-fill); --bs-btn-disabled-border-color: var(--ui-accent-fill); --bs-btn-disabled-color: var(--ui-accent-on);
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.btn-warning, .btn-primary, .btn-success):hover { filter: brightness(.94); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.btn-outline-warning, .btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-info, .btn-outline-dark, .btn-light) {
  --bs-btn-bg: var(--ui-surface); --bs-btn-color: var(--ui-text); --bs-btn-border-color: var(--ui-border);
  --bs-btn-hover-bg: var(--ui-raised); --bs-btn-hover-color: var(--ui-text); --bs-btn-hover-border-color: #d1d5db;
  --bs-btn-active-bg: #f3f4f6; --bs-btn-active-color: var(--ui-text); --bs-btn-active-border-color: #d1d5db;
  --bs-btn-disabled-color: var(--ui-text-3); --bs-btn-disabled-border-color: var(--ui-border);
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-outline-danger { --bs-btn-border-color: var(--ui-border); --bs-btn-bg: var(--ui-surface); }

/* ── Status labels: soft tints, dark words (counters on icons stay solid) ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge:not(.position-absolute) { font-weight: 500; letter-spacing: 0; border-radius: 6px; padding: .3em .55em; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-success:not(.position-absolute)   { background: #e7f6ec !important; color: #166534 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-warning:not(.position-absolute)   { background: #fef6e0 !important; color: #854d0e !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-danger:not(.position-absolute)    { background: #fdecec !important; color: #991b1b !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-info:not(.position-absolute)      { background: #e6f4fb !important; color: #075985 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-primary:not(.position-absolute)   { background: #e9effd !important; color: #1e3a8a !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge:is(.bg-secondary, .bg-dark, .bg-light):not(.position-absolute) { background: #f1f2f4 !important; color: var(--ui-text-2) !important; }

/* ── Tables ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table {
  --bs-table-bg: transparent; --bs-table-striped-bg: var(--ui-raised); --bs-table-hover-bg: var(--ui-raised);
  --bs-table-border-color: var(--ui-border-soft); color: var(--ui-text); font-size: .875rem;
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > thead > tr > th,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > thead.table-light > tr > th,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table-light > tr > th {
  background: transparent !important; color: var(--ui-text-3); font-weight: 500; font-size: .8rem;
  text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--ui-border); white-space: nowrap;
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr > td { padding-top: .75rem; padding-bottom: .75rem; vertical-align: middle; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table-sm > tbody > tr > td { padding-top: .55rem; padding-bottom: .55rem; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr:last-child > td { border-bottom: 0; }

/* ── Forms ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.form-control, .form-select) { border-color: #d6d9de; border-radius: 8px; color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.form-control, .form-select):focus { border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--ui-ring); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-label { font-weight: 500 !important; color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-text { color: var(--ui-text-3); font-size: .78rem !important; line-height: 1.45; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-check-input:checked { background-color: var(--brand-ink); border-color: var(--brand-ink); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-check-input:focus { box-shadow: 0 0 0 3px var(--ui-ring); border-color: var(--brand-ink); }
/* long explanations under a field: two lines, then "More" (layouts/admin.ejs adds the button) */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-text.rx-clamp:not(.rx-open) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .rx-more { background: none; border: 0; padding: 0; font-size: .76rem; font-weight: 500; color: var(--brand-ink); }

/* ── Tabs, pills, menus, alerts ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav-tabs { border-bottom: 1px solid var(--ui-border); gap: 1.25rem; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .6rem .1rem; color: var(--ui-text-2); background: transparent;
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav-tabs .nav-link:hover { color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav-tabs .nav-link.active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav-pills .nav-link.active { background: var(--ui-accent-soft); color: var(--brand-ink); }
body.ui-new .dropdown-menu { border: 1px solid var(--ui-border) !important; border-radius: 10px; box-shadow: 0 8px 24px rgba(17, 24, 39, .08) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert { border-radius: 10px; border: 1px solid rgba(17, 24, 39, .06); }
/* lighter tints than Bootstrap's, dark words (all ≥ 7:1) */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-info    { background: #f1f7fb; border-color: #d9e9f3; color: #0c4a6e; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-warning { background: #fffaeb; border-color: #f6e3b0; color: #713f12; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-success { background: #f0faf3; border-color: #cdebd7; color: #14532d; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-danger  { background: #fef3f2; border-color: #f7d4d0; color: #7f1d1d; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-secondary,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .alert-light   { background: var(--ui-raised); border-color: var(--ui-border); color: var(--ui-text-2); }
/* the Settings jump bar sits on the canvas */
body.ui-new .rx-settings-nav { background: var(--ui-canvas) !important; }
body.ui-new .rx-settings-nav .nav-link { color: var(--ui-text-2) !important; }
body.ui-new .rx-settings-nav .nav-link:hover { background: var(--ui-surface) !important; color: var(--ui-text) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .pagination { --bs-pagination-color: var(--ui-text-2); --bs-pagination-active-bg: var(--brand-ink); --bs-pagination-active-border-color: var(--brand-ink); --bs-pagination-border-color: var(--ui-border); --bs-pagination-border-radius: 8px; }

/* ── The page head: title left, one main action right ── */
body.ui-new .rx-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
body.ui-new .rx-page-head h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
body.ui-new .rx-page-head p { color: var(--ui-text-3); margin: .25rem 0 0; font-size: .875rem; }

/* ── Lists ── */
/* an amount is a figure, not a warning */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .rx-amount { color: var(--ui-text) !important; font-weight: 600 !important; }
/* the dark table head (a dozen lists) becomes the quiet one */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > thead.table-dark { --bs-table-bg: transparent; --bs-table-color: var(--ui-text-3); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > thead > tr > th { vertical-align: middle; padding-top: .7rem; padding-bottom: .7rem; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .badge.bg-light.border { border-color: var(--ui-border) !important; }

/* ── Readable colour words on white (Bootstrap's yellow and cyan text read at 1.6–2:1) ── */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-warning { color: #a15c07 !important; }   /* 4.9:1 on white */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-info    { color: #0e7490 !important; }   /* 5.4:1 */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-success { color: #146c35 !important; }   /* 6.2:1 */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-danger  { color: #b42318 !important; }   /* 6.2:1 */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .text-primary { color: #1d4ed8 !important; }   /* 6.7:1 */
/* on Bootstrap's "-subtle" fills the darker "-emphasis" shade */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.bg-warning-subtle, .alert-warning) :is(.text-warning),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-warning-subtle.text-warning { color: #664d03 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.bg-info-subtle) .text-info,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-info-subtle.text-info { color: #055160 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-success-subtle.text-success,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-success-subtle .text-success { color: #0a3622 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-danger-subtle.text-danger,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-danger-subtle .text-danger { color: #58151c !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-primary-subtle.text-primary,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-primary-subtle .text-primary { color: #052c65 !important; }
/* pale greys typed into pages */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is([style*="color:#aaa"], [style*="color: #aaa"], [style*="color:#999"], [style*="color: #999"], [style*="color:#adb5bd"]),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.fee-default, .fee-desc, .currency-prefix, .percent-suffix) { color: var(--ui-text-3) !important; }
/* on a photo's dark caption band the bright shade stays */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is([style*="background: rgba(0,0,0"], [style*="background:rgba(0,0,0"], .bg-dark) .text-warning { color: #ffd75e !important; }

/* ── List pages (stage 2) ── */
/* A filter or search form (GET) is not the page's main action: its button is the plain one. */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) form:not([method="post" i]) :is(.btn-warning, .btn-primary, .btn-success, .btn-dark, .btn-info),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-dark {
  --bs-btn-bg: var(--ui-surface); --bs-btn-color: var(--ui-text); --bs-btn-border-color: #d1d5db;
  --bs-btn-hover-bg: var(--ui-raised); --bs-btn-hover-color: var(--ui-text); --bs-btn-hover-border-color: #c4c8cf;
  --bs-btn-active-bg: #f3f4f6; --bs-btn-active-color: var(--ui-text); --bs-btn-active-border-color: #c4c8cf;
  --bs-btn-disabled-bg: var(--ui-surface); --bs-btn-disabled-color: var(--ui-text-3); --bs-btn-disabled-border-color: var(--ui-border);
  filter: none;
}
/* rows flagged overdue / waiting: a quiet tint and a marker on the first cell, not a block of colour */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-danger  { --bs-table-bg: #fff7f7; --bs-table-color: var(--ui-text); --bs-table-hover-bg: #fdeeee; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-warning { --bs-table-bg: #fffcf2; --bs-table-color: var(--ui-text); --bs-table-hover-bg: #fdf6e3; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-info    { --bs-table-bg: #f5fafd; --bs-table-color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-success { --bs-table-bg: #f5fbf7; --bs-table-color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-danger  > :first-child { box-shadow: inset 3px 0 0 #d92d20; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .table > tbody > tr.table-warning > :first-child { box-shadow: inset 3px 0 0 #dc9a0b; }
/* one size of page title */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(h2, h3, h4).fw-bold { font-weight: 600 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) h3.fw-bold, body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) h4.fw-bold { font-size: 1.4rem; }
/* the list toolbar ("With selected", "Download") and the pager stay small and grey */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .rx-list-toolbar .btn,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .list-toolbar .btn { font-size: .8rem; }
/* empty states: one quiet line */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) td.text-center.text-muted { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
/* the theme bridge (config/themes.js) paints .btn-warning / .btn-outline-warning with !important —
   the plain buttons above must win over it too */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) form:not([method="post" i]) :is(.btn-warning, .btn-primary, .btn-success, .btn-dark, .btn-info),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) form:not([method="post" i]) :is(.btn-warning, .btn-primary, .btn-success, .btn-dark, .btn-info):is(:hover, :focus, :active),
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-dark,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-outline-warning,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-outline-warning:is(:hover, :focus, :active) {
  background-color: var(--ui-surface) !important; border-color: #d1d5db !important; color: var(--ui-text) !important; filter: none !important;
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) form:not([method="post" i]) :is(.btn-warning, .btn-primary, .btn-success, .btn-dark, .btn-info):hover,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-dark:hover,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-outline-warning:hover { background-color: var(--ui-raised) !important; }
/* more pale words found on the list pages */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-secondary-subtle.text-secondary,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .bg-secondary-subtle .text-secondary { color: #2b2f32 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(.msg-conv-time, .msg-time, .cnum, .ghint) { color: var(--ui-text-3) !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .gchip { color: #7a4d00 !important; }

/* ── Detail pages (stage 3) ── */
/* cyan buttons ("Request revision", "Resend") read as a second main action — plain instead */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-info,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-info:is(:hover, :focus, :active) {
  background-color: var(--ui-surface) !important; border-color: #d1d5db !important; color: var(--ui-text) !important;
}
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-info:hover { background-color: var(--ui-raised) !important; }
/* label/value pairs in detail cards: quiet label, clear value */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) dl dt,
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .detail-label { color: var(--ui-text-3); font-weight: 500; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) code { color: #a1265f; }   /* 6.4:1 on the canvas */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-secondary { background-color: #4b5563 !important; border-color: #4b5563 !important; color: #ffffff !important; }   /* 7.6:1 */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-secondary:hover { background-color: #374151 !important; border-color: #374151 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-secondary:disabled { opacity: 1; }   /* the current pipeline stage is shown as a disabled button: keep it readable */

/* ── Forms and pop-up forms (stage 4) ── */
body.ui-new .modal-content { border: 1px solid var(--ui-border); border-radius: 14px; box-shadow: 0 20px 48px rgba(17, 24, 39, .14); }
body.ui-new .modal-header, body.ui-new .modal-footer { border-color: var(--ui-border-soft); }
body.ui-new .modal-title { font-weight: 600; font-size: 1.05rem; color: var(--ui-text); }
body.ui-new .modal-title > i.bi:first-child { color: var(--ui-text-3); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .input-group-text { background: var(--ui-raised); border-color: #d6d9de; color: var(--ui-text-3); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) :is(fieldset legend, .form-section-title) { font-size: .9rem; font-weight: 600; color: var(--ui-text); }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-control::placeholder { color: #6b7280; }   /* a hint, lighter than a typed value, still 4.8:1 */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-control:disabled, body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-select:disabled, body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .form-control[readonly] { background: var(--ui-raised); color: var(--ui-text-2); }

/* ═════════════════════════════════════════════════════════════
   Stage 5 — the business portal (contractors, site staff), the agency
   website, the Property Hub and the client's own pages.
   The content rules above already cover .biz-content (business portal)
   and .rx-portal (a signed-in client's dashboard pages — layouts/main.ejs).
   ═════════════════════════════════════════════════════════════ */

/* text buttons and tab buttons in the agency colour, not Bootstrap blue */
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .btn-link:not(:is(.text-muted, .text-dark, .text-body, .text-white, .text-secondary, .text-danger, .text-success, .text-warning, .text-info, .text-reset, .dm-edit-btn)) { color: var(--brand-ink); }
/* a message's time and "Edit" inside the chat bubble: full strength, smaller is enough */
body.ui-new .rx-portal :is(small[style*="opacity:.6"], .dm-edit-btn) { opacity: 1 !important; }
body.ui-new :is(.admin-content, .biz-content, .rx-portal, .sa-content) .nav:not(.nav-tabs) button.nav-link:not(.active) { color: var(--ui-text-2); }

/* ── Business portal frame: light sidebar, the agency colour on the active item ── */
body.ui-new .biz-content { background: var(--ui-canvas); }
body.ui-new .biz-sidebar {
  background: var(--ui-surface); border-right: 1px solid var(--ui-border); color: var(--ui-text);
  --business-accent: var(--brand-ink);
}
body.ui-new .biz-sidebar .brand { border-bottom: 1px solid var(--ui-border-soft); }
body.ui-new .biz-sidebar .brand .product-label { color: var(--ui-text-3); text-transform: none; letter-spacing: 0; font-size: .75rem; font-weight: 500; }
body.ui-new .biz-sidebar .brand h6 { color: var(--ui-text) !important; }
body.ui-new .biz-sidebar .brand small { color: var(--ui-text-3) !important; font-size: .75rem !important; }
body.ui-new .biz-sidebar .brand h6 .bi { color: var(--brand-ink) !important; }
body.ui-new .biz-sidebar .nav-scroll { scrollbar-color: #d1d5db transparent; }
body.ui-new .biz-sidebar .nav-link {
  border-left: 0; margin: 1px 10px; padding: 7px 10px; border-radius: 8px; font-size: .875rem; color: var(--ui-text-2);
}
body.ui-new .biz-sidebar .nav-link i { color: var(--ui-text-3); }
body.ui-new .biz-sidebar .nav-link:hover { background: var(--ui-raised); color: var(--ui-text); }
body.ui-new .biz-sidebar .nav-link.active { background: var(--ui-accent-soft); color: var(--brand-ink); font-weight: 600; }
body.ui-new .biz-sidebar .nav-link.active i { color: var(--brand-ink); }
body.ui-new .biz-sidebar .nav-group-toggle {
  text-transform: none; letter-spacing: 0; font-size: .78rem; font-weight: 600; color: var(--ui-text-3); padding: 14px 20px 4px;
}
body.ui-new .biz-sidebar .nav-group-toggle:hover,
body.ui-new .biz-sidebar .nav-group-toggle .chevron { color: var(--ui-text-3); }
body.ui-new .biz-sidebar .nav-section { text-transform: none; letter-spacing: 0; font-size: .75rem; color: var(--ui-text-3); }
body.ui-new .biz-sidebar :is(.nav-link .nav-badge, .nav-link .nav-badge.info, .nav-group-toggle .grp-badge) {
  background: #eef0f3; color: var(--ui-text-2); font-weight: 600;
}
body.ui-new .biz-sidebar .bottom-links { border-top: 1px solid var(--ui-border-soft); }
body.ui-new .biz-sidebar .bottom-links .nav-link { margin: 0; padding: 6px 0; color: var(--ui-text-2) !important; }   /* the links carry light inline colours meant for the dark sidebar */
body.ui-new .biz-sidebar .bottom-links .nav-link[href="/auth/logout"] { color: #b42318 !important; }
body.ui-new .biz-sidebar .bottom-links .nav-link:hover { background: transparent; color: var(--ui-text); }
body.ui-new .biz-close-btn { color: var(--ui-text-2); }
body.ui-new .biz-topbar { background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); }
body.ui-new .biz-topbar h6 { font-weight: 600 !important; color: var(--ui-text) !important; }
body.ui-new .biz-topbar .product-pill { display: none !important; }   /* the sidebar already says which portal this is */
body.ui-new .biz-content .stat-card { background: var(--ui-surface); }

/* ── The website: one typeface, quiet greys, the agency colour for the main action ── */
body.ui-new.rx-site { background: var(--ui-surface); }
body.ui-new.rx-site main.rx-portal { background: var(--ui-canvas); min-height: 60vh; padding-bottom: 2rem; }
body.ui-new.rx-site .rx-nav { font-family: var(--rx-site-font, var(--brand-font)); box-shadow: none; border-bottom: 1px solid var(--ui-border); background: rgba(255, 255, 255, .96); }
body.ui-new.rx-site .rx-brand-name { font-family: var(--rx-site-font, var(--brand-font)); font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ui-text); }
body.ui-new.rx-site .rx-link { color: var(--ui-text-2); }
body.ui-new.rx-site .rx-dropdown { font-family: var(--rx-site-font, var(--brand-font)); box-shadow: 0 8px 24px rgba(17, 24, 39, .08) !important; border: 1px solid var(--ui-border) !important; }
body.ui-new.rx-site .rx-btn-cta { font-weight: 600; }
body.ui-new.rx-site .rx-btn-cta:hover { transform: none; }

/* muted words: Bootstrap's grey reads at 4.4:1 on the light sections — one step darker */
body.ui-new.rx-site main :is(.text-muted, .text-secondary):not(.bg-dark *, [class*="hero"] *) { color: #5b6170 !important; }   /* 5.9:1 on white, 5.3:1 on #f4f5f7 */
/* links in the agency's colour, not Bootstrap blue */
body.ui-new.rx-site main .breadcrumb a,
body.ui-new.rx-site main :is(p, li, small, td, .form-text) > a:not([class]) { color: var(--brand-ink); }
body.ui-new.rx-site main .breadcrumb-item.active { color: #5b6170; }

/* buttons: rounded the same everywhere; Bootstrap blue becomes the agency colour */
body.ui-new.rx-site main .btn { border-radius: 8px; }
/* a main button that can't be used yet ("Reserve now" before dates are picked): plain grey, not Bootstrap's pale blue */
body.ui-new.rx-site main .btn-primary:is(:disabled, .disabled) {
  background-color: #e5e7eb !important; border-color: #e5e7eb !important; color: #4b5563 !important; opacity: 1;
}
body.ui-new.rx-site main :is(.btn-outline-primary, .btn-outline-secondary) {
  --bs-btn-color: var(--ui-text); --bs-btn-border-color: #d1d5db; --bs-btn-bg: var(--ui-surface);
  --bs-btn-hover-color: var(--ui-text); --bs-btn-hover-bg: var(--ui-raised); --bs-btn-hover-border-color: #c4c8cf;
  --bs-btn-active-color: var(--ui-text); --bs-btn-active-bg: #f3f4f6; --bs-btn-active-border-color: #c4c8cf;
}

/* cards: a thin line, no heavy shadow */
body.ui-new.rx-site main .card { border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: none; }
body.ui-new.rx-site main .card.shadow-sm,
body.ui-new.rx-site main .card.shadow { box-shadow: none !important; }
body.ui-new.rx-site main .card.border-0 { border: 1px solid var(--ui-border) !important; }

/* status labels: soft tints with dark words (as in the back office) */
body.ui-new.rx-site main .badge.bg-success-subtle.text-success { color: #0a3622 !important; }
body.ui-new.rx-site main .badge.bg-primary-subtle.text-primary { color: #052c65 !important; }
body.ui-new.rx-site main .badge.bg-info-subtle.text-info       { color: #055160 !important; }
body.ui-new.rx-site main .badge.bg-warning-subtle.text-warning { color: #664d03 !important; }
body.ui-new.rx-site main .badge.bg-danger-subtle.text-danger   { color: #58151c !important; }
body.ui-new.rx-site main .badge.bg-secondary-subtle.text-secondary { color: #2b2f32 !important; }

/* the hero's small label and the figures band under it */
body.ui-new.rx-site .hero-badge {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); color: rgba(255, 255, 255, .92);
}
body.ui-new.rx-site .stats-bar { background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); }
body.ui-new.rx-site .stats-bar .stat-item h3 { color: var(--ui-text); font-weight: 650; }
body.ui-new.rx-site .stats-bar .stat-item p { color: #5b6170; opacity: 1; }
/* brand-coloured words on a dark band (comparison tables, loan terms): the readable light shade */
body.ui-new.rx-site main .bg-dark :is(.text-warning, .text-success),
body.ui-new.rx-site main tbody.table-dark :is(.text-warning, .text-success) { color: var(--brand-accent-on-panel) !important; }
/* on a photo's dark caption band (off-plan progress) the bright shade */
body.ui-new.rx-site main :is([style*="background: rgba(0,0,0"], [style*="background:rgba(0,0,0"]) .text-warning { color: #ffd75e !important; }
/* the agency's name in the hero line ("By …") sits on the fixed dark hero: white, bold */
body.ui-new.rx-site .hero-section .hero-subtitle strong { color: #ffffff !important; }
/* the dark header strip (agents) and the dark band on each agent card */
body.ui-new.rx-site main > .container-fluid.bg-dark { background: var(--brand-panel) !important; color: var(--brand-on-panel) !important; }
body.ui-new.rx-site main .card > .bg-dark:first-child { background: var(--ui-accent-soft) !important; border-bottom: 1px solid var(--ui-border-soft); }
/* the public tables (mortgage schemes, a client's payments): the quiet head */
body.ui-new.rx-site main .table > thead.table-dark { --bs-table-bg: var(--ui-raised); --bs-table-color: var(--ui-text-3); }
body.ui-new.rx-site main .table > thead.table-dark th { font-weight: 500; border-bottom: 1px solid var(--ui-border); }
body.ui-new.rx-site main .table > thead.table-dark th:is(.text-warning, .text-success, .text-info) { color: var(--ui-text) !important; }
/* pale greys typed into the public pages (ratings, counts) */
body.ui-new.rx-site main :is([style*="color:#aaa"], [style*="color: #aaa"], [style*="color:#999"], [style*="color: #999"], [style*="color:#adb5bd"]) { color: #5b6170 !important; }

/* ── Sign-in, register and password pages: the same typeface and greys as the rest ── */
body.ui-new.rx-site :is(.ax-root, .ax-input, .ax-btn, .ax-btn-ghost) { font-family: var(--rx-site-font, var(--brand-font)); }
body.ui-new.rx-site :is(.ax-logo, .ax-mobrand-logo, .ax-panel-h, .ax-title, .ax-panel-foot-text) { font-family: var(--rx-site-font, var(--brand-font)); letter-spacing: -0.02em; }
body.ui-new.rx-site :is(.ax-logo, .ax-mobrand-logo) { font-style: normal; font-weight: 650; }
body.ui-new.rx-site .ax-panel-h { font-weight: 650; }
body.ui-new.rx-site .ax-panel-h em { font-style: normal; }
body.ui-new.rx-site .ax-left::before,
body.ui-new.rx-site .ax-left::after { display: none; }
body.ui-new.rx-site .ax-right { background: var(--ui-surface); }
body.ui-new.rx-site .ax-title { font-weight: 650; color: var(--ui-text); }
body.ui-new.rx-site :is(.ax-sub, .ax-tenant-name, .ax-check-label, .ax-terms, .ax-footer-link, .ax-back, .ax-pw-hint, .ax-powered) { color: #5b6170; }
body.ui-new.rx-site .ax-label { color: var(--ui-text); font-weight: 500; letter-spacing: 0; }
body.ui-new.rx-site .ax-input { border: 1px solid #d6d9de; color: var(--ui-text); }
body.ui-new.rx-site .ax-input::placeholder { color: #6b7280; }
body.ui-new.rx-site .ax-input:focus { border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--ui-ring); }
body.ui-new.rx-site :is(.ax-terms a, .ax-footer-link a) { color: var(--brand-ink); }
body.ui-new.rx-site :is(.ax-btn, .ax-btn-ghost) { border-radius: 8px; }
body.ui-new.rx-site .ax-btn:hover { transform: none; box-shadow: none; }
body.ui-new.rx-site .ax-btn-ghost { border: 1px solid #d1d5db; color: var(--ui-text); }
body.ui-new.rx-site .ax-divider { border-top-color: var(--ui-border); }
body.ui-new.rx-site .ax-mobrand-tag { background: var(--ui-raised); color: var(--ui-text-2); border-color: var(--ui-border); }

/* ═════════════════════════════════════════════════════════════
   Stage 6 — the superadmin console (layouts/superadmin.ejs, body.rx-console).
   Its own switch (Platform Controls → This console's look). In the new look the
   layout leaves out its dark Bootstrap block; the console's colour tokens turn
   light here, and the colours typed into its pages are mapped to readable ones.
   The accent is a deep green (#047857: 5.5:1 on white, white text 5.5:1 on it).
   ═════════════════════════════════════════════════════════════ */
body.ui-new.rx-console {
  --sa-bg: var(--ui-canvas);
  --sa-sidebar: var(--ui-surface);
  --sa-card: var(--ui-surface);
  --sa-border: var(--ui-border);
  --sa-green: #047857;
  --sa-green-soft: #047857;
  --sa-text: var(--ui-text);
  --sa-muted: var(--ui-text-2);
  --sa-faint: var(--ui-text-3);
  --brand-primary: #047857;
  --brand-on-primary: #ffffff;
  --brand-ink: #047857;
  --ui-accent-soft: #ecf7f3;
}
/* frame */
body.ui-new.rx-console .sa-sidebar { border-right: 1px solid var(--ui-border); }
body.ui-new.rx-console .sa-sidebar .brand { border-bottom-color: var(--ui-border-soft); }
body.ui-new.rx-console .sa-sidebar .brand-icon .bi { color: #ffffff !important; }
body.ui-new.rx-console .sa-sidebar .brand-title { letter-spacing: .02em; }
body.ui-new.rx-console .nav-section { text-transform: none; letter-spacing: 0; font-size: .75rem; font-weight: 600; color: var(--ui-text-3); padding: 14px 20px 4px; }
body.ui-new.rx-console .sa-link { border-left: 0; margin: 1px 10px; padding: 7px 10px; border-radius: 8px; font-size: .875rem; color: var(--ui-text-2); }
body.ui-new.rx-console .sa-link i { color: var(--ui-text-3); }
body.ui-new.rx-console .sa-link:hover { background: var(--ui-raised); color: var(--ui-text); }
body.ui-new.rx-console .sa-link.active { background: var(--ui-accent-soft); color: var(--brand-ink); font-weight: 600; }
body.ui-new.rx-console .sa-link.active i { color: var(--brand-ink); }
body.ui-new.rx-console .sa-logout { color: #b42318; }
body.ui-new.rx-console .sa-topbar { background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); }
body.ui-new.rx-console .sa-topbar-title { color: var(--ui-text); font-weight: 600; }
body.ui-new.rx-console .sa-overlay { background: rgba(17, 24, 39, .35); }
body.ui-new.rx-console .stat-card { background: var(--ui-surface); border: 1px solid var(--ui-border); }
/* the toast-style messages */
body.ui-new.rx-console .sa-flash .alert-success { background: #f0faf3 !important; border-color: #cdebd7 !important; color: #14532d !important; }
body.ui-new.rx-console .sa-flash .alert-danger  { background: #fef3f2 !important; border-color: #f7d4d0 !important; color: #7f1d1d !important; }
body.ui-new.rx-console .sa-flash .btn-close-white { filter: none; }
body.ui-new.rx-console .btn-close-white { filter: none; }
body.ui-new.rx-console .rx-page-help-btn.rx-on-dark { border-color: var(--ui-border); color: var(--ui-text-2); }

/* colours typed into the console's pages (they were chosen for the dark page) */
body.ui-new.rx-console .sa-content :is([style*="color:#e0e0e0"], [style*="color: #e0e0e0"], [style*="color:#fff;"], [style$="color:#fff"], [style*="color: #fff"], [style*="color:#ffffff"], [style*="color:white"], [style*="color: white"], [style*="color:#cfcfcf"]):not([style*="background"]) { color: var(--ui-text) !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#00ff88"], [style*="color: #00ff88"], [style*="color:#75b798"]):not([style*="background:#00ff88"]) { color: #047857 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#ffc107"], [style*="color: #ffc107"]):not([style*="background"]) { color: #a15c07 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#00d4ff"], [style*="color: #00d4ff"]) { color: #0e7490 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#ff4d4d"], [style*="color:#f85149"], [style*="color: #ff4d4d"], [style*="color:#ff4444"]) { color: #b42318 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#58a6ff"], [style*="color:#6ea8fe"]) { color: #1d4ed8 !important; }
/* dark panels and fields typed in (any #0…/#1… fill, the faint white washes) → light, with dark words */
body.ui-new.rx-console .sa-content :is([style*="background:#0"], [style*="background: #0"], [style*="background:#1"], [style*="background: #1"], [style*="background-color:#1"]):not([style*="#00ff88"]):not([style*="#00d4ff"]):not([style*="#00cc"]),
body.ui-new.rx-console .sa-content :is([style*="background: rgb(20, 20, 42)"], [style*="background: rgb(21, 26, 35)"], [style*="background: rgb(26, 26, 46)"], [style*="background: rgb(13, 13, 26)"], [style*="background: rgb(28, 34, 48)"], [style*="background: rgb(28, 20, 16)"]) {
  background: var(--ui-surface) !important; border-color: var(--ui-border) !important; color: var(--ui-text) !important;
}
body.ui-new.rx-console .sa-content :is([style*="background:rgba(255,255,255"], [style*="background: rgba(255,255,255"], [style*="background:rgba(0,0,0"], [style*="background: rgba(0,0,0"]) { background: var(--ui-raised) !important; color: var(--ui-text-2) !important; }
/* Bootstrap's dark utilities used on the console's tables and fields */
body.ui-new.rx-console .sa-content .table-dark { --bs-table-bg: transparent; --bs-table-color: var(--ui-text); --bs-table-border-color: var(--ui-border-soft); --bs-table-striped-bg: var(--ui-raised); --bs-table-striped-color: var(--ui-text); --bs-table-hover-bg: var(--ui-raised); --bs-table-hover-color: var(--ui-text); --bs-table-active-bg: #f3f4f6; --bs-table-active-color: var(--ui-text); color: var(--ui-text); border-color: var(--ui-border-soft); }
body.ui-new.rx-console .sa-content .bg-dark { background-color: var(--ui-surface) !important; color: var(--ui-text); }
body.ui-new.rx-console .sa-content .text-light { color: var(--ui-text) !important; }
body.ui-new.rx-console .sa-content .border-secondary { border-color: #d6d9de !important; }
/* more colours typed in for the dark page */
body.ui-new.rx-console .sa-content :is([style*="color:#ff5f56"], [style*="color: #ff5f56"]) { color: #b42318 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#9db4ff"], [style*="color:#00ccff"], [style*="color: #00ccff"]) { color: #1d4ed8 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#3fb950"]) { color: #146c35 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:#d97706"], [style*="color:#ffc107"], [style*="color: #ffc107"]) { color: #92400e !important; }
body.ui-new.rx-console .sa-content [style*="color:#b06bff"] { color: #6d28d9 !important; }
body.ui-new.rx-console .sa-content :is([style*="color:rgba(255,255,255"], [style*="color: rgba(255,255,255"], [style*="color:#aaa"], [style*="color:#b9b9b9"]) { color: var(--ui-text-3) !important; }
/* a main button typed with black words: white on the deep green */
body.ui-new.rx-console .sa-content .btn:is(.btn-warning, .btn-primary, .btn-success)[style*="color:#000"] { color: #ffffff !important; }
body.ui-new.rx-console .sa-content :is([style*="border-color:rgba(255,255,255"], [style*="border:1px solid rgba(255,255,255"], [style*="border: 1px solid rgba(255,255,255"], [style*="border-bottom:1px solid rgba(255,255,255"], [style*="border-top:1px solid rgba(255,255,255"]) { border-color: var(--ui-border) !important; }
/* the neon fills (buttons, chips) → the deep green with white words */
body.ui-new.rx-console .sa-content :is([style*="background:#00ff88"], [style*="background: #00ff88"], [style*="background:var(--sa-green)"], [style*="background: var(--sa-green)"]) {
  background: #047857 !important; border-color: #047857 !important; color: #ffffff !important;
}
body.ui-new.rx-console .sa-content :is([style*="background:#00ff88"], [style*="background: #00ff88"], [style*="background:var(--sa-green)"], [style*="background: var(--sa-green)"]) :is(i, span, strong, small) { color: #ffffff !important; }
body.ui-new.rx-console .sa-content [style*="border:1px solid #00ff88"] { border-color: #9fd8c3 !important; }
/* the console's tables: the quiet head */
body.ui-new.rx-console .sa-content .table > thead > tr > th { text-transform: none; letter-spacing: 0; }
