:root {
  --auth-background: #F8F9FA;
  --auth-surface: #FFFFFF;
  --auth-input: #FFFFFF;
  --auth-heading: #111827;
  --auth-text: #374151;
  --auth-muted: #59636F;
  --auth-line: #E5E7EB;
  --auth-accent: #047857;
  --auth-focus: #00A896;
  --auth-button: #047857;
  --auth-button-text: #FFFFFF;
  --auth-button-hover: #047857;
  --auth-error-background: #FFE0E0;
  --auth-error-line: #EF4444;
  --auth-error-text: #374151;
  --auth-shadow: 0 2px 8px rgb(17 24 39 / 4%);
  --theme-control-line: #87968F;
  --theme-focus: var(--auth-focus);
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #374151;
  background: #F8F9FA;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 48px 24px;
}

.login-workspace {
  width: 100%;
  max-width: 448px;
  min-width: 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  text-align: center;
}

.login-logo {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.login-product {
  margin: 0;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.login-card {
  padding: 24px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(17 24 39 / 4%);
}

.login-introduction {
  margin-bottom: 24px;
}

.login-introduction h1 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
}

.login-introduction p {
  margin: 0;
  color: #374151;
  font-size: 14px;
}

.login-error {
  margin-bottom: 24px;
  padding: 16px;
  background: #FFE0E0;
  border: 1px solid #EF4444;
  border-radius: 8px;
  color: #374151;
  overflow-wrap: anywhere;
}

.login-error p {
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.login-field label {
  color: #374151;
  font-size: 12px;
  font-weight: 400;
}

.login-field input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 16px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  color: #111827;
  font-size: 16px;
  line-height: 1.5;
}

.login-field input:focus {
  border-color: #00A896;
  outline: 2px solid #00A896;
  outline-offset: 2px;
}

.login-password-field {
  position: relative;
}

.login-password-field.has-password-toggle input {
  padding-right: 80px;
}

.login-password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  min-width: 64px;
  padding: 8px;
  background: #FFFFFF;
  border: 0;
  border-radius: 4px;
  color: #047857;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.login-password-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-submit {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: #047857;
  border: 1px solid #047857;
  border-radius: 8px;
  color: #FFFFFF;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.login-submit:hover {
  box-shadow: 0 2px 8px rgb(4 120 87 / 20%);
}

.login-submit:active {
  box-shadow: inset 0 1px 4px rgb(17 24 39 / 16%);
}

.login-password-toggle:focus-visible,
.login-submit:focus-visible {
  outline: 2px solid #00A896;
  outline-offset: 3px;
}

.login-access-note {
  margin: 24px 0 0;
  color: #374151;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-page {
    padding: 32px 16px;
  }

  .login-brand {
    margin-bottom: 24px;
  }
}

@media (forced-colors: active) {
  .login-field input,
  .login-submit,
  .login-password-toggle {
    border: 1px solid ButtonText;
  }
}

/* Explicit themes preserve the original light form as the fallback. */
:root[data-theme="light"] {
  color-scheme: light;
  --auth-background: #F6F5F2;
  --auth-line: #87968F;
  --auth-focus: #047857;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --auth-background: #0E0E0E;
  --auth-surface: #161615;
  --auth-input: #1C1C1B;
  --auth-heading: #F7F6F2;
  --auth-text: #CFCDC6;
  --auth-muted: #B3B1A9;
  --auth-line: #62635D;
  --auth-accent: #AEEA2C;
  --auth-focus: #AEEA2C;
  --auth-button: #AEEA2C;
  --auth-button-text: #0E0E0E;
  --auth-button-hover: #C4F35B;
  --auth-error-background: #351F21;
  --auth-error-line: #DD7777;
  --auth-error-text: #FFD1D1;
  --auth-shadow: 0 2px 8px rgb(0 0 0 / 24%);
  --theme-control-line: #62635D;
}
:root[data-theme] { background: var(--auth-background); color: var(--auth-text); }
:root[data-theme] .login-logo { background: #F6F5F2; padding: 8px 12px; border-radius: 8px; }
:root[data-theme] :is(.login-product, .login-introduction p, .login-field label, .login-access-note) { color: var(--auth-text); }
:root[data-theme] .login-card { background: var(--auth-surface); border-color: var(--auth-line); box-shadow: var(--auth-shadow); }
:root[data-theme] .login-introduction h1 { color: var(--auth-heading); }
:root[data-theme] .login-error { color: var(--auth-error-text); background: var(--auth-error-background); border-color: var(--auth-error-line); }
:root[data-theme] .login-field input { color: var(--auth-heading); background: var(--auth-input); border-color: var(--auth-line); caret-color: var(--auth-accent); accent-color: var(--auth-accent); }
:root[data-theme] .login-field input::placeholder { color: var(--auth-muted); opacity: 1; }
:root[data-theme] .login-field input:focus { border-color: var(--auth-focus); outline-color: var(--auth-focus); }
:root[data-theme] .login-field input:-webkit-autofill { -webkit-text-fill-color: var(--auth-heading); box-shadow: 0 0 0 1000px var(--auth-input) inset; caret-color: var(--auth-accent); }
:root[data-theme] .login-password-toggle { background: var(--auth-input); color: var(--auth-accent); }
:root[data-theme] .login-submit { background: var(--auth-button); border-color: var(--auth-button); color: var(--auth-button-text); }
:root[data-theme] .login-submit:hover { background: var(--auth-button-hover); border-color: var(--auth-button-hover); }
:root[data-theme] :is(.login-password-toggle, .login-submit):focus-visible { outline-color: var(--auth-focus); }
@media (forced-colors: active) {
  :root[data-theme] :is(.login-field input, .login-submit, .login-password-toggle) { border-color: ButtonText; }
}

.login-notice {
  margin-bottom: 24px;
  padding: 16px;
  background: #E6F7F5;
  border: 1px solid #9ACABD;
  border-radius: 8px;
  color: #374151;
  overflow-wrap: anywhere;
}
.login-notice p { margin: 0; }
:root[data-theme] .login-notice { color: var(--auth-text); background: var(--auth-surface); border-color: var(--auth-accent); }
