/**
 * RepoCloud Dark Mode Stylesheet
 * 
 * Strict Isolation Contract:
 * - 100% of selectors MUST be scoped under html[data-theme="dark"]
 * - Zero bare class or element selectors
 * - Modern dark palette (OpenRouter-inspired: #0d1117 canvas, #161b22 panels, #e6edf3 text)
 */

/* ==========================================================================
   Section 1: Global & Base
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --dash-bg: #0d1117;
  --dash-surface: #161b22;
  --dash-border: #30363d;
  --dash-text: #e6edf3;
}

html[data-theme="dark"] body {
  background-color: #0d1117 !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] ::selection {
  background-color: #1f6feb !important;
  color: #ffffff !important;
}

html[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0d1117;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #21262d;
  border-radius: 5px;
  border: 2px solid #0d1117;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #30363d;
}

/* ==========================================================================
   Section 2: Typography
   ========================================================================== */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .h1,
html[data-theme="dark"] .h2,
html[data-theme="dark"] .h3,
html[data-theme="dark"] .h4,
html[data-theme="dark"] .h5,
html[data-theme="dark"] .h6 {
  color: #e6edf3 !important;
}

html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] span {
  color: inherit;
}

html[data-theme="dark"] small,
html[data-theme="dark"] .small {
  color: #8b949e;
}

html[data-theme="dark"] strong,
html[data-theme="dark"] b {
  color: #e6edf3;
}

