/* Six appearances reuse the original workspace tokens. Business semantics stay independent. */
html:is(
  [data-theme="rose"],
  [data-theme="lavender"],
  [data-theme="peach"],
  [data-theme="mint"]
) {
  color-scheme: light;
  --bg-elevated: #ffffff;
  --text-primary: #302c35;
  --text-secondary: #544d58;
  --text-muted: #68606b;
  --text-disabled: #77717d;
  --text-on-accent: #ffffff;
  --success: #23644b;
  --success-soft: #e5f3eb;
  --warning: #765008;
  --warning-soft: #fff2d5;
  --danger: #a02732;
  --danger-soft: #fdecef;
  --info: #245c87;
  --info-soft: #e5eff9;
  --accent-cyan: #236878;
  --accent-cyan-soft: #e7f3f5;
  --shadow-soft: 0 2px 8px #34243208;
  --shadow-elevated: 0 16px 48px #3424321f;
  --shadow-color: #34243218;
  --overlay: #211c3159;
  --glow-cyan: none;
  --glow-blue: none;
}
html[data-theme="rose"] {
  --bg-base: #faf5f7;
  --bg-sidebar: #f5edf1;
  --bg-surface: #fffafb;
  --bg-surface-raised: #f5eaf0;
  --bg-hover: #f0e0e8;
  --bg-selected: #f4e3ea;
  --border-subtle: #e5d6df;
  --border-default: #bda5b2;
  --border-highlight: #8c345b;
  --accent-primary: #8c345b;
  --accent-primary-hover: #742b4b;
  --accent-primary-soft: #f4e3ea;
  --surface-glass: #fffafbf9;
  --avatar-surface: #ecd2df;
  --chart-primary: #963b66;
  --chart-secondary: #337268;
}
html[data-theme="lavender"] {
  --bg-base: #f7f5fb;
  --bg-sidebar: #efedf6;
  --bg-surface: #fcfbff;
  --bg-surface-raised: #eeebf6;
  --bg-hover: #e7e2f1;
  --bg-selected: #eae3f6;
  --border-subtle: #dcd7e8;
  --border-default: #b3a8c7;
  --border-highlight: #6550a4;
  --accent-primary: #6550a4;
  --accent-primary-hover: #514085;
  --accent-primary-soft: #eae3f6;
  --surface-glass: #fcfbfff9;
  --avatar-surface: #ded5ee;
  --chart-primary: #7053a4;
  --chart-secondary: #377479;
}
html[data-theme="peach"] {
  --bg-base: #faf6f0;
  --bg-sidebar: #f3ece2;
  --bg-surface: #fffcf7;
  --bg-surface-raised: #f6ebdd;
  --bg-hover: #eee1cf;
  --bg-selected: #f5e3d1;
  --border-subtle: #e4d7c6;
  --border-default: #baa78e;
  --border-highlight: #875026;
  --accent-primary: #875026;
  --accent-primary-hover: #713f1b;
  --accent-primary-soft: #f5e3d1;
  --surface-glass: #fffcf7f9;
  --avatar-surface: #eed7bc;
  --chart-primary: #94603b;
  --chart-secondary: #477569;
}
html[data-theme="mint"] {
  --bg-base: #f3f8f5;
  --bg-sidebar: #e9f2ed;
  --bg-surface: #fcfefc;
  --bg-surface-raised: #eaf3ed;
  --bg-hover: #deede5;
  --bg-selected: #deeee6;
  --border-subtle: #d1e1d7;
  --border-default: #97b2a3;
  --border-highlight: #196952;
  --accent-primary: #196952;
  --accent-primary-hover: #125540;
  --accent-primary-soft: #deeee6;
  --surface-glass: #fcfefcf9;
  --avatar-surface: #cae2d5;
  --chart-primary: #267860;
  --chart-secondary: #576fa2;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #121418;
  --bg-sidebar: #101216;
  --bg-surface: #1b1e24;
  --bg-surface-raised: #22262e;
  --bg-hover: #2b303b;
  --bg-selected: #323347;
  --border-subtle: #313641;
  --border-default: #586171;
  --border-highlight: #b5b2df;
  --accent-primary: #b5b2df;
  --accent-primary-hover: #cecbee;
  --accent-primary-soft: #323347;
  --surface-glass: #22262ef9;
  --avatar-surface: #3d4357;
  --chart-primary: #b2accf;
  --chart-secondary: #8ebcba;
  --bg-elevated: #2b303a;
  --text-primary: #e9e9ef;
  --text-secondary: #b7bfce;
  --text-muted: #9ea8bb;
  --text-disabled: #8993a5;
  --text-on-accent: #171623;
  --info: #a4b8d4;
  --info-soft: #29394e;
}

