/*
 * SIMHSYNC final theme pass.
 * Loaded after all page styles so forced Light/Dark/System mode remains readable
 * across administrator, customer, cloud-provider and authentication screens.
 */

/* Uploaded logos always fit inside the established rounded brand frame. */
body.simh-app .brand-mark.logo-mark,
body.simh-app .top-brand .brand-mark.logo-mark,
body.simh-app .auth-brand-mark.logo-mark {
  overflow: hidden !important;
  padding: 4px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
}
body.simh-app .brand-mark.logo-mark img,
body.simh-app .top-brand .brand-mark.logo-mark img,
body.simh-app .auth-brand-mark.logo-mark img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Generic semantic states: never allow pale text on pale pills in dark mode. */
html[data-theme="dark"] body.simh-app :is(
  .badge,.status-badge,.status-pill,.state-pill,.pill,.chip,
  .mtn-share-badge,.mtn-share-count,.mtn-session-pill,.mtn-wallet-status,
  .mtn-ss-badge,.airtel-status,.airtel-status-pill,.glo-status,.glo-status-pill,
  .decision,.execution-badge,.stage5-rail-badge,.engine-event-type
) {
  border-color: #3a4d67 !important;
  background: #223047 !important;
  color: #eaf2ff !important;
  text-shadow: none !important;
}
html[data-theme="dark"] body.simh-app :is(
  .badge-success,.status-success,.status-active,.status-connected,.status-ready,
  .is-success,.is-active,.is-connected,.is-ready,.good,.successful,
  .decision.success,.mtn-session-connected,.mtn-share-badge.good,.glo-status-pill.good
) {
  border-color: #287a56 !important;
  background: #153d2c !important;
  color: #a9f4ca !important;
}
html[data-theme="dark"] body.simh-app :is(
  .badge-warning,.status-warning,.status-pending,.status-processing,.status-review,
  .is-warning,.is-pending,.is-processing,.warn,.pending,.review,
  .decision.retry,.decision.cooldown,.decision.limited,.mtn-share-badge.warn,.glo-status-pill.warn
) {
  border-color: #8c6724 !important;
  background: #493817 !important;
  color: #ffe09a !important;
}
html[data-theme="dark"] body.simh-app :is(
  .badge-danger,.status-danger,.status-failed,.status-error,.status-expired,
  .is-danger,.is-failed,.is-error,.bad,.failed,.rejected,.revoked,
  .decision.fail,.decision.blocked,.mtn-share-badge.bad
) {
  border-color: #944b51 !important;
  background: #4a2329 !important;
  color: #ffc2c7 !important;
}

