.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

.admin-body button,
.admin-body input,
.admin-body textarea,
.admin-body select {
  font-family: var(--font-ui);
}

.login-gate {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

.login-card {
  display: grid;
  width: min(100%, 440px);
  gap: 28px;
  padding: clamp(28px, 5vw, 46px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  box-shadow: var(--shadow);
}

.login-brand,
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.login-brand img,
.admin-brand img {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: contain;
}

.login-brand span {
  font-size: 17px;
  font-weight: 700;
}

.admin-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.login-card h1,
.site-settings-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.1;
}

.login-copy,
.site-settings-heading p,
.settings-card-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-form,
.settings-fields {
  display: grid;
  gap: 18px;
}

.login-form label,
.settings-fields label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.login-form input,
.settings-fields input,
.settings-fields textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--surface-inset);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-form input,
.settings-fields input {
  min-height: 44px;
  padding: 0 13px;
}

.settings-fields textarea {
  min-height: 112px;
  padding: 12px 13px;
  resize: vertical;
}

.login-form input:focus,
.settings-fields input:focus,
.settings-fields textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.settings-fields label small {
  justify-self: end;
  color: var(--subtle);
  font-weight: 400;
}

.login-submit {
  width: 100%;
  min-height: 44px;
}

.form-error {
  margin: -6px 0 0;
  color: var(--rose);
  font-size: 12px;
  line-height: 1.5;
}

.back-home-link {
  justify-self: center;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.back-home-link:hover {
  color: var(--text);
}

.admin-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  grid-template-columns: 276px minmax(0, 1fr);
  overflow-x: clip;
}

.admin-shell[hidden],
.login-gate[hidden] {
  display: none !important;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  min-width: 0;
  flex-direction: column;
  padding: 18px 16px 16px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  box-shadow: 14px 0 40px color-mix(in srgb, var(--bg) 30%, transparent);
  backdrop-filter: blur(20px);
}

.admin-brand {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface-inset) 82%, transparent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--bg) 18%, transparent);
}

.admin-brand div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.admin-brand strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.admin-brand span {
  color: var(--subtle);
  font-size: 9px;
  letter-spacing: 0.13em;
}

.admin-nav {
  display: grid;
  gap: 7px;
  padding: 24px 0 18px;
}

.admin-nav-section-label {
  padding: 0 12px 3px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.admin-nav-settings-label {
  margin-top: 12px;
}

.admin-nav-item,
.admin-submenu-item,
.admin-logout {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.admin-nav-item {
  position: relative;
  min-height: 52px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  isolation: isolate;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.admin-nav-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface-inset) 80%, transparent);
  color: var(--subtle);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.admin-nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.admin-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-item:hover,
.admin-nav-item.is-active,
.admin-submenu-item:hover,
.admin-submenu-item.is-active {
  background: var(--surface-hover);
  color: var(--text);
}

.admin-nav-item:hover {
  transform: translateX(2px);
}

.admin-nav-item:hover .admin-nav-icon,
.admin-nav-item.is-active .admin-nav-icon {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-inset));
  color: var(--accent);
}

.admin-nav-item.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-inset));
  color: var(--accent);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 10%, transparent);
}

.admin-nav-item.is-active::before {
  position: absolute;
  z-index: -1;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
  content: "";
  inset: 8px auto 8px 0;
}

.submenu-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
  transition: transform 160ms ease;
}

.admin-nav-parent[aria-expanded="true"] .submenu-chevron {
  transform: rotate(90deg);
}

.admin-submenu {
  position: relative;
  display: grid;
  gap: 4px;
  margin-left: 27px;
  padding: 3px 0 8px 27px;
}

.admin-submenu::before {
  position: absolute;
  width: 1px;
  background: color-mix(in srgb, var(--accent) 26%, var(--border));
  content: "";
  inset: 0 auto 9px 0;
}

.admin-submenu[hidden] {
  display: none;
}

.admin-submenu-item {
  position: relative;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.admin-submenu-item.is-active {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-inset));
  color: var(--accent);
}

.admin-submenu-item.is-active::before {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 2px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--accent);
  content: "";
  left: -31px;
}

.admin-sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-inset) 72%, transparent);
}

.admin-language-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  opacity: 1;
}

.admin-language-switch button {
  min-height: 30px;
}

.admin-language-switch button.is-active {
  background: var(--surface-hover);
  color: var(--text);
}

.admin-logout {
  min-height: 36px;
  justify-content: center;
  color: var(--rose);
  font-size: 12px;
}