/* A brand tint must not turn an in-progress status into an error or warning. */
html:not([data-theme="default"])
  .workspace-theme
  :is(.mgr-status-info, .lead-status-running) {
  background: var(--info-soft);
  color: var(--info);
}
html:not([data-theme="default"]) .workspace-theme button:disabled {
  opacity: 1;
  color: var(--text-disabled);
  background: var(--bg-surface-raised);
  border-color: var(--border-subtle);
}
.workspace-theme .mgr-user-items:has(.appearance-settings) {
  width: min(304px, calc(100vw - 32px));
  min-width: 0;
  max-height: calc(100dvh - 132px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.appearance-settings {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2);
  min-width: 0;
}
.appearance-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  cursor: pointer;
  color: var(--text-primary);
}
.appearance-summary::after {
  content: "▾";
  color: var(--text-muted);
}
.appearance-settings[open] .appearance-summary::after {
  content: "▴";
}
.appearance-current {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--font-secondary);
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  padding: var(--space-2) 0;
}
.workspace-theme .theme-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  padding: var(--space-2);
  min-width: 0;
  min-height: 92px;
  white-space: normal;
  overflow-wrap: anywhere;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  background: var(--bg-surface);
  border-radius: var(--radius-m);
  box-shadow: none;
  font-size: var(--font-secondary);
  font-weight: 500;
}
.workspace-theme .theme-choice:hover {
  background: var(--bg-hover);
  filter: none;
}
.workspace-theme .theme-choice[aria-pressed="true"] {
  border-color: var(--border-highlight);
  outline: 1px solid var(--border-highlight);
  background: var(--accent-primary-soft);
}
.workspace-theme .theme-choice:focus-visible {
  outline: 2px solid var(--border-highlight);
  outline-offset: 2px;
}
.theme-name {
  text-align: left;
}
.theme-selected {
  font-size: 10px;
  color: var(--accent-primary);
  text-align: left;
}
.theme-preview {
  position: relative;
  display: block;
  height: 32px;
  border: 1px solid var(--preview-line);
  border-radius: var(--radius-s);
  background: var(--preview-base);
  overflow: hidden;
}
.theme-preview-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 22%;
  background: var(--preview-side);
}
.theme-preview-content {
  position: absolute;
  inset: 7px 6px 7px 32%;
  border: 1px solid var(--preview-line);
  border-radius: 2px;
  background: var(--preview-panel);
}
.theme-preview-accent {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 13px;
  height: 4px;
  border-radius: 2px;
  background: var(--preview-accent);
}
.theme-storage-status {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--font-secondary);
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: reduce) {
  .workspace-theme .theme-choice {
    transition: none;
  }
}
[data-preview="default"] {
  --preview-base: #141a23;
  --preview-side: #101720;
  --preview-panel: #1b232f;
  --preview-line: #425267;
  --preview-accent: #a4b8d4;
}
[data-preview="rose"] {
  --preview-base: #faf5f7;
  --preview-side: #f5edf1;
  --preview-panel: #fffafb;
  --preview-line: #e5d6df;
  --preview-accent: #8c345b;
}
[data-preview="lavender"] {
  --preview-base: #f7f5fb;
  --preview-side: #efedf6;
  --preview-panel: #fcfbff;
  --preview-line: #dcd7e8;
  --preview-accent: #6550a4;
}
[data-preview="peach"] {
  --preview-base: #faf6f0;
  --preview-side: #f3ece2;
  --preview-panel: #fffcf7;
  --preview-line: #e4d7c6;
  --preview-accent: #875026;
}
[data-preview="mint"] {
  --preview-base: #f3f8f5;
  --preview-side: #e9f2ed;
  --preview-panel: #fcfefc;
  --preview-line: #d1e1d7;
  --preview-accent: #196952;
}
[data-preview="dark"] {
  --preview-base: #121418;
  --preview-side: #101216;
  --preview-panel: #1b1e24;
  --preview-line: #313641;
  --preview-accent: #b5b2df;
}
