/* Shared surfaces follow the selected theme, including dynamically created dialogs. */
:root{--bg:#11100f!important;--panel:#171512!important;--border:#302d29!important;--text:#f5f2ee!important;--muted:#a49b90!important;color-scheme:dark}
:root{--surface-soft:#211e19;--surface-code:#211b15;--border-strong:#40382e;--accent-border:#8a4922;--code-text:#d6cbc0;--surface-hover:#302820;--theme-scheme:dark}
html[data-theme="light"],html[data-settings-theme="light"]{--bg:#f7f5f2!important;--panel:#fff!important;--border:#ded7ce!important;--text:#29221b!important;--muted:#74685c!important;--orange:#c4550b;--surface-soft:#f3eee8;--surface-code:#fff8f0;--border-strong:#d4c8bb;--accent-border:#d6aa83;--code-text:#59402c;--surface-hover:#fff1e4;--theme-scheme:light;color-scheme:light}

body{background-color:var(--bg)!important;color:var(--text)}
dialog,dialog.tip-dialog,dialog.pix-checkout,dialog.media-payment-dialog,.lead-chat dialog.tip-dialog,.member-detail{background:var(--panel)!important;color:var(--text)!important;border-color:var(--border)!important;color-scheme:var(--theme-scheme)!important}
dialog::backdrop{background:#000b!important;backdrop-filter:blur(5px)}
dialog :is(h1,h2,h3,h4,label),dialog .pix-identity h2,dialog .pix-plan-price,dialog .media-payment-price,dialog .media-payment-methods,.lead-chat .tip-amount-controls label,.lead-chat .tip-amount-controls input{color:var(--text)!important}
dialog :is(input:not([type=range]):not([type=checkbox]):not([type=radio]),textarea,select){background-color:var(--bg)!important;color:var(--text)!important;border-color:var(--border-strong)!important}
dialog input::placeholder,dialog textarea::placeholder{color:var(--muted)!important}
dialog :is(.tip-profile,.tip-message,.pix-payment-area,.pix-terms){border-color:var(--border)!important}
dialog :is(.tip-profile p,.tip-limits,.tip-counter,.pix-handle,.pix-plan-name,.pix-payment-status,.pix-security,.pix-terms,.media-payment-state,.media-payment-note,.attachment-info){color:var(--muted)!important}
dialog :is(.pix-copy-row,.media-payment-code){background:var(--surface-code)!important;border-color:var(--accent-border)!important}
dialog .pix-copy-row>span{color:var(--code-text)!important}
dialog :is(.lead-checkout-close,.attachment-dialog-heading button,.media-payment-close,.tip-close){background:var(--surface-soft)!important;color:var(--text)!important;border-color:var(--border-strong)!important}
dialog .pix-avatar{border-color:var(--panel)!important;background:var(--surface-soft)!important}
dialog.tip-dialog .tip-submit,.lead-chat dialog.tip-dialog .tip-submit{background:transparent!important;color:var(--orange,#fb923c)!important}
dialog.tip-dialog .tip-submit:hover,.lead-chat dialog.tip-dialog .tip-submit:hover{background:var(--surface-hover)!important}
dialog .tip-message textarea{background:var(--bg)!important;border-color:var(--border-strong)!important}
dialog .tip-amount-controls input{background:transparent!important}
dialog :is(.pix-qr-placeholder,.media-payment-qr){background:var(--surface-soft)!important;border-color:var(--border-strong)!important;color:var(--muted)!important}
/* QR artwork keeps its original contrast for scanning. */
dialog :is(.media-payment-qr,.pix-qr-placeholder):has(img:not([hidden])){background:#fff!important}
#attachment-preview .voice-message{background:var(--surface-soft)!important;color:var(--text)!important}
/* Avoid darker patches around the gift amount and close icon. */
dialog.tip-dialog .tip-amount-controls input[type=number],.lead-chat dialog.tip-dialog .tip-amount-controls input[type=number],dialog.tip-dialog .tip-heading .tip-close,.lead-chat dialog.tip-dialog .tip-heading .tip-close{background:transparent!important;background-color:transparent!important;box-shadow:none!important;border:0!important}
/* Match shared controls, receipt cards and status text to the light palette. */
html:is([data-theme="light"],[data-settings-theme="light"]) body{color:var(--text);background-color:var(--bg)!important}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(.sidebar,.topbar,.panel,.settings-panel,.settings-card,.member-detail){color:var(--text);border-color:var(--border)}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=color]),textarea,select){color:var(--text);color-scheme:light}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(.gauge-caption,.ranking-note,.settings-status,.account-status,.attachment-info){color:var(--muted)}
html:is([data-theme="light"],[data-settings-theme="light"]) .gauge path:not(.gauge-progress){stroke:var(--border)}
html:is([data-theme="light"],[data-settings-theme="light"]) .chat-bubble.chat-tip-card{background:linear-gradient(145deg,#fff8ed,#f9eee0)!important;color:var(--text)!important;border-color:#dec4a4}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(.tip-gift-title,.tip-gift-note){color:var(--text)}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(.tip-gift-value,.tip-gift-symbol){color:#9a4b0b}
html:is([data-theme="light"],[data-settings-theme="light"]) :is(.tip-gift-eyebrow,.tip-gift-brand,.chat-tip-card>time){color:var(--muted)!important}
html:is([data-theme="light"],[data-settings-theme="light"]) .tip-gift-confirmation{color:#28603c}
html:is([data-theme="light"],[data-settings-theme="light"]) .tip-gift-footer{border-color:var(--border)}
