/**
 * 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;
  }
}

/* ==========================================================================
   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;
}

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;
}

html[data-theme="dark"] .btn-soft-secondary {
  background-color: rgba(110, 118, 129, 0.2) !important;
  color: #8b949e !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;
}

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;
}

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;
}

/* 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;
}

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

html[data-theme="dark"] .app-rail-links-list a:hover {
  color: #58a6ff !important;
}

html[data-theme="dark"] .app-rail-links-list li.active a {
  color: #58a6ff !important;
  font-weight: 600 !important;
}

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

/* ==========================================================================
   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
   ========================================================================== */
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-card span[style*="color: green"],
html[data-theme="dark"] .billing-card span[style*="color:green"] {
  color: #3fb950 !important;
}

/* ==========================================================================
   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;
}

/* 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;
}

/* ==========================================================================
   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;
}
