:root { --native-scheme: dark; color-scheme: var(--native-scheme); }
:root[data-theme='light'] {
  --native-scheme: light;
  --bg: #f3f5f8;
  --bg2: #edf1f6;
  --sf: #ffffff;
  --sf2: #e7edf5;
  --ln: #d5dde7;
  --ln2: #aab9cc;
  --ink: #18283d;
  --mut: #52647b;
  --mut2: #5e6d80;
  --blue: #1761bd;
  --bluebg: #e7f0fc;
  --green: #167344;
  --greend: #176640;
  --amber: #95600c;
  --yellow: #80530c;
  --red: #b12b40;
  --success-surface: #e4f4eb;
  --warning-surface: #fff3d9;
  --danger-surface: #fce9ec;
  --danger-hover: #f8d5db;
  --info-surface: #e7f0fc;
  --info-hover: #dce9fa;
  --success-text: #176640;
  --warning-text: #80530c;
  --danger-text: #af263e;
  --info-text: #17599e;
  --success-border: #9bcdb0;
  --warning-border: #d8b765;
  --danger-border: #d998a4;
  --info-border: #a6c3e6;
  --on-accent: #ffffff;
  --plain-surface: #ffffff;
  --secondary-text: #52647b;
}
body > .theme-bar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--ln);
}
body .theme-bar { flex: 0 0 auto; }
body .theme-switch {
  position: relative;
  display: block;
  width: 112px;
  min-width: 112px;
  height: 56px;
  min-height: 56px;
  margin: 0;
  padding: 0;
  border: 1px solid #505050;
  border-radius: 999px;
  background: linear-gradient(#303030, #222222);
  color: #f5f5f5;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
}
.theme-switch-sun, .theme-switch-moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font: 36px/1 system-ui, sans-serif;
  pointer-events: none;
}
.theme-switch-sun { left: 12px; opacity: 0; }
.theme-switch-moon { right: 13px; }
.theme-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #dedede);
  box-shadow: 0 2px 5px #0005;
  transition: transform 160ms ease;
  pointer-events: none;
}
body .theme-switch[aria-checked='true'] {
  background: linear-gradient(#dedede, #f5f5f5);
  border-color: #b8b8b8;
  color: #292929;
}
.theme-switch[aria-checked='true'] .theme-switch-thumb {
  transform: translateX(56px);
  background: linear-gradient(135deg, #484848, #242424);
}
.theme-switch[aria-checked='true'] .theme-switch-sun { opacity: 1; }
.theme-switch[aria-checked='true'] .theme-switch-moon { opacity: 0; }
body .theme-switch:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
body > .theme-bar:has(~ .login:not(.hidden):not([hidden])),
body.packing-workplace > .theme-bar {
  position: absolute;
  inset: 0 0 auto;
  background: transparent;
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch-thumb { transition: none; }
}
@media print { body .theme-bar { display: none; } }
