/* Shared contextual controls. Existing brand palette, no layout redesign. */
#formularz[data-mode44=white],#formularz[data-mode44=barter],.r10-quote[data-world=white]{--form-control-surface:#fafaf8;--form-control-ink:var(--ink);--form-control-accent:var(--purple)}
#formularz:is([data-mode44=white],[data-mode44=barter]) :is(.r10-extra,.r24-no-extras,.r10-stepper button,.r10-stepper input,.r10-discount select,.r11-pills label,.r10-radio),.r10-quote[data-world=white] :is(.r10-extra,.r24-no-extras,.r10-stepper button,.r10-stepper input,.r10-discount select,.r11-pills label,.r10-radio){background:var(--form-control-surface)!important;color:var(--form-control-ink)!important;border-color:var(--form-control-accent)!important}
#formularz:is([data-mode44=white],[data-mode44=barter]) :is(.r10-extra,.r10-radio,.r11-pills label):has(input:checked){background:color-mix(in srgb,var(--purple) 12%,var(--form-control-surface))!important;box-shadow:inset 3px 0 var(--purple)}
#formularz:is([data-mode44=white],[data-mode44=barter]) .r10-stepper button:not(:disabled):hover{background:color-mix(in srgb,var(--purple) 6%,var(--form-control-surface))!important}
#formularz .r10-stepper :disabled{opacity:.55;cursor:not-allowed}
#formularz .r10-stepper :focus-visible{outline:2px solid var(--purple);outline-offset:2px}
/* The mobile total and its detail share a body-level fixed layer. */
body .r10-mobile-total,body .r11-mobile-breakdown{--estimate-bg:var(--brand-purple);--estimate-fg:white}
body:has(#formularz[data-mode44=white]) :is(.r10-mobile-total,.r11-mobile-breakdown){--estimate-bg:var(--gold);--estimate-fg:var(--ink)}
body .r10-mobile-total:not(.r11-visible){display:none!important}
@media(max-width:760px){
 body .r10-mobile-total.r11-visible{position:fixed!important;inset:auto 0 0!important;width:100%!important;max-width:none!important;margin:0!important;transform:none!important;padding:14px 16px calc(14px + env(safe-area-inset-bottom,0px))!important;background:var(--estimate-bg)!important;color:var(--estimate-fg)!important;border-color:var(--estimate-bg)!important;z-index:80;box-sizing:border-box;gap:12px}
 body:has(#formularz) .r10-mobile-total :is(span,b){color:var(--estimate-fg)!important}
 body .r10-mobile-total .r24-estimate-arrow{background:var(--gold2);color:var(--ink);border:2px solid var(--estimate-bg)}
 body .r11-mobile-breakdown.r11-open{position:fixed!important;inset:auto 0 var(--estimate-bar-height,70px)!important;margin:0!important;max-height:calc(var(--estimate-viewport-height,100dvh) - var(--estimate-bar-height,70px) - var(--header) - 40px)!important;background:var(--estimate-bg)!important;color:var(--estimate-fg)!important;padding:16px!important;border:0!important;overflow-y:auto;overscroll-behavior:contain;z-index:79;box-sizing:border-box}
 body:has(#formularz) .r11-mobile-breakdown :is(h3,h4,p,span,strong,b,summary,li){color:inherit!important}
 body .r11-mobile-breakdown .receipt-body{overflow:visible;max-height:none}
 body .r11-mobile-breakdown :is(.receipt-header,.receipt-footer){position:static;background:transparent;color:inherit}
 #projectForm{padding-bottom:calc(var(--estimate-bar-height,70px) + 32px)!important}
 body[data-estimate-keyboard] :is(.r10-mobile-total,.r11-mobile-breakdown){display:none!important}
}

/* Match the specificity of the older WHITE/mobile theme rules. */
@media(max-width:760px){
 body:has(#formularz[data-mode44=black]) :is(.r10-mobile-total.r11-visible,.r11-mobile-breakdown.r11-open){background:var(--brand-purple)!important;color:white!important;border-color:var(--brand-purple)!important}
 body:has(#formularz[data-mode44=white]) :is(.r10-mobile-total.r11-visible,.r11-mobile-breakdown.r11-open){background:var(--gold)!important;color:var(--ink)!important;border-color:var(--gold)!important}
 body .r10-mobile-total.r11-visible{display:flex!important;justify-content:space-between;padding-top:28px!important}
 body .r11-mobile-breakdown.r11-open .receipt-row{grid-template-columns:minmax(0,1fr) minmax(0,40%)}
 body .r11-mobile-breakdown.r11-open .receipt-row>strong{white-space:normal;overflow-wrap:anywhere}
}
/* One readable summary on mobile, not a second full receipt after the form. */
#projectForm .r11-vat{position:static;float:none;clear:both;margin:8px 0;line-height:1.5;height:auto;min-height:0;overflow-wrap:anywhere;flex:none}
@media(max-width:760px){
 #projectForm .r10-layout{display:block;padding-bottom:0}
 #projectForm #r10Estimate{display:none!important}
 #projectForm .r10-main{min-height:0}
 #projectForm .form-actions{position:static;height:auto;margin-bottom:0}
}
/* Eight equally spaced positions; business values still live in the original select. */
#projectForm [data-question=cd_frequency] .patch-a-frequency-select{display:none!important}
#projectForm [data-question=cd_frequency] .v4-frequency-slider{display:block!important;visibility:visible!important;width:100%;min-width:0;accent-color:var(--brand-purple)}
#projectForm [data-question=cd_frequency] .frequency-ticks40{display:block!important;position:relative;min-height:48px;margin:0 11px;padding:0;font-size:12px;line-height:1.2;color:var(--brand-purple)}
#projectForm .frequency-ticks40 span{position:absolute;top:4px;transform:translateX(-50%);text-align:center;width:auto;max-width:90px}
#projectForm .frequency-ticks40 span:first-child{transform:translateX(-50%)}
#projectForm .frequency-ticks40 span:last-child{transform:translateX(-100%);text-align:right;top:22px;white-space:nowrap;font-size:11px}
#projectForm .frequency-ticks40 span:last-child::before{content:"";position:absolute;right:0;top:-18px;height:13px;border-right:1px solid currentColor}
#projectForm [data-question=cd_frequency] .r33-frequency{overflow-wrap:anywhere}
@media(max-width:760px){body[data-estimate-keyboard]:has(#formularz) :is(.r10-mobile-total.r11-visible,.r11-mobile-breakdown.r11-open){display:none!important}}
