/* Login page — theme-aware, reference-matched background */

.login-page {
  --login-bg: #f8fafc;
  --login-card-bg: #ffffff;
  --login-card-border: rgba(15, 23, 42, 0.08);
  --login-card-shadow: 0 24px 48px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --login-title-rest: #0f172a;
  --login-heading: #0f172a;
  --login-text: #64748b;
  --login-text-muted: #94a3b8;
  --login-label: #334155;
  --login-input-bg: #f8fafc;
  --login-input-border: rgba(15, 23, 42, 0.1);
  --login-input-text: #0f172a;
  --login-input-placeholder: #94a3b8;
  --login-icon: #94a3b8;
  --login-ring-color: rgba(34, 197, 94, 0.14);
  --login-glow-center: rgba(34, 197, 94, 0.16);
  --login-glow-mid: rgba(34, 197, 94, 0.06);
  --login-glow-outer: rgba(34, 197, 94, 0);
  --login-feature-icon-bg: rgba(34, 197, 94, 0.08);
  --login-feature-icon-border: rgba(34, 197, 94, 0.18);
  --login-feature-title: #0f172a;
  --login-remember-bg: #f8fafc;
  --login-remember-border: rgba(15, 23, 42, 0.15);
  --login-divider: rgba(15, 23, 42, 0.08);
  --login-shield-glow: 0 0 24px rgba(34, 197, 94, 0.12);

  min-height: 100vh;
  display: flex;
  background: var(--login-bg);
  padding: 0;
  overflow: hidden;
}

html[data-theme="dark"] .login-page {
  --login-bg: #05070a;
  --login-card-bg: #0f172a;
  --login-card-border: rgba(255, 255, 255, 0.06);
  --login-card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 80px rgba(34, 197, 94, 0.04);
  --login-title-rest: #ffffff;
  --login-heading: #ffffff;
  --login-text: #9ca3af;
  --login-text-muted: #64748b;
  --login-label: #e2e8f0;
  --login-input-bg: #0b1119;
  --login-input-border: rgba(255, 255, 255, 0.08);
  --login-input-text: #f1f5f9;
  --login-input-placeholder: #64748b;
  --login-icon: #64748b;
  --login-ring-color: rgba(34, 197, 94, 0.12);
  --login-glow-center: rgba(34, 197, 94, 0.14);
  --login-glow-mid: rgba(34, 197, 94, 0.05);
  --login-glow-outer: rgba(34, 197, 94, 0);
  --login-feature-icon-bg: rgba(34, 197, 94, 0.1);
  --login-feature-icon-border: rgba(34, 197, 94, 0.2);
  --login-feature-title: #f1f5f9;
  --login-remember-bg: #0b1119;
  --login-remember-border: rgba(255, 255, 255, 0.15);
  --login-divider: rgba(255, 255, 255, 0.08);
  --login-shield-glow: 0 0 24px rgba(34, 197, 94, 0.15);
}

/* ---- Left branding panel ---- */

.login-brand {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  overflow: hidden;
}

.login-brand-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-brand-glow {
  position: absolute;
  top: 50%;
  left: 58%;
  transform: translate(-50%, -50%);
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--login-glow-center) 0%,
    var(--login-glow-mid) 42%,
    var(--login-glow-outer) 72%
  );
}

.login-brand-rings {
  position: absolute;
  top: 50%;
  left: 58%;
  transform: translate(-50%, -50%);
  width: min(900px, 95vw);
  height: min(900px, 95vw);
  color: var(--login-ring-color);
  opacity: 1;
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.login-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.login-brand-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.login-brand-title .accent {
  color: #22c55e;
}

.login-brand-title .rest {
  color: var(--login-title-rest);
}

.login-brand-tagline {
  font-size: 15px;
  line-height: 1.6;
  color: var(--login-text);
  margin-bottom: 40px;
  max-width: 400px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.login-feature-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-feature-icon-bg);
  border: 1px solid var(--login-feature-icon-border);
  border-radius: 12px;
  color: #22c55e;
}

.login-feature-icon svg {
  width: 20px;
  height: 20px;
}

.login-feature-text h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--login-feature-title);
  margin-bottom: 4px;
}

.login-feature-text p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--login-text);
}

.login-brand-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--login-text);
}

.login-brand-footer svg {
  width: 16px;
  height: 16px;
  color: #22c55e;
  flex-shrink: 0;
}

/* ---- Right form panel ---- */

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 64px;
  background: var(--login-bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--login-card-bg);
  border: 1px solid var(--login-card-border);
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: var(--login-card-shadow);
}

.login-card-shield {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 50%;
  color: #22c55e;
  box-shadow: var(--login-shield-glow);
}

.login-card-shield svg {
  width: 26px;
  height: 26px;
}

.login-card h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--login-heading);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-card-subtitle {
  font-size: 14px;
  color: var(--login-text);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
}

html[data-theme="dark"] .login-error {
  color: #fca5a5;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--login-label);
  margin-bottom: 8px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--login-icon);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-input-icon svg {
  width: 18px;
  height: 18px;
}

