/* VeltraStake V76: scoped mobile dark-mode finishing
   Explicit selectors only. Do not change financial transactions or backend logic.
   Loaded after the legacy theme so prior global rules cannot paint over these components. */

/* ---- Mobile login: the main auth region should not force one full viewport
   and leave a large empty band before the legal footer. Applies to both themes. */
@media (max-width: 767px) {
  html body.v25-login .auth-layout {
    min-height: 0 !important;
    height: auto !important;
    grid-template-columns: minmax(0,1fr) !important;
    display: block !important;
  }
  html body.v25-login .auth-layout .wrap {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 14px !important;
  }
  html body.v25-login > footer.v25-footer {
    margin-top: 0 !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    box-shadow: none !important;
  }
}

/* Rewards: on short screens place the footer immediately above the fixed bottom bar.
   Main content expands instead of leaving a dark stripe beneath the footer. */
@media (max-width: 767px) {
  html body.v25-app.at-hadiah {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100dvh !important;
  }
  html body.v25-app.at-hadiah > main.page.community {
    flex: 1 0 auto !important;
    align-content: start !important;
    width: 100% !important;
  }
  html body.v25-app.at-hadiah > footer.v25-footer {
    margin-top: auto !important;
    margin-bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    flex-shrink: 0 !important;
  }
}

