/* Account themes. Literal fallbacks preserve the original MDWDark palette. */
:root{--theme-color:#111318;--theme-scheme:dark;--theme-on-accent:#fff;--theme-on-danger:#fff}
:root[data-theme]{color-scheme:var(--theme-scheme)}

:root[data-theme="MDWLight"]{
  --bg:#e9edf4;
  --bg2:#f4f6fa;
  --surface:#ffffff;
  --surface2:#edf1f8;
  --surface3:#e0e6f1;
  --line:#d7deea;
  --line2:#b8c3d6;
  --text:#20283a;
  --muted:#56627a;
  --muted2:#65718a;
  --accent:#4654d6;
  --accent2:#3641b5;
  --accent-soft:rgba(70,84,214,.10);
  --on-accent:#ffffff;
  --green:#14724c;
  --yellow:#96610b;
  --red:#bf3049;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#f4f6fa;--theme-scheme:light;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#fff;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(30,35,55,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}
:root[data-theme="MDWPink"]{
  --bg:#170c16;
  --bg2:#21121f;
  --surface:#2c1928;
  --surface2:#382034;
  --surface3:#482b41;
  --line:#55364c;
  --line2:#755267;
  --text:#fff1f9;
  --muted:#d6acbf;
  --muted2:#b687a0;
  --accent:#f071b6;
  --accent2:#ffa7d6;
  --accent-soft:rgba(240,113,182,.14);
  --on-accent:#321326;
  --green:#58d8a1;
  --yellow:#ecc26d;
  --red:#ff879f;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#21121f;--theme-scheme:dark;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#170c16;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(255,255,255,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}
:root[data-theme="MDWRed"]{
  --bg:#160c0e;
  --bg2:#201113;
  --surface:#2a1a1d;
  --surface2:#352124;
  --surface3:#482d30;
  --line:#56373c;
  --line2:#765056;
  --text:#fff2f1;
  --muted:#d6b0b3;
  --muted2:#b89196;
  --accent:#f2777c;
  --accent2:#ffaca7;
  --accent-soft:rgba(242,119,124,.14);
  --on-accent:#351216;
  --green:#58d3a0;
  --yellow:#edbf74;
  --red:#ff8790;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#201113;--theme-scheme:dark;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#160c0e;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(255,255,255,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}
:root[data-theme="MDWCherryBlossom"]{
  --bg:#f8e8ef;
  --bg2:#fff5f8;
  --surface:#fffafb;
  --surface2:#fbe9f0;
  --surface3:#f1d6e4;
  --line:#ead1de;
  --line2:#d6acc1;
  --text:#3b2435;
  --muted:#785267;
  --muted2:#916579;
  --accent:#b83670;
  --accent2:#9e2f65;
  --accent-soft:rgba(184,54,112,.10);
  --on-accent:#ffffff;
  --green:#287452;
  --yellow:#966523;
  --red:#b6324e;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#fff5f8;--theme-scheme:light;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#fff;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(30,35,55,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}
:root[data-theme="MDWRisingSun"]{
  --bg:#f3e8d5;
  --bg2:#fff7eb;
  --surface:#fffdf8;
  --surface2:#f9ecd8;
  --surface3:#eddabd;
  --line:#e3cdb1;
  --line2:#c7ab83;
  --text:#362820;
  --muted:#7b5c46;
  --muted2:#856248;
  --accent:#b73728;
  --accent2:#922d23;
  --accent-soft:rgba(183,55,40,.10);
  --on-accent:#ffffff;
  --green:#31714c;
  --yellow:#925906;
  --red:#b32e30;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#fff7eb;--theme-scheme:light;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#fff;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(30,35,55,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}
:root[data-theme="MDWPurple"]{
  --bg:#110c1b;
  --bg2:#191326;
  --surface:#241b34;
  --surface2:#2f2443;
  --surface3:#3d3056;
  --line:#4f4066;
  --line2:#6c578a;
  --text:#f6f0ff;
  --muted:#c7b4de;
  --muted2:#ac95c8;
  --accent:#bd9aff;
  --accent2:#ddc4ff;
  --accent-soft:rgba(189,154,255,.14);
  --on-accent:#29163f;
  --green:#63d9b0;
  --yellow:#e8c06d;
  --red:#ff8da8;
  --theme-bg:var(--bg);
  --theme-bg2:var(--bg2);
  --theme-surface:var(--surface);
  --theme-surface2:var(--surface2);
  --theme-surface3:var(--surface3);
  --theme-line:var(--line);
  --theme-line2:var(--line2);
  --theme-text:var(--text);
  --theme-muted:var(--muted);
  --theme-muted2:var(--muted2);
  --theme-accent:var(--accent);
  --theme-accent-soft:var(--accent-soft);
  --theme-on-accent:var(--on-accent);
  --theme-color:#191326;--theme-scheme:dark;
  --theme-accent-text:var(--accent2);--theme-danger:var(--red);--theme-success:var(--green);--theme-warning:var(--yellow);
  --theme-on-danger:#110c1b;
  --theme-danger-fill:var(--red);--theme-success-fill:var(--green);--theme-warning-fill:var(--yellow);
  --theme-danger-soft:color-mix(in srgb,var(--red) 12%,var(--surface));--theme-success-soft:color-mix(in srgb,var(--green) 12%,var(--surface));--theme-warning-soft:color-mix(in srgb,var(--yellow) 12%,var(--surface));
  --theme-danger-border:color-mix(in srgb,var(--red) 40%,var(--line));--theme-glow:var(--accent-soft);--theme-divider:var(--line);
  --theme-hover:rgba(255,255,255,.045);
  --panel:var(--surface);--panel2:var(--surface2);--blue:var(--accent);--cyan:var(--accent2);--text-primary:var(--text);--border-color:var(--line);
  --mdw-surface-0:var(--bg);--mdw-surface-1:var(--bg2);--mdw-surface-2:var(--surface);--mdw-surface-3:var(--surface2);--mdw-divider:var(--line);--mdw-hover:var(--theme-hover);
  --theme-banner:linear-gradient(120deg,var(--surface3),var(--accent-soft) 65%,var(--surface2));
}

:root[data-theme="MDWCherryBlossom"]{--theme-banner:radial-gradient(ellipse at 82% 20%,#ffe3ef 0 9%,transparent 10%),radial-gradient(ellipse at 93% 65%,#f4bed5 0 10%,transparent 11%),radial-gradient(ellipse at 72% 70%,#f9d0e2 0 12%,transparent 13%),linear-gradient(115deg,#f1d6e4,#fff4f8)}
:root[data-theme="MDWRisingSun"]{--theme-banner:radial-gradient(circle at 84% 98%,#c84534 0 43px,#e9b458 44px 49px,transparent 50px),linear-gradient(115deg,#efd7b0,#fff7eb)}
:root[data-theme]:not([data-theme="MDWDark"]) .me-banner{background:var(--theme-banner)}
:root[data-theme]:not([data-theme="MDWDark"]) .ambient{background:radial-gradient(ellipse at 85% 0,var(--accent-soft),transparent 60%)}
:root[data-theme]:not([data-theme="MDWDark"]) .call-control.primary{color:var(--theme-on-accent)}
:root[data-theme]:not([data-theme="MDWDark"]) .message-row.mine .rich-text,
:root[data-theme]:not([data-theme="MDWDark"]) .secure-messages>div.own{background:color-mix(in srgb,var(--accent) 16%,var(--surface));border-color:color-mix(in srgb,var(--accent) 45%,var(--line));color:var(--text)}
:root[data-theme]:not([data-theme="MDWDark"]) .reaction-pill.reacted,
:root[data-theme]:not([data-theme="MDWDark"]) .secure-reactions>button.reacted,
:root[data-theme]:not([data-theme="MDWDark"]) .composer-icon.picker-active{background:var(--accent-soft);color:var(--accent2)}
:root[data-theme]:not([data-theme="MDWDark"]) .button.primary,
:root[data-theme]:not([data-theme="MDWDark"]) .picker-upload-actions button[type=submit]{color:var(--theme-on-accent)}
:root[data-theme]:not([data-theme="MDWDark"]) .call-control.danger{color:var(--theme-on-danger)}
::selection{background:var(--accent);color:var(--theme-on-accent,#fff)}
.appearance-card{margin-top:16px;padding:20px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.appearance-heading{display:flex;align-items:center;gap:11px;margin-bottom:18px}
.appearance-heading>svg{color:var(--accent2)}
.appearance-heading h2{margin:0;font-size:17px;color:var(--text)}
.appearance-heading p{margin:4px 0 0;font-size:12px;color:var(--muted);line-height:1.5}
.theme-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.theme-option{display:flex;flex-direction:column;min-width:0;gap:9px;padding:10px;text-align:left;border:1px solid var(--line);border-radius:10px;background:var(--bg2);color:var(--text);font:inherit;cursor:pointer;transition:border-color .15s,box-shadow .15s}
.theme-option:hover{border-color:var(--accent2)}
.theme-option.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.theme-option:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.theme-option:disabled{cursor:wait}
.theme-preview{position:relative;display:flex;height:76px;width:100%;gap:8px;overflow:hidden;border-radius:6px;background:var(--preview-bg);padding:9px}
.theme-preview-rail{width:22%;border-radius:3px;background:var(--preview-panel)}
.theme-preview-chat{display:flex;flex:1;flex-direction:column;gap:7px;align-items:flex-start;padding-top:4px}
.theme-preview-chat i{display:block;height:5px;width:76%;border-radius:3px;background:var(--preview-accent);opacity:.35}
.theme-preview-chat i:nth-child(2){width:56%;opacity:.18}
.theme-preview-chat i:nth-child(3){width:66%;opacity:.18}
.theme-preview-bubble{position:absolute;right:12px;bottom:11px;width:36%;height:12px;background:var(--preview-accent);border-radius:5px;opacity:.8}
.theme-preview-check{position:absolute;top:7px;right:7px;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--preview-accent);color:var(--preview-bg)}
.theme-option-title{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:5px;font-size:12px;font-weight:750;overflow-wrap:anywhere}
.theme-option-title small{font-size:9px;padding:2px 5px;border-radius:4px;background:var(--accent-soft);color:var(--accent2)}
.theme-option-description{font-size:11px;color:var(--muted);line-height:1.45}
.theme-status{min-height:17px;margin:14px 0 0;font-size:11px;color:var(--muted)}
@media(max-width:600px){.appearance-card{padding:15px}.theme-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.theme-option{padding:9px}.appearance-heading p{font-size:11px}}
@media(prefers-reduced-motion:reduce){.theme-option{transition:none}}
