/* The document head resolves the selected mode before the page is painted. */
:root {
  --canvas: #faf9f6;
  --panel: #fff;
  --surface: #f3eff5;
  --selected: #e8dced;
  --edge: #e4e0e5;
  --on-accent: #fff;
  --glass: rgba(255,255,255,.92);
}
:root[data-theme="dark"] {
  --canvas: #19171d;
  --panel: #232027;
  --surface: #302b34;
  --selected: #43344c;
  --edge: #49414d;
  --glass: rgba(36,32,40,.95);
  --ink: #f3edf6;
  --muted: #c1b7c7;
  --paper: var(--canvas);
  --white: var(--panel);
  --line: var(--edge);
  --plum: #dec2ed;
  --lilac: #3c3044;
  --orange: #ffae73;
  --peach: #49342b;
  --on-accent: #34243d;
  accent-color: var(--plum);
}
.screen-modes {margin:0;padding:0;border:0;min-width:0}
.screen-modes legend {margin:0 0 10px;padding:0;font-size:1.12rem;font-weight:700}
.screen-modes > div {display:inline-flex;max-width:100%;gap:3px;padding:3px;background:var(--surface);border:1px solid var(--edge);border-radius:15px}
.screen-modes label {position:relative;display:block;margin:0;cursor:pointer}
.screen-modes label input {position:absolute;inset:0;margin:0;width:100%;height:100%;opacity:0;cursor:pointer}
.screen-modes label span {display:grid;place-items:center;min-height:44px;padding:0 clamp(8px,3vw,18px);border-radius:11px;color:var(--muted);font-weight:600}
.screen-modes input:checked + span {background:var(--plum);color:var(--on-accent)}
.screen-modes input:focus-visible + span {outline:2px solid var(--plum);outline-offset:3px}
@media (forced-colors:active) {
  .screen-modes input:checked + span {outline:2px solid Highlight;outline-offset:-3px}
}

/* The Discover view also uses the selected palette in its own header and tabs. */
html[data-theme] :is(body,.workspace):has(.discover),
html[data-theme] .workspace:has(.discover) .main-wrap {background:var(--canvas)}
html[data-theme] .workspace:has(.discover) .workspace-bar {background:var(--canvas);border-color:var(--edge)}
html[data-theme] .discover {--paper:var(--ink);--line:var(--edge);--secondary:var(--muted)}
html[data-theme] .discover :is(.discover-ask,.discover-news),
html[data-theme] .workspace:has(.discover) .workspace-bar :is(.quiet,button) {
  background:var(--surface);color:var(--ink);border-color:var(--edge)
}
html[data-theme] .discover :is(.discover-categories button,.discover-section-heading button,.discover-news small,.discover-news > span:last-child),
html[data-theme] .workspace:has(.discover) .desktop-path {color:var(--muted)}
html[data-theme] .discover-categories button > span {background:var(--surface)}
html[data-theme] .discover-categories button[aria-pressed=true],
html[data-theme] .discover button:hover {color:var(--plum)}
html[data-theme] :is(.discover-categories button[aria-pressed=true] > span,.discover-ask:hover) {background:var(--selected)}
html[data-theme] .discover-categories button[aria-pressed=true] > span {box-shadow:inset 0 0 0 1px var(--plum)}
html[data-theme] .discover :is(button,a):focus-visible {outline-color:var(--plum)}

