/* Make Disciples v3.31 — Custom Theme isolation repair
   Prevents Black & Gold's hard-coded surfaces and text colors from leaking
   into Warm Blush, Forest & Stone, Charcoal & Copper, Embellished Ivory,
   or Dark. */

/* Shared nested surfaces that were not covered by the first Studio pass. */
body.custom-theme :is(
  .contact-action-panel,.contact-search-panel,.contact-mode-note,.contact-detail-row,
  .recurring-card,.history-card,.share-preview,.form-picker-options,.duplicate-summary-card,
  .duplicate-merge-field,.share-method,.share-status,.share-outcome-button,
  .visit-tab-row,.visit-attention-controls,.visit-summary,.visit-badge,.visit-reasons span,
  .map-search-panel,.map-summary-bar,.map-contact-preview,.map-card-actions,.map-inline-action,
  .time-month-focus,.time-year-position,.time-focus-total,.time-midyear-card,
  .time-midyear-stats>div,.settings-note,.settings-toggle-row,.settings-segmented,
  .settings-help-list details,.detail-row,.about-feature-row span,.appearance-active-label
){
  background:var(--custom-card)!important;
  color:var(--custom-text)!important;
  border-color:var(--custom-line)!important;
  box-shadow:var(--custom-shadow)!important;
}

body.custom-theme :is(
  .contact-action-panel,.contact-search-panel,.visit-tab-row,.map-search-panel,
  .map-contact-preview,.time-month-focus,.time-year-position
)::before,
body.custom-theme :is(
  .contact-action-panel,.contact-search-panel,.visit-tab-row,.map-search-panel,
  .map-contact-preview,.time-month-focus,.time-year-position
)::after{display:none!important}

/* Search fields and their icon/reset compartments. */
body.custom-theme :is(.contact-search-wrap,.map-search-wrap){border-color:var(--custom-line)!important}
body.custom-theme :is(.contact-search-wrap>svg,.map-search-wrap>svg,.contact-reset,.map-search-reset){color:var(--custom-primary)!important;stroke:currentColor!important}
body.custom-theme :is(.contact-search-wrap input,.map-search-wrap input){background:transparent!important;color:var(--custom-text)!important}
body.custom-theme :is(.contact-search-wrap input,.map-search-wrap input)::placeholder{color:var(--custom-muted)!important}

/* All Studio-aware nested controls. */
body.custom-theme :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .map-search-reset,.time-scope-option,.time-quick-row button,.share-method,.share-option,
  .form-picker-option,.study-lesson-list-choice,.settings-toggle-row
){
  background:var(--custom-card)!important;
  color:var(--custom-text)!important;
  border-color:var(--custom-line)!important;
  border-radius:var(--custom-radius-control)!important;
  box-shadow:none!important;
  text-shadow:none!important;
}
body.custom-theme :is(
  .visit-tab.active,.visit-choice.active,.picker-choice.active,.map-filter.active,
  .time-scope-option.active,.share-option.active,.share-option.required,
  .form-picker-option.active,.study-lesson-list-choice.active
){
  background:var(--custom-primary)!important;
  color:var(--custom-on-primary)!important;
  border-color:var(--custom-primary)!important;
}
body.custom-theme :is(.visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,.share-option)::before,
body.custom-theme :is(.visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,.share-option)::after{display:none!important}