.admin-logout:hover {
  background: var(--rose-soft);
}

.admin-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.admin-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(20px);
}

.admin-toolbar-title,
.admin-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-toolbar-title > div {
  display: grid;
  gap: 3px;
}

.admin-toolbar-title span {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.admin-toolbar-title small {
  color: var(--subtle);
  font-size: 10px;
}

.admin-menu-toggle {
  display: none;
  width: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.admin-menu-toggle svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.admin-home-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.admin-view {
  width: min(100% - clamp(28px, 6vw, 84px), 1380px);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) 0 60px;
}

.admin-view[hidden] {
  display: none;
}

#routes-view {
  width: min(100% - clamp(28px, 6vw, 84px), 1240px);
}

.admin-manager-panel {
  display: grid;
  min-width: 0;
  margin: 0;
  gap: 18px;
  container-type: inline-size;
}

.admin-manager-panel .manager-heading {
  align-items: flex-end;
}

.admin-manager-panel .manager-workspace {
  align-items: start;
  gap: 16px;
  padding-top: 0;
}

.admin-manager-panel .route-library,
.admin-manager-panel .route-composer-card,
.admin-manager-panel .selection-editor,
.admin-manager-panel .deployment-panel,
.admin-manager-panel .agent-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-inset) 82%, transparent);
}

.admin-manager-panel .route-library {
  padding: 16px;
  border-right: 1px solid var(--border);
}

.admin-manager-panel .route-editor {
  display: grid;
  gap: 14px;
}

.admin-manager-panel .route-composer-card {
  padding: 16px;
}

.admin-manager-panel .route-path-builder {
  margin: 18px 0 0;
}

.admin-manager-panel .selection-editor {
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
}

.admin-manager-panel .manager-actions {
  margin-top: 0;
}

.admin-manager-panel .deployment-panel,
.admin-manager-panel .agent-panel {
  margin-top: 0;
  padding: 18px;
}

.admin-global-notice,
.admin-callout {
  width: min(100% - clamp(28px, 6vw, 84px), 1380px);
  margin: 24px auto 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
}

.admin-global-notice {
  padding: 12px 16px;
  color: var(--text);
  font-size: 12px;
}

.admin-global-notice[data-tone="error"] {
  border-color: color-mix(in srgb, var(--rose) 45%, transparent);
  color: var(--rose);
}

.admin-callout {
  display: grid;
  gap: 5px;
  margin-top: 0;
  margin-bottom: 20px;
  padding: 16px 18px;
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
  color: var(--amber);
}

.admin-callout[hidden] {
  display: none;
}

.admin-callout span {
  color: var(--muted);
  font-size: 12px;
}

.site-settings-heading {
  margin-bottom: 28px;
}

.site-settings-heading > div {
  max-width: 680px;
}

.site-settings-form {
  display: grid;
  gap: 16px;
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(280px, 1.3fr);
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface-solid);
}

.settings-card-copy h2 {
  font-size: 17px;
}

.settings-card-copy a {
  display: inline-block;
  margin-top: 7px;
  color: var(--accent);
  text-underline-offset: 3px;
}

.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theme-preset-option {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-inset);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.theme-preset-option:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-preset-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-preset-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-preset-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-preset-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.theme-preset-option strong {
  color: var(--text);
  font-size: 13px;
}

.theme-preset-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.theme-preset-swatch {
  position: relative;
  display: flex;
  height: 58px;
  align-items: flex-end;
  gap: 7px;
  overflow: hidden;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 11px;
  background:
    radial-gradient(circle at 15% 15%, rgba(167, 98, 45, 0.3), transparent 38%),
    #eeede5;
}

.theme-preset-swatch i {
  display: block;
  width: 26px;
  height: 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 5px 16px rgba(60, 55, 44, 0.12);
}

.theme-preset-swatch i:nth-child(2) {
  height: 26px;
}

.theme-preset-swatch i:nth-child(3) {
  height: 34px;
}

[data-theme-preview="glassmorphism"] .theme-preset-swatch {
  background:
    radial-gradient(circle at 15% 0%, rgba(16, 185, 129, 0.48), transparent 45%),
    radial-gradient(circle at 95% 95%, rgba(129, 140, 248, 0.4), transparent 46%),
    #e8edf4;
}

