/* Dashboard Appearance dialog, plus the boot cover below. The Light overrides live in dashboard-light.css,
   which dashboard-appearance.js adds only for Light. Dark (including the approved 30%-alpha glass) remains
   entirely in its original stylesheets. This sheet stays in dashboard.html after the page stylesheets: route
   sheets are inserted before it and the light sheet right after it. The controller resolves System into
   data-dashboard-theme; CSS deliberately does not override a user's choice with prefers-color-scheme. */

/* Native modal lives on body, not inside the scaled dashboard composition. */
.dashboard-page .da-dialog {
  --vx-unit:1px;
  --da-accent:var(--vx-lime);
  box-sizing:border-box;
  width:min(540px,calc(100vw - 32px));
  max-width:calc(100vw - 32px);
  max-height:calc(100dvh - 32px);
  margin:auto;
  padding:var(--vx-space-24);
  overflow:auto;
  overscroll-behavior:contain;
  border:1px solid var(--vx-hairline-strong);
  border-radius:var(--vx-radius-card);
  background:color-mix(in srgb,var(--vx-surface) 30%,transparent);
  color:var(--vx-text);
  color-scheme:dark;
  font:var(--vx-weight-regular) var(--vx-text-input)/var(--vx-leading-input) var(--vx-font-sans);
  font-feature-settings:var(--vx-font-features);
  letter-spacing:var(--vx-track-text);
  text-align:start;
  -webkit-backdrop-filter:blur(5.4px);
  backdrop-filter:blur(5.4px);
}
.dashboard-page .da-dialog::backdrop {
  background:color-mix(in srgb,var(--vx-bg) 86%,transparent);
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px);
}
.dashboard-page .da-dialog *,
.dashboard-page .da-dialog *::before,
.dashboard-page .da-dialog *::after { box-sizing:border-box; }
.dashboard-page .da-heading { display:flex;align-items:center;gap:var(--vx-space-16); }
.dashboard-page .da-heading h2 {
  flex:1;min-width:0;margin:0;overflow-wrap:anywhere;
  font-size:var(--vx-text-subheading);font-weight:var(--vx-weight-medium);line-height:var(--vx-leading-subheading);
}
.dashboard-page .da-close {
  display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0;
  border:1px solid var(--vx-hairline);border-radius:var(--vx-radius-pill);
  background:transparent;color:var(--vx-text-secondary);cursor:pointer;
  font:var(--vx-weight-regular) var(--vx-text-heading)/1 var(--vx-font-sans);letter-spacing:var(--vx-track-heading);
}
.dashboard-page .da-close svg { display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.dashboard-page .da-close:hover { background:var(--vx-whisper);color:var(--vx-text); }
.dashboard-page .da-intro { margin:var(--vx-space-12) 0 var(--vx-space-24);color:var(--vx-text-muted);font-size:var(--vx-text-sm);overflow-wrap:anywhere; }
.dashboard-page .da-themes {
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--vx-space-12);
  min-width:0;margin:0;padding:0;border:0;
}
.dashboard-page .da-themes legend { margin-bottom:var(--vx-space-12);padding:0;font-size:var(--vx-text-sm);font-weight:var(--vx-weight-medium); }
.dashboard-page .da-option {
  position:relative;display:grid;gap:var(--vx-space-12);min-width:0;padding:var(--vx-space-12);
  border:1px solid var(--vx-hairline-strong);border-radius:var(--vx-radius-card);cursor:pointer;
  background:transparent;color:var(--vx-text);
}
.dashboard-page .da-option:hover { background:var(--vx-whisper); }
.dashboard-page .da-option:has(input:checked) { border-color:var(--da-accent);box-shadow:inset 0 0 0 1px var(--da-accent); }
.dashboard-page .da-option input {
  position:absolute;inset-inline-start:var(--vx-space-12);bottom:var(--vx-space-16);
  width:16px;height:16px;margin:0;accent-color:var(--da-accent);cursor:pointer;
}
.dashboard-page .da-label { min-width:0;padding-inline-start:var(--vx-space-24);font-size:var(--vx-text-sm);font-weight:var(--vx-weight-medium);overflow-wrap:anywhere; }
/* Literal theme previews retain their identity while the surrounding UI changes. */
.dashboard-page .da-swatch {
  display:grid;grid-template-columns:22% 1fr;grid-template-rows:12px 1fr;gap:var(--vx-space-8);
  height:76px;padding:var(--vx-space-8);overflow:hidden;border-radius:var(--vx-radius-nested);
  border:1px solid var(--vx-light-hairline-strong);
}
.dashboard-page .da-swatch i { display:block;min-width:0;border-radius:var(--vx-radius-nested); }
.dashboard-page .da-swatch i:first-child { grid-row:1/3; }
.dashboard-page .da-swatch i:nth-child(2) { width:72%; }
.dashboard-page .da-swatch-dark { background:var(--vx-ink); }
.dashboard-page .da-swatch-dark i { background:color-mix(in srgb,var(--vx-light-surface) 18%,transparent); }
.dashboard-page .da-swatch-dark i:nth-child(2) { background:var(--vx-lime); }
.dashboard-page .da-swatch-light { background:var(--vx-light-bg); }
.dashboard-page .da-swatch-light i { background:var(--vx-light-hairline); }
.dashboard-page .da-swatch-light i:nth-child(2) { background:var(--vx-light-accent); }
.dashboard-page .da-swatch-system { background:linear-gradient(90deg,var(--vx-ink) 50%,var(--vx-light-bg) 50%); }
.dashboard-page .da-swatch-system i { background:var(--vx-light-hairline-strong); }
.dashboard-page .da-swatch-system i:first-child { background:color-mix(in srgb,var(--vx-light-surface) 18%,transparent); }
.dashboard-page .da-swatch-system i:nth-child(2) { background:var(--vx-lime); }
.dashboard-page .da-language { display:grid;gap:var(--vx-space-8);margin-top:var(--vx-space-24);font-size:var(--vx-text-sm);font-weight:var(--vx-weight-medium); }
.dashboard-page .da-language select {
  width:100%;min-width:0;min-height:44px;padding:var(--vx-space-8) var(--vx-space-16);
  border:1px solid var(--vx-hairline-strong);border-radius:var(--vx-radius-pill);
  background:var(--vx-surface-sunken);color:var(--vx-text);
  font:var(--vx-weight-regular) var(--vx-text-input)/var(--vx-leading-input) var(--vx-font-sans);
}
.dashboard-page .da-language option { background:var(--vx-surface);color:var(--vx-text); }
/* As in the account menu (dashboard-home.css): outside Russian pages, no Inter in the language list, so its
   "Русский" entry never fetches the Cyrillic face; Latin labels keep OpenAI Sans. */
