html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] #main {
  background: #0f1f2e;
  color: #a9c1d3;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] strong,
html[data-theme="dark"] b,
html[data-theme="dark"] label,
html[data-theme="dark"] th,
html[data-theme="dark"] #menu ul a,
html[data-theme="dark"] #menu ul span {
  color: #f4f8fb;
}

html[data-theme="dark"] a,
html[data-theme="dark"] #menu ul a:hover,
html[data-theme="dark"] #menu ul span:hover {
  color: #2f9bff;
}

html[data-theme="dark"] #header,
html[data-theme="dark"] header.major > :last-child,
html[data-theme="dark"] #menu > ul > li,
html[data-theme="dark"] table tbody tr,
html[data-theme="dark"] hr {
  border-color: #2b4e67;
}

html[data-theme="dark"] #sidebar,
html[data-theme="dark"] #sidebar > .inner {
  background: #0a1824;
}

html[data-theme="dark"] table tbody tr:nth-child(2n + 1) {
  background-color: rgba(25, 59, 84, 0.45);
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] textarea[readonly] {
  background: #193b54 !important;
  border-color: #2b4e67;
  color: #f4f8fb;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #a9c1d3;
  opacity: 0.8;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #ffc600;
  box-shadow: 0 0 0 1px #ffc600;
}

html[data-theme="dark"] input[type="submit"],
html[data-theme="dark"] input[type="reset"],
html[data-theme="dark"] input[type="button"],
html[data-theme="dark"] button,
html[data-theme="dark"] .button {
  box-shadow: inset 0 0 0 2px #2f9bff;
  color: #63b5ff !important;
}

html[data-theme="dark"] input[type="submit"]:hover,
html[data-theme="dark"] input[type="reset"]:hover,
html[data-theme="dark"] input[type="button"]:hover,
html[data-theme="dark"] button:hover,
html[data-theme="dark"] .button:hover {
  background-color: rgba(47, 155, 255, 0.15);
}

html[data-theme="dark"] input[type="submit"].primary,
html[data-theme="dark"] input[type="reset"].primary,
html[data-theme="dark"] input[type="button"].primary,
html[data-theme="dark"] button.primary,
html[data-theme="dark"] .button.primary {
  background-color: #2f9bff;
  color: #07131e !important;
}

html[data-theme="light"] {
  color-scheme: light;
}

.theme-switcher {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.7em;
  justify-content: center;
  margin: 0 0 2em 0;
}

.theme-switcher__icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.2em;
  line-height: 1;
}

.theme-switcher__control {
  display: inline-block;
  flex: 0 0 auto;
  height: 1.7em;
  margin: 0;
  position: relative;
  width: 3.2em;
}

.theme-switcher__control input {
  float: none;
  height: 1px;
  margin: 0;
  opacity: 0;
  position: absolute;
  width: 1px;
  z-index: 1;
}

.theme-switcher__slider {
  background: #c5d5e2;
  border-radius: 2em;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: background-color 0.2s ease;
}

.theme-switcher__slider::before {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  content: "";
  height: 1.3em;
  left: 0.2em;
  position: absolute;
  top: 0.2em;
  transition: transform 0.2s ease;
  width: 1.3em;
}

.theme-switcher__control input:checked + .theme-switcher__slider {
  background: #2f9bff;
}

.theme-switcher__control input:checked + .theme-switcher__slider::before {
  transform: translateX(1.5em);
}

.theme-switcher__control input:focus-visible + .theme-switcher__slider {
  outline: 2px solid #ffc600;
  outline-offset: 3px;
}

.sidebar-logout {
  margin: 0;
}

.sidebar-logout button,
html[data-theme="dark"] .sidebar-logout button,
html[data-theme="light"] .sidebar-logout button {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit !important;
  cursor: pointer;
  display: block;
  font: inherit;
  font-size: 0.9em;
  height: auto;
  letter-spacing: inherit;
  line-height: inherit;
  margin: 0;
  padding: 0.625em 0;
  text-align: left;
  text-decoration: none;
  text-transform: inherit;
  white-space: normal;
  width: 100%;
}

.sidebar-logout button:hover,
html[data-theme="dark"] .sidebar-logout button:hover,
html[data-theme="light"] .sidebar-logout button:hover {
  background: transparent;
  color: #2f9bff !important;
}