[data-theme-preview="glassmorphism"] .theme-preset-swatch i {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(241, 245, 249, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.theme-color-settings {
  display: grid;
  gap: 20px;
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.theme-color-grid[hidden] {
  display: none;
}

.theme-color-grid > label {
  display: grid;
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.color-field {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-field);
}

.color-field input[type="color"] {
  width: 34px;
  height: 28px;
  flex: 0 0 34px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-field input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-strong);
  border-radius: 7px;
}

.color-field output {
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
}

.theme-colors-reset {
  grid-column: 1 / -1;
  justify-self: start;
}

.theme-detail-fields {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.theme-select-field,
.background-source-card label {
  display: grid;
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.theme-select-field select,
.background-source-card input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--surface-field);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.theme-select-field select:focus,
.background-source-card input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.background-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  transition: opacity 160ms ease;
}

.background-source-grid[data-enabled="false"] {
  opacity: 0.7;
}

.background-source-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-inset) 86%, transparent);
}

.background-source-card > div:first-child {
  display: grid;
  gap: 5px;
}

.background-source-card strong {
  color: var(--text);
  font-size: 13px;
}

.background-source-card small {
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.5;
}

.background-source-card input[type="file"] {
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
}

.background-source-card input[type="file"]::file-selector-button {
  margin-right: 9px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-field);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.background-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theme-range-grid > label {
  display: grid;
  min-width: 0;
  gap: 16px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-inset) 86%, transparent);
}

.theme-range-grid > label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.theme-range-grid strong {
  color: var(--text);
  font-size: 13px;
}

.theme-range-grid output {
  min-width: 54px;
  padding: 4px 7px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.theme-range-grid input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.theme-save-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

:root[data-visual-theme="glassmorphism"] .admin-sidebar {
  border-radius: 0 var(--site-corner-radius) var(--site-corner-radius) 0;
}

:root[data-visual-theme="glassmorphism"] .background-source-card,
:root[data-visual-theme="glassmorphism"] .theme-range-grid > label {
  border-color: color-mix(in srgb, var(--text) var(--site-glass-border-opacity), transparent);
  background: color-mix(in srgb, var(--surface-solid) var(--site-glass-opacity), transparent);
  -webkit-backdrop-filter: blur(var(--site-glass-blur)) saturate(135%);
  backdrop-filter: blur(var(--site-glass-blur)) saturate(135%);
}

.favicon-editor {
  display: flex;
  align-items: center;
  gap: 22px;
}

.komari-api-settings,
.komari-api-key-field,
.komari-api-key-field > span {
  display: grid;
  min-width: 0;
}

.komari-api-settings {
  gap: 11px;
}

.komari-api-key-field {
  gap: 10px;
}

.komari-api-key-field > span {
  gap: 6px;
}

.komari-api-key-field strong {
  color: var(--text);
  font-size: 14px;
}

.komari-api-key-field small,
.komari-api-security {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.komari-api-key-field small[data-configured="true"] {
  color: var(--green);
}

.komari-api-key-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--surface-field);
  color: var(--text);
  font-family: var(--font-mono);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.komari-api-key-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.komari-api-key-field input::placeholder {
  color: var(--subtle);
  font-family: var(--font-ui);
}

.komari-api-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 3px;
}

.favicon-preview {
  display: grid;
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-inset);
}

.favicon-preview img {
  width: 60px;
  height: 60px;
  border-radius: 13px;
  object-fit: contain;
}

.favicon-actions {
  display: grid;
  min-width: 0;
  gap: 11px;
}

.favicon-actions input {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
}

.favicon-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.favicon-actions small {
  color: var(--subtle);
  font-size: 11px;
}

.settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  cursor: pointer;
}

.settings-switch-row > span {
  display: grid;
  gap: 7px;
}

.settings-switch-row strong {
  color: var(--text);
  font-size: 14px;
}