/* Customer dashboard developer-access panel. */
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-snapshot,
html[data-theme="dark"] body.page-customer_dashboard .customer-dashboard-api-key {
  border-color: #2f4560 !important;
  background: #111d30 !important;
  color: #edf5ff !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-snapshot :is(h2,h3,strong,label),
html[data-theme="dark"] body.page-customer_dashboard .customer-dashboard-api-key :is(strong,label) {
  color: #edf5ff !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-snapshot :is(p,small,span),
html[data-theme="dark"] body.page-customer_dashboard .customer-dashboard-api-key :is(p,small,span) {
  color: #aabbd0 !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-snapshot-grid > div {
  border-color: #30445e !important;
  background: #18263a !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-cta {
  border: 1px solid #31506a !important;
  background: #17283b !important;
  color: #dff8ff !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-cta :is(strong,small,b,svg) {
  color: #dff8ff !important;
  fill: currentColor !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-developer-cta small {
  color: #9fb5c9 !important;
}
html[data-theme="dark"] body.page-customer_dashboard .customer-dashboard-secret-row input,
html[data-theme="dark"] body.page-customer_dashboard .customer-dashboard-api-key input {
  border-color: #38506b !important;
  background: #0c1728 !important;
  color: #f3f7ff !important;
}

/* PIN settings and benefit panels. */
html[data-theme="dark"] body.page-customer_pin .pin-benefit-list > div {
  border: 1px solid #344a64 !important;
  background: #1a283c !important;
}
html[data-theme="dark"] body.page-customer_pin .pin-benefit-list strong {
  color: #f4f7fc !important;
}
html[data-theme="dark"] body.page-customer_pin .pin-benefit-list span {
  color: #aebdd0 !important;
}

/* Customer API documentation. */
html[data-theme="dark"] body.page-customer_api .api-security-note {
  border: 1px solid #286271 !important;
  background: #123846 !important;
  color: #d5f8ff !important;
}
html[data-theme="dark"] body.page-customer_api .api-security-note strong {
  color: #ffffff !important;
}
html[data-theme="dark"] body.page-customer_api .api-security-note span {
  color: #b9e5ed !important;
}
html[data-theme="dark"] body.page-customer_api .customer-api-rule-list li,
html[data-theme="dark"] body.page-customer_api .customer-endpoint-group,
html[data-theme="dark"] body.page-customer_api .customer-api-downloads article,
html[data-theme="dark"] body.page-customer_api .webhook-next-card {
  border-color: #31445e !important;
  background: #172438 !important;
}
html[data-theme="dark"] body.page-customer_api :is(.method-get,.method-post,.customer-api-downloads a) {
  border: 1px solid #35647a !important;
  background: #17394b !important;
  color: #bcefff !important;
}
html[data-theme="dark"] body.page-customer_api .customer-code-row {
  border: 1px solid #30435d !important;
  background: #081323 !important;
}

/* Authentication cards, notices and kickers. */
html[data-theme="dark"] body.auth-page .auth-kicker {
  border: 1px solid #35657a !important;
  background: #173b4c !important;
  color: #c8f5ff !important;
}
html[data-theme="dark"] body.auth-page .alert {
  border: 1px solid #496076 !important;
  background: #243247 !important;
  color: #f0f5fb !important;
}
html[data-theme="dark"] body.auth-page .auth-card,
html[data-theme="dark"] body.auth-page .auth-form-card {
  border-color: #2f435e !important;
  background: #101c2f !important;
  color: #eef4fb !important;
}
html[data-theme="dark"] body.auth-page :is(label,h1,h2,h3,strong) {
  color: #f4f7fb !important;
}
html[data-theme="dark"] body.auth-page :is(p,small,.auth-subtitle) {
  color: #bdc8d7 !important;
}
html[data-theme="dark"] body.auth-page :is(input,select,textarea) {
  border-color: #425772 !important;
  background: #1b2a41 !important;
  color: #ffffff !important;
}

/* SIM Engine: neutral dark rows and legible route/status metadata. */
html[data-theme="dark"] body.page-sim_engine :is(.stage6-routing-card,.native-panel,.stage5-panel,.engine-panel) {
  border-color: #30445f !important;
  background: #111d30 !important;
  color: #eef4fb !important;
}
html[data-theme="dark"] body.page-sim_engine :is(.stage6-routing-card header,.native-panel-head,.engine-table thead,.engine-table th) {
  border-color: #354c68 !important;
  background: #19283d !important;
  color: #dce8f7 !important;
}
html[data-theme="dark"] body.page-sim_engine .engine-table tbody tr,
html[data-theme="dark"] body.page-sim_engine .engine-table tbody tr:nth-child(odd),
html[data-theme="dark"] body.page-sim_engine .engine-table tbody tr:nth-child(even) {
  border-color: #2d4059 !important;
  background: #132136 !important;
  color: #eaf1fa !important;
}
html[data-theme="dark"] body.page-sim_engine .engine-table tbody tr:hover {
  background: #1b2d46 !important;
}
html[data-theme="dark"] body.page-sim_engine .engine-table :is(td,strong,.connection-name) {
  color: #edf4fc !important;
}
html[data-theme="dark"] body.page-sim_engine .engine-table :is(small,.muted) {
  color: #a9b9cc !important;
}

/* MTN Data Share surfaces and header. */
html[data-theme="dark"] body.page-cloud_mtn_data_share .mtn-share-page {
  --ds-bg: #091322;
  --ds-surface: #121f33;
  --ds-soft: #17263b;
  --ds-border: #30445f;
  --ds-border-strong: #415773;
  --ds-text: #f2f6fc;
  --ds-muted: #aebdd0;
  --ds-primary: #5eead4;
  --ds-primary-dark: #2dd4bf;
  --ds-good: #9df2bd;
  --ds-warn: #ffd791;
  --ds-bad: #ffb4ba;
  color-scheme: dark;
}
html[data-theme="dark"] body.page-cloud_mtn_data_share :is(.mtn-share-head,.mtn-share-panel,.mtn-share-stats article) {
  border-color: var(--ds-border) !important;
  background: var(--ds-surface) !important;
  color: var(--ds-text) !important;
}
html[data-theme="dark"] body.page-cloud_mtn_data_share :is(.mtn-share-head h1,.mtn-share-head h2,.mtn-share-panel h2,.mtn-share-panel h3,.mtn-share-table td,.mtn-share-table strong) {
  color: var(--ds-text) !important;
}
html[data-theme="dark"] body.page-cloud_mtn_data_share :is(.mtn-share-head p,.mtn-share-panel p,.mtn-share-table small,.mtn-share-table th) {
  color: var(--ds-muted) !important;
}
html[data-theme="dark"] body.page-cloud_mtn_data_share .mtn-share-table tr {
  border-color: var(--ds-border) !important;
  background: var(--ds-surface) !important;
}
html[data-theme="dark"] body.page-cloud_mtn_data_share :is(button,.btn,.mtn-share-icon-btn) {
  border-color: #53647b !important;
}

/* MTN portal login and wallet page. */
html[data-theme="dark"] body.page-cloud_mtn_portal_login .network-mtn-page {
  --mtn-page:#091322;
  --mtn-surface:#121f33;
  --mtn-surface-soft:#19263a;
  --mtn-surface-muted:#1b293e;
  --mtn-text:#edf4fc;
  --mtn-text-strong:#ffffff;
  --mtn-text-soft:#c1cddd;
  --mtn-text-muted:#9eafc3;
  --mtn-border:#3f4e62;
  --mtn-border-soft:#2c3c52;
  --mtn-input:#0d192a;
  --mtn-hover:#1f3048;
  --mtn-success-bg:#153d2c;
  --mtn-success-text:#a9f4ca;
  --mtn-danger-soft:#472329;
  --mtn-danger-text:#ffc2c7;
  color-scheme:dark;
}
html[data-theme="dark"] body.page-cloud_mtn_portal_login :is(.mtn-control-bar,.mtn-session-strip,.mtn-wallet-panel,.mtn-wallet-table tr,.mtn-balance-grid,.mtn-balance-grid > div) {
  border-color: var(--mtn-border) !important;
  background: var(--mtn-surface) !important;
  color: var(--mtn-text) !important;
}
html[data-theme="dark"] body.page-cloud_mtn_portal_login :is(.mtn-btn-secondary,.mtn-control-actions .btn) {
  border-color: #52647a !important;
  background: #1a2a40 !important;
  color: #eef5ff !important;
}
html[data-theme="dark"] body.page-cloud_mtn_portal_login .mtn-btn-primary {
  border-color: #ffcc00 !important;
  background: #ffcc00 !important;
  color: #161616 !important;
}

/* Share and Sell action icons must remain visible against the dark table. */
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-icon,
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-actions > a,
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-actions button {
  border-color: #f1c700 !important;
  background: #ffcc00 !important;
  color: #151515 !important;
  opacity: 1 !important;
}
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-icon.assign {
  border-color: #35c4b2 !important;
  background: #123f3c !important;
  color: #a8fff3 !important;
}
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-icon.pin {
  border-color: #e8c14c !important;
  background: #4a3a12 !important;
  color: #ffe389 !important;
}
html[data-theme="dark"] body.page-cloud_mtn_share_and_sell .mtn-ss-actions > a[data-simh-delete-for] {
  border-color: #a84c54 !important;
  background: #4a2329 !important;
  color: #ffc4ca !important;
}

/* Airtel service hero: mobile actions never overflow. */
@media (max-width: 720px) {
  body.page-cloud_airtel_sessions .airtel-service-actions,
  body.page-cloud_airtel_data_gifting .airtel-service-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  body.page-cloud_airtel_sessions .airtel-service-actions .airtel-btn,
  body.page-cloud_airtel_data_gifting .airtel-service-actions .airtel-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 8px 7px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
  body.page-cloud_airtel_sessions .airtel-service-actions .airtel-btn:last-child,
  body.page-cloud_airtel_data_gifting .airtel-service-actions .airtel-btn:last-child {
    grid-column: 1 / -1 !important;
  }
}

/* Airtel dark surfaces/statuses. */
html[data-theme="dark"] body :is(.airtel-service-page,.airtel-cloud-page) {
  --airtel-ink:#f4f7fb;
  --airtel-muted:#aeb9ca;
  --airtel-line:rgba(163,184,211,.22);
  --airtel-surface:#141f31;
  --airtel-soft:#221e29;
}
html[data-theme="dark"] body :is(.airtel-service-panel,.airtel-service-stats article,.airtel-action-tile,.airtel-login-steps > div,.airtel-wallet-panel,.airtel-wallet-grid article) {
  border-color: #3a4659 !important;
  background: #151f30 !important;
  color: #f2f5fa !important;
}
html[data-theme="dark"] body :is(.airtel-service-panel,.airtel-cloud-page) :is(h1,h2,h3,strong,label) {
  color: #f4f7fb !important;
}
html[data-theme="dark"] body :is(.airtel-service-panel,.airtel-cloud-page) :is(p,small,span) {
  color: #b6c1cf !important;
}

/* Glo service and login pages. */
html[data-theme="dark"] body :is(.glo-service-page,.glo-cloud-page) {
  --glo-ink:#f3f7fb;
  --glo-muted:#afbdca;
  --glo-line:rgba(155,181,203,.22);
  --glo-surface:#131f2f;
  --glo-soft:#183426;
  color-scheme:dark;
}
html[data-theme="dark"] body :is(.glo-service-panel,.glo-service-stats article,.glo-action-grid button,.glo-login-steps > div,.glo-wallet-panel,.glo-wallet-grid article,.glo-service-shortcut,.glo-pin-panel) {
  border-color: #365069 !important;
  background: #142236 !important;
  color: #f1f7fc !important;
}
html[data-theme="dark"] body :is(.glo-service-page,.glo-cloud-page) :is(h1,h2,h3,strong,label) {
  color: #f3f8fc !important;
}
html[data-theme="dark"] body :is(.glo-service-page,.glo-cloud-page) :is(p,small,span) {
  color: #afc0cf !important;
}
html[data-theme="dark"] body .glo-primary,
html[data-theme="dark"] body .glo-btn-green {
  border-color: #27b75a !important;
  background: #159447 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] body .glo-btn-white {
  border-color: #a8e7bd !important;
  background: #e9fff0 !important;
  color: #096c31 !important;
}

/* Network logos are circular, full-bleed and never padded. */
body.simh-app :is(.glo-service-logo,.glo-service-avatar,.glo-brand-logo,.airtel-service-logo,.airtel-service-avatar,.airtel-brand-logo,.mtn-service-logo,.mtn-service-avatar) {
  overflow: hidden !important;
  padding: 0 !important;
  border-radius: 50% !important;
}
body.simh-app :is(.glo-service-logo,.glo-service-avatar,.glo-brand-logo,.airtel-service-logo,.airtel-service-avatar,.airtel-brand-logo,.mtn-service-logo,.mtn-service-avatar) img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}
