.theme-switch {
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid #d7c78d;
  border-radius: 999px;
  background: #163e37;
  color: #fff4d2;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 8px 22px #071b1833;
}

.theme-switch:hover {
  background: #245749;
}

.theme-switch-icon {
  font-size: 19px;
  line-height: 1;
}

.site-studio > .sidebar .theme-switch {
  width: calc(100% - 16px);
  margin: 0 8px 12px;
}

.site-studio:not(:has(> .sidebar)) > .theme-switch,
.ak-audience > .theme-switch,
.ak-projection > .theme-switch {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
}

.theme-switch:focus-visible {
  outline: 3px solid #e2bd57;
  outline-offset: 3px;
}

@media (min-width: 801px) {
  body.mira-compact .sidebar .theme-switch {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    padding: 0;
  }

  body.mira-compact .sidebar .theme-switch-label {
    display: none;
  }
}

@media (max-width: 800px) {
  .site-studio > .sidebar .theme-switch {
    width: auto;
    margin: 0 0 0 12px;
  }
}

@media (max-width: 500px) {
  .site-studio:not(:has(> .sidebar)) > .theme-switch,
  .ak-audience > .theme-switch,
  .ak-projection > .theme-switch {
    position: sticky;
    float: right;
    top: 8px;
    right: 8px;
    margin: 8px;
  }
}

html[data-theme='light'] body.site-studio,
html[data-theme='light'] body.ak-audience,
html[data-theme='light'] body.ak-projection {
  --studio-paper: #fffdf7;
  --studio-stroke: #c8d8ca;
  background: radial-gradient(circle at 85% 0, #e1eadc 0, transparent 40%), #f3f3e9;
  color: #17392f;
}

html[data-theme='light'] .theme-switch {
  border-color: #b7cdbb;
  background: #fffdf7;
  color: #173f33;
  box-shadow: 0 6px 18px #2352441c;
}

html[data-theme='light'] .theme-switch:hover {
  background: #e8f0e7;
}

html[data-theme='light'] .site-studio > .sidebar {
  border-right-color: #b4cdbc;
  background: linear-gradient(165deg, #f9f9f1, #e6efe6);
  color: #17392f;
  scrollbar-color: #9bb7a6 transparent;
}

html[data-theme='light'] .sidebar .brand {
  border-color: #c5d9c9;
  color: #17392f;
}

html[data-theme='light'] .sidebar .brand-logo {
  filter: brightness(0) saturate(100%) invert(19%) sepia(22%) saturate(1145%) hue-rotate(107deg);
}

html[data-theme='light'] .sidebar .brand small,
html[data-theme='light'] .sidebar .sidebar-label,
html[data-theme='light'] .sidebar .work-system-menu > summary,
html[data-theme='light'] .sidebar .local-note small {
  color: #48675a;
}

html[data-theme='light']
  .sidebar
  :is(
    .nav,
    .logout,
    #staff-feedback-open,
    #mira-collapse,
    .work-find,
    #nav-toggle,
    .workspace-area-selector button
  ) {
  color: #1a4538;
}

html[data-theme='light']
  .sidebar
  :is(
    #staff-feedback-open,
    #mira-collapse,
    .work-find,
    #nav-toggle,
    .workspace-area-selector button
  ) {
  border-color: #b9cdbd;
  background: #ffffffbd;
}

html[data-theme='light']
  .sidebar
  :is(.nav, #staff-feedback-open, #mira-collapse, .workspace-area-selector button):hover {
  border-color: #8aac98;
  background: #e5f0e5;
  color: #10392f;
}

html[data-theme='light'] .sidebar :is(.nav-icon, .area-icon) {
  color: #2f7558;
}

html[data-theme='light']
  .sidebar
  :is(.nav.active, .workspace-area-selector button[aria-pressed='true']) {
  border-color: #b9994d;
  background: linear-gradient(125deg, #f3e8c4, #e5eedf);
  color: #173e32;
  box-shadow: 0 4px 14px #285f441c;
}

html[data-theme='light'] .sidebar .work-system-menu {
  border-color: #c7d6c9;
}

html[data-theme='light'] .site-studio > #main-content > header,
html[data-theme='light']
  .site-studio
  > #main-content
  > header
  :is(h1, #page-description, .header-right label) {
  color: #183e33;
}

html[data-theme='light'] .site-studio > #main-content > header {
  border-bottom-color: #b5c9b7;
}

html[data-theme='light'] .site-studio > #main-content > header .eyebrow {
  color: #76601f;
}

html[data-theme='light'] .site-studio #workspace > [data-page]:not([data-page='academy']) {
  border-color: #d4dccd;
  box-shadow: 0 15px 42px #214c3520;
}