html:not([lang=ru]) .dashboard-page .da-language :is(select,option) { font-family:"OpenAI Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif!important; }
.dashboard-page .da-status { min-height:1.5em;margin:var(--vx-space-16) 0 0;color:var(--vx-text-muted);font-size:var(--vx-text-caption);overflow-wrap:anywhere; }
.dashboard-page .da-status[data-error=true] { color:var(--vx-error); }
.dashboard-page .da-language select:disabled { color:var(--vx-text-muted);cursor:wait; }
.dashboard-page .da-dialog :is(button,select,input):focus-visible { outline:2px solid var(--da-accent);outline-offset:3px; }
.dashboard-page .da-option:has(input:focus-visible) { outline:2px solid var(--da-accent);outline-offset:3px; }
@media (max-width:480px) {
  .dashboard-page .da-dialog { padding:var(--vx-space-16); }
  .dashboard-page .da-themes { grid-template-columns:minmax(0,1fr);gap:var(--vx-space-8); }
  .dashboard-page .da-option { grid-template-columns:76px minmax(0,1fr);align-items:center;padding:var(--vx-space-8);padding-inline-end:var(--vx-space-32); }
  .dashboard-page .da-swatch { height:52px; }
  .dashboard-page .da-label { padding:0; }
  .dashboard-page .da-option input { inset-inline-start:auto;inset-inline-end:var(--vx-space-12);bottom:auto;top:calc(50% - 8px); }
}
@media (prefers-reduced-motion:no-preference) {
  .dashboard-page :is(.da-close,.da-option,.da-language select) { transition:color var(--vx-duration) var(--vx-ease),background-color var(--vx-duration) var(--vx-ease),border-color var(--vx-duration) var(--vx-ease); }
}

/* A stored Light theme at boot, until dashboard-light.css (inserted by dashboard-appearance.js) has loaded:
   the light page colour with the dashboard hidden, never a frame of dark cards. Cleared on load or error. */
html[data-dashboard-light-pending] .dashboard-page { background:var(--vx-light-bg);color-scheme:light; }
html[data-dashboard-light-pending] .dashboard-page [data-dashboard-root] { visibility:hidden; }