/* Keep all remaining visual changes scoped to dark mode. */
@layer veltra-dark {
  /* Staking: the header text was painted over by an unintended white surface.
     A text title should never be a filled tile. */
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .invest-head .invest-name {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    color: #f1f6ff !important;
    -webkit-text-fill-color: #f1f6ff !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .invest-head > div:first-child,
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .invest-head .invest-name::before,
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .invest-head .invest-name::after {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] body.ss-staking-atelier .balance-pill,
  html[data-theme="dark"] body.ss-staking-atelier .terms-row {
    background: #24354a !important;
    border-color: #455c75 !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] body.ss-staking-atelier .terms-row :is(span,a),
  html[data-theme="dark"] body.ss-staking-atelier .balance-pill :is(span,strong) {
    color: #e8f0fc !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .sa-invest-symbol {
    color: #e4eeff !important;
    background: #304b6e !important;
    border-color: #5e7da2 !important;
  }
  html[data-theme="dark"] body.ss-staking-atelier .transaction-entry .invest-card .sa-invest-symbol :is(svg,i) {
    color: inherit !important;
    stroke: currentColor !important;
    opacity: 1 !important;
  }

  /* Transfer: the summary list and title are content rows, not secondary cards.
     Remove rectangular background bands introduced by the old generic dark rules. */
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-heading,
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-breakdown,
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-row,
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-row > span,
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-heading > span {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-row {
    border: 0 !important;
    border-bottom: 1px solid #3d526a !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-break-row:last-child {
    border-bottom: 0 !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section :is(.at-break-heading strong,.at-break-row strong) {
    color: #f1f6ff !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section :is(.at-break-heading small,.at-break-row > span) {
    color: #c3d1e2 !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-icon {
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 30px !important;
    color: #e5f0ff !important;
    background: #304b6c !important;
    border: 1px solid #55779b !important;
    border-radius: 9px !important;
  }
  html[data-theme="dark"] body.ss-transfer-atelier .at-break-section .at-icon::before {
    color: #e5f0ff !important;
    opacity: 1 !important;
  }

  /* The inner number field should merge with its parent input shell, instead
     of looking like a second rectangular card inside the amount field. */
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-input-wrap {
    background: #23364b !important;
    border-color: #59728d !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-input-wrap input.f-input {
    min-width: 0 !important;
    background: transparent !important;
    background-image: none !important;
    color: #f1f6ff !important;
    -webkit-text-fill-color: #f1f6ff !important;
    box-shadow: none !important;
    border: 0 !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-input-wrap input.f-input::placeholder {
    color: #c4d1e3 !important;
    -webkit-text-fill-color: #c4d1e3 !important;
  }

  /* Withdraw: amount calculation should be an open list with separators,
     not a row of rectangular colored overlays. */
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border-top: 1px solid #41566e !important;
    border-bottom: 1px solid #41566e !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-summary-row,
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-summary-row > :is(span,strong,small) {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-summary-row {
    color: #c4d3e5 !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-summary-row strong,
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-receive {
    color: #f3f7ff !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-panel .wd-summary .wd-summary-row small {
    color: #c4d3e5 !important;
    -webkit-text-fill-color: currentColor !important;
  }

  /* Earnings icons: SVG / icon-font glyphs must contrast against their
     background. Pastel white shells + pale glyphs made them unreadable. */
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-sources .wd-source-icon {
    display: inline-grid !important;
    place-items: center !important;
    color: #e7f0ff !important;
    -webkit-text-fill-color: #e7f0ff !important;
    background: #30496a !important;
    border: 1px solid #5a789b !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-sources .wd-source-icon :is(i,svg),
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-sources .wd-source-icon::before {
    color: #e7f0ff !important;
    stroke: currentColor !important;
    -webkit-text-fill-color: #e7f0ff !important;
    opacity: 1 !important;
  }
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-sources .wd-source-row,
  html[data-theme="dark"] body.ss-withdraw-atelier .wd-sources .wd-source-label {
    background: transparent !important;
    box-shadow: none !important;
    color: #dce8f5 !important;
  }

  /* Support: make the section label and response-time note readable.
     Remove the unexpected white pill/glow under the support links. */
  html[data-theme="dark"] body.at-cs .at9-support-channels .sec-row,
  html[data-theme="dark"] body.at-cs .at9-support-channels .sec-title,
  html[data-theme="dark"] body.at-cs .at9-support-channels .cards-list {
    background: transparent !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] body.at-cs .at9-support-channels .sec-title {
    color: #d6e5f7 !important;
    -webkit-text-fill-color: #d6e5f7 !important;
    opacity: 1 !important;
  }
  html[data-theme="dark"] body.at-cs .at9-support-channels .foot-note {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 40px !important;
    margin: 8px 0 0 !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    background: #23364a !important;
    background-image: none !important;
    color: #c5d5e7 !important;
    -webkit-text-fill-color: #c5d5e7 !important;
    border: 1px solid #455d77 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    white-space: normal !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere !important;
  }
  html[data-theme="dark"] body.at-cs .at9-support-channels .foot-note :is(i,span,small) {
    background: transparent !important;
    color: #c5d5e7 !important;
    -webkit-text-fill-color: #c5d5e7 !important;
    box-shadow: none !important;
    opacity: 1 !important;
  }
  html[data-theme="dark"] body.at-cs .at9-support-channels .ccard .ccard-icon,
  html[data-theme="dark"] body.at-cs .at9-support-channels .ccard .ccard-arrow {
    color: #e5efff !important;
    background: #304968 !important;
    border: 1px solid #5b7899 !important;
  }
  html[data-theme="dark"] body.at-cs .at9-support-channels .ccard :is(.ccard-icon i,.ccard-arrow i) {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    opacity: 1 !important;
  }

  /* Ensure the selected bottom navigation item always has readable icons,
     even when an individual module paints the selected tab light. */
  html[data-theme="dark"] body.v25-app .v25-bottom-nav a[aria-current="page"] {
    background: #34547d !important;
    border-color: #6c90bd !important;
    color: #f1f6ff !important;
    -webkit-text-fill-color: #f1f6ff !important;
  }
  html[data-theme="dark"] body.v25-app .v25-bottom-nav a[aria-current="page"] :is(.v63-nav-icon,svg,small) {
    color: #f1f6ff !important;
    -webkit-text-fill-color: #f1f6ff !important;
    opacity: 1 !important;
  }
  html[data-theme="dark"] body.v25-app .v25-bottom-nav a[aria-current="page"] svg {
    stroke: currentColor !important;
  }
}
