/**
 * Admin login — /admin/auth/login
 * Light + dark via data-tl-theme (same prefs key as admin shell).
 */

:root,
html[data-tl-theme="light"] {
  --tl-login-bg: #eef2f6;
  --tl-login-bg-accent: #dce8ef;
  --tl-login-card: #ffffff;
  --tl-login-ink: #1b2430;
  --tl-login-muted: #667788;
  --tl-login-line: #d5dee8;
  --tl-login-input: #ffffff;
  --tl-login-hover: #f3f6f9;
  --tl-login-primary: #0b2a4a;
  --tl-login-primary-soft: #143a5f;
  --tl-login-accent: #0e7c7b;
  --tl-login-danger: #c53030;
  --tl-login-danger-bg: #fdecec;
  --tl-login-shadow: 0 18px 48px rgba(15, 35, 60, 0.12);
  --tl-login-focus: 0 0 0 3px rgba(14, 124, 123, 0.28);
  color-scheme: light;
}

html[data-tl-theme="dark"] {
  --tl-login-bg: #0e131a;
  --tl-login-bg-accent: #16202c;
  --tl-login-card: #18212c;
  --tl-login-ink: #eef3f8;
  --tl-login-muted: #a7b6c7;
  --tl-login-line: #3a4658;
  --tl-login-input: #101822;
  --tl-login-hover: #2b3648;
  --tl-login-primary: #1e8f82;
  --tl-login-primary-soft: #0f6865;
  --tl-login-accent: #1e8f82;
  --tl-login-danger: #e07a80;
  --tl-login-danger-bg: #3a1c1f;
  --tl-login-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --tl-login-focus: 0 0 0 3px rgba(30, 143, 130, 0.35);
  color-scheme: dark;
}

html[data-tl-accent="blue"] {
  --tl-login-accent: #2b6cb0;
  --tl-login-primary: #1a4570;
  --tl-login-primary-soft: #245a8f;
  --tl-login-focus: 0 0 0 3px rgba(43, 108, 176, 0.32);
}

html[data-tl-theme="dark"][data-tl-accent="blue"] {
  --tl-login-accent: #4f8ec9;
  --tl-login-primary: #4f8ec9;
  --tl-login-primary-soft: #286396;
}

html[data-tl-accent="green"] {
  --tl-login-accent: #1f7a4d;
  --tl-login-primary: #1a4d35;
  --tl-login-primary-soft: #226644;
}

html[data-tl-theme="dark"][data-tl-accent="green"] {
  --tl-login-accent: #2d8a5e;
  --tl-login-primary: #2d8a5e;
  --tl-login-primary-soft: #24704b;
}

html[data-tl-accent="teal"] {
  --tl-login-primary: #0a4f4e;
  --tl-login-primary-soft: #0c6361;
  --tl-login-accent: #0e7c7b;
}

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

html,
body.tl-login-page {
  margin: 0;
  min-height: 100%;
}

body.tl-login-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--tl-login-ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(14, 124, 123, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(11, 42, 74, 0.18), transparent 50%),
    linear-gradient(160deg, var(--tl-login-bg) 0%, var(--tl-login-bg-accent) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

html[data-tl-theme="dark"] body.tl-login-page {
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(30, 143, 130, 0.18), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(22, 58, 92, 0.28), transparent 50%),
    linear-gradient(160deg, var(--tl-login-bg) 0%, var(--tl-login-bg-accent) 100%);
}

.tl-login-shell {
  width: 100%;
  max-width: 420px;
}

.tl-login-card {
  background: var(--tl-login-card);
  border: 1px solid var(--tl-login-line);
  border-radius: 16px;
  box-shadow: var(--tl-login-shadow);
  padding: 32px 28px 28px;
}

.tl-login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 0 24px;
  padding: 0;
  text-align: center;
}

.tl-login-logo {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 48px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  /* SVG is a wide canvas with the TL badge on the left — crop to the badge square */
  object-fit: cover;
  object-position: left center;
}

.tl-login-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 0 14px;
  padding: 0;
  border-radius: 12px;
  background: var(--tl-login-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tl-login-title {
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tl-login-ink);
  line-height: 1.25;
  text-align: center;
}

.tl-login-subtitle {
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--tl-login-muted);
  font-weight: 500;
  text-align: center;
}

.tl-login-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--tl-login-danger);
  background: var(--tl-login-danger-bg);
  color: var(--tl-login-danger);
}

.tl-login-alert > .fa {
  margin-top: 2px;
  flex: 0 0 auto;
}

.tl-login-alert-body p {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.tl-login-alert-body p:last-child {
  margin-bottom: 0;
}

.tl-login-form {
  margin: 0;
}

.tl-login-field {
  margin: 0 0 16px;
}

.tl-login-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--tl-login-ink);
  letter-spacing: 0.01em;
}

.tl-login-control {
  position: relative;
  display: flex;
  align-items: center;
}

.tl-login-icon {
  position: absolute;
  left: 12px;
  z-index: 1;
  width: 18px;
  text-align: center;
  color: var(--tl-login-muted);
  pointer-events: none;
}

.tl-login-input {
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--tl-login-line);
  border-radius: 10px;
  background: var(--tl-login-input);
  color: var(--tl-login-ink);
  font-size: 14px;
  line-height: 1.3;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tl-login-control.has-toggle .tl-login-input {
  padding-right: 44px;
}

.tl-login-input::placeholder {
  color: var(--tl-login-muted);
  opacity: 0.9;
}

.tl-login-input:hover {
  border-color: var(--tl-login-accent);
}

.tl-login-input:focus {
  outline: none;
  border-color: var(--tl-login-accent);
  box-shadow: var(--tl-login-focus);
}

.tl-login-field.is-invalid .tl-login-input {
  border-color: var(--tl-login-danger);
}

.tl-login-field.is-invalid .tl-login-input:focus {
  box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.22);
}

.tl-login-toggle {
  position: absolute;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tl-login-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tl-login-toggle:hover,
.tl-login-toggle:focus {
  background: var(--tl-login-hover);
  color: var(--tl-login-accent);
  outline: none;
}

.tl-login-toggle:focus-visible {
  box-shadow: var(--tl-login-focus);
}

.tl-login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
}

.tl-login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--tl-login-ink);
  cursor: pointer;
  user-select: none;
}

.tl-login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--tl-login-accent);
  cursor: pointer;
}

.tl-login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid var(--tl-login-primary);
  border-radius: 10px;
  background: var(--tl-login-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.tl-login-submit:hover,
.tl-login-submit:focus {
  background: var(--tl-login-primary-soft);
  border-color: var(--tl-login-primary-soft);
  color: #fff;
  outline: none;
}

.tl-login-submit:focus-visible {
  box-shadow: var(--tl-login-focus);
}

.tl-login-submit:active {
  transform: translateY(1px);
}

.tl-login-submit .fa {
  font-size: 13px;
}

@media (max-width: 480px) {
  body.tl-login-page {
    padding: 16px 12px;
    align-items: flex-start;
    padding-top: max(24px, 8vh);
  }

  .tl-login-card {
    padding: 24px 18px 20px;
    border-radius: 14px;
  }

  .tl-login-title {
    font-size: 20px;
  }

  .tl-login-input,
  .tl-login-submit {
    height: 46px;
  }
}

@media (min-width: 768px) {
  .tl-login-shell {
    max-width: 440px;
  }

  .tl-login-card {
    padding: 36px 34px 30px;
  }
}
