/* Shared primitives. Important declarations in this named layer take priority
   over the legacy unlayered !important rules, regardless of page specificity.
   New buttons and .modal/.modal-card dialogs inherit this contract automatically. */
:root {
  --ui-font: Poppins, Tajawal, system-ui, sans-serif;
  --ui-button-size: 14px;
  --ui-button-weight: 600;
  --ui-button-leading: 1.4;
  --ui-ink: #1c1a17;
  --ui-muted: #71717a;
  --ui-orange: #ff6a00;
  --ui-border: 1px solid rgba(0, 0, 0, .08);
}
@layer product-components {
  :where(button:not(.tabbar-btn), .btn:not(.tabbar-btn), [role="button"]:not(.tabbar-btn), input[type="button"], input[type="submit"], input[type="reset"]) {
    font-family: var(--ui-font) !important;
    font-size: var(--ui-button-size) !important;
    font-weight: var(--ui-button-weight) !important;
    line-height: var(--ui-button-leading) !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    font-style: normal !important;
  }
  :where(button:not(.tabbar-btn), .btn:not(.tabbar-btn), [role="button"]:not(.tabbar-btn)) :is(span, b, strong, small, em):not([class*="icon"]):not([class*="ph"]):not(.tab-ic) {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    text-transform: inherit !important;
  }
  :where(button, .btn, [role="button"]):focus-visible {
    outline: 2px solid var(--ui-orange) !important;
    outline-offset: 3px !important;
  }

  /* Bottom Navigation Bar: Refined, lightweight, secondary typography */
  .tabbar-btn {
    font-family: var(--ui-font) !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    color: var(--ui-muted) !important;
  }
  .tabbar-btn span {
    font-family: var(--ui-font) !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    color: var(--ui-muted) !important;
  }
  .tabbar-btn.on span {
    font-weight: 600 !important;
    color: var(--ui-orange) !important;
  }

  /* Section Headings: Consistent UPPERCASE typography across all pages */
  :is(.sec-title, .sec-h, .sub-title, .section-heading, .profile-sec-title, .prof-sec-head, .menu-group-title, .w-alloc h4, #view-detail :is(.how-card, .why-card) h4, #view-subpage :is(.card-plain, #subpage-body) > :is(h3, h4), #modal-title, #filters-title) {
    text-transform: uppercase !important;
  }

  /* Protected Exception: Headings/titles inside Property or Fund cards keep existing capitalization and typography style */
  :is(.prop-card, .fund-card, .inv-card) :is(.prop-title, .inv-title, h1, h2, h3, h4, h5, h6, b) {
    text-transform: none !important;
  }
  #d-title {
    text-transform: none !important;
  }

  /* One overlay presentation for property/fund investment, payments, academy,
     and future dialogs. The filter drawer uses the same panel geometry. */
  .modal {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 120 !important;
    background: rgba(20, 12, 8, .48) !important;
    backdrop-filter: blur(6px) !important;
  }
  .modal.hidden { display: none !important; }
  .modal-card, .filters-drawer {
    box-sizing: border-box !important;
    background: #fff !important;
    color: var(--ui-ink) !important;
    border: var(--ui-border) !important;
    box-shadow: 0 24px 60px rgba(20, 12, 8, .18) !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .modal-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    animation: none !important;
  }
  .modal-card .head-row, .filters-head {
    position: relative !important;
    top: auto !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    background: #fff !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    border-bottom: var(--ui-border) !important;
  }
  #modal-title, #filters-title {
    font-family: var(--ui-font) !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: var(--ui-ink) !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    margin: 0 !important;
  }
  #modal-close, #filters-close {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
    display: grid !important;
    place-items: center !important;
    border: var(--ui-border) !important;
    box-shadow: none !important;
    background: #fff !important;
    padding: 0 !important;
  }
  #modal-body, .filters-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom)) !important;
    scroll-padding-block: 16px 120px;
  }
  .filters-drawer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    transform: translateY(105%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: 100000 !important;
    transition: transform .2s ease, opacity .2s ease !important;
  }
  .filters-drawer.open {
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    z-index: 100000 !important;
  }
  .filters-handle {
    flex: 0 0 4px;
    width: 36px !important;
    height: 4px !important;
    margin: 10px auto 0 !important;
    background: #d4d4d8 !important;
  }
  #filters-apply {
    flex: 0 0 auto !important;
    width: calc(100% - 40px) !important;
    margin: 12px 20px calc(16px + env(safe-area-inset-bottom)) !important;
  }
  :is(.modal-card, .filters-drawer) :is(.input, select, textarea) {
    font-family: var(--ui-font) !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    background: #fff !important;
    color: var(--ui-ink) !important;
    border: 1px solid rgba(0,0,0,.12) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    min-height: 48px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
  }
  :is(.modal-card, .filters-drawer) :is(.btn, .aq, .pchip, .slide-cancel) {
    min-height: 44px !important;
    box-shadow: none !important;
  }
  .modal-card .invest-flow {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  .modal-card :is(.invest-entry, .invest-payment) {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    min-width: 0 !important;
  }
  .modal-card .lbl {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--ui-ink) !important;
    margin: 0 0 8px !important;
  }
  .modal-card .hint {
    font-size: 13px !important;
    line-height: 1.6 !important;
    color: var(--ui-muted) !important;
    margin: 0 !important;
  }
  .modal-card :is(.amt-quick, .pay-chips) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  .modal-card :is(.aq, .pchip) {
    flex: 1 1 auto !important;
    background: #fff !important;
    color: var(--ui-ink) !important;
    border: 1px solid rgba(0,0,0,.12) !important;
    border-radius: 999px !important;
    padding: 10px 16px !important;
  }
  .modal-card :is(.aq, .pchip).on {
    color: #fff !important;
    background: var(--ui-orange) !important;
    border-color: var(--ui-orange) !important;
  }
  .modal-card .calc-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 0 !important;
  }
  .modal-card .calc-grid > div {
    padding: 14px !important;
    border: var(--ui-border) !important;
    border-radius: 18px !important;
    background: #fff !important;
    min-width: 0 !important;
    box-shadow: none !important;
  }
  .modal-card .calc-grid b {
    font-size: 18px !important;
    line-height: 1.35 !important;
    color: var(--ui-ink) !important;
    overflow-wrap: anywhere;
  }
  .modal-card .calc-grid span {
    display: block !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    color: var(--ui-muted) !important;
    margin-top: 4px !important;
  }
  .modal-card .order-summary {
    background: #fff !important;
    border: var(--ui-border) !important;
    border-radius: 18px !important;
    padding: 16px !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
  .modal-card .os-head {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding-bottom: 16px !important;
    margin-bottom: 8px !important;
    border-bottom: var(--ui-border) !important;
  }
  .modal-card .os-head > div { min-width: 0 !important; }
  .modal-card .os-head b { font-size: 14px !important; line-height: 1.4 !important; white-space: normal !important; }
  .modal-card .os-head span { font-size: 12px !important; color: var(--ui-muted) !important; }
  .modal-card .os-thumb { width: 52px !important; height: 52px !important; border-radius: 12px !important; flex-shrink: 0 !important; }
  .modal-card .os-row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    gap: 4px 16px !important;
    padding: 8px 0 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    border: 0 !important;
  }
  .modal-card .os-row span { color: var(--ui-muted) !important; }
  .modal-card .os-row b { color: var(--ui-ink) !important; }
  .modal-card :is(.dialog-actions, #slide-zone) {
    position: sticky !important;
    bottom: calc(-20px - env(safe-area-inset-bottom)) !important;
    z-index: 5 !important;
    background: #fff !important;
    border-top: var(--ui-border) !important;
    margin-top: 16px !important;
    padding: 16px 0 calc(16px + env(safe-area-inset-bottom)) !important;
  }
  .dialog-actions .btn { width: 100% !important; margin: 0 !important; }
  .modal-card .slider-wrap { margin: 0 !important; }
  .modal-card .slide-track {
    height: 48px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #fff2ea !important;
    box-shadow: none !important;
  }
  .modal-card .slide-label {
    font-family: var(--ui-font) !important;
    font-size: var(--ui-button-size) !important;
    font-weight: var(--ui-button-weight) !important;
    color: var(--ui-ink) !important;
    text-shadow: none !important;
  }
  .modal-card .slide-thumb {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: var(--ui-orange) !important;
    color: #fff !important;
    box-shadow: none !important;
  }
  .modal-card .slide-cancel { margin-top: 8px !important; }
  .modal-card .msg:empty { display: none !important; }

  /* The detail CTA is fixed independently of page length. Its measured height
     provides clearance for every label length, viewport and safe area. */
  #view-detail {
    padding-bottom: calc(var(--detail-cta-height, 260px) + 32px) !important;
    /* A transformed ancestor turns a fixed child into a page-relative box. */
    transform: none !important;
    will-change: auto !important;
    animation: none !important;
  }
  #view-detail .d-bottom {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: 0 -4px 20px rgba(20, 12, 8, 0.06) !important;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom)) !important;
    z-index: 55 !important;
  }
  #view-detail .d-cta-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
  }
  #view-detail .d-cta-chips {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
  }
  #view-detail .d-amt-chip {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    height: 24px !important;
    min-height: 24px !important;
    padding: 0 4px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    box-sizing: border-box !important;
  }
  #view-detail .d-amt-chip b {
    font-size: 9.5px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }
  #view-detail .d-amt-chip span {
    font-size: 8.5px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }
  #view-detail .d-bottom .hidden { display: none !important; }
  #view-detail .d-cta-earn {
    font-size: 9px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    text-align: center !important;
  }
  #view-detail .d-cta-sub {
    font-size: 8.5px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    text-align: center !important;
  }
  #view-detail .d-cta-sub :is(.cta-shares, .hot, .pill-open) {
    font-size: 8px !important;
    padding: 1px 4px !important;
    border-radius: 4px !important;
  }
  #view-detail #start-invest {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    margin: 0 !important;
    background: #FF6A00 !important;
    color: #FFFFFF !important;
    box-shadow: 0 3px 12px rgba(255, 106, 0, 0.28) !important;
  }
  #screen-app:has(#view-detail:not(.hidden)) .tabbar { display: none !important; }

  @media (min-width: 768px) {
    .modal { align-items: center !important; padding: 24px !important; }
    .modal-card, .filters-drawer {
      width: min(100%, 600px) !important;
      max-width: 600px !important;
      max-height: calc(100dvh - 48px) !important;
      border-radius: 24px !important;
    }
    .filters-drawer {
      top: 50% !important;
      left: 50% !important;
      right: auto !important;
      bottom: auto !important;
      transform: translate(-50%, -48%) !important;
    }
    .filters-drawer.open { transform: translate(-50%, -50%) !important; }
    .filters-handle { display: none !important; }
    .modal-card::before { display: none !important; }
    .modal-card:has(#inv-amount) {
      width: min(100%, 820px) !important;
      max-width: 820px !important;
    }
    .modal-card:has(#inv-amount) .invest-flow {
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
      align-items: start !important;
      gap: 20px !important;
    }
    .modal-card .invest-entry { grid-column: 1 !important; grid-row: 1 !important; }
    .modal-card .invest-payment { grid-column: 1 !important; grid-row: 2 !important; }
    .modal-card .order-summary { grid-column: 2 !important; grid-row: 1 / span 2 !important; }
    .modal-card .invest-flow > .msg { grid-column: 1 / -1 !important; }
    .modal-card #slide-zone { grid-column: 1 / -1 !important; width: 100% !important; box-sizing: border-box !important; }
    #view-detail .d-bottom {
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      transform: none !important;
      width: 100% !important;
      max-width: 100% !important;
      border-radius: 0 !important;
      border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06) !important;
      padding: 8px 32px !important;
      background: rgba(255, 255, 255, 0.96) !important;
      backdrop-filter: blur(16px) !important;
      -webkit-backdrop-filter: blur(16px) !important;
    }
    #view-detail .d-cta-stack {
      display: grid !important;
      grid-template-columns: auto 1fr auto !important;
      gap: 6px 16px !important;
      align-items: center !important;
      max-width: 1200px !important;
      margin: 0 auto !important;
      width: 100% !important;
    }
    #view-detail .d-cta-chips {
      grid-column: 1 !important;
      grid-row: 1 / span 2 !important;
      display: flex !important;
      gap: 6px !important;
      margin: 0 !important;
      padding: 0 !important;
    }
    #view-detail .d-amt-chip {
      height: 28px !important;
      min-height: 28px !important;
      padding: 0 10px !important;
      gap: 5px !important;
      border-radius: 8px !important;
      flex: 0 0 auto !important;
    }
    #view-detail .d-amt-chip b {
      font-size: 10.5px !important;
    }
    #view-detail .d-amt-chip span {
      font-size: 9.5px !important;
    }
    #view-detail .d-cta-earn {
      grid-column: 2 !important;
      grid-row: 1 !important;
      font-size: 10px !important;
      text-align: left !important;
      margin: 0 !important;
      white-space: nowrap !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
    }
    html[dir="rtl"] #view-detail .d-cta-earn {
      text-align: right !important;
    }
    #view-detail .d-cta-sub {
      grid-column: 2 !important;
      grid-row: 2 !important;
      font-size: 9.5px !important;
      text-align: left !important;
      margin: 0 !important;
      white-space: nowrap !important;
    }
    html[dir="rtl"] #view-detail .d-cta-sub {
      text-align: right !important;
    }
    #view-detail #start-invest {
      grid-column: 3 !important;
      grid-row: 1 / span 2 !important;
      height: 38px !important;
      min-height: 38px !important;
      max-height: 38px !important;
      width: auto !important;
      padding: 0 28px !important;
      font-size: 13px !important;
      font-weight: 700 !important;
      border-radius: 9999px !important;
      white-space: nowrap !important;
    }
  }
  @media (max-width: 767px) {
    .tabbar-btn span { font-size: 10px !important; white-space: nowrap !important; line-height: 1.15 !important; }
    .tabbar-btn { min-width: 0 !important; padding-inline: 2px !important; }
  }
  @media (prefers-reduced-motion: reduce) {
    .modal, .modal-card, .filters-drawer { transition: none !important; animation: none !important; }
  }

  /* ==========================================================================
     COMPLETE PROFESSIONAL DARK MODE SYSTEM (الوضع الداكن المتقن)
     ========================================================================== */
  body.dark {
    --ui-ink: #F4F4F5;
    --ui-muted: #A1A1AA;
    --ui-border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0C0C0E !important;
    color: #F4F4F5 !important;
  }

  body.dark :is(#screen-app, .view, .screen) {
    background: #0C0C0E !important;
    color: #F4F4F5 !important;
  }

  /* Header & Action Controls */
  body.dark .app-header {
    background: rgba(12, 12, 14, 0.88) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body.dark :is(#hdr-saved, #hdr-bell, #dark-toggle, .app-header .hdr-btn) {
    background: #1E1E23 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #F4F4F5 !important;
  }
  body.dark #dark-toggle {
    --header-icon: url('/icons/sun.svg');
  }
  body.dark :is(#lang-toggle, .lang-segmented-switch) {
    background: #18181B !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }
  body.dark :is(#lang-toggle, .lang-segmented-switch) .lang-seg-btn {
    color: #A1A1AA !important;
  }
  body.dark :is(#lang-toggle, .lang-segmented-switch) .lang-seg-btn.on {
    background: #FF6A00 !important;
    color: #FFFFFF !important;
  }

  /* Floating Bottom Navigation Bar */
  body.dark .tabbar {
    background: rgba(20, 20, 24, 0.92) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5) !important;
  }
  body.dark .tabbar-btn {
    color: #A1A1AA !important;
  }
  body.dark .tabbar-btn.on {
    color: #FF6A00 !important;
  }
  body.dark .tabbar-btn span {
    color: #A1A1AA !important;
  }
  body.dark .tabbar-btn.on span {
    color: #FF6A00 !important;
  }

  /* All Surfaces & Cards */
  body.dark :is(.card-plain, .prop-card, .fund-card, .inv-card, .media-card, .notif, .tx, .how-card, .why-card, .lease-card, .guarantee-card, .q-card, .d-card, .auth-form-card, #view-wallet :is(.w-stat, .w-pnl, .w-alloc, .tx)) {
    background: #161619 !important;
    background-color: #161619 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
  }

  /* Heroes: Rich dark glowing gradients */
  body.dark :is(.nw-card, .wallet-hero, #inv-hero-card, .inv-hero, #rewards-hero-card, .rewards-hero, .prof-head) {
    background: linear-gradient(135deg, #1f140e 0%, #161619 100%) !important;
    border: 1px solid rgba(255, 106, 0, 0.22) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
    color: #F4F4F5 !important;
  }
  body.dark :is(.nw-val, .wallet-hero .w-balance) {
    color: #FF6A00 !important;
    -webkit-text-fill-color: #FF6A00 !important;
  }
  body.dark #inv-hero-card .w-balance {
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF !important;
  }
  body.dark :is(.nw-label, .w-label, .w-sub, #inv-sub, #r-tier-line) {
    color: #A1A1AA !important;
  }
  body.dark :is(.nw-row span, .w-sub-row span) {
    color: #A1A1AA !important;
  }
  body.dark :is(.nw-row b, .w-sub-row b) {
    color: #F4F4F5 !important;
  }
  body.dark .wallet-hero .w-act {
    background: #222228 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
  }
  body.dark .wallet-hero .w-act span {
    color: #F4F4F5 !important;
  }
  body.dark .w-sales-tip {
    background: #1C1C22 !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: #A1A1AA !important;
  }
  body.dark .w-sales-tip b {
    color: #FF6A00 !important;
  }

  /* Stats, Metrics & Grid Cells */
  body.dark :is(.w-stat, .hs-item, .metric, .decision-cell, .inv-rows > div, .inv-rows .w-stat, .r-step, .stat, .calc-grid > div) {
    background: #1E1E23 !important;
    background-color: #1E1E23 !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: none !important;
  }
  body.dark :is(.ws-txt b, .hs-item b, .m-val, .dc-val, .r-step b, .calc-grid b, .stat b, .tx-mid b) {
    color: #F4F4F5 !important;
    -webkit-text-fill-color: #F4F4F5 !important;
  }
  body.dark :is(.ws-txt span, .hs-item span, .m-label, .dc-label, .r-step span, .calc-grid span, .stat span, .tx-mid span) {
    color: #A1A1AA !important;
  }
  body.dark :is(.m-icon, .ws-ic, .stat-ic) {
    background: rgba(255, 106, 0, 0.12) !important;
    border-color: rgba(255, 106, 0, 0.2) !important;
  }

  /* Segmented Controls & Chips */
  body.dark :is(.seg, #home-seg, #inv-seg) {
    background: #18181B !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body.dark :is(.seg-btn) {
    color: #A1A1AA !important;
  }
  body.dark :is(.seg-btn.on) {
    background: #FF6A00 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 10px rgba(255, 106, 0, 0.3) !important;
  }
  body.dark :is(.chip, .pchip, .m-chip, .d-amt-chip) {
    background: #18181B !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    color: #A1A1AA !important;
  }
  body.dark :is(.chip.on, .pchip.on, .m-chip.on, .d-amt-chip.on) {
    background: #FF6A00 !important;
    border-color: #FF6A00 !important;
    color: #FFFFFF !important;
  }
  body.dark :is(.filters-open-btn, .sort-select-btn) {
    background: #18181B !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    color: #F4F4F5 !important;
  }

  /* Text & Headings */
  body.dark :is(h1, h2, h3, h4, h5, h6, .sec-title, .sec-h, .sub-title, .prop-title, .inv-title, .prof-name, #d-title) {
    color: #F4F4F5 !important;
    -webkit-text-fill-color: #F4F4F5 !important;
  }
  body.dark :is(.sec-count, #prop-count, #fund-count, .prop-loc-line, .hint, .d-desc, .step p, .lease-desc, .empty-note, .kyc-hint, .saved-hint, .card-price small, .d-cta-sub) {
    color: #A1A1AA !important;
  }

  /* Inputs & Forms */
  body.dark :is(.input, select, textarea) {
    background: #18181B !important;
    color: #F4F4F5 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
  }
  body.dark :is(.input, select, textarea):focus {
    border-color: #FF6A00 !important;
    box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.2) !important;
  }

  /* Progress bars */
  body.dark :is(.bar, .tier-track) {
    background: rgba(255, 255, 255, 0.10) !important;
  }
  body.dark :is(.bar-pct, .pct-n) {
    color: #A1A1AA !important;
  }

  /* Modals & Dialogs */
  body.dark .modal {
    background: rgba(0, 0, 0, 0.72) !important;
  }
  body.dark :is(.modal-card, .filters-drawer) {
    background: #161619 !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    color: #F4F4F5 !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6) !important;
  }
  body.dark :is(.head-row, .filters-head) {
    background: #161619 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body.dark :is(#modal-title, #filters-title) {
    color: #F4F4F5 !important;
  }
  body.dark :is(#modal-close, #filters-close, .round-btn) {
    background: #24242B !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
  }
  body.dark :is(.os-card, .order-summary) {
    background: #1E1E23 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
  }

  /* Profile page specific in dark mode */
  body.dark #view-profile .avatar {
    background: #18181B !important;
    border: 1px solid rgba(255, 106, 0, 0.25) !important;
  }
  body.dark #view-profile .premium-menu-label {
    background: #1C1C22 !important;
    border: 1px solid rgba(255, 106, 0, 0.16) !important;
    color: #A1A1AA !important;
  }
  body.dark #view-profile .menu-list button {
    background: #161619 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
  }
  body.dark #view-profile .menu-list button:hover {
    background: #1E1E23 !important;
    border-color: rgba(255, 106, 0, 0.3) !important;
  }
  body.dark #view-profile .menu-list button:active {
    background: #24242B !important;
  }
  body.dark #view-profile .menu-list button img {
    background: rgba(255, 106, 0, 0.12) !important;
    border: 1px solid rgba(255, 106, 0, 0.2) !important;
  }
  body.dark #view-profile .menu-list button::after {
    border-color: #71717A !important;
  }
  body.dark #view-profile #logout {
    background: #18181B !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F4F4F5 !important;
  }

  /* Property detail page in dark mode */
  body.dark #view-detail .d-bottom,
  body.dark .d-bottom {
    background: #141417 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body.dark :is(.lease-row, .faq-item, .help-row, .d-price-row, .kyc-status-row) {
    border-color: rgba(255, 255, 255, 0.08) !important;
  }
  body.dark .faq-q {
    color: #F4F4F5 !important;
  }
  body.dark .faq-a {
    color: #A1A1AA !important;
  }
  body.dark .help-row {
    background: #1E1E23 !important;
    color: #F4F4F5 !important;
  }
  body.dark .code-box {
    background: #1E1E23 !important;
    border: 1px dashed rgba(255, 106, 0, 0.4) !important;
  }
  body.dark .code-box b {
    color: #FF6A00 !important;
  }
  body.dark .sub-head {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body.dark #sub-back {
    background: #1E1E23 !important;
    color: #F4F4F5 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
}
