/* FITPLAN V807 - Tenant theme isolation + builder white-label completion.
   Loaded after V806: every builder surface uses the authenticated organization palette. */

/* Builder root and major panels */
#builder,
#builder .builder-main-panel,
#builder .panel,
#builder .draft-panel,
#builder .ux-v769-builder-shell,
#builder .ux-v769-builder-side,
#builder .ux-v769-builder-side-card{
  color:var(--theme-text)!important;
}
#builder .builder-main-panel,
#builder .panel,
#builder .draft-panel,
#builder .ux-v769-builder-side-card{
  background:var(--theme-surface)!important;
  border-color:var(--theme-text-12)!important;
  box-shadow:none!important;
}

/* Operational boxes: opaque and palette driven */
#builder .builder-timer-sticky,
#builder .builder-excel-primary,
#builder .excel-builder-hint.builder-excel-primary,
#builder .builder-sticky-daybar,
#builder .builder-sticky-daybar-v701,
#builder .builder-sticky-daybar-v702,
#builder .draft-day-head-v702,
#builder .draft-day-section-v702,
#builder .draft-excel-table-v702 tr.main-row,
#builder .draft-excel-table-v702 tr.draft-subrow-v702>td[colspan],
#builder .draft-history-snapshot,
#builder .draft-technique-summary-inline,
#builder .notice{
  background:var(--theme-card)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-text-12)!important;
  opacity:1!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
}
#builder .builder-timer-sticky,
#builder .builder-excel-primary,
#builder .builder-sticky-daybar,
#builder .builder-sticky-daybar-v701,
#builder .builder-sticky-daybar-v702,
#builder .draft-day-section-v702.active{
  border-color:var(--theme-primary-28)!important;
}

/* Typography */
#builder h1,#builder h2,#builder h3,#builder h4,#builder strong,#builder label{
  color:var(--theme-text)!important;
}
#builder .muted,
#builder small,
#builder .draft-progression-note,
#builder .mini-label{
  color:var(--theme-muted)!important;
}
#builder .builder-timer-line span,
#builder .draft-running-badge,
#builder .draft-history-reference-v736 .best-row td{
  color:var(--theme-primary)!important;
}

/* Inputs must never fall back to the original dark FitPlan surface. */
#builder .input,
#builder input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
#builder select,
#builder textarea,
#builder .draft-table-notes,
#builder .draft-table-input,
#builder .draft-table-select,
#builder .mini-input{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-text-18)!important;
  box-shadow:none!important;
}
#builder .input:focus,
#builder input:focus,
#builder select:focus,
#builder textarea:focus{
  border-color:var(--theme-primary)!important;
  box-shadow:0 0 0 3px var(--theme-primary-12)!important;
  outline:none!important;
}
#builder select option{background:var(--theme-surface)!important;color:var(--theme-text)!important}

/* Primary and secondary actions */
#builder .btn:not(.secondary):not(.danger){
  background:linear-gradient(135deg,var(--theme-primary),var(--theme-primary2))!important;
  color:var(--theme-on-primary)!important;
  border-color:transparent!important;
  box-shadow:none!important;
}
#builder .btn.secondary{
  background:var(--theme-card)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-text-18)!important;
  box-shadow:none!important;
}
#builder .btn.danger,
#builder .draft-table-actions .btn.danger{
  background:var(--theme-danger-10)!important;
  color:var(--theme-danger)!important;
  border-color:var(--theme-danger-30)!important;
}
#builder .btn:not(:disabled):hover{filter:brightness(1.04)}

/* Exercise actions and progression area */
#builder .draft-table-actions{
  background:var(--theme-surface)!important;
  border:1px solid var(--theme-text-09)!important;
  border-radius:14px!important;
  padding:8px!important;
}
#builder .draft-table-actions .btn:not(.danger){
  background:var(--theme-card)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-text-18)!important;
}
#builder .draft-subrow-v702 td,
#builder .draft-row-mini-v702{
  background:var(--theme-card)!important;
  border-color:var(--theme-text-09)!important;
  color:var(--theme-text)!important;
}
#builder .draft-load-missing{color:var(--theme-danger)!important}

/* Historical load popovers */
#builder .draft-ex-history-popover-v743,
#builder .history-max-card,
#builder .draft-history-reference-v736{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-primary-28)!important;
}
#builder .draft-ex-history-pill-v743,
#builder .badge{
  background:var(--theme-primary-12)!important;
  color:var(--theme-primary)!important;
  border-color:var(--theme-primary-28)!important;
}
#builder .history-load-bar,
#builder .draft-ex-history-loadbar-v743,
#builder .v736-test-preview .test-bar{
  background:var(--theme-text-12)!important;
}
#builder .history-load-bar span,
#builder .draft-ex-history-loadbar-v743 i,
#builder .v736-test-preview .test-bar span{
  background:linear-gradient(90deg,var(--theme-primary),var(--theme-secondary),var(--theme-primary2))!important;
}

/* Test/progression panels */
#builder .v736-test-panel,
#builder .v737-test-panel,
#builder #progressionPanel,
#builder #strengthParametersBox,
#builder #runningParametersBox,
#builder #suggestedLoadPanel{
  background:var(--theme-card)!important;
  border-color:var(--theme-primary-22)!important;
  color:var(--theme-text)!important;
}
#builder .v736-test-preview,
#builder .v736-test-preview th,
#builder .v736-test-preview td{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-text-09)!important;
}

/* Tenant transition shield: no stale tenant content is visible while switching accounts. */
html.fitplan-v807-tenant-switch .web-shell{
  visibility:hidden!important;
  pointer-events:none!important;
}

/* Preserve semantic success/warning notices while staying on the tenant palette. */
#builder .plan-date-ok{background:var(--theme-primary-08)!important;border-color:var(--theme-primary-28)!important;color:var(--theme-text)!important}
#builder .plan-date-warning{background:var(--theme-cta-10)!important;border-color:var(--theme-cta-30)!important;color:var(--theme-text)!important}