/* Respect the chosen button treatment for the controls added above. */
body.custom-theme[data-button-style="soft"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){background:linear-gradient(145deg,color-mix(in srgb,var(--custom-card) 94%,#fff),color-mix(in srgb,var(--custom-card) 86%,var(--custom-primary)))!important;box-shadow:0 7px 18px color-mix(in srgb,var(--custom-text) 10%,transparent)!important}
body.custom-theme[data-button-style="raised"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){box-shadow:0 4px 0 color-mix(in srgb,var(--custom-secondary) 55%,transparent),0 9px 17px color-mix(in srgb,var(--custom-text) 10%,transparent)!important;transform:translateY(-1px)}
body.custom-theme[data-button-style="embellished"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){border:3px double var(--custom-metal)!important;background:linear-gradient(145deg,color-mix(in srgb,var(--custom-primary) 92%,#fff),color-mix(in srgb,var(--custom-primary) 72%,#000))!important;color:var(--custom-on-primary)!important;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--custom-metal) 40%,transparent),0 8px 18px color-mix(in srgb,var(--custom-text) 16%,transparent)!important}
body.custom-theme[data-button-style="minimal"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){background:transparent!important;box-shadow:none!important;border-color:color-mix(in srgb,var(--custom-text) 36%,transparent)!important}
body.custom-theme[data-button-style="tech"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){border-radius:min(var(--custom-radius-control),8px)!important;border-color:color-mix(in srgb,var(--custom-primary) 68%,transparent)!important;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--custom-primary) 18%,transparent),0 0 15px color-mix(in srgb,var(--custom-primary) 20%,transparent)!important;letter-spacing:.025em}
body.custom-theme[data-button-style="classic"] :is(
  .visit-tab,.visit-choice,.picker-choice,.map-filter,.map-small-action,.map-inline-action,
  .time-scope-option,.time-quick-row button,.share-method,.share-option,.form-picker-option,
  .study-lesson-list-choice,.settings-toggle-row
){font-family:Georgia,"Times New Roman",serif!important;border-color:color-mix(in srgb,var(--custom-secondary) 38%,transparent)!important;box-shadow:0 3px 8px color-mix(in srgb,var(--custom-text) 10%,transparent)!important}
body.custom-theme[data-button-style] :is(
  .visit-tab.active,.visit-choice.active,.picker-choice.active,.map-filter.active,
  .time-scope-option.active,.share-option.active,.share-option.required,
  .form-picker-option.active,.study-lesson-list-choice.active
){background:var(--custom-primary)!important;color:var(--custom-on-primary)!important;border-color:var(--custom-primary)!important}

/* Visits */
body.custom-theme .visit-attention-controls h3,
body.custom-theme .visit-form h4,
body.custom-theme .visit-card-top h3,
body.custom-theme .visit-date-grid strong,
body.custom-theme .history-section>h3,
body.custom-theme .history-card h4,
body.custom-theme .history-card strong{color:var(--custom-text)!important}
body.custom-theme :is(.visit-summary,.visit-card-top p,.visit-date-grid small,.history-card p,.history-empty-action){color:var(--custom-muted)!important}
body.custom-theme .visit-badge{background:color-mix(in srgb,var(--custom-primary) 10%,var(--custom-card))!important;color:var(--custom-primary)!important}
body.custom-theme .visit-reasons span{background:color-mix(in srgb,var(--danger) 9%,var(--custom-card))!important;color:var(--danger)!important;border-color:color-mix(in srgb,var(--danger) 45%,transparent)!important}

/* Ministry Map */
body.custom-theme .ui2-map-shell{background:var(--custom-card-2)!important;border-color:var(--custom-line)!important;box-shadow:var(--custom-shadow)!important}
body.custom-theme .ui2-map-shell::before{display:none!important}
body.custom-theme .ui2-map-canvas,
body.custom-theme .ui2-map-canvas.leaflet-container{background:linear-gradient(145deg,var(--custom-card),var(--custom-card-2))!important}
body.custom-theme .ui2-map-canvas .leaflet-tile-pane{filter:none!important}
body.custom-theme .ui2-map-overlay{background:color-mix(in srgb,var(--custom-bg) 86%,transparent)!important;color:var(--custom-text)!important}
body.custom-theme .map-loader{border-color:var(--custom-line)!important;border-top-color:var(--custom-primary)!important}
body.custom-theme .ui2-map-canvas .leaflet-control-zoom{border-color:var(--custom-line)!important;box-shadow:var(--custom-shadow)!important}
body.custom-theme .ui2-map-canvas .leaflet-control-zoom a,
body.custom-theme .ui2-map-canvas .leaflet-tooltip{background:var(--custom-card)!important;color:var(--custom-text)!important;border-color:var(--custom-line)!important;box-shadow:var(--custom-shadow)!important}
body.custom-theme .ui2-map-legend{background:color-mix(in srgb,var(--custom-card) 90%,transparent)!important;color:var(--custom-text)!important}
body.custom-theme :is(.map-preview-pin,.map-card-pin){background:color-mix(in srgb,var(--custom-primary) 10%,var(--custom-card))!important;border-color:var(--custom-line)!important}
body.custom-theme :is(.map-preview-top h3,.map-card-copy strong,.map-location-copy strong,.map-contact-group h4){color:var(--custom-text)!important}
body.custom-theme :is(.map-summary-bar,.map-section-copy,.map-card-copy small,.map-card-copy .map-card-date,.map-location-copy>span,.map-location-copy small){color:var(--custom-muted)!important}
body.custom-theme .map-type-badge{color:var(--custom-primary)!important;border-color:var(--custom-line)!important}

/* Ministry Time */
body.custom-theme :is(.time-month-focus small,.time-year-position small,.time-card-kicker,.time-entry-type){color:var(--custom-muted)!important}
body.custom-theme :is(.time-month-focus strong,.time-year-position strong,.time-goal-card strong,.time-entry-copy h3,.time-entry-copy p,.service-month-card span,.service-month-card>strong,.time-midyear-card h3,.time-midyear-stats strong){color:var(--custom-text)!important}
body.custom-theme .time-focus-total{background:color-mix(in srgb,var(--custom-primary) 10%,var(--custom-card))!important;color:var(--custom-primary)!important}
body.custom-theme :is(.settings-stat-icon,.time-entry-icon,.share-method-icon,.toolbox-resource-icon,.duplicate-alert-icon,.import-confirmation-check,.share-check){background:color-mix(in srgb,var(--custom-primary) 10%,var(--custom-card))!important;color:var(--custom-primary)!important;border-color:var(--custom-line)!important}
body.custom-theme .mini-goal-track{background:color-mix(in srgb,var(--custom-text) 12%,var(--custom-card))!important}
body.custom-theme .mini-goal-fill{background:linear-gradient(90deg,var(--custom-secondary),var(--custom-primary))!important}

/* Settings, About, and Toolbox */
body.custom-theme :is(
  .settings-hero h3,.settings-block-head h4,.settings-status-card strong,
  .settings-stat strong,.settings-toggle-copy strong,.appearance-copy strong,
  .toolbox-summary-chip strong,.toolbox-type-heading,.toolbox-manage-copy strong,
  .settings-help-list summary,.detail-row strong,.settings-note strong
){color:var(--custom-text)!important}
body.custom-theme :is(
  .settings-eyebrow,.settings-status-card small,.settings-status-card div>span,
  .settings-block-head p,.settings-toggle-copy span,.settings-stat>span:last-child,
  .appearance-copy span,.toolbox-summary-chip span,.toolbox-type-heading span,
  .toolbox-manage-copy span,.settings-help-list p,.about-map-credit,.detail-row
){color:var(--custom-muted)!important}
body.custom-theme .about-feature-row span{background:color-mix(in srgb,var(--custom-primary) 9%,var(--custom-card))!important;color:var(--custom-text)!important}
body.custom-theme .settings-toggle-switch{background:color-mix(in srgb,var(--custom-text) 12%,var(--custom-card))!important;border-color:var(--custom-line)!important;box-shadow:none!important}
body.custom-theme .settings-toggle-switch span{background:var(--custom-muted)!important;box-shadow:none!important}
body.custom-theme .settings-toggle-row.active .settings-toggle-switch{background:color-mix(in srgb,var(--custom-primary) 24%,var(--custom-card))!important;border-color:var(--custom-primary)!important}
body.custom-theme .settings-toggle-row.active .settings-toggle-switch span{background:var(--custom-primary)!important}
body.custom-theme .settings-segmented{background:var(--custom-card)!important;border-color:var(--custom-line)!important}
body.custom-theme .settings-segmented button{border-color:var(--custom-line)!important}

/* Dialogs, forms, sharing, and duplicate review. */
body.custom-theme :is(.form-field,.form-field legend,.time-duration-grid label,.time-custom-goal,.time-service-year-input){color:var(--custom-text)!important}
body.custom-theme .share-method-copy strong,
body.custom-theme .share-outcome-button strong,
body.custom-theme .share-review-section h4,
body.custom-theme .duplicate-summary-card strong,
body.custom-theme .duplicate-summary-card small,
body.custom-theme .import-confirmation h4{color:var(--custom-text)!important}
body.custom-theme :is(.share-method-copy small,.share-outcome-button small,.share-review-note,.share-status,.duplicate-summary-card span,.import-confirmation p){color:var(--custom-muted)!important}
body.custom-theme .form-picker-options{background:var(--custom-card-2)!important;border-color:var(--custom-line)!important}