html[data-theme='light'] .site-studio #workspace > [data-page='academy'] {
  --ak-night: #f8f7ee;
  --ak-surface: #fffdf7;
  --ak-surface-raised: #e9f1e8;
  --ak-stroke: #b9cdbd;
  --ak-gold: #806626;
  --ak-copy: #183d33;
  --ak-muted: #456a57;
  border-color: #d6d9c6;
  background: radial-gradient(circle at 90% 0, #e1e9da 0, transparent 34%), #f8f7ee;
  box-shadow: 0 16px 44px #214c3520;
}

html[data-theme='light'] [data-page='academy'] .ak-hero .eyebrow,
html[data-theme='light'] [data-page='academy'] .ak-hero .ak-hero-action b {
  color: #f0d892;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    .ak-overview > div,
    .ak-card,
    .ak-empty,
    #ak-history,
    .ak-steps button,
    #ak-authoring > .ak-toolbar,
    [data-ak-page='live'] .ak-presenter-main > .ak-toolbar,
    #ak-empty-slide,
    #ak-deck,
    .ak-deck-card,
    .ak-report-slide,
    .ak-question,
    .wv-panel
  ) {
  border-color: #c6d6c5;
  background: #fffdf7;
  color: #183d33;
  box-shadow: 0 6px 20px #214c3515;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    #ak-library > .section-head h2,
    #ak-detail > .section-head h2,
    .ak-empty h3,
    #ak-empty-slide h3,
    .ak-card h3,
    .ak-report-slide h4,
    #ak-report-intro,
    #ak-participants
  ) {
  color: #173c31;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    .ak-library-tools label,
    .ak-card p,
    .ak-card small,
    #ak-authoring .panel label,
    [data-ak-page='live'] .panel label,
    [data-ak-page='report'] .panel label,
    #ak-slide-form label,
    .ak-report-slide p,
    .ak-report-slide blockquote,
    .ak-question p,
    .wv-panel p
  ) {
  color: #456a57;
}

html[data-theme='light']
  [data-page='academy']
  :is(.ak-card .ak-badge, .ak-badge, #ak-history > summary) {
  border-color: #c7ad61;
  background: #f5edcf;
  color: #6f541a;
}

html[data-theme='light']
  [data-page='academy']
  :is(.ak-steps button.active, .ak-slide-list button.active) {
  border-color: #b18e3d;
  background: #e8f0dd;
  color: #153a30;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    .ak-toolbar .secondary,
    #ak-back,
    #ak-reload,
    #ak-source-view,
    .ak-slide-list button,
    #ak-project-tab,
    .ak-qr-controls [data-ak-qr]
  ) {
  border-color: #a9c6af;
  background: #e8f1e7;
  color: #173f33;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    .ak-slide-list button small,
    #ak-deck-state,
    .ak-keyboard-hint,
    #ak-qr-mode-state,
    #ak-local-note,
    #ak-invite-note,
    #ak-live-edit-note
  ) {
  color: #496b55;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    #ak-authoring .panel,
    [data-ak-page='live'] .panel,
    [data-ak-page='report'] .panel,
    #ak-live-dock
  ) {
  border-color: #bfd1bf;
  background: #fffdf7;
  color: #173d32;
}

html[data-theme='light']
  [data-page='academy']
  :is(
    #ak-authoring .panel > summary,
    [data-ak-page='live'] .panel > summary,
    #ak-live-dock > h3,
    #ak-live-dock #ak-dock-tabs
  ) {
  color: #1b4a38;
}

html[data-theme='light']
  [data-page='academy']
  :is(.ak-deck-preview, .ak-deck-preview:hover, #ak-add-palette) {
  background: #e9f0e5;
  color: #183d33;
}

html[data-theme='light'] #ak-create-dialog {
  border-color: #b9caac;
  background: #fffdf7;
  color: #173d32;
}

html[data-theme='light'] #ak-create-dialog :is(h2, label) {
  color: #173d32;
}

html[data-theme='light'] #ak-create-dialog :is(p, .eyebrow) {
  color: #745a20;
}

html[data-theme='light'] .site-studio.entry-page .entry-card {
  border-color: #c4d6c4;
  background: #fffdf7;
  box-shadow: 0 25px 65px #22463229;
}

html[data-theme='light'] .site-studio.entry-page :is(.brand, h1, h3, summary, label) {
  color: #173d32;
}

html[data-theme='light'] .site-studio.entry-page :is(.entry-intro, details p, section p) {
  color: #4b6b5b;
}

html[data-theme='light'] .site-studio.entry-page details {
  border-color: #c5d8c7;
}

html[data-theme='light'] .site-studio.entry-page .brand img {
  filter: brightness(0) saturate(100%) invert(19%) sepia(22%) saturate(1145%) hue-rotate(107deg);
}

