:root {
  color-scheme: light;
  --bg: #edf3f8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #162033;
  --muted: #617086;
  --line: rgba(128, 145, 169, 0.22);
  --primary: #8a4f6d;
  --primary-strong: #733f5a;
  --accent: #2f7f8f;
  --gold: #c89445;
  --shadow: 0 24px 70px rgba(39, 51, 71, 0.18);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(138, 79, 109, 0.16), rgba(47, 127, 143, 0.10) 42%, rgba(200, 148, 69, 0.12)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(22, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(120deg, rgba(0,0,0,0.9), transparent 68%);
}

.login-page {
  min-height: 100vh;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 430px);
  align-items: center;
  gap: clamp(22px, 5vw, 72px);
}

.login-hero {
  position: relative;
  min-height: 520px;
  border: 1px solid rgba(255,255,255,0.62);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(255,255,255,0.84), rgba(255,255,255,0.42)),
    linear-gradient(135deg, rgba(138,79,109,0.22), rgba(47,127,143,0.17));
  box-shadow: var(--shadow);
  display: grid;
  align-content: space-between;
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -28% 18%;
  height: 62%;
  background:
    repeating-linear-gradient(90deg, rgba(138,79,109,0.16) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(47,127,143,0.14) 0 1px, transparent 1px 28px);
  transform: rotate(-7deg);
  opacity: 0.8;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  padding: 7px;
  box-shadow: 0 10px 25px rgba(39, 51, 71, 0.12);
}

.brand-name {
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.brand-slogan {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 260px;
}

.hero-kicker {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.74);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-strong);
  font-weight: 850;
  font-size: 13px;
}

.hero-copy h1 {
  margin: 20px 0 25px;
  font-size: clamp(38px, 5.2vw, 40px);
  line-height: 1.1;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 510px;
  margin: 0;
  color: #4b5a6f;
  font-size: 17px;
  line-height: 1.55;
}

.hero-grid {
  position: absolute;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 84px);
  gap: 10px;
}

.hero-grid span {
  height: 62px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(255,255,255,0.78);
  box-shadow: 0 12px 28px rgba(39, 51, 71, 0.10);
}

.hero-grid span:nth-child(2) { background: rgba(138,79,109,0.16); }
.hero-grid span:nth-child(3) { background: rgba(47,127,143,0.15); }
.hero-grid span:nth-child(4) { background: rgba(200,148,69,0.17); }

.login-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card form {
  padding: clamp(22px, 4vw, 34px);
  display: grid;
  gap: 16px;
}

.form-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 4px;
}

.form-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 12px 24px rgba(138,79,109,0.25);
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.form-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 8px;
  color: #2d3a4d;
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
  background: rgba(255,255,255,0.88);
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus {
  outline: 0;
  border-color: rgba(138,79,109,0.55);
  box-shadow: 0 0 0 4px rgba(138,79,109,0.13);
  background: #fff;
}

button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 14px 26px rgba(138,79,109,0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
  box-shadow: 0 18px 30px rgba(138,79,109,0.30);
}

.error {
  margin: 0;
  color: #a23b55;
  background: #fff1f5;
  border: 1px solid #f6c9d4;
  border-radius: var(--radius);
  padding: 11px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.notice {
  margin: 0;
  color: #126849;
  background: #effbf6;
  border: 1px solid #bfe4d5;
  border-radius: var(--radius);
  padding: 11px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.two-factor-form {
  padding-bottom: 18px;
}

.code-input {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
}

.two-factor-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

[data-2fa-timer] {
  color: var(--primary-strong);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

[data-2fa-timer].is-expired {
  color: #a23b55;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 clamp(22px, 4vw, 34px) clamp(22px, 4vw, 34px);
}

.login-actions form {
  margin: 0;
  padding: 0;
  margin-top: -15px;
}

.ghost-button {
  min-height: 42px;
  background: rgba(255,255,255,0.76);
  color: var(--primary-strong);
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 13px;
}

.ghost-button:hover {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 12px 24px rgba(39, 51, 71, 0.10);
}

.muted-button {
  color: var(--muted);
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .login-hero {
    min-height: 330px;
  }
  .hero-grid {
    display: none;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 14px;
    gap: 14px;
  }
  .login-hero {
    min-height: 280px;
    padding: 20px;
  }
  .brand-logo {
    width: 46px;
    height: 46px;
  }
  .hero-copy h1 {
    font-size: 36px;
  }
  .hero-copy p {
    font-size: 15px;
  }
  .login-actions {
    grid-template-columns: 1fr;
  }
  .code-input {
    letter-spacing: 5px;
  }
}

/* Keep authentication controls aligned with the admin UI contract. */
.login-card label,
.login-card label > span {
  font-size: 12px;
  font-weight: 500 !important;
  line-height: 1.35;
}

.login-card input {
  min-height: 44px;
  border-radius: 11px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-style: normal;
  font-weight: 400 !important;
  letter-spacing: 0;
  line-height: 1.35;
}

.login-card input::placeholder {
  font-style: normal;
  font-weight: 400;
}

.login-card .code-input {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 8px;
}

.login-card button {
  font-weight: 500 !important;
  letter-spacing: 0;
}

.login-support {
  margin: 2px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
}

.login-support a {
  color: var(--primary-strong);
  font-weight: 500;
  text-decoration-color: rgba(115, 63, 90, .38);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