.settings-switch-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.settings-switch-row input {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  appearance: none;
  background: var(--surface-field);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.settings-switch-row input::after {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
  content: "";
  inset: 2px auto auto 2px;
  transition: transform 160ms ease, background 160ms ease;
}

.settings-switch-row input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.settings-switch-row input:checked::after {
  background: #fff;
  transform: translateX(20px);
}

.settings-switch-row input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.health-threshold-settings {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.health-threshold-group {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 32%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, var(--amber) 7%, var(--surface-inset));
}

.health-threshold-group.is-degraded {
  border-color: color-mix(in srgb, var(--rose) 30%, var(--border));
  background: color-mix(in srgb, var(--rose) 6%, var(--surface-inset));
}

.health-threshold-group-copy {
  display: grid;
  gap: 5px;
}

.health-threshold-group-copy strong {
  color: var(--text);
  font-size: 14px;
}

.health-threshold-group-copy small,
.health-threshold-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.health-threshold-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.health-threshold-grid > label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.health-threshold-input {
  display: grid;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-field);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.health-threshold-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.health-threshold-input input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.health-threshold-input em {
  min-width: 42px;
  padding: 0 11px;
  border-left: 1px solid var(--border);
  color: var(--subtle);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.health-threshold-note {
  margin: 2px 2px 0;
}

.geoip-settings {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.geoip-settings > .settings-switch-row,
.geoip-setting-row {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-inset) 86%, transparent);
}

.geoip-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.geoip-setting-row > span:first-child {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.geoip-setting-row strong {
  color: var(--text);
  font-size: 14px;
}

.geoip-setting-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.geoip-provider-badge {
  display: inline-flex;
  min-height: 35px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--green) 24%, transparent);
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.geoip-provider-badge > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px var(--green-soft);
}

.geoip-update-row .manager-button {
  flex: 0 0 auto;
}

:root[data-visual-theme="glassmorphism"] .geoip-settings > .settings-switch-row,
:root[data-visual-theme="glassmorphism"] .geoip-setting-row {
  border-color: color-mix(in srgb, var(--text) var(--site-glass-border-opacity), transparent);
  background: color-mix(in srgb, var(--surface-solid) var(--site-glass-opacity), transparent);
  -webkit-backdrop-filter: blur(var(--site-glass-blur)) saturate(135%);
  backdrop-filter: blur(var(--site-glass-blur)) saturate(135%);
}

.site-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 8px;
}

.sidebar-scrim {
  display: none;
}

@container (max-width: 980px) {
  .admin-manager-panel .manager-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-manager-panel .route-library {
    padding: 16px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .admin-manager-panel .route-list,
  .admin-manager-panel .deployment-grid,
  .admin-manager-panel .task-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (max-width: 620px) {
  .admin-manager-panel .route-list,
  .admin-manager-panel .route-meta-fields,
  .admin-manager-panel .editor-fields,
  .admin-manager-panel .deployment-grid,
  .admin-manager-panel .task-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-manager-panel .route-path-builder {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-manager-panel .builder-node,
  .admin-manager-panel .builder-edge {
    width: 100%;
    min-height: 58px;
    flex-basis: auto;
  }
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 280px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .admin-shell[data-sidebar-open="true"] .admin-sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    display: block;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
  }

  .admin-shell[data-sidebar-open="false"] .sidebar-scrim,
  .sidebar-scrim[hidden] {
    display: none;
  }

  .admin-menu-toggle {
    display: inline-flex;
  }

  .settings-card {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .theme-preset-grid,
  .theme-color-grid,
  .background-source-grid,
  .theme-range-grid,
  .health-threshold-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login-gate {
    align-items: start;
    padding: 16px;
  }

  .login-card {
    margin-top: 5vh;
    padding: 26px 22px;
    border-radius: 18px;
  }

  .admin-toolbar {
    min-height: 68px;
    padding-inline: 14px;
  }

  .admin-toolbar-title small,
  .admin-home-button {
    display: none;
  }

  .admin-view {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .settings-card {
    padding: 20px 18px;
  }

  .favicon-editor {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-switch-row {
    align-items: flex-start;
  }

  .geoip-setting-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .geoip-provider-badge,
  .geoip-update-row .manager-button {
    align-self: stretch;
    justify-content: center;
  }

  .site-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .komari-api-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .komari-api-actions .manager-button {
    min-height: 44px;
  }

  .theme-save-row {
    display: flex;
  }

  .background-source-actions .manager-button {
    flex: 1 1 140px;
  }

  .site-save-row .manager-button {
    min-height: 44px;
  }
}

.theme-settings-controls {
  display: grid;
  min-width: 0;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-exclusive-note {
  display: grid;
  gap: 5px;
  padding: 15px 17px;
  border: 1px solid color-mix(in srgb, var(--amber) 36%, transparent);
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.theme-exclusive-note[hidden] {
  display: none;
}

.theme-exclusive-note strong {
  color: var(--text);
  font-size: 14px;
}

.theme-settings-controls:disabled {
  opacity: 0.48;
}

#theme-settings-form[data-locked="true"] .theme-settings-controls {
  pointer-events: none;
  filter: saturate(0.42);
}