.login-input {
  width: 100%;
  background: var(--login-input-bg);
  border: 1px solid var(--login-input-border);
  border-radius: 10px;
  padding: 12px 14px 12px 44px;
  font-size: 14px;
  color: var(--login-input-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input::placeholder {
  color: var(--login-input-placeholder);
}

.login-input:focus {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.login-input-wrap.has-toggle .login-input {
  padding-right: 44px;
}

.login-toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--login-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.login-toggle-pw:hover {
  color: var(--login-text);
}

.login-toggle-pw svg {
  width: 18px;
  height: 18px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  cursor: pointer;
  user-select: none;
}

.login-remember input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.login-remember-box {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--login-remember-border);
  border-radius: 5px;
  background: var(--login-remember-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.login-remember-box svg {
  width: 12px;
  height: 12px;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
}

.login-remember input:checked + .login-remember-box {
  background: #22c55e;
  border-color: #22c55e;
}

.login-remember input:checked + .login-remember-box svg {
  opacity: 1;
  transform: scale(1);
}

.login-remember input:focus-visible + .login-remember-box {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.login-remember-text {
  font-size: 13px;
  color: var(--login-label);
}

.login-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #22c55e;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.login-submit:hover {
  background: #16a34a;
}

.login-submit:active {
  transform: scale(0.99);
}

.login-submit svg {
  width: 18px;
  height: 18px;
}

.login-help-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0 16px;
}

.login-help-divider::before,
.login-help-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--login-divider);
}

.login-help-divider span {
  font-size: 12px;
  color: var(--login-text-muted);
  white-space: nowrap;
}

.login-help-text {
  font-size: 13px;
  color: var(--login-text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ---- Mobile top bar & tabs (hidden on desktop) ---- */

.login-mobile-top {
  display: none;
}

.login-desktop-only {
  display: flex;
}

/* ---- Responsive ---- */

@media (max-width: 960px) {
  body:has(.login-page) {
    overflow-x: hidden;
  }

  .login-page {
    flex-direction: column;
    min-height: 100dvh;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
  }

  .login-mobile-top {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--login-bg);
    border-bottom: 1px solid var(--login-card-border);
    padding: max(12px, env(safe-area-inset-top)) 16px 12px;
    flex-shrink: 0;
    width: 100%;
  }

  .login-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
  }

  .login-mobile-brand .login-logo {
    width: 36px;
    height: 36px;
  }

  .login-mobile-brand .login-brand-title {
    font-size: 22px;
  }

  .login-mobile-tabs {
    display: flex;
    gap: 4px;
    background: var(--login-input-bg);
    border: 1px solid var(--login-input-border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 0;
    width: 100%;
  }

  .login-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--login-text);
    font-size: 14px;
    font-weight: 600;
    padding: 11px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .login-tab.is-active {
    background: var(--login-card-bg);
    color: var(--login-heading);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  }

  html[data-theme="dark"] .login-tab.is-active {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }

  .login-desktop-only {
    display: none !important;
  }

  [data-mobile-panel] {
    display: none;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  [data-mobile-panel].is-active {
    display: flex !important;
  }

  .login-brand[data-mobile-panel]:not(.is-active),
  .login-form-panel[data-mobile-panel]:not(.is-active) {
    display: none !important;
  }

  .login-brand {
    flex-direction: column;
    justify-content: flex-start;
    padding: 16px 16px 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .login-brand-glow {
    width: 320px;
    height: 320px;
    top: 22%;
    left: 50%;
  }

  .login-brand-rings {
    width: min(420px, 120vw);
    height: min(420px, 120vw);
    top: 20%;
    left: 50%;
  }

  .login-brand-inner {
    max-width: none;
    width: 100%;
  }

  .login-brand-tagline {
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    max-width: none;
    padding: 0 8px;
  }

  .login-features {
    gap: 10px;
    margin-bottom: 16px;
  }

  .login-feature {
    background: var(--login-card-bg);
    border: 1px solid var(--login-card-border);
    border-radius: 14px;
    padding: 14px;
    gap: 12px;
    box-shadow: var(--login-card-shadow);
  }

  .login-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .login-feature-text h3 {
    font-size: 14px;
  }

  .login-feature-text p {
    font-size: 12px;
  }

  .login-brand-footer {
    display: flex;
    justify-content: center;
    text-align: center;
    padding-top: 8px;
  }

  .login-form-panel {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 12px 16px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .login-card {
    max-width: none;
    width: 100%;
    border: none;
    border-radius: 0;
    padding: 4px 0 0;
    box-shadow: none;
    background: transparent;
  }

  .login-card h2 {
    font-size: 22px;
    text-align: left;
    margin-bottom: 4px;
  }

  .login-card-subtitle {
    text-align: left;
    margin-bottom: 22px;
    font-size: 13px;
  }

  .login-input {
    padding-top: 13px;
    padding-bottom: 13px;
    font-size: 16px;
  }

  .login-submit {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px;
  }

  .login-help-divider {
    margin-top: 24px;
  }
}

@media (max-width: 480px) {
  .login-mobile-top {
    padding-left: 12px;
    padding-right: 12px;
  }

  .login-brand,
  .login-form-panel {
    padding-left: 12px;
    padding-right: 12px;
  }
}
