/* Core palette tokens are also read by the three swatches in the theme menu. */
:root, .theme-swatch[data-palette="light"] {
  --bg:#f4f5f7; --side:#e4e8ee; --surface:#fff; --ink:#27313e; --accent:#607c9f;
  --muted:#4e5e70; --side-text:#354457; --line:#cbd2db; --field:#fafbfd; --input-line:#768394;
  --soft:#eaf0f5; --hover:#e0e8f1; --head:#e9edf3; --focus:#345c88;
  --action:#405f80; --action-hover:#334e6b; --on-action:#fff; --link:#345578;
}
:root[data-theme="dark"], .theme-swatch[data-palette="dark"] {
  --bg:#191c22; --side:#14171c; --surface:#252a34; --ink:#e8ebf0; --accent:#83a6ce;
  --muted:#b3bfce; --side-text:#b9c5d5; --line:#454e5c; --field:#202630; --input-line:#7e899a;
  --soft:#303947; --hover:#3b4658; --head:#303846; --focus:#a2c6ee;
  --action:#83a6ce; --action-hover:#a0bfdf; --on-action:#131f2e; --link:#a7c7ec;
}
:root[data-theme="industrial"], .theme-swatch[data-palette="industrial"] {
  --bg:#33312e; --side:#22211f; --surface:#45413c; --ink:#f2e8d8; --accent:#c6a16c;
  --muted:#d5c7b5; --side-text:#d9cbb9; --line:#675f54; --field:#3b3732; --input-line:#a29686;
  --soft:#514a41; --hover:#5c5246; --head:#4f483e; --focus:#edc894;
  --action:#c6a16c; --action-hover:#dfba87; --on-action:#292017; --link:#f0cc99;
}
:root[data-theme="forest"], .theme-swatch[data-palette="forest"] {
  --bg:#182c25; --side:#11221b; --surface:#263e33; --ink:#e2ece4; --accent:#8eb49a;
  --muted:#b9cfc0; --side-text:#bfd3c5; --line:#4e6a5a; --field:#20362c; --input-line:#829f8d;
  --soft:#304b3d; --hover:#395645; --head:#2e483b; --focus:#b1d5bc;
  --action:#8eb49a; --action-hover:#aaccb4; --on-action:#14261c; --link:#bcdec6;
}
:root[data-theme="sandstone"], .theme-swatch[data-palette="sandstone"] {
  --bg:#eae5dc; --side:#d8cfc0; --surface:#f8f5ef; --ink:#453e35; --accent:#a18661;
  --muted:#584b3c; --side-text:#4e4539; --line:#cbc0af; --field:#f9f6f0; --input-line:#887866;
  --soft:#ede5d8; --hover:#e4d9c8; --head:#ebe2d4; --focus:#73552e;
  --action:#705837; --action-hover:#5c482e; --on-action:#fff; --link:#624522;
}
:root[data-theme="slate"], .theme-swatch[data-palette="slate"] {
  --bg:#cbd9e6; --side:#9fb5ca; --surface:#e5edf5; --ink:#263f58; --accent:#426b91;
  --muted:#3a5066; --side-text:#23384e; --side-ink:#172d44; --line:#9dafc2; --field:#ecf2f8; --input-line:#5d7892;
  --soft:#d9e5ef; --hover:#c7d8e8; --head:#d5e1ed; --focus:#224c73;
  --action:#315679; --action-hover:#254663; --on-action:#fff; --link:#244e77;
}

:root {
  color-scheme:light;
  --side-ink:var(--ink);
  --side-hover:color-mix(in srgb,var(--side) 86%,var(--ink));
  --side-active:color-mix(in srgb,var(--side) 81%,var(--accent));
  --selected:color-mix(in srgb,var(--surface) 85%,var(--accent));
  --chart-primary:var(--focus);
  --progress:var(--action);
  --text:var(--ink); --panel:var(--surface);
  --scrim:#10141c88;
  --media-matte:#fff;

  /* Semantic colors are independent of the chosen accent. */
  --success:#195732; --success-bg:#dff3e7;
  --warning:#6e4607; --warning-bg:#fff0d6;
  --danger:#8a2026; --danger-bg:#fde5e5;
  --info:#155788; --info-bg:#deedfc;
  --neutral:#414e60; --neutral-bg:#e9edf2;
  --special:#693995; --special-bg:#f1e7fc;
  --teal:#16554e; --teal-bg:#dcefed;
  --drawing-cross:#7e5854;
}
:root[data-theme-scheme="dark"] {
  color-scheme:dark;
  --success:#98e3b2; --success-bg:#233c2f;
  --warning:#ffcd83; --warning-bg:#49381d;
  --danger:#ffaaa7; --danger-bg:#49292d;
  --info:#a4d8ff; --info-bg:#263c52;
  --neutral:#d0dbe8; --neutral-bg:#303641;
  --special:#e0c3f8; --special-bg:#403052;
  --teal:#a9e3d7; --teal-bg:#234339;
  --drawing-cross:#c6a5a2;
}

.theme-control{margin:24px 10px 0;padding-top:14px;border-top:1px solid var(--line)}
.theme-control label{display:block;color:var(--side-text);font-size:12px;margin-bottom:6px}
#theme715{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  width:100%;min-width:0;padding:9px 11px;text-align:start;
  background:var(--side-hover);color:var(--side-ink);border:1px solid var(--focus);
}
#theme715::after{
  content:"";width:6px;height:6px;margin-inline:2px;
  border:solid currentColor;border-width:0 1px 1px 0;transform:rotate(45deg) translateY(-2px);
}
.theme-options{
  position:fixed;z-index:11000;overflow:auto;padding:4px;
  background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:8px;
}
.theme-options button{
  display:grid;grid-template-columns:1fr auto 1em;align-items:center;gap:7px;
  width:100%;padding:5px 8px;min-height:32px;text-align:start;background:transparent;
}
.theme-options button[aria-checked="true"]{background:var(--selected)}
.theme-options button:focus-visible{outline-offset:-2px}
.theme-options button:not([aria-checked="true"]) .theme-check{visibility:hidden}
.theme-swatch{display:flex;gap:3px}
.theme-swatch i{width:9px;height:9px;border:1px solid var(--input-line);border-radius:50%;background:var(--bg)}
.theme-swatch i:nth-child(2){background:var(--side)}
.theme-swatch i:nth-child(3){background:var(--accent)}
@media(max-width:700px){.theme-control{margin:10px 0 0;max-width:220px}}