html[data-theme="dark"] .workspace {background:var(--canvas)}
html[data-theme="dark"] :is(.sidebar,dialog,.skip:focus,.composer,.quiet,.examples button,.handoff-card,.review-card,.service-card,
  .profile-voice-row,.profile-wizard-actions,.library-tabs,.library-day > div,.archive-medium,.archive-message,.news-topic-chips button,
  .home-hero + .composer,.drawer-search,.admin-block :is(input,select)) {
  background:var(--panel);color:var(--ink);border-color:var(--edge)
}
html[data-theme="dark"] :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  background-color:var(--panel);color:var(--ink);border-color:var(--edge)
}
html[data-theme="dark"] :is(.composer textarea,.drawer-search input) {background:transparent}
html[data-theme="dark"] :is(input,textarea)::placeholder {color:#afa3b7}
html[data-theme="dark"] :is(.switch,.home-hero,.receipt,.team-banner,.context-link,.request-quote,.dialog-feedback,.call-check,
  .voice-companion,.preview-result,.profile-question,.archive-uploads li,.archive-preview,.chat-file-chip,.news-prefs .news-next,
  .nav-link:hover,.quiet:hover,.examples button:hover,.icon-btn:hover,.record-row[href]:hover,.menu-links a:hover,.feature-row:hover,
  .drawer-entry:hover,.drawer-entry:focus-within,.compose-icon:hover,.workspace-menu nav a:hover) {background:var(--surface)}
html[data-theme="dark"] #chat-editor {background:var(--panel)}
html[data-theme="dark"] :is(.user-msg,.nav-link.active,.switch button[aria-pressed=true],.mode-switch button[aria-pressed=true],
  .library-tabs a[aria-current],.workspace-menu nav a[aria-current],.appearance-choice input:checked + span,.avatar-choice input:checked + span,
  .profile-voice-row:has(input:checked)) {background:var(--selected);color:var(--ink)}
html[data-theme="dark"] :is(.welcome-product,.restore,.nav-link,.desktop-path,.hero-copy p,.text-button,.empty-line,.record-row > .ico,
  .examples button,.mode-switch button,.switch button,.chat-context,.chat-room .agent-head small,.profile-question p,.bookmark-message,
  .drawer-stow,.drawer-unavailable,.drawer-section,.drawer-entry small,.drawer-empty,.drawer-more,.catalog-item small,
  .library-suggestion-body p,.item-list .deselected b,.desktop-path span) {color:var(--muted)}
html[data-theme="dark"] :is(.avatar,.dialog-feedback,.nav-link.active,.mode-switch button[aria-pressed=true],.edit-row .text-button) {color:var(--plum)}
html[data-theme="dark"] .nav-link.active .ico {fill:var(--selected)}
html[data-theme="dark"] :is(.primary,.submit-round,.nav-count,.chat-dock .assistant-call,.chat-dock .voice-shortcuts a,
  .library-suggestion button,.news-topic-chips [aria-pressed=true],.profile-listen[aria-pressed=true]) {background:var(--plum);color:var(--on-accent)}
html[data-theme="dark"] :is(.primary:hover,.submit-round:hover,.chat-dock .assistant-call:hover) {background:#edd8f7}
html[data-theme="dark"] .dictation-bar [data-dictation-send] {color:var(--canvas)}
html[data-theme="dark"] :is(.feature-icon,.service-card:nth-child(even) .service-glyph,.library-file-icon,.library-art,.library-suggestion.lilac) {background:var(--lilac);color:var(--plum)}
html[data-theme="dark"] :is(.reply,.service-glyph,.library-file-icon.calendar,.library-suggestion.peach,.state-chip.pending) {background:var(--peach);color:#ffd9bb}
html[data-theme="dark"] :is(.library-suggestion.mint,.connection-result.success,.state-chip,.ms-initial,.ms-room-assist,.ms-own p) {background:#2b3c32;color:#cbebd1}
html[data-theme="dark"] :is(.error,.dictation-trigger[aria-pressed=true]) {background:#492c32;color:#ffc3c0}
html[data-theme="dark"] :is(.ms-error,.admin-delete > summary,.edit-row .text-button:hover) {color:#ffb0ac}
html[data-theme="dark"] .brand b span {color:var(--orange)}
html[data-theme="dark"] .art-panel {background:#493b54;color:#fff3ff}
html[data-theme="dark"] .art-panel :is(.mascot-label,.art-foot) {color:#fff3ff}
html[data-theme="dark"] dialog::backdrop {background:#09070ca8}
html[data-theme="dark"] dialog[open]:has(.workspace-menu),
html[data-theme="dark"] body:has(dialog[open] .workspace-menu) {background:var(--canvas);color:var(--ink)}
html[data-theme="dark"] dialog:has(.workspace-menu) .dialog-head button {color:var(--muted)}
html[data-theme="dark"] dialog:has(.workspace-menu)::backdrop {background:transparent}
html[data-theme="dark"] .drawer-entry mark {background:#2f4560;color:#d4e7fc}
html[data-theme="dark"] :is(.ms-tabs,.ms-list li,.ms-history,.catalog-item) {border-color:var(--edge)}
html[data-theme="dark"] :is(.ms-tabs button,.ms-person small,.ms-meta,.ms-room-head small,.ms-message time,.ms-empty) {color:var(--muted)}
html[data-theme="dark"] :is(.ms-tabs button[aria-pressed=true],.ms-assist) {color:#b3dbbb}
html[data-theme="dark"] .ms-tabs button[aria-pressed=true] {border-color:currentColor}
html[data-theme="dark"] .ms-message:not(.ms-own) p {background:var(--surface);color:var(--ink)}
html[data-theme="dark"] #install-invitation {background:var(--panel);color:var(--ink);border-color:var(--edge)}
html[data-theme="dark"] #install-invitation [data-install-app] {background:var(--plum);color:var(--on-accent)}
html[data-theme="dark"] #install-invitation [data-install-later] {color:var(--muted)}

@media(max-width:740px),(pointer:coarse) and (max-width:1000px) and (max-height:520px) {
  html[data-theme] .workspace:has(.discover) .workspace-bar {background:transparent}
  html[data-theme] .workspace:has(.discover) .mobile-tabs,
  html[data-theme="dark"] .workspace .mobile-tabs {background:var(--panel);border-color:var(--edge)}
  html[data-theme] .workspace:has(.discover) .mobile-tabs a,
  html[data-theme="dark"] .mobile-tabs a {color:var(--ink)}
  html[data-theme] .workspace:has(.discover) .mobile-tabs a[aria-current],
  html[data-theme="dark"] .mobile-tabs a[aria-current="page"] {background:var(--selected);color:var(--plum)}
  html[data-theme] .workspace:has(.discover) .mobile-tabs a[aria-current] .tab-detail,
  html[data-theme="dark"] .mobile-tabs a[aria-current="page"] .tab-detail {color:var(--selected)}
  html[data-theme="dark"] .workspace:has(.chat-room) .workspace-bar :is(.mobile-menu,[data-team-invite]),
  html[data-theme="dark"] .workspace:has(.chat-room) .mobile-name :is(.assistant-avatar,.assistant-name),
  html[data-theme="dark"] .workspace:has(.chat-room) .mobile-tabs,
  html[data-theme="dark"] .chat-room .chat-dock .composer {background:var(--glass);border-color:var(--edge);color:var(--ink)}
}
html[data-theme="light"] #dialog:has([data-live-panel]) {background:linear-gradient(160deg,#eee1d0,#faf7f3 57%,#f3edf5);color:var(--ink)}
html[data-theme="light"] :is(.call-state,.live-controls button,.live-controls [aria-pressed=true]) {color:var(--ink)}
html[data-theme="light"] :is(.call-head > button,.call-menu > summary,.call-pop,.call-circle) {background:var(--panel);border-color:var(--edge)}
html[data-theme="light"] .live-controls [aria-pressed=true] .call-circle {background:var(--plum);color:#fff}
html[data-theme="light"] .live-controls [data-live-stop] .call-circle {background:#c42031;color:#fff}

/* Tab selection uses the same quiet fill in the compact navigation. */
@media (width < 1024px) {
  html[data-theme] .work-tabs a {border:0;border-radius:8px}
  .work-tabs a {padding-inline:10px}
  html[data-theme] .work-tabs a[aria-current] {background:var(--selected);color:var(--plum)}
}
html[data-theme] .ms-tabs button {border:0;border-radius:6px}
html[data-theme] .ms-tabs button[aria-pressed=true] {background:var(--selected);color:var(--plum)}
.profile-progress span {border:0;padding:5px 8px;border-radius:6px}
.profile-progress .filled {color:var(--ink)}
.profile-progress [aria-current] {background:var(--selected)}
