:root[data-theme="light"] {
  color-scheme: light;
  --admin-canvas: #f5f7f6;
  --admin-surface: #ffffff;
  --admin-surface-muted: #f7f9f8;
  --admin-surface-hover: #eef4f1;
  --admin-border: #e2e8e5;
  --admin-border-strong: #cbd5d0;
  --admin-control-border: #c4d8cf;
  --admin-control-border-hover: #8fb7a5;
  --admin-text: #18211d;
  --admin-text-muted: #52605a;
  --admin-text-soft: #5f6c66;
  --admin-accent: #047857;
  --admin-accent-foreground: #ffffff;
  --admin-accent-strong: #065f46;
  --admin-accent-soft: #e8f5ef;
  --admin-danger: #c2413a;
  --admin-danger-soft: #fdf0ef;
  --admin-info: #0369a1;
  --admin-info-soft: #e8f4fb;
  --admin-success: #047857;
  --admin-success-soft: #e7f7ef;
  --admin-focus: rgb(4 120 87 / 0.2);
  --admin-shadow: none;
  --admin-shadow-raised: 0 14px 32px rgb(24 33 29 / 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --admin-canvas: #151816;
  --admin-surface: #1d211f;
  --admin-surface-muted: #242925;
  --admin-surface-hover: #2b332e;
  --admin-border: #343b37;
  --admin-border-strong: #48524d;
  --admin-control-border: #405b50;
  --admin-control-border-hover: #5c8775;
  --admin-text: #f3f6f4;
  --admin-text-muted: #b5c0ba;
  --admin-text-soft: #949f99;
  --admin-accent: #5ee0ad;
  --admin-accent-foreground: #052e22;
  --admin-accent-strong: #9af0ce;
  --admin-accent-soft: #163c2e;
  --admin-danger: #ffb4ae;
  --admin-danger-soft: #452524;
  --admin-info: #a5e3ff;
  --admin-info-soft: #173446;
  --admin-success: #9af0cf;
  --admin-success-soft: #173a2d;
  --admin-focus: rgb(94 224 173 / 0.24);
  --admin-shadow: none;
  --admin-shadow-raised: 0 18px 40px rgb(0 0 0 / 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--admin-canvas);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body,
h1,
p {
  margin: 0;
}

button,
input {
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
}

button {
  appearance: button;
  background: none;
  cursor: pointer;
}

svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.admin-auth-body {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  background: var(--admin-canvas);
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  color: var(--admin-text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0;
}

.admin-auth-layout {
  width: min(100%, 25rem);
}

.admin-auth-header {
  margin-bottom: 1.25rem;
  text-align: center;
}

.admin-auth-logo {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
}

.admin-auth-logo-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.admin-auth-brand {
  margin: 0.875rem 0 0;
  color: var(--admin-text);
  font-size: 1.125rem;
  font-weight: 750;
  line-height: 1.5rem;
}

.admin-auth-header > p:last-child {
  margin: 0.5rem 0 0;
  color: var(--admin-text-muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.admin-auth-panel {
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  background: var(--admin-surface);
  padding: 1.75rem;
  box-shadow: var(--admin-shadow-raised);
}

.admin-auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  background: var(--admin-danger-soft);
  padding: 0.75rem;
  color: var(--admin-danger);
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.admin-auth-alert[data-tone="success"] {
  background: var(--admin-success-soft);
  color: var(--admin-success);
}

.admin-auth-alert[data-tone="info"] {
  background: var(--admin-info-soft);
  color: var(--admin-info);
}

.admin-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.admin-auth-form {
  display: grid;
  gap: 1rem;
}

.admin-auth-field > span {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--admin-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-auth-field input,
.admin-auth-submit {
  width: 100%;
}

.admin-auth-field input {
  height: 2.5rem;
  border: 1px solid var(--admin-control-border);
  border-radius: 0.5rem;
  background-color: var(--admin-surface);
  padding: 0.5rem 1rem;
  color: var(--admin-text);
  box-shadow: none;
  outline: none;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.admin-auth-field input:hover:not(:disabled) {
  border-color: var(--admin-control-border-hover);
}

.admin-auth-field input:focus {
  border-color: var(--admin-accent);
  background-color: var(--admin-surface);
  outline: none;
}

.admin-auth-field input:disabled {
  cursor: not-allowed;
  border-color: var(--admin-border);
  background-color: var(--admin-surface-muted);
  color: var(--admin-text-muted);
}

.admin-button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: transparent;
  padding: 0.5rem 0.875rem;
  color: var(--admin-text);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1rem;
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.admin-button:focus-visible {
  outline: 3px solid var(--admin-focus);
  outline-offset: 2px;
}

.admin-button-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.admin-auth-submit {
  min-height: 2.75rem;
  margin-top: 0.5rem;
  gap: 0.5rem;
}

.admin-auth-theme-toggle {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-border);
  border-radius: 0.5rem;
  background: var(--admin-surface);
  color: var(--admin-text-muted);
  box-shadow: var(--admin-shadow);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.admin-auth-theme-toggle:hover {
  border-color: var(--admin-border-strong);
  background: var(--admin-surface-hover);
  color: var(--admin-text);
}

.admin-auth-theme-toggle:focus-visible {
  outline: 3px solid var(--admin-focus);
  outline-offset: 2px;
}

.admin-auth-theme-light,
.admin-auth-theme-dark {
  display: inline-flex;
}

:root[data-theme="light"] .admin-auth-theme-light,
:root[data-theme="dark"] .admin-auth-theme-dark {
  display: none;
}

@media (max-width: 767px) {
  .admin-auth-body {
    padding-bottom: max(5rem, env(safe-area-inset-bottom));
  }

  .admin-auth-panel {
    padding: 1.25rem;
  }

  .admin-auth-field input {
    font-size: 1rem;
    line-height: 1.5rem;
  }

  .admin-auth-theme-toggle {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-auth-field input,
  .admin-button,
  .admin-auth-theme-toggle {
    transition: none;
  }
}
