/* Global preview palette. Appearance changes apply immediately when selected. */
html[data-appearance-active]{color-scheme:light;background-image:var(--home-bg);background-size:cover;background-position:center}
html[data-appearance-active][data-appearance-mode=night]{color-scheme:dark}
html[data-appearance-active]:not([data-appearance-embedded]) body{zoom:var(--appearance-scale);width:calc(100% / var(--appearance-scale));min-height:calc(var(--app-viewport-height,100svh) / var(--appearance-scale))}
html[data-appearance-active]:not([data-appearance-embedded]) :is(.chat-list-page,.chat-window-page){height:calc(var(--app-viewport-height,100svh) / var(--appearance-scale))}
html[data-appearance-active]:not([data-appearance-embedded]) :is(.chat-list-layout,.conversation-layout,.me-shell){height:calc(var(--app-viewport-height,100svh) / var(--appearance-scale))}
html[data-appearance-active]:not([data-appearance-embedded]) :is(.chat-list-shell,.chat-window-shell){height:100%}
html[data-appearance-active] body{color:var(--appearance-backdrop-ink)}
html[data-appearance-active] .page-backdrop::after{background:linear-gradient(155deg,var(--appearance-overlay-a),var(--appearance-overlay-b))!important}
html[data-appearance-active] :is(.glass:not(.contacts-page-sheet),.list-dialog,.plus-menu,.conversation-action-menu,.preview-message-menu,.chat-window-header){background:linear-gradient(140deg,var(--appearance-surface-a),var(--appearance-surface-b))!important;color:var(--appearance-ink)!important;border-color:var(--appearance-line)!important;box-shadow:inset 0 1px 2px #ffffff55,0 12px 35px #112f4426!important;backdrop-filter:blur(24px) saturate(115%);-webkit-backdrop-filter:blur(24px) saturate(115%)}
html[data-appearance-active] :is(.chat-list-shell,.chat-list-empty-pane){background:transparent!important}
html[data-appearance-active] .contacts-page-sheet{border:0!important;background:transparent!important;box-shadow:none!important;backdrop-filter:none;-webkit-backdrop-filter:none}
html[data-appearance-active] :is(.list-brand,.list-icon-button,.conversation-copy h2,.chat-peer-copy,.chat-peer-copy h1,.me-identity,.me-identity h2,.me-account,.me-option,.me-setting-entry,.global-privacy-label,.global-notification-row,.preview-contact-main,.preview-contact-more,.friend-profile-identity,.friend-profile-identity h3,.friend-profile-account,.chat-setting-toggle-row,.global-privacy-device-row,.global-privacy-entry,.me-help-section summary){color:var(--appearance-ink)!important}
html[data-appearance-active] :is(.list-brand p,.conversation-copy p,.conversation-meta,.me-tagline,.me-option-copy small,.me-profile-footer,.me-preview-label,.preview-contact-copy small,.friend-field-label,.friend-profile-status,.friend-profile-added,.friend-block-copy small,.preview-caption,.global-privacy-note,.global-privacy-count,.global-privacy-cleanup-control small,.global-privacy-device-copy small,.me-device-row small,.me-setting-entry-value,.me-help-section p,.chat-setting-explanation,.me-section-summary){color:var(--appearance-muted)!important}
html[data-appearance-active] :is(.me-option-icon,.me-edit-icon,.me-avatar-edit-badge,.me-setting-entry-icon,.friend-back-button,.global-notification-heading,.global-privacy-heading,.global-notification-row>svg,.global-privacy-label svg,.me-navigation a[aria-current=page],.list-bottom-navigation [aria-current=page]){color:var(--appearance-ink)!important}
html[data-appearance-active] :is(.list-search,.list-dialog input:not([type=range]),.list-dialog select,.list-dialog textarea,.preview-composer textarea,.me-status-control select){background:var(--appearance-surface-a)!important;color:var(--appearance-ink)!important;border-color:var(--appearance-line)!important}
html[data-appearance-active] :is(input,textarea)::placeholder{color:var(--appearance-muted)!important;opacity:.8}
/* Stable light text over photos; glass controls keep their own theme contrast. */
html[data-appearance-active] :is(.chat-list-header .list-brand,.chat-list-header .list-icon-button,.conversation-copy h2,.contacts-page-header h2,.contacts-page-header .contacts-page-add,.contacts-page-body .preview-contact-main,.contacts-page-body .preview-contact-more){color:var(--appearance-backdrop-ink)!important;text-shadow:0 1px 3px #071c2e80}
html[data-appearance-active] :is(.chat-list-header .list-brand p,.conversation-copy p,.conversation-meta,.contacts-page-body .preview-contact-copy small){color:var(--appearance-backdrop-muted)!important;text-shadow:0 1px 3px #071c2e80}
html[data-appearance-active] .list-search :is(input,svg){color:var(--appearance-ink)!important}
html[data-appearance-active] .contacts-page-body .preview-contact-search{background:var(--appearance-surface-a)!important;color:var(--appearance-ink)!important;border-color:var(--appearance-line)!important}
html[data-appearance-active][data-appearance-color=follow] :is(input,select,textarea){color-scheme:dark}
html[data-appearance-active] option{background:var(--appearance-solid);color:var(--appearance-ink)}
html[data-appearance-active] :is(.preview-search-button,.preview-unread,.global-notification-test){background:var(--appearance-accent)!important;color:#173f49!important}
html[data-appearance-active] .friend-block-switch[aria-checked=true]{background:var(--appearance-accent)!important}
html[data-appearance-active] .preview-bubble,html[data-appearance-active] .preview-audio-bubble{background:var(--appearance-other)!important;color:#244b5b!important}
html[data-appearance-active] .mine .preview-bubble,html[data-appearance-active] .mine .preview-audio-bubble{background:var(--appearance-mine)!important}
html[data-appearance-active] .preview-message-text{font-size:var(--appearance-chat-font);line-height:1.6}
html[data-appearance-active] #preview-message{font-size:var(--appearance-chat-font);line-height:1.5}
html[data-appearance-active] .list-dialog{max-height:calc((var(--app-viewport-height,100svh) - 32px) / var(--appearance-scale));width:min(420px,calc((100vw - 32px) / var(--appearance-scale)))}

/* Six appearance controls. */
.global-appearance-body{padding-top:0;padding-bottom:2px}.appearance-setting{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,202px);align-items:center;gap:12px;min-height:88px;padding:17px 0;border-bottom:1px solid #e1fff235}.appearance-setting-title{grid-column:1;margin:0;color:inherit;font-size:15px;font-weight:500;line-height:1.6}.appearance-setting>:is(.appearance-font-line,.appearance-select,.appearance-picture-select){grid-column:2;min-width:0}
.appearance-font-line{display:flex;align-items:center;gap:12px}.appearance-small-a{font-size:13px}.appearance-large-a{font-size:25px}.list-dialog .appearance-font-line input[type=range]{flex:1;min-width:0;width:100%;min-height:28px;height:28px;padding:0;border:0;background:transparent;box-shadow:none;accent-color:#b6eee2}.appearance-font-value{display:block;margin-top:0;text-align:center;font-size:12px;line-height:1.5;color:inherit;opacity:.75}
.appearance-chat-sample{grid-column:1/-1;display:flex;flex-direction:column;gap:7px;min-width:0;margin-top:0;padding:11px 12px;border:1px solid #e1fff235;border-radius:17px;background:#143b4a22}.appearance-chat-sample p{width:fit-content;max-width:94%;margin:0!important;padding:8px 11px;border-radius:14px;font-size:var(--sample-font)!important;line-height:1.6!important;color:#244b5b!important;white-space:pre-wrap}.appearance-sample-other{align-self:flex-start;background:#e3edef}.appearance-sample-mine{align-self:flex-end;background:#b5e2df}
.list-dialog .appearance-select{width:100%;min-height:46px;padding:10px 13px;border:1px solid #d4f4ee69;border-radius:17px;background:#4a7482;color:#f3fffb;font-size:15px}
.appearance-picture-trigger,.appearance-picture-option{display:flex;align-items:center;gap:12px;width:100%;min-height:58px;padding:8px 11px;border:1px solid #d4f4ee69;border-radius:17px;background:#d9f6ec14;color:inherit;text-align:left;font-size:15px;line-height:1.5}.appearance-picture-trigger>span,.appearance-picture-option>span{flex:1;min-width:0}.appearance-picture-trigger>img,.appearance-picture-option>img{width:60px;height:38px;flex-shrink:0;border:1px solid #e5fff44d;border-radius:9px;object-fit:cover}.appearance-picture-trigger>svg{width:17px;height:17px;flex-shrink:0;transform:rotate(90deg);opacity:.75}
.appearance-picture-select{position:relative}.appearance-picture-options{position:absolute;z-index:20;box-sizing:border-box;max-height:215px;overflow-y:auto;overscroll-behavior:contain;margin:0;padding:5px;border:1px solid #d4f4ee69;border-radius:18px;background:#426b78;box-shadow:inset 0 1px 2px #ffffff35,0 10px 25px #112f443b;scrollbar-width:none}.appearance-picture-options[hidden]{display:none}.appearance-picture-options::-webkit-scrollbar{display:none}.appearance-picture-option{min-height:56px;border:0;border-radius:12px;background:transparent}.appearance-picture-option+.appearance-picture-option{border-top:1px solid #e1fff221}.appearance-picture-option[aria-selected=true],.appearance-picture-option:hover{background:#d9fff121}.appearance-picture-option:focus-visible,.appearance-picture-trigger:focus-visible{outline:0;outline-offset:0;box-shadow:inset 0 0 0 1px #ddfff2a8}
html[data-appearance-active] .appearance-picture-options{background:var(--appearance-solid);color:var(--appearance-ink)}

html[data-appearance-active] :is(.composer-icon,.preview-send-button,.list-bottom-navigation button,.me-navigation a,.friend-block-copy strong,.friend-block-row,.appearance-setting-title){color:var(--appearance-ink)!important}
html[data-appearance-active] .plus-menu::before{background:var(--appearance-solid)!important;border-color:var(--appearance-line)!important}
html[data-appearance-active] .list-dialog{max-height:calc((var(--app-viewport-height,100svh) - 32px) / var(--appearance-scale))!important;width:min(420px,calc((100vw - 32px) / var(--appearance-scale)))!important}

.appearance-font-heading{display:flex;flex-direction:column;align-items:flex-start;gap:4px}.appearance-font-heading .appearance-font-value{font-size:12px;font-weight:400}
@media(max-width:380px){.appearance-setting{grid-template-columns:78px minmax(0,1fr);gap:10px}.appearance-picture-trigger,.appearance-picture-option{gap:8px;padding:8px;font-size:14px}.appearance-picture-trigger>img,.appearance-picture-option>img{width:42px;height:30px}.appearance-font-line{gap:8px}}

/* Classic light is a flat chat background with a separate list surface on wide screens. */
html[data-appearance-background=classic-light]{
  --classic-canvas:#f7f7f7;
  --classic-list:#e8e8e8;
  --classic-divider:#d6d6d6;
  --classic-green:#087e53;
  --classic-ink:#202124;
  --classic-muted:#51565c;
  --classic-danger:#9c2c35;
  --classic-hover:#e5eee9;
  background-color:var(--classic-canvas);
}
html[data-appearance-background=classic-light] .page-backdrop{background-color:var(--classic-canvas)}
html[data-appearance-background=classic-light] .page-backdrop::after{background:none!important}
html[data-appearance-background=classic-light] .chat-list-layout>.chat-list-shell{background:var(--classic-list)!important;border-color:var(--classic-divider)}
html[data-appearance-background=classic-light] :is(.chat-window-shell,.chat-list-empty-pane){background:var(--classic-canvas)!important}
html[data-appearance-background=classic-light] .conversation-sidebar{border-color:var(--classic-divider)}
html[data-appearance-background=classic-light] :is(.chat-window-header,.preview-composer,.list-bottom-navigation){
  box-shadow:none!important;
  border-color:var(--classic-divider)!important;
}
html[data-appearance-background=classic-light] :is(.chat-window-header,.preview-composer){border-radius:8px}
html[data-appearance-background=classic-light] .list-search{border-radius:8px}
html[data-appearance-background=classic-light] .chat-list-header .list-brand{
  align-items:center;
  gap:7px;
}
html[data-appearance-background=classic-light] .chat-list-header .list-brand-logo{
  width:20px;
  height:26px;
  filter:brightness(.42);
}
@supports (mask-image:url('./brand-leaf.svg')) or (-webkit-mask-image:url('./brand-leaf.svg')){
  html[data-appearance-background=classic-light] .chat-list-header .list-brand-logo{display:none}
  html[data-appearance-background=classic-light] .chat-list-header .list-brand::before{
    content:'';
    flex:0 0 20px;
    height:26px;
    background:var(--classic-green);
    -webkit-mask:url('./brand-leaf.svg') center / contain no-repeat;
    mask:url('./brand-leaf.svg') center / contain no-repeat;
  }
}
html[data-appearance-background=classic-light] .chat-list-header .list-brand h1{
  font-family:var(--sans);
  font-size:clamp(19px,5.6vw,22px);
  font-weight:650;
  line-height:1.2;
  letter-spacing:.01em;
}
html[data-appearance-background=classic-light] .list-brand-copy{
  display:flex;
  flex:0 0 auto;
  align-items:center;
  padding:0;
}
html[data-appearance-background=classic-light] .list-brand-copy>p{display:none}
html[data-appearance-background=classic-light] .list-brand-copy>.live-header-status{
  padding:3px 7px;
  border-radius:12px;
  background:#dcdfe0;
  color:#4c5256;
  font:11px/1.35 var(--sans);
}
html[data-appearance-background=classic-light] .list-brand-copy>.live-header-status.is-online{
  background:#dcebe2;
  color:#176346;
}
html[data-appearance-background=classic-light] :is(.list-brand,.list-brand p,.list-icon-button,.conversation-copy h2,.conversation-copy p,.conversation-meta,.contacts-page-header h2,.contacts-page-header .contacts-page-add,.contacts-page-body .preview-contact-main,.contacts-page-body .preview-contact-more,.contacts-page-body .preview-contact-copy small){
  text-shadow:none;
}
html[data-appearance-background=classic-light] .chat-list-page .conversation-row{
  border-color:var(--classic-divider);
  border-radius:7px;
}
html[data-appearance-background=classic-light] .chat-list-page .conversation-row:not(.is-active):is(:hover,:active){background:#dedede;box-shadow:none}
html[data-appearance-background=classic-light] .chat-list-page .conversation-row.is-active{
  background:var(--classic-green);
  border-color:var(--classic-green);
  box-shadow:none;
}
html[data-appearance-background=classic-light] .conversation-row.is-active :is(.conversation-copy h2,.conversation-copy p,.conversation-meta,.conversation-receipt){color:#fff!important}
html[data-appearance-background=classic-light] :is(.conversation-online-dot,.chat-online-dot),
html[data-appearance-background=classic-light] .live-header-status.is-online::before{background:var(--classic-green)}
html[data-appearance-background=classic-light] .conversation-row.is-active .conversation-online-dot{background:#95ec9b}
html[data-appearance-background=classic-light] .conversation-receipt.is-read{color:var(--classic-green)}
html[data-appearance-background=classic-light] :is(.chat-message-avatar,.conversation-row .preview-avatar,.chat-peer-avatar){border-radius:6px}
html[data-appearance-background=classic-light] .assistant-avatar{
  border-radius:6px;
  background:#dcebe2;
  border-color:#b0ccbd;
  color:#176346;
}
html[data-appearance-background=classic-light] .assistant-avatar svg{width:56%;height:56%}
html[data-appearance-background=classic-light] #assistant-status{color:var(--classic-muted)}
html[data-appearance-background=classic-light] :is(.preview-bubble,.preview-audio-bubble){
  border-radius:7px;
  box-shadow:none;
  color:#202124!important;
}
html[data-appearance-background=classic-light] :is(.chat-date,.preview-message-empty,.chat-online-label,.preview-message-meta){
  color:var(--appearance-muted,#595e63);
  text-shadow:none;
}
html[data-appearance-background=classic-light] .appearance-chat-sample{background:var(--classic-canvas);border-color:var(--classic-divider)}
html[data-appearance-background=classic-light] .appearance-chat-sample .appearance-sample-mine{background:var(--appearance-mine)}
html[data-appearance-background=classic-light] .appearance-chat-sample .appearance-sample-other{background:var(--appearance-other)}

/* Keep pop-up surfaces and their content colors together on the light backdrop. */
html[data-appearance-active][data-appearance-background=classic-light] :is(.list-dialog,.composer-panel,.plus-menu,.preview-message-menu,.conversation-action-menu,.chat-input-menu,.chat-album-dialog){
  --appearance-ink:var(--classic-ink);
  --appearance-muted:var(--classic-muted);
  --appearance-surface-a:var(--classic-canvas);
  --appearance-surface-b:var(--classic-canvas);
  --appearance-solid:#fff;
  --appearance-line:var(--classic-divider);
  --appearance-accent:#95ec9b;
  background:var(--appearance-solid)!important;
  color:var(--appearance-ink)!important;
  border-color:var(--appearance-line)!important;
}
html[data-appearance-background=classic-light] :is(.composer-panel,.plus-menu,.preview-message-menu,.conversation-action-menu,.chat-input-menu,.preview-selection-toolbar) button,
html[data-appearance-background=classic-light] #emoji-panel .preview-emoji-tab,
html[data-appearance-background=classic-light] :is(.chat-background-option,.preview-contact-add,.preview-composer .preview-hold-to-talk){
  color:var(--classic-ink);
}
html[data-appearance-background=classic-light] :is(.composer-panel,.plus-menu,.preview-message-menu,.conversation-action-menu,.chat-input-menu,.preview-selection-toolbar) button svg{
  color:inherit;
}
html[data-appearance-background=classic-light] :is(.plus-menu .menu-danger,.preview-message-menu .preview-message-menu-danger,.conversation-action-menu .conversation-action-danger,.preview-selection-toolbar .preview-selection-delete){
  color:var(--classic-danger);
}
html[data-appearance-background=classic-light] .conversation-menu .menu-danger svg{color:inherit}
html[data-appearance-background=classic-light] :is(.composer-panel,.plus-menu,.preview-message-menu,.conversation-action-menu,.chat-input-menu,.preview-selection-toolbar) button:not(:disabled):is(:hover,:focus-visible),
html[data-appearance-background=classic-light] #emoji-panel .preview-emoji-tab[aria-pressed=true],
html[data-appearance-background=classic-light] :is(.chat-background-option:hover,.appearance-picture-option[aria-selected=true],.appearance-picture-option:hover){
  background:var(--classic-hover);
}
html[data-appearance-background=classic-light] .attachment-panel button+button::before{background:var(--classic-divider)}
html[data-appearance-background=classic-light] :is(.plus-menu,.preview-message-menu,.conversation-action-menu) button+button::before,
html[data-appearance-background=classic-light] .chat-background-option{border-color:var(--classic-divider)}
html[data-appearance-background=classic-light] .list-dialog :is(p,.settings-scope-label,.global-notification-volume output,.global-privacy-device-toolbar,.friend-add-account,.friend-add-last-seen){
  color:var(--classic-muted);
}
html[data-appearance-background=classic-light] .list-dialog :is(.me-setting-entry>svg,.me-device-row>svg,.global-privacy-entry>svg,.global-privacy-device-row>svg){
  color:var(--classic-muted);
}
html[data-appearance-background=classic-light] .friend-block-switch[aria-checked=false]{background:#737a7f}
html[data-appearance-background=classic-light] .friend-block-switch[aria-checked=true]{background:var(--classic-green)!important}
html[data-appearance-background=classic-light][data-appearance-color=follow] :is(input,select,textarea){color-scheme:light}
html[data-appearance-background=classic-light] :is(.list-dialog,.composer-panel,.plus-menu,.preview-message-menu,.conversation-action-menu,.chat-input-menu,.chat-album-dialog) :is(button,input,select,textarea):focus-visible{
  outline:2px solid var(--classic-green);
  outline-offset:-2px;
}