html[data-theme='light']
  .site-studio.downloads-page
  :is(.download-content, footer, .download-heading span, .download-group > p) {
  color: #254739;
}

html[data-theme='light'] .site-studio.downloads-page .download-group-host {
  border-color: #b7caac;
  background: #ecf1e7;
}

html[data-theme='light'] .site-studio.downloads-page .download-card {
  box-shadow: 0 8px 22px #214b3520;
}

html[data-theme='light'] .site-studio.portal-page main > header {
  border-color: #bed0b9;
  background: #e7efe5;
  color: #173d32;
}

html[data-theme='light'] .site-studio.portal-page main > header :is(small, p),
html[data-theme='light'] .site-studio.portal-page footer {
  color: #496b57;
}

html[data-theme='light'] .site-studio.api-page main,
html[data-theme='light'] .site-studio.portal-page :is(section article, form) {
  box-shadow: 0 10px 28px #214b351d;
}

html[data-theme='light'] body.ak-audience {
  color: #173d32;
}

html[data-theme='light'] .ak-audience > header {
  border-color: #bfd0b9;
  background: #e7efe5;
  color: #173d32;
}

html[data-theme='light'] .ak-audience #learn-join,
html[data-theme='light'] .ak-audience #learn-session > .panel,
html[data-theme='light'] .ak-audience #learn-session .learn-option,
html[data-theme='light'] .ak-audience .wv-panel {
  border-color: #c2d2bb;
  background: #fffdf7;
  color: #173d32;
  box-shadow: 0 12px 35px #214b3520;
}

html[data-theme='light']
  .ak-audience
  :is(
    #learn-join h1,
    #learn-join label,
    #learn-session > .section-head h1,
    #learn-session > .panel h3
  ) {
  color: #173d32;
}

html[data-theme='light'] .ak-audience :is(.ak-privacy, #learn-status, .wv-panel p) {
  color: #496b57;
}

html[data-theme='light'] .ak-audience #learn-join::before {
  color: #806626;
}

html[data-theme='light'] .ak-audience .learn-option:has(input:checked) {
  border-color: #a8873f;
  background: #f1ead1;
}

html[data-theme='light'] body.ak-projection {
  background: #e9eee3;
}

html[data-theme='light'] .ak-projection #project-screen {
  border-color: #bed1b9;
  background: linear-gradient(135deg, #f8f7eb, #e1ece1);
  color: #173d32;
}

html[data-theme='light'] .ak-projection #project-screen :is(header, footer) {
  color: #735a1e;
}

html[data-theme='light']
  .ak-projection
  #project-screen
  :is(#project-title, #project-body, #project-options, #project-results, #project-questions) {
  color: #173d32;
}

html[data-theme='light']
  .ak-projection
  #project-screen
  :is(#project-results, #project-questions)
  :is(h2, h3, p) {
  color: #173d32;
}

html[data-theme='light'] .ak-projection #project-screen :is(#project-status, #project-kind) {
  color: #69551e;
}

html[data-theme='light'] .ak-projection #project-options li {
  background: #fffdf7;
  border-color: #a9bfa8;
}

html[data-theme='light'] .ak-projection #project-screen :is(button, a) {
  border-color: #a9bfa8;
  background: #fffdf7;
  color: #173d32;
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch {
    transition: none;
  }
}

.theme-switch {
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.theme-switch-icon,
.theme-switch-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
html[data-theme='dark'] .theme-switch {
  border-color: #6a9b87;
  background: linear-gradient(140deg, #214e4d, #143537);
  color: #f4e7ad;
  box-shadow:
    inset 0 1px #ffffff22,
    0 5px 18px #03151470;
}
html[data-theme='dark'] .theme-switch:hover {
  border-color: #b5ddc4;
  background: #285d58;
}
body.ak-audience > header .theme-switch {
  position: static;
  flex: 0 0 auto;
  margin-left: auto;
}
html[data-theme='light'] .ak-audience > header img {
  filter: brightness(0) saturate(100%) invert(19%) sepia(22%) saturate(1145%) hue-rotate(107deg);
}
html[data-theme='dark'] [data-page='academy'] .workshop-icon-button {
  border-color: #567d73;
  background: linear-gradient(145deg, #204546, #173539);
  color: #e8f5e9;
  box-shadow: inset 0 1px #ffffff1c;
}
html[data-theme='dark'] [data-page='academy'] .workshop-icon-button:is(:hover, :focus-visible) {
  border-color: #a1dccb;
  background: #285752;
  box-shadow: 0 0 0 3px #69c5ae33;
}
@media (max-width: 500px) {
  body.ak-audience > header .theme-switch {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }
  body.ak-audience > header .theme-switch-label {
    display: none;
  }
}