html[data-theme="dark"] code {
  color: #79c0ff !important;
  background-color: rgba(110, 118, 129, 0.2) !important;
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

html[data-theme="dark"] pre {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border: 1px solid rgba(240, 246, 252, 0.1) !important;
  border-radius: 6px;
}

html[data-theme="dark"] pre code {
  background-color: transparent !important;
  padding: 0;
}

html[data-theme="dark"] a:not(.btn) {
  color: #58a6ff;
}

html[data-theme="dark"] a:not(.btn):hover {
  color: #79c0ff;
}

html[data-theme="dark"] hr {
  border-color: rgba(240, 246, 252, 0.1) !important;
  opacity: 1 !important;
}

/* ==========================================================================
   Section 3: Global Utilities & Specificity Overrides
   ========================================================================== */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .bg-body {
  background-color: #161b22 !important;
}

html[data-theme="dark"] .text-body {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary {
  color: #8b949e !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end {
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .border-primary {
  border-color: rgba(56, 139, 253, 0.4) !important;
}

/* Legacy theme.min.css:30120-30295 !important overrides */
html[data-theme="dark"] .black,
html[data-theme="dark"] *.black,
html[data-theme="dark"] a.black,
html[data-theme="dark"] label.black {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .green,
html[data-theme="dark"] strong.green {
  color: #3fb950 !important;
}

html[data-theme="dark"] .blue,
html[data-theme="dark"] a.blue {
  color: #58a6ff !important;
}

html[data-theme="dark"] .grey,
html[data-theme="dark"] .gray,
html[data-theme="dark"] a.grey,
html[data-theme="dark"] li.grey,
html[data-theme="dark"] span.grey {
  color: #8b949e !important;
}

html[data-theme="dark"] .underlinehoverblue:hover {
  text-decoration: underline !important;
  color: #58a6ff !important;
}

/* text-dark isolation: invert standard text-dark, preserve warning badges */
html[data-theme="dark"] .text-dark:not(.badge):not(.badge *) {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .badge.bg-warning.text-dark,
html[data-theme="dark"] .badge.bg-warning {
  color: #0d1117 !important;
  background-color: #d29922 !important;
}

html[data-theme="dark"] .badge.text-dark:not([class*="bg-"]) {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .cardfade {
  box-shadow: 0 0.8rem 1rem 0px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .chatbot {
  border-color: rgba(240, 246, 252, 0.14) !important;
  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   Section 4: Header & Navigation
   ========================================================================== */
html[data-theme="dark"] #header,
html[data-theme="dark"] #header.navbar-light.bg-white {
  background-color: #161b22 !important;
  border-bottom: 1px solid rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] #header .nav-link {
  color: #e6edf3 !important;
}

html[data-theme="dark"] #header .nav-link:hover,
html[data-theme="dark"] #header .nav-link:focus {
  color: #58a6ff !important;
}

html[data-theme="dark"] .navbar-scrolled.navbar-light {
  background-color: #161b22 !important;
  border-bottom: 1px solid rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .navbar-toggler {
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .navbar-toggler-default i,
html[data-theme="dark"] .navbar-toggler-toggled i {
  color: #e6edf3 !important;
}

@media (max-width: 991.98px) {
  html[data-theme="dark"] .navbar-collapse {
    background-color: #161b22 !important;
    border-top: 1px solid rgba(240, 246, 252, 0.1);
    padding: 1rem 0;
  }
}

/* Breadcrumb of a listing, an index and an app page (templates/_breadcrumb.html). The theme paints the page that the
   reader is on (.breadcrumb-item.active) in its own dark grey, which read 1.16:1 on the dark canvas (#0d1117);
   #8b949e reads 6.15:1 there and 5.62:1 on the offcanvas drawer (#161b22), where WCAG AA asks for 4.5:1. The links of
   the trail keep the generic dark link colour (#58a6ff, 7.49:1). */
html[data-theme="dark"] .breadcrumb-item.active {
  color: #8b949e;
}

/* ==========================================================================
   Section 5: Logo Swapping (Zero-FOLL)
   ========================================================================== */
html[data-theme="dark"] .logo-dark.d-none {
  display: inline-block !important;
}

html[data-theme="dark"] .logo-light {
  display: none !important;
}

/* ==========================================================================
   Section 6: Hero Section (Homepage)
   ========================================================================== */
html[data-theme="dark"] .app-hero-section {
  position: relative;
  z-index: 20;
  background: #161b22 !important;
  border-bottom: 1px solid rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .app-hero-video-section {
  position: relative;
  z-index: 20;
  background: transparent !important;
}

html[data-theme="dark"] .app-hero-video-bg {
  background-image: url('/static/bgstatic-darkmode.jpg') !important;
  background-size: cover !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
}

html[data-theme="dark"] .app-hero-video-bg video,
html[data-theme="dark"] .app-hero-video-bg img {
  display: none !important;
}

html[data-theme="dark"] .app-hero-heading {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .app-hero-tagline {
  color: #8b949e !important;
}

/* ==========================================================================
   Section 7: Cards & Containers
   ========================================================================== */
html[data-theme="dark"] .card {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
  box-shadow: 0 0.1875rem 0.75rem rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .card-title {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .card-text {
  color: #8b949e !important;
}

/* ==========================================================================
   Section 8: Forms, Inputs, & Dropdowns
   ========================================================================== */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control,
html[data-theme="dark"] select.form-select {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea.form-control:focus,
html[data-theme="dark"] select.form-select:focus {
  background-color: #0d1117 !important;
  border-color: #58a6ff !important;
  box-shadow: 0 0 0 0.25rem rgba(56, 139, 253, 0.25) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .form-select:disabled {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.08) !important;
  color: #6e7681 !important;
  opacity: 0.8 !important;
}

html[data-theme="dark"] .form-control[readonly].text-primary {
  color: #58a6ff !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .form-control[readonly].font-monospace {
  color: #e6edf3 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .form-control::placeholder {
  color: #6e7681 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .form-label {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .form-floating > label {
  color: #8b949e !important;
}

html[data-theme="dark"] .form-text {
  color: #8b949e !important;
}

html[data-theme="dark"] .input-group-text {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #8b949e !important;
}

html[data-theme="dark"] .form-select option {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
}

/* TomSelect Custom Overrides (e.g. sms-confirmation.html) */
html[data-theme="dark"] .tom-select-custom .ts-control {
  background-color: #0d1117 !important;
  color: #e6edf3 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .tom-select-custom .ts-dropdown {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .tom-select-custom .ts-dropdown .option {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .tom-select-custom .ts-dropdown .active {
  background-color: #21262d !important;
  color: #58a6ff !important;
}

/* Monospace inputs (USDT wallet, SSH keys) */
html[data-theme="dark"] input.font-monospace,
html[data-theme="dark"] textarea.font-monospace {
  background-color: #0d1117 !important;
  color: #e6edf3 !important;
}

/* ==========================================================================
   Section 9: Form Switches & Checkboxes
   ========================================================================== */
html[data-theme="dark"] .form-check-input {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.25) !important;
}

html[data-theme="dark"] .form-check-input:checked {
  background-color: #1f6feb !important;
  border-color: #1f6feb !important;
}

html[data-theme="dark"] .form-check-input:focus {
  border-color: #58a6ff !important;
  box-shadow: 0 0 0 0.25rem rgba(56, 139, 253, 0.25) !important;
}

html[data-theme="dark"] .form-check-label {
  color: #e6edf3 !important;
}

/* ==========================================================================
   Section 10: Radio Tier Cards & Nav-Tabs
   ========================================================================== */
html[data-theme="dark"] label.form-control {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] label.form-control:hover {
  border-color: rgba(88, 166, 255, 0.5) !important;
}

html[data-theme="dark"] .nav-tabs {
  --bs-nav-tabs-border-color: rgba(240, 246, 252, 0.1);
  --bs-nav-tabs-link-hover-border-color: rgba(240, 246, 252, 0.2);
  --bs-nav-tabs-link-active-color: #58a6ff;
  --bs-nav-tabs-link-active-bg: transparent;
  --bs-nav-tabs-link-active-border-color: #58a6ff;
  --bs-nav-link-color: #8b949e;
  border-bottom-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .page-header {
  border-bottom-color: rgba(240, 246, 252, 0.1) !important;
}

/* ==========================================================================
   Section 11: Buttons
   ========================================================================== */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-dark,
html[data-theme="dark"] .btn-info {
  --bs-btn-color: #ffffff !important;
  --bs-btn-hover-color: #ffffff !important;
  --bs-btn-active-color: #ffffff !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-primary:focus,
html[data-theme="dark"] .btn-primary:active,
html[data-theme="dark"] .btn-primary.active,
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-secondary:focus,
html[data-theme="dark"] .btn-secondary:active,
html[data-theme="dark"] .btn-success:hover,
html[data-theme="dark"] .btn-success:focus,
html[data-theme="dark"] .btn-success:active,
html[data-theme="dark"] .btn-danger:hover,
html[data-theme="dark"] .btn-danger:focus,
html[data-theme="dark"] .btn-danger:active,
html[data-theme="dark"] .btn-dark:hover,
html[data-theme="dark"] .btn-dark:focus,
html[data-theme="dark"] .btn-dark:active,
html[data-theme="dark"] .btn-info:hover,
html[data-theme="dark"] .btn-info:focus,
html[data-theme="dark"] .btn-info:active {
  color: #ffffff !important;
}

html[data-theme="dark"] .btn-warning {
  --bs-btn-color: #0d1117 !important;
  --bs-btn-hover-color: #0d1117 !important;
  --bs-btn-active-color: #0d1117 !important;
  color: #0d1117 !important;
  font-weight: 600 !important;
}

/* The danger button keeps its white label (rule above) and starts one shade down: the theme paints it #ed4c78,
   where white reads 3.56:1 (measured on Delete Server of /manage, dark theme). The theme's own next shades, hover
   #c94166 and press #be3d60, keep white above 4.5:1, so these are the base, hover and press colours here.
   Custom properties on the class out-rank the theme's by specificity, no !important
   (tests/test_dark_mode.py, Group 18). */
html[data-theme="dark"] .btn-danger {
  --bs-btn-bg: #c94166;
  --bs-btn-border-color: #c94166;
  --bs-btn-hover-bg: #be3d60;
  --bs-btn-hover-border-color: #b2395a;
  --bs-btn-active-bg: #b2395a;
  --bs-btn-active-border-color: #a63555;
}

html[data-theme="dark"] .btn-outline-primary {
  border-color: #388bfd !important;
  color: #58a6ff !important;
  font-weight: 500;
}

html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:focus,
html[data-theme="dark"] .btn-outline-primary:active,
html[data-theme="dark"] .btn-outline-primary.active {
  background-color: #388bfd !important;
  border-color: #388bfd !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .btn-white {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .btn-white:hover,
html[data-theme="dark"] .btn-white:focus,
html[data-theme="dark"] .btn-white:active {
  background-color: #21262d !important;
  border-color: rgba(240, 246, 252, 0.25) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .btn-white.disabled,
html[data-theme="dark"] .btn-white:disabled {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.08) !important;
  color: #6e7681 !important;
}

html[data-theme="dark"] .btn-ghost-secondary {
  color: #8b949e !important;
}

html[data-theme="dark"] .btn-ghost-secondary:hover {
  background-color: #21262d !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .btn-soft-primary {
  background-color: rgba(56, 139, 253, 0.15) !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .btn-soft-primary:hover {
  background-color: rgba(56, 139, 253, 0.25) !important;
  color: #79c0ff !important;
}

/* #8b949e read 4.4963:1 on this button's own tint over the card (Reset and Reboot of /manage, measured in the dark
   theme); #9198a1 reads 4.75:1 (tests/test_dark_mode.py, Group 18). */
html[data-theme="dark"] .btn-soft-secondary {
  background-color: rgba(110, 118, 129, 0.2) !important;
  color: #9198a1 !important;
}

html[data-theme="dark"] .btn-soft-secondary:hover {
  background-color: rgba(110, 118, 129, 0.3) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .btn-outline-secondary {
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #8b949e !important;
}

html[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: #21262d !important;
  border-color: rgba(240, 246, 252, 0.25) !important;
  color: #e6edf3 !important;
}

/* ==========================================================================
   Section 12: Close Buttons
   ========================================================================== */
html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%) !important;
}

/* ==========================================================================
   Section 13: Modals (All 14 Modals)
   ========================================================================== */
html[data-theme="dark"] .modal-content {
  background-color: #161b22 !important;
  border: 1px solid rgba(240, 246, 252, 0.15) !important;
  color: #e6edf3 !important;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  border-color: rgba(240, 246, 252, 0.1) !important;
  background-color: #161b22 !important;
}

html[data-theme="dark"] .modal-title {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .modal-body {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .modal-backdrop {
  opacity: 0.7 !important;
}

/* ==========================================================================
   Section 14: Dropdowns, Popovers & Tooltips
   ========================================================================== */
html[data-theme="dark"] .dropdown-menu {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .dropdown-item {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
  background-color: #21262d !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .dropdown-divider {
  border-top-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .popover {
  --bs-popover-bg: #161b22;
  --bs-popover-border-color: rgba(240, 246, 252, 0.14);
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .popover-header {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border-bottom-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .popover-body {
  color: #8b949e !important;
}

html[data-theme="dark"] .tooltip-inner {
  background-color: #1c2128 !important;
  color: #e6edf3 !important;
  border: 1px solid rgba(240, 246, 252, 0.14) !important;
}

/* ==========================================================================
   Section 15: Tables
   ========================================================================== */
html[data-theme="dark"] .table {
  color: #e6edf3 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  border-bottom-color: rgba(240, 246, 252, 0.1) !important;
}

/* The theme colours the rows and the header cells themselves (theme.min.css: `.table tr` navy #21325b, 1.4:1 on a
   dark card, and `.table thead th` charcoal #1e2022, 1.1:1), so the colour set on `.table` above never reaches the
   text. These rules out-rank both by specificity, with no !important (tests/test_dark_mode.py, Group 17). */
html[data-theme="dark"] .table tr {
  color: #e6edf3;
}

html[data-theme="dark"] .table thead th {
  color: #8b949e;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(240, 246, 252, 0.02) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(240, 246, 252, 0.05) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .thead-light th,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .table-light th,
html[data-theme="dark"] .table-light td {
  background-color: #161b22 !important;
  color: #8b949e !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

/* ==========================================================================
   Section 16: Alerts & Flash Messages
   ========================================================================== */
html[data-theme="dark"] .alert-soft-primary {
  background-color: rgba(56, 139, 253, 0.12) !important;
  border: 1px solid rgba(56, 139, 253, 0.3) !important;
  color: #79c0ff !important;
}

html[data-theme="dark"] .alert-soft-success {
  background-color: rgba(63, 185, 80, 0.12) !important;
  border: 1px solid rgba(63, 185, 80, 0.3) !important;
  color: #56d364 !important;
}

html[data-theme="dark"] .alert-soft-danger {
  background-color: rgba(248, 81, 73, 0.12) !important;
  border: 1px solid rgba(248, 81, 73, 0.3) !important;
  color: #ff7b72 !important;
}

html[data-theme="dark"] .alert-soft-warning {
  background-color: rgba(210, 153, 34, 0.12) !important;
  border: 1px solid rgba(210, 153, 34, 0.3) !important;
  color: #e3b341 !important;
}

html[data-theme="dark"] .alert-soft-info,
html[data-theme="dark"] .alert-info {
  background-color: rgba(56, 139, 253, 0.1) !important;
  border: 1px solid rgba(56, 139, 253, 0.25) !important;
  color: #79c0ff !important;
}

html[data-theme="dark"] .alert-warning {
  background-color: rgba(210, 153, 34, 0.15) !important;
  border: 1px solid rgba(210, 153, 34, 0.35) !important;
  color: #e3b341 !important;
}

html[data-theme="dark"] .alert-danger {
  background-color: rgba(248, 81, 73, 0.15) !important;
  border: 1px solid rgba(248, 81, 73, 0.35) !important;
  color: #ff7b72 !important;
}

html[data-theme="dark"] .alert-success {
  background-color: rgba(63, 185, 80, 0.15) !important;
  border: 1px solid rgba(63, 185, 80, 0.35) !important;
  color: #56d364 !important;
}

html[data-theme="dark"] .alert-primary {
  background-color: rgba(56, 139, 253, 0.15) !important;
  border: 1px solid rgba(56, 139, 253, 0.35) !important;
  color: #79c0ff !important;
}

html[data-theme="dark"] .alert .alert-link {
  color: inherit !important;
  text-decoration: underline !important;
}

/* ==========================================================================
   Section 17: Badges & Indicators
   ========================================================================== */
html[data-theme="dark"] .bg-soft-primary {
  background-color: rgba(56, 139, 253, 0.15) !important;
  color: #79c0ff !important;
}

html[data-theme="dark"] .bg-soft-success {
  background-color: rgba(63, 185, 80, 0.15) !important;
  color: #56d364 !important;
}

html[data-theme="dark"] .bg-soft-danger {
  background-color: rgba(248, 81, 73, 0.15) !important;
  color: #ff7b72 !important;
}

html[data-theme="dark"] .bg-soft-secondary {
  background-color: rgba(110, 118, 129, 0.2) !important;
  color: #8b949e !important;
}

/* Solid badges: the dark `span { color: inherit }` rule (Section 2) out-ranks Bootstrap's `.badge` colour, so a
   `span.badge` took the colour of the text around it (navy on the blue and red badges, 3.3:1 and 3.5:1). Dark text
   on the solid backgrounds clears 4.5:1; the warning badge has its own rule in Section 3. Specificity, no
   !important (tests/test_dark_mode.py, Group 17). */
html[data-theme="dark"] .badge.bg-primary,
html[data-theme="dark"] .badge.bg-secondary,
html[data-theme="dark"] .badge.bg-success,
html[data-theme="dark"] .badge.bg-danger,
html[data-theme="dark"] .badge.bg-info {
  color: #0d1117;
}

html[data-theme="dark"] .legend-indicator.bg-primary {
  background-color: #58a6ff !important;
}

html[data-theme="dark"] .legend-indicator.bg-success {
  background-color: #3fb950 !important;
}

html[data-theme="dark"] .legend-indicator.bg-warning {
  background-color: #d29922 !important;
}

html[data-theme="dark"] .legend-indicator.bg-danger {
  background-color: #f85149 !important;
}

/* ==========================================================================
   Section 18: Pagination
   ========================================================================== */
html[data-theme="dark"] .pagination {
  --bs-pagination-bg: #161b22;
  --bs-pagination-color: #8b949e;
  --bs-pagination-border-color: rgba(240, 246, 252, 0.1);
  --bs-pagination-hover-bg: #21262d;
  --bs-pagination-hover-color: #e6edf3;
  --bs-pagination-active-bg: #1f6feb;
  --bs-pagination-active-color: #ffffff;
  --bs-pagination-disabled-bg: #0d1117;
  --bs-pagination-disabled-color: #484f58;
}

html[data-theme="dark"] .page-link {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
  color: #8b949e !important;
}

html[data-theme="dark"] .pagination .page-item.active .page-link,
html[data-theme="dark"] .page-item.active .page-link {
  background-color: #1f6feb !important;
  border-color: #1f6feb !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .page-item.disabled .page-link {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.08) !important;
  color: #484f58 !important;
}

/* ==========================================================================
   Section 19: Segmented Control Tabs
   ========================================================================== */
html[data-theme="dark"] .nav-segment {
  background-color: #0d1117 !important;
  border: 1px solid rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .nav-segment .nav-link {
  color: #8b949e !important;
}

html[data-theme="dark"] .nav-segment .nav-link.active {
  background-color: #21262d !important;
  color: #e6edf3 !important;
  box-shadow: 0 0.1875rem 0.375rem rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   Section 20: Accordions
   ========================================================================== */
html[data-theme="dark"] .accordion-item {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .accordion-button {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: #21262d !important;
  color: #58a6ff !important;
  box-shadow: inset 0 -1px 0 rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .accordion-button::after {
  filter: invert(1) !important;
}

html[data-theme="dark"] .accordion-body {
  background-color: #161b22 !important;
  color: #8b949e !important;
}

/* ==========================================================================
   Section 21: Offcanvas Drawer
   ========================================================================== */
html[data-theme="dark"] .offcanvas {
  --bs-offcanvas-bg: #161b22;
  --bs-offcanvas-color: #e6edf3;
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .offcanvas-header {
  border-bottom: 1px solid rgba(240, 246, 252, 0.1) !important;
}

/* ==========================================================================
   Section 22: App Card Grid & Similar Apps Carousel
   ========================================================================== */
html[data-theme="dark"] .app-card {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
  box-shadow: 0 0.1875rem 0.75rem rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .app-card:hover {
  border-color: rgba(88, 166, 255, 0.4) !important;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .app-favorite-chip {
  background-color: rgba(22, 27, 34, 0.92) !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #8b949e !important;
}

html[data-theme="dark"] .app-favorite-chip:hover,
html[data-theme="dark"] .app-favorite-chip.is-favorited {
  color: #f85149 !important;
}

html[data-theme="dark"] .app-card-unavailable {
  background-color: #12161c !important;
  opacity: 0.65 !important;
}

/* The result toolbar (count, filter chip, sort) of the home page, /results/ and the listing pages is a sticky bar
   below 992 px, and site.css paints that bar white at 95% in both themes. On the dark canvas the count and the chip
   label read 1.07:1 and 2.09:1 on it. The bar takes the canvas colour at the same opacity inside the same query, so
   that nothing changes from 992 px up; the rule wins by specificity, not by !important. */
@media (max-width: 991.98px) {
  html[data-theme="dark"] .app-toolbar {
    background: rgba(13, 17, 23, 0.95);
    border-bottom-color: rgba(240, 246, 252, 0.1);
  }
}

/* Similar Apps Carousel on app-details.html */
html[data-theme="dark"] .similar-apps-fade-left {
  background: linear-gradient(to right, #0d1117 15%, rgba(13, 17, 23, 0)) !important;
}

html[data-theme="dark"] .similar-apps-fade-right {
  background: linear-gradient(to left, #0d1117 15%, rgba(13, 17, 23, 0)) !important;
}

html[data-theme="dark"] .similar-apps-arrow-btn {
  background-color: #161b22 !important;
  border: 1px solid rgba(240, 246, 252, 0.2) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .similar-apps-arrow-btn:hover {
  background-color: #21262d !important;
  border-color: #58a6ff !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .similar-skeleton-thumb,
html[data-theme="dark"] .similar-skeleton-title,
html[data-theme="dark"] .similar-skeleton-text,
html[data-theme="dark"] .similar-skeleton-btn {
  background: linear-gradient(90deg, #161b22 25%, #21262d 50%, #161b22 75%) !important;
  background-size: 200% 100% !important;
}

/* ==========================================================================
   Section 23: Hover Preview Panel
   ========================================================================== */
html[data-theme="dark"] .app-preview-panel {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .app-preview-panel-caption {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .app-preview-panel.is-loading .app-preview-panel-img-wrap {
  background: linear-gradient(90deg, #161b22 25%, #21262d 50%, #161b22 75%) !important;
  background-size: 200% 100% !important;
}

/* ==========================================================================
   Section 24: Left Rail (Categories)
   ========================================================================== */
html[data-theme="dark"] .app-layout-main {
  border-left-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .app-rail-heading {
  color: #8b949e !important;
}

/* Explore links (All Apps ... Newly Added). Space/Front paints a selected, hovered or focused vertical-pills
   link navy (#21325b, specificity 0,4,0) on a translucent grey pill; the generic dark link colour
   (a:not(.btn), 0,2,2) loses to it, which left the selected link at 1.02:1 contrast. These rules out-rank the
   theme through specificity (0,5,1 and up), not !important. The rule for a selected link that is also hovered
   or focused is more specific than the plain hover/focus rule, so it never depends on source order. The pill
   itself is the theme's own rgba(189, 197, 209, 0.2): over the page body (#0d1117) or the offcanvas drawer
   (#161b22), #79c0ff reads at 6.3:1 / 5.6:1 and #e6edf3 at 10.4:1 / 9.3:1 (the resting #58a6ff would only
   reach 4.3:1 on the drawer's pill, which is why hover and focus do not reuse it). */
html[data-theme="dark"] .app-rail-nav .nav-pills .nav-link:hover,
html[data-theme="dark"] .app-rail-nav .nav-pills .nav-link:focus {
  color: #79c0ff;
}

html[data-theme="dark"] .app-rail-nav .nav-pills .nav-link.active,
html[data-theme="dark"] .app-rail-nav .nav-pills .nav-link.active:hover,
html[data-theme="dark"] .app-rail-nav .nav-pills .nav-link.active:focus {
  color: #e6edf3;
}

/* The thin line between the movement lists and the totals. */
html[data-theme="dark"] .app-rail-nav .app-rail-divider {
  border-top-color: rgba(240, 246, 252, 0.14);
}

/* "See all ..." buttons: the brand violet of .btn-link reads 2.4:1 on the dark page and 2.2:1 on the drawer; #58a6ff
   reads 7.5:1 and 6.9:1, #79c0ff (hover, focus) 9.7:1 and 8.9:1. Specificity (0,3,1), no !important. */
html[data-theme="dark"] .app-rail-nav .js-rail-show-all {
  color: #58a6ff;
}

html[data-theme="dark"] .app-rail-nav .js-rail-show-all:hover,
html[data-theme="dark"] .app-rail-nav .js-rail-show-all:focus {
  color: #79c0ff;
}

/* The empty note of the filter, 6.2:1 on the page and 5.6:1 on the drawer. */
html[data-theme="dark"] .app-rail-nav .app-rail-empty {
  color: #8b949e;
}

/* The filter's placeholder: the global dark placeholder is #6e7681 !important (4.1:1), so this one has to be important
   too; #8b949e reads 6.2:1. */
html[data-theme="dark"] .app-rail-nav .js-rail-filter::placeholder {
  color: #8b949e !important;
}

/* The chip of the category in force. The global dark chip colours above are !important, so the state is important
   too; #79c0ff on the blue tint reads 7.6:1 on the page and 6.8:1 on the drawer. Bold in site.css as well. */
html[data-theme="dark"] .app-rail-nav .app-rail-tag.active {
  color: #79c0ff !important;
  background-color: rgba(88, 166, 255, 0.16) !important;
  border-color: rgba(88, 166, 255, 0.5);
}

html[data-theme="dark"] .app-rail-nav .app-rail-tag.active:hover,
html[data-theme="dark"] .app-rail-nav .app-rail-tag.active:focus {
  color: #79c0ff !important;
  background-color: rgba(88, 166, 255, 0.24) !important;
  border-color: rgba(88, 166, 255, 0.7);
}

/* The two text buttons under each tag list of the rail ("See all ..." and "A-Z index") are Bootstrap link buttons: the
   theme paints them #3f00ff, which read 2.39:1 on the dark canvas (#0d1117) and 2.19:1 on the offcanvas drawer
   (#161b22). #58a6ff reads 7.49:1 and 6.85:1; hover and focus take #79c0ff (9.73:1 and 8.89:1). */
html[data-theme="dark"] .app-rail-nav .btn-link {
  color: #58a6ff;
}

html[data-theme="dark"] .app-rail-nav .btn-link:hover,
html[data-theme="dark"] .app-rail-nav .btn-link:focus-visible {
  color: #79c0ff;
}

html[data-theme="dark"] .app-rail::-webkit-scrollbar-thumb {
  background: rgba(240, 246, 252, 0.2) !important;
}

/* The "New!" badge of Platforms sits on the page, the drawer, and the pill the theme paints under a hovered, focused or
   selected link (rgba(189, 197, 209, 0.2)). The theme's info cyan #09a5be read 6.4:1 and 5.9:1 at rest but 4.19:1 on
   the page's pill and 3.72:1 on the drawer's; #45cbe2 reads 9.8:1 and 9.0:1 at rest and 6.4:1 and 5.7:1 on the pills.
   site.css gives the light theme a darker colour; this selector (0,3,1) out-ranks it and the dark `span { color:
   inherit }`. */
html[data-theme="dark"] .app-rail-nav .app-rail-new {
  color: #45cbe2;
}

/* "Sort:" used to be .text-muted, which is #8b949e here (6.2:1 on the page, 5.6:1 on the button); its own class takes
   the same colour. */
html[data-theme="dark"] .app-toolbar-sort-prefix {
  color: #8b949e;
}

/* ==========================================================================
   Section 25: Search & Typeahead
   ========================================================================== */
html[data-theme="dark"] .input-card,
html[data-theme="dark"] .input-card-pill,
html[data-theme="dark"] .app-search-card {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  box-shadow: 0 0.1875rem 0.75rem rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .input-card .form-control {
  background-color: transparent !important;
  border: 0 !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .input-card .form-control:focus {
  background-color: transparent !important;
  border: 0 !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .input-card:focus-within {
  border-color: #58a6ff !important;
  box-shadow: 0 0 0 0.25rem rgba(56, 139, 253, 0.25) !important;
}

html[data-theme="dark"] .app-search-suggest {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .app-search-suggest-item {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .app-search-suggest-item:hover {
  background-color: #21262d !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .app-search-suggest-category {
  color: #8b949e !important;
}

/* ==========================================================================
   Section 26: Dashboard Shell & DNS Subpages
   ========================================================================== */
html[data-theme="dark"] {
  --dash-primary: #58a6ff;
  --dash-success: #3fb950;
  --dash-danger: #f85149;
  --dash-warning: #d29922;
  --dash-warning-text: #d29922;
  --dash-secondary: #8b949e;
  --dash-dark: #e6edf3;
  --dash-border: rgba(240, 246, 252, 0.1);
  --dash-card-shadow: 0 0.1875rem 0.75rem rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .manage-card {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .instance-row {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .instance-chip,
html[data-theme="dark"] .instance-tag-editor-chip {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .usage-chart-card {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .affiliate-stat {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .affiliate-stat-value {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .affiliate-code {
  background-color: #21262d !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .manage-dl-row {
  border-top-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .manage-dl-row dd {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .manage-hint {
  color: #8b949e !important;
}

html[data-theme="dark"] #vps-resize-btn:disabled {
  background-color: #21262d !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
  color: #8b949e !important;
}

html[data-theme="dark"] .subpage-dns-status-ok {
  color: #3fb950 !important;
}

html[data-theme="dark"] .subpage-dns-status-pending {
  color: #d29922 !important;
}

html[data-theme="dark"] .subpage-tier-option {
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .subpage-tier-option:hover {
  border-color: rgba(88, 166, 255, 0.5) !important;
}

html[data-theme="dark"] .subpage-tier-label {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .js-copy-btn {
  color: #8b949e !important;
}

html[data-theme="dark"] .js-copy-btn:hover {
  color: #58a6ff !important;
}

/* ==========================================================================
   Section 27: Dashboard Tabs & Header Balance
   ========================================================================== */
html[data-theme="dark"] .dashboard-tabs-bar {
  border-bottom-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link {
  color: #8b949e !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link:hover {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link.active {
  color: #58a6ff !important;
  border-bottom-color: #58a6ff !important;
}

html[data-theme="dark"] .dashboard-balance.black {
  color: #e6edf3 !important;
}

/* ==========================================================================
   Section 28: Pricing Page
   ========================================================================== */
html[data-theme="dark"] .pricing-tier {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.12) !important;
}

html[data-theme="dark"] .pricing-tier:hover {
  border-color: rgba(88, 166, 255, 0.4) !important;
}

html[data-theme="dark"] .pricing-tier-toggle {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-tier-specs {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-tier-sep {
  color: #484f58 !important;
}

html[data-theme="dark"] .pricing-tier-monthly {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-tier-hourly {
  color: #8b949e !important;
}

html[data-theme="dark"] .pricing-tier-chevron {
  color: #8b949e !important;
}

html[data-theme="dark"] .pricing-compare {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .pricing-compare-heading {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-compare-table {
  --bs-table-color: #e6edf3 !important;
  --bs-table-bg: transparent !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-compare-table thead th {
  color: #8b949e !important;
  border-bottom-color: rgba(240, 246, 252, 0.15) !important;
}

html[data-theme="dark"] .pricing-compare-table tr {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-compare-table th,
html[data-theme="dark"] .pricing-compare-table td {
  color: #e6edf3 !important;
  border-bottom-color: rgba(240, 246, 252, 0.08) !important;
}

html[data-theme="dark"] .pricing-compare-table tbody th[scope="row"] {
  color: #e6edf3 !important;
  font-weight: 500 !important;
}

html[data-theme="dark"] .pricing-plan-name {
  color: #8b949e !important;
}

html[data-theme="dark"] .pricing-compare-table .pricing-price {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .pricing-compare-table .pricing-compare-us,
html[data-theme="dark"] .pricing-compare-us {
  background-color: rgba(56, 139, 253, 0.15) !important;
}

html[data-theme="dark"] .pricing-compare-table .pricing-compare-us > * {
  background-color: rgba(56, 139, 253, 0.15) !important;
  color: #58a6ff !important;
  font-weight: 700 !important;
}

html[data-theme="dark"] .pricing-compare-us th,
html[data-theme="dark"] .pricing-compare-us td,
html[data-theme="dark"] .pricing-compare-table .pricing-compare-us th[scope="row"],
html[data-theme="dark"] .pricing-compare-table .pricing-compare-us .pricing-price,
html[data-theme="dark"] .pricing-compare-us th[scope="row"],
html[data-theme="dark"] .pricing-compare-us .pricing-price {
  color: #58a6ff !important;
  font-weight: 700 !important;
}

html[data-theme="dark"] .pricing-compare-table tbody tr:not(.pricing-compare-us):hover {
  background-color: rgba(240, 246, 252, 0.04) !important;
}

html[data-theme="dark"] .pricing-compare-table tbody tr:not(.pricing-compare-us):hover > * {
  background-color: rgba(240, 246, 252, 0.04) !important;
}

html[data-theme="dark"] .scaling-cell {
  background-color: #21262d !important;
}

html[data-theme="dark"] .scaling-cell.is-active {
  background-color: #58a6ff !important;
}

/* ==========================================================================
   Section 29: Billing (history tables, Top Up Your Balance and Auto Recharge cards)
   One rule per colour-bearing class in static/css/billing-credits.css.
   The card rules are written without !important: each selector is the theme
   attribute plus two classes, which out-ranks the two-class light rules and
   the generic typography rules above. The two history-table rules keep the
   !important they had before the cards existed.
   ========================================================================== */
html[data-theme="dark"] .billing-history-table td {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .billing-history-table th {
  color: #8b949e !important;
}

html[data-theme="dark"] .billing-section .billing-method-badge-primary {
  color: #79c0ff;
  background-color: rgba(56, 139, 253, 0.15);
}

html[data-theme="dark"] .billing-section .billing-chip-once {
  color: #c9d1d9;
  background-color: #21262d;
}

html[data-theme="dark"] .billing-section .billing-section-title,
html[data-theme="dark"] .billing-section .billing-subtitle,
html[data-theme="dark"] .billing-section .billing-method-label {
  color: #e6edf3;
}

html[data-theme="dark"] .billing-section .billing-lede,
html[data-theme="dark"] .billing-section .billing-summary-caption,
html[data-theme="dark"] .billing-section .billing-hint,
html[data-theme="dark"] .billing-section .billing-facts,
html[data-theme="dark"] .billing-section .billing-method-meta {
  color: #8b949e;
}

html[data-theme="dark"] .billing-section .billing-help:focus-visible,
html[data-theme="dark"] .billing-section .billing-how-summary:focus-visible {
  outline-color: #58a6ff;
}

/* "How it works" accordion: hairline dividers, a readable summary, a muted chevron. */
html[data-theme="dark"] .billing-section .billing-how {
  border-top-color: rgba(240, 246, 252, 0.1);
  border-bottom-color: rgba(240, 246, 252, 0.1);
}

html[data-theme="dark"] .billing-section .billing-how-summary {
  color: #e6edf3;
}

html[data-theme="dark"] .billing-section .billing-how-summary:hover {
  color: #79c0ff;
}

html[data-theme="dark"] .billing-section .billing-how-chevron {
  color: #8b949e;
}

html[data-theme="dark"] .billing-section .billing-status-pill.is-on {
  color: #3fb950;
  background-color: rgba(46, 160, 67, 0.15);
}

html[data-theme="dark"] .billing-section .billing-status-pill.is-off {
  color: #8b949e;
  background-color: #21262d;
}

html[data-theme="dark"] .billing-section .billing-summary {
  color: #e6edf3;
  background-color: #0d1117;
  border-color: rgba(240, 246, 252, 0.1);
}

html[data-theme="dark"] .billing-section .billing-notice-info {
  color: #79c0ff;
  background-color: rgba(56, 139, 253, 0.12);
  border-color: rgba(56, 139, 253, 0.4);
}

html[data-theme="dark"] .billing-section .billing-notice-warning {
  color: #e3b341;
  background-color: rgba(187, 128, 9, 0.15);
  border-color: rgba(187, 128, 9, 0.4);
}

html[data-theme="dark"] .billing-section .billing-payment-methods {
  border-top-color: rgba(240, 246, 252, 0.1);
}

html[data-theme="dark"] .billing-section .billing-method-list .list-group-item {
  color: #e6edf3;
  background-color: transparent;
  border-color: rgba(240, 246, 252, 0.1);
}

html[data-theme="dark"] .billing-section .billing-method-badge-expired {
  color: #ff7b72;
  background-color: rgba(248, 81, 73, 0.15);
}

html[data-theme="dark"] .billing-section .billing-method-add {
  color: #79c0ff;
  border-color: rgba(240, 246, 252, 0.25);
}

html[data-theme="dark"] .billing-section .billing-method-add:hover,
html[data-theme="dark"] .billing-section .billing-method-add:focus-visible {
  border-color: #58a6ff;
  background-color: rgba(56, 139, 253, 0.1);
}

/* ==========================================================================
   Section 30: MCP Portal & 2FA Setup
   ========================================================================== */
html[data-theme="dark"] .mcp-config-code-wrap {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .mcp-compare-card {
  background-color: rgba(240, 246, 252, 0.03) !important;
  border-color: rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .mcp-api-table code {
  color: #79c0ff !important;
}

html[data-theme="dark"] .mcp-key-prefix {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .alert.mcp-key-alert {
  background-color: rgba(56, 139, 253, 0.1) !important;
  border-color: rgba(56, 139, 253, 0.25) !important;
}

/* Install guides (Connect Your AI Agent): the text, tint and tile properties of mcp-dashboard.css are set again for
   the dark canvas (4.5:1 on the card and on the tinted surfaces), the row has a rule of its own for its surface, and
   the tile of a row swaps its pair of vendor images (the light image is hidden, the dark one shown; a row with one
   file has no pair and shows it in both themes). The generic rule "p, li, span { color: inherit }" of Section 2
   outranks a one-class selector, so each paragraph or span that the page colours is restated below; headings keep the
   site-wide heading colour. Each selector is more specific than the rule it replaces, so none needs !important. */
html[data-theme="dark"] .mcp-install-groups,
html[data-theme="dark"] .mcp-install-notice {
  --mcp-install-muted: #9aa4af;
  --mcp-install-accent: var(--dash-primary);
  --mcp-install-tint: rgba(88, 166, 255, 0.10);
  --mcp-install-tint-strong: rgba(88, 166, 255, 0.16);
  --mcp-install-tint-border: rgba(88, 166, 255, 0.30);
  --mcp-install-tile-bg: #0d1117;
  --mcp-install-tile-border: rgba(240, 246, 252, 0.16);
}

html[data-theme="dark"] .mcp-install-row {
  background-color: rgba(240, 246, 252, 0.03);
}

html[data-theme="dark"] .mcp-install-tile .mcp-install-icon-light {
  display: none;
}

html[data-theme="dark"] .mcp-install-tile .mcp-install-icon-dark {
  display: block;
}

html[data-theme="dark"] .mcp-install-verify-label {
  color: var(--mcp-install-accent);
}

html[data-theme="dark"] .mcp-install-status,
html[data-theme="dark"] .mcp-install-snippet-label,
html[data-theme="dark"] .mcp-install-verify-note,
html[data-theme="dark"] .mcp-install-sources-label,
html[data-theme="dark"] .mcp-install-source-date,
html[data-theme="dark"] .mcp-install-notice {
  color: var(--mcp-install-muted);
}

html[data-theme="dark"] .nav.mcp-install-modes .nav-link:hover {
  background-color: rgba(240, 246, 252, 0.08);
}

/* 2FA Setup (setup-2fa.html) */
html[data-theme="dark"] .secret-box {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .form-control-custom {
  background-color: #0d1117 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
  color: #e6edf3 !important;
}

html[data-theme="dark"] .alternative-steps-link {
  border-top-color: rgba(240, 246, 252, 0.1) !important;
  color: #58a6ff !important;
}

html[data-theme="dark"] .back-link {
  color: #58a6ff !important;
}

html[data-theme="dark"] .qr-code-container {
  background-color: #ffffff !important;
}

/* ==========================================================================
   Section 31: AI Deploy
   ========================================================================== */
html[data-theme="dark"] .model-picker-dropdown {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .ai-chat-topbar {
  border-bottom: 1px solid rgba(240, 246, 252, 0.1) !important;
  background-color: #161b22 !important;
}

html[data-theme="dark"] .ai-chat-bar {
  color: #8b949e !important;
}

html[data-theme="dark"] .ai-chat-bar .repo-name {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .ai-chat-wrapper iframe {
  background-color: #0d1117 !important;
}

html[data-theme="dark"] .ai-chat-error {
  background-color: #161b22 !important;
  border: 1px solid rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .ai-chat-error .error-title {
  color: #e6edf3 !important;
}

/* The AI deploy status page's secondary text (dashboard.css): the value the
   dark theme gives .text-muted, 6.15:1 on the canvas and 5.62:1 on a panel.
   The link form equals the specificity of the theme's own link colour and
   comes after it, so the quiet "Back to Dashboard" link stays quiet. */
html[data-theme="dark"] .deploy-status-note,
html[data-theme="dark"] a.deploy-status-note {
  color: #8b949e;
}

/* ==========================================================================
   Section 32: Footer & Back-To-Top
   ========================================================================== */
html[data-theme="dark"] .site-footer {
  background-color: #161b22 !important;
  border-top: 1px solid rgba(240, 246, 252, 0.1) !important;
}

html[data-theme="dark"] .site-footer a {
  color: #8b949e !important;
}

html[data-theme="dark"] .site-footer a:hover {
  color: #58a6ff !important;
}

html[data-theme="dark"] .site-cta {
  background-color: #161b22 !important;
  border-color: rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .site-cta-heading {
  color: #e6edf3 !important;
}

html[data-theme="dark"] .site-cta-copy {
  color: #8b949e !important;
}

html[data-theme="dark"] .site-cta-note {
  color: #6e7681 !important;
}

html[data-theme="dark"] .app-back-to-top {
  background-color: #161b22 !important;
  color: #58a6ff !important;
  border: 1px solid rgba(240, 246, 252, 0.14) !important;
}

html[data-theme="dark"] .app-back-to-top:hover {
  background-color: #21262d !important;
  color: #79c0ff !important;
}

/* ==========================================================================
   Section 33: Pay with crypto (USDT)
   One rule per colour-bearing class in static/css/crypto-pay.css. The cards,
   titles, ledes, chips, notices and actions of /billing/crypto are the
   .billing-section classes that Section 29 already covers. The rules are
   written without !important: each selector is the theme attribute plus two
   classes, which out-ranks the two-class light rules. The QR tile stays white
   in this theme too: a scanner needs dark modules on a light ground.
   ========================================================================== */
html[data-theme="dark"] .crypto-pay .crypto-only {
  color: #e3b341;
  background-color: rgba(187, 128, 9, 0.15);
  border-color: rgba(187, 128, 9, 0.6);
}

html[data-theme="dark"] .crypto-pay .crypto-qr-tile {
  background-color: #ffffff;
  border-color: rgba(240, 246, 252, 0.25);
}

html[data-theme="dark"] .crypto-pay .crypto-address {
  color: #8b949e;
  background-color: #0d1117;
  border-color: rgba(240, 246, 252, 0.14);
}

html[data-theme="dark"] .crypto-pay .crypto-quote {
  background-color: #0d1117;
  border-color: rgba(240, 246, 252, 0.14);
}

html[data-theme="dark"] .crypto-pay .crypto-amount-input[aria-invalid="true"] {
  border-color: #ff7b72;
}

html[data-theme="dark"] .crypto-pay .crypto-quote-change a {
  color: #79c0ff;
}

html[data-theme="dark"] .crypto-pay .crypto-address-edge,
html[data-theme="dark"] .crypto-pay .crypto-label,
html[data-theme="dark"] .crypto-pay .crypto-quote-lead,
html[data-theme="dark"] .crypto-pay .crypto-send-amount,
html[data-theme="dark"] .crypto-pay .crypto-countdown,
html[data-theme="dark"] .crypto-pay .crypto-subtitle,
html[data-theme="dark"] .crypto-pay .crypto-headline,
html[data-theme="dark"] .crypto-pay .crypto-ack,
html[data-theme="dark"] .crypto-pay .crypto-ack-label,
html[data-theme="dark"] .crypto-pay .crypto-deposit-status,
html[data-theme="dark"] .crypto-pay .crypto-deposit-amount {
  color: #e6edf3;
}

html[data-theme="dark"] .crypto-pay .crypto-ends,
html[data-theme="dark"] .crypto-pay .crypto-amount-hint,
html[data-theme="dark"] .crypto-pay .crypto-send,
html[data-theme="dark"] .crypto-pay .crypto-another-amount,
html[data-theme="dark"] .crypto-pay .crypto-detail,
html[data-theme="dark"] .crypto-pay .crypto-cancel-text,
html[data-theme="dark"] .crypto-pay .crypto-quiet-button,
html[data-theme="dark"] .dashboard-page .crypto-pay-lede,
html[data-theme="dark"] .crypto-pay .crypto-deposit-credit,
html[data-theme="dark"] .crypto-pay .crypto-deposit-note,
html[data-theme="dark"] .crypto-pay .crypto-deposit-meta,
html[data-theme="dark"] .crypto-pay .crypto-support {
  color: #8b949e;
}

html[data-theme="dark"] .crypto-pay .crypto-copy-status {
  color: #3fb950;
}

html[data-theme="dark"] .crypto-pay .crypto-copy-failed,
html[data-theme="dark"] .crypto-pay .crypto-field-error {
  color: #ff7b72;
}

html[data-theme="dark"] .crypto-pay .crypto-step {
  color: #8b949e;
}

html[data-theme="dark"] .crypto-pay .crypto-step-done {
  color: #3fb950;
}

html[data-theme="dark"] .crypto-pay .crypto-step-current {
  color: #79c0ff;
}

html[data-theme="dark"] .crypto-pay .crypto-fact,
html[data-theme="dark"] .crypto-pay .crypto-fact:last-child,
html[data-theme="dark"] .crypto-pay .crypto-cancel,
html[data-theme="dark"] .crypto-pay .crypto-deposit,
html[data-theme="dark"] .crypto-pay .crypto-deposit:last-child {
  border-color: rgba(240, 246, 252, 0.1);
}

html[data-theme="dark"] .crypto-pay .crypto-fact dt {
  color: #e6edf3;
}

html[data-theme="dark"] .crypto-pay .crypto-fact dd {
  color: #8b949e;
}

html[data-theme="dark"] .crypto-pay .crypto-deposit-confirming .crypto-deposit-status,
html[data-theme="dark"] .crypto-pay .crypto-deposit-crediting .crypto-deposit-status,
html[data-theme="dark"] .crypto-pay .crypto-deposit-finality .crypto-deposit-status {
  color: #79c0ff;
}

html[data-theme="dark"] .crypto-pay .crypto-deposit-credited .crypto-deposit-status {
  color: #3fb950;
}

html[data-theme="dark"] .crypto-pay .crypto-deposit-review .crypto-deposit-status {
  color: #e3b341;
}

html[data-theme="dark"] .crypto-pay .crypto-deposit-reversed .crypto-deposit-status,
html[data-theme="dark"] .crypto-pay .crypto-deposit-not-credited .crypto-deposit-status {
  color: #ff7b72;
}

html[data-theme="dark"] .billing-section .billing-crypto-link a {
  color: #79c0ff;
}

/* ==========================================================================
   Section 34: New-device code page
   One rule per colour-bearing class in static/css/device-verification.css (the
   /verify-device page of the sign-in). Every selector is the theme attribute,
   the page root class and one more class, written without !important: that
   out-ranks the two-class light rules. The code field is not a .form-control,
   so no !important rule of Section 8 reaches it. Every text keeps a contrast
   of 4.5:1 or more on the surface it sits on, and the border of the field 3:1.
   ========================================================================== */
html[data-theme="dark"] .device-verify .device-verify-card {
  background-color: #161b22;
  border-color: rgba(240, 246, 252, 0.14);
  box-shadow: 0 0.375rem 1.5rem rgba(1, 4, 9, 0.45);
}

html[data-theme="dark"] .device-verify .device-verify-icon {
  color: #79c0ff;
  background-color: rgba(56, 139, 253, 0.15);
}

html[data-theme="dark"] .device-verify .device-verify-title,
html[data-theme="dark"] .device-verify .device-verify-address,
html[data-theme="dark"] .device-verify .device-verify-label,
html[data-theme="dark"] .device-verify .device-verify-remember {
  color: #e6edf3;
}

html[data-theme="dark"] .device-verify .device-verify-lead,
html[data-theme="dark"] .device-verify .device-verify-status,
html[data-theme="dark"] .device-verify .device-verify-timer {
  color: #c9d1d9;
}

html[data-theme="dark"] .device-verify .device-verify-help {
  color: #9ea7b3;
}

html[data-theme="dark"] .device-verify .device-verify-error {
  color: #ff9a92;
  background-color: rgba(248, 81, 73, 0.15);
  border-color: rgba(248, 81, 73, 0.5);
}

html[data-theme="dark"] .device-verify .device-verify-notice {
  color: #e3b341;
  background-color: rgba(187, 128, 9, 0.15);
  border-color: rgba(187, 128, 9, 0.5);
}

html[data-theme="dark"] .device-verify .device-code-input {
  color: #e6edf3;
  background-color: #0d1117;
  border-color: #7d8590;
}

html[data-theme="dark"] .device-verify .device-code-input::placeholder {
  color: #8b949e;
}

html[data-theme="dark"] .device-verify .device-code-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 0.25rem rgba(88, 166, 255, 0.3);
}

html[data-theme="dark"] .device-verify .device-code-input[aria-invalid="true"] {
  border-color: #ff7b72;
}

html[data-theme="dark"] .device-verify .device-code-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 123, 114, 0.3);
}

html[data-theme="dark"] .device-verify .device-code-input[readonly] {
  background-color: #161b22;
}

html[data-theme="dark"] .device-verify .device-verify-remember input {
  accent-color: #388bfd;
}

html[data-theme="dark"] .device-verify .device-verify-submit {
  color: #ffffff;
  background-color: #1f6feb;
  border-color: #1f6feb;
}

html[data-theme="dark"] .device-verify .device-verify-submit:hover,
html[data-theme="dark"] .device-verify .device-verify-submit:focus {
  background-color: #1a5fc9;
  border-color: #1a5fc9;
}

html[data-theme="dark"] .device-verify .device-verify-resend {
  border-top-color: rgba(240, 246, 252, 0.14);
}

html[data-theme="dark"] .device-verify .device-verify-resend-button {
  color: #79c0ff;
  background-color: #161b22;
  border-color: #58a6ff;
}

html[data-theme="dark"] .device-verify .device-verify-resend-button:hover,
html[data-theme="dark"] .device-verify .device-verify-resend-button:focus {
  background-color: rgba(56, 139, 253, 0.15);
}

html[data-theme="dark"] .device-verify .device-verify-resend-button:disabled {
  color: #9ea7b3;
  background-color: #21262d;
  border-color: #30363d;
}

html[data-theme="dark"] .device-verify .device-verify-back {
  color: #79c0ff;
}
