:root {
  color-scheme: light;
  --page: #f4f7fa;
  --surface: #ffffff;
  --ink: #19283a;
  --muted: #708093;
  --line: #dce4eb;
  --accent: #087f83;
  --accent-strong: #06696d;
  --accent-soft: #e7f4f3;
  --focus: rgba(8, 127, 131, 0.18);
  --shadow: 0 24px 64px rgba(20, 38, 57, 0.1);
}

:root[data-theme="dark"],
:root.dark-theme,
body[data-theme="dark"],
body.dark-theme {
  color-scheme: dark;
  --page: #101923;
  --surface: #172330;
  --ink: #ecf2f7;
  --muted: #a1afbc;
  --line: #344453;
  --accent: #4cc4bb;
  --accent-strong: #66d5cc;
  --accent-soft: #203b40;
  --focus: rgba(76, 196, 187, 0.2);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 28px;
  display: grid;
  place-items: center;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.login-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(480px, 1.08fr);
  width: min(1100px, 100%);
  min-height: min(700px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid rgba(212, 222, 230, 0.72);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 42px 44px;
  background:
    radial-gradient(ellipse at 7% 82%, rgba(22, 151, 148, 0.3), transparent 35%),
    linear-gradient(145deg, #17283a 0%, #10283a 52%, #0a4246 100%);
  color: #fff;
}

.brand-lockup,
.mobile-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  font-size: 16px;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-lockup strong,
.mobile-brand strong {
  font-weight: 700;
}

.auth-logo-image {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 11px;
  object-fit: contain;
}

.brand-content {
  position: relative;
  z-index: 1;
  max-width: 390px;
  margin: 45px 0 55px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #94b4be;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.5;
}

.brand-content h1 {
  margin: 25px 0 17px;
  color: #f7fafc;
  font-size: clamp(38px, 4.1vw, 52px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.brand-content h1 span {
  color: #70d5ca;
}

.brand-description {
  max-width: 340px;
  margin: 0;
  color: #c0ced6;
  font-size: 15px;
  line-height: 1.8;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #67d3c8;
  box-shadow: 0 0 0 4px rgba(103, 211, 200, 0.12);
}

.brand-bottom {
  position: relative;
  z-index: 1;
  color: #b4c7ce;
  font-size: 12px;
  letter-spacing: 0.025em;
}

.brand-bottom p {
  margin: 15px 0 0;
}

.brand-rule {
  width: 34px;
  height: 2px;
  background: #69cfc5;
}

.brand-orb {
  position: absolute;
  z-index: 0;
  border: 1px solid rgba(127, 205, 198, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.brand-orb-one {
  right: -165px;
  bottom: 42px;
  width: 390px;
  height: 390px;
}

.brand-orb-two {
  right: -110px;
  bottom: 97px;
  width: 280px;
  height: 280px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 64px clamp(42px, 7vw, 94px);
  background: var(--surface);
}

.login-content {
  width: 100%;
  max-width: 390px;
}

.mobile-brand {
  display: none;
  color: var(--ink);
}

.welcome-copy {
  margin-bottom: 35px;
}

.welcome-copy .eyebrow {
  margin-bottom: 11px;
  color: var(--accent);
}

.welcome-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 2.6vw, 32px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.welcome-description {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.form-group input {
  display: block;
  width: 100%;
  height: 51px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-group input::placeholder {
  color: #9aa7b4;
}

.form-group input:hover {
  border-color: #aebdc8;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.remember-forgot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 1px 0 25px;
}

.remember-me {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.remember-me input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.forgot-password {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.forgot-password:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 51px;
  padding: 12px 18px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.btn-login:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(8, 127, 131, 0.18);
}

.btn-login:focus-visible,
.forgot-password:focus-visible,
.brand-lockup:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  background: #aab7bf;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-login[hidden] {
  display: none;
}

.security-key-button {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.security-key-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.message {
  display: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.message.show {
  display: block;
}

.error-message {
  border-color: #f2c5c5;
  background: #fff1f0;
  color: #9d2828;
}

.success-message {
  border-color: #b9dfca;
  background: #edf8f1;
  color: #226a40;
}

.info-message {
  border-color: #e9d7a5;
  background: #fff8e6;
  color: #795b12;
}

.loading {
  display: none;
  margin-top: 22px;
  text-align: center;
}

.loading.show {
  display: block;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.footer {
  margin-top: 35px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.security-icon {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 10px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.security-icon::before {
  position: absolute;
  top: -6px;
  left: 2px;
  width: 6px;
  height: 8px;
  border: 1.5px solid var(--accent);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  content: "";
}

.footer-copy {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.reset-overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 19, 29, 0.55);
}

.reset-overlay.show {
  display: flex;
}

.reset-modal {
  width: min(420px, 100%);
  padding: 26px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.reset-modal h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 20px;
}

.reset-modal p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.reset-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.reset-cancel {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 820px) {
  body {
    padding: 18px;
  }

  .login-shell {
    grid-template-columns: minmax(250px, 0.8fr) minmax(390px, 1.2fr);
    min-height: min(660px, calc(100vh - 36px));
  }

  .brand-panel {
    padding: 34px 30px;
  }

  .login-panel {
    padding: 48px 38px;
  }
}

@media (max-width: 720px) {
  body {
    display: block;
    padding: 0;
    background: var(--surface);
  }

  .login-shell {
    display: block;
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .brand-panel {
    display: none;
  }

  .login-panel {
    display: block;
    min-height: 100vh;
    padding: 30px 24px 24px;
  }

  .login-content {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 54px);
    max-width: 430px;
    margin: 0 auto;
  }

  .mobile-brand {
    display: inline-flex;
    margin-bottom: 56px;
    font-size: 15px;
  }

  .mobile-brand .auth-logo-image {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .welcome-copy {
    margin-bottom: 31px;
  }

  .footer {
    margin-top: auto;
    padding-top: 22px;
  }
}

@media (max-width: 380px) {
  .login-panel {
    padding-right: 20px;
    padding-left: 20px;
  }

  .mobile-brand {
    margin-bottom: 42px;
  }

  .remember-forgot {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
