.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  grid-template-rows: 100vh;
}

/* 登入頁固定視口高度，避免捲動條（僅桌面） */
body.auth-body { height: 100vh; overflow: hidden; }
body.auth-body .auth-shell { height: 100vh; }
body.auth-body .auth-form-area { overflow-y: auto; overflow-x: hidden; }

@media (max-width: 880px) {
  body.auth-body { height: auto; overflow: auto; }
  body.auth-body .auth-shell { height: auto; overflow: visible; min-height: 100vh; }
  body.auth-body .auth-form-area { overflow: visible; padding: 24px 16px 40px; }
}

/* Height-based adjustments: desktop only (mobile handled in @media max-width:880px) */
@media (min-width: 881px) and (max-height: 860px) {
  body.auth-body .auth-brand { padding: 28px 44px; }
  body.auth-body .auth-brand__greeting { font-size: 46px; }
  body.auth-body .auth-brand__sub { margin-top: 12px; font-size: 15px; }
  body.auth-body .auth-card { padding: 26px 30px 28px; }
  body.auth-body .auth-card__subtitle { margin: 0 0 20px; }
  body.auth-body .field { margin-bottom: 14px; }
  body.auth-body .auth-divider { margin: 16px 0; }
  body.auth-body .auth-forgot-row { margin: 14px 0 16px; }
  body.auth-body .auth-footer-link { margin-top: 18px; }
  body.auth-body .auth-legal-links { margin-top: 12px; }
}
@media (min-width: 881px) and (max-height: 700px) {
  body.auth-body .auth-brand { padding: 18px 40px; }
  body.auth-body .auth-brand__sub { display: none; }
  body.auth-body .auth-brand__footer { display: none; }
  body.auth-body .auth-brand__greeting { font-size: 34px; }
  body.auth-body .auth-form-area { padding: 24px; }
  body.auth-body .auth-lang-switcher { top: 14px; right: 20px; }
  body.auth-body .auth-card { padding: 18px 24px 20px; }
  body.auth-body .auth-card__eyebrow { margin-bottom: 6px; }
  body.auth-body .auth-card__title { font-size: 23px; margin-bottom: 4px; }
  body.auth-body .auth-card__subtitle { margin: 0 0 12px; font-size: 13.5px; }
  body.auth-body .field { margin-bottom: 10px; }
  body.auth-body .field__label { margin-bottom: 4px; }
  body.auth-body .field__input { padding: 9px 12px; font-size: 14px; }
  body.auth-body .checkbox-row { margin-bottom: 14px !important; }
  body.auth-body .auth-divider { margin: 10px 0; }
  body.auth-body .auth-social-btn { width: 40px; height: 40px; }
  body.auth-body .auth-forgot-row { margin: 8px 0 10px; }
  body.auth-body .auth-footer-link { margin-top: 12px; }
  body.auth-body .auth-legal-links { margin-top: 10px; }
}

/* ---------- left brand panel（四主色：藍底＋黃/紅/綠圓點點綴，可愛活潑）---------- */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 48px;
  color: #FFFFFF;
  background: #1F66D6;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(252, 196, 32, 0.95) 26px, transparent 27px),
    radial-gradient(circle, rgba(228, 62, 48, 0.9) 16px, transparent 17px),
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 34px, transparent 35px),
    radial-gradient(circle, rgba(252, 196, 32, 0.55) 11px, transparent 12px),
    radial-gradient(circle, rgba(255, 255, 255, 0.16) 18px, transparent 19px);
  background-size: 300px 300px, 240px 240px, 360px 360px, 200px 200px, 260px 260px;
  background-position: 88% 8%, 94% 82%, -50px -50px, 24% 92%, 55% 45%;
  background-repeat: no-repeat;
}
.auth-brand__mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
  text-shadow: rgba(0, 0, 0, 0.35) 0 1px 2px;
}
.auth-brand__mark-icon {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.auth-brand__hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-brand__greeting {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  height: 1.3em;
  color: #FFFFFF;
}
.auth-brand__greeting span {
  position: absolute;
  left: 0; top: 0;
  white-space: nowrap;
  opacity: 0;
  animation-name: brand-cycle;
  animation-duration: var(--cycle-duration, 20s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes brand-cycle {
  0%   { opacity: 0; transform: translateY(10px); }
  2%   { opacity: 1; transform: translateY(0); }
  9%   { opacity: 1; transform: translateY(0); }
  12%  { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-brand__greeting span { animation: none; opacity: 0; }
  .auth-brand__greeting span:first-child { opacity: 1; position: static; }
}
.auth-brand__sub {
  margin-top: 18px;
  max-width: 34ch;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: rgba(0, 0, 0, 0.1) 0 1px 1px;
}
.auth-brand__footer {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.auth-brand__footer strong { color: #FFFFFF; font-weight: 700; }

/* ---------- right form panel（Aqua 細條紋桌面）---------- */
.auth-form-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
  background-color: var(--color-bg);
  min-height: 0;
}
.auth-lang-switcher { position: absolute; top: 28px; right: 32px; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border: 2px solid #F6E3B8;
  border-radius: 20px;
  padding: 30px 32px 34px;
  box-shadow: var(--shadow-card);
}

/* -- Mobile-only classes (hidden on desktop) -- */
.auth-mobile-header { display: none; }
.auth-mobile-form { display: contents; }
.auth-card__eyebrow {
  font-family: var(--font-body);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 10px;
}
.auth-card__title {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.auth-card__subtitle {
  color: var(--color-ink-muted);
  font-size: 14.5px;
  margin: 0 0 28px;
  line-height: 1.5;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--color-ink-faint);
  font-size: 12.5px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #DDD;
}

.auth-social-stack { display: flex; justify-content: center; gap: 12px; }
.auth-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: #F9F9F9;
  border: 1px solid var(--color-border);
  color: var(--color-ink);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.auth-social-btn:hover { background: #EFF6FF; border-color: #9CC9F2; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 0 2px rgba(44,123,237, 0.12); }
.auth-social-btn__fallback { font-weight: 700; font-size: 15px; color: var(--color-accent); }

.auth-footer-link {
  text-align: center;
  margin-top: 28px;
  font-size: 14px;
  color: var(--color-ink-muted);
}
.auth-footer-link a { color: #1F66D6; font-weight: 700; text-decoration: none; }
.auth-footer-link a:hover { text-decoration: underline; }

.auth-forgot-row { display: flex; justify-content: center; margin: 18px 0 22px; }
.auth-forgot-row a { font-size: 13.5px; color: #1F66D6; text-decoration: none; }
.auth-forgot-row a:hover { text-decoration: underline; }

.auth-legal-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--color-ink-faint);
}
.auth-legal-links a { color: #666; text-decoration: none; }
.auth-legal-links a:hover { color: #1F66D6; text-decoration: underline; }

.auth-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-ink-muted);
  font-size: 14px;
}

/* ============================================================
   Mobile Login – Full-screen App Style
   ============================================================ */
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }

  body.auth-body { background: #1F66D6; }
  body.auth-body .auth-shell { background: transparent; }

  .auth-lang-switcher {
    position: static;
    margin-bottom: 0;
    display: flex;
    justify-content: flex-end;
    padding: 0 4px;
  }
  .auth-lang-switcher .lang-switcher__select {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    font-size: 13px;
    padding: 6px 28px 6px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .auth-form-area {
    padding: 0;
    justify-content: flex-start;
    background: transparent;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth-card {
    max-width: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* -- Header zone -- */
  .auth-card__eyebrow {
    display: none;
  }
  .auth-card__title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
  }
  .auth-card__subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    margin: 0 0 28px;
    line-height: 1.5;
  }

  /* -- Mobile header block with site name + form title -- */
  .auth-mobile-header {
    padding: 48px 24px 0;
    text-align: left;
  }
  .auth-mobile-header__site {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 32px;
  }
  .auth-mobile-header__site svg {
    opacity: 0.8;
  }

  /* -- Form card with white background -- */
  .auth-mobile-form {
    flex: 1;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 32px 24px 40px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
  }

  .auth-mobile-form .field {
    margin-bottom: 18px;
  }
  .auth-mobile-form .field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-ink);
    margin-bottom: 6px;
  }
  .auth-mobile-form .field__input {
    height: 48px;
    padding: 0 14px;
    font-size: 16px;
    border-radius: 12px;
    border: 1.5px solid #E2E8F0;
    background: #F8FAFC;
    color: var(--color-ink);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }
  .auth-mobile-form .field__input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(44,123,237,0.12);
    background: #fff;
    outline: none;
  }
  .auth-mobile-form .field__input::placeholder {
    color: #94A3B8;
  }
  .auth-mobile-form .field__input-wrap {
    position: relative;
  }
  .auth-mobile-form .field__toggle-visibility {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    border-radius: 8px;
  }
  .auth-mobile-form .field__toggle-visibility:active {
    background: #F1F5F9;
  }

  /* -- Checkbox -- */
  .auth-mobile-form .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px !important;
    font-size: 14px;
    color: var(--color-ink-muted);
  }
  .auth-mobile-form .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
    border-radius: 4px;
  }

  /* -- Submit button（四色：藍→綠漸層＋深藍胖胖底邊） -- */
  .auth-mobile-form .btn--primary {
    width: 100%;
    height: 50px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 16px;
    background: #1F66D6;
    color: #fff;
    border: none;
    border-bottom: 4px solid #174EA6;
    box-shadow: 0 4px 14px rgba(44,123,237,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
  }
  .auth-mobile-form .btn--primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(44,123,237,0.25);
  }

  /* -- Forgot password -- */
  .auth-mobile-form .auth-forgot-row {
    justify-content: center;
    margin: 14px 0 0;
  }
  .auth-mobile-form .auth-forgot-row a {
    font-size: 13.5px;
    color: var(--color-accent);
    font-weight: 500;
  }

  /* -- Divider -- */
  .auth-mobile-form .auth-divider {
    margin: 24px 0 18px;
    font-size: 12.5px;
    color: #94A3B8;
  }
  .auth-mobile-form .auth-divider::before,
  .auth-mobile-form .auth-divider::after {
    background: #E2E8F0;
  }

  /* -- Social buttons -- */
  .auth-mobile-form .auth-social-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
  .auth-mobile-form .auth-social-btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  }
  .auth-mobile-form .auth-social-btn:active {
    transform: scale(0.93);
    background: #EFF6FF;
    border-color: #9CC9F2;
  }
  .auth-mobile-form .auth-social-btn__fallback {
    font-size: 16px;
    color: var(--color-accent);
  }

  /* -- Footer links -- */
  .auth-mobile-form .auth-footer-link {
    margin-top: 24px;
    font-size: 14px;
    color: var(--color-ink-muted);
  }
  .auth-mobile-form .auth-footer-link a {
    color: var(--color-accent);
    font-weight: 700;
  }

  /* -- Error -- */
  .auth-mobile-form .error-list {
    background: var(--color-error-soft);
    color: var(--color-error);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 18px;
    border: 1px solid rgba(192,0,0,0.12);
  }

  /* -- Legal links -- */
  .auth-mobile-form .auth-legal-links {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #F1F5F9;
  }
  .auth-mobile-form .auth-legal-links a {
    color: #94A3B8;
    font-size: 12px;
  }

  /* -- 白底表單內的標題一律深色（行動版 .auth-card__title 預設白色只適用橘底） -- */
  .auth-mobile-form .auth-card__title {
    color: var(--color-ink);
  }
  .auth-mobile-form .auth-card__subtitle {
    color: #64748B;
  }
  .auth-mobile-form .auth-card__eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
  }

  /* -- Org login specific -- */
  .auth-mobile-form .org-login-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
  }
  .auth-mobile-form .org-login-header img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1.5px solid #E2E8F0;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }
  .auth-mobile-form .org-login-header .org-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .auth-mobile-form .org-login-header .org-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-ink);
    margin: 0;
  }
}

@media (max-width: 480px) {
  .auth-mobile-header { padding: 40px 20px 0; }
  .auth-mobile-form { padding: 28px 20px 36px; }
  .auth-card__title { font-size: 26px; }
  .auth-mobile-form .btn--primary { height: 48px; font-size: 15px; }
  .auth-mobile-form .auth-social-btn { width: 48px; height: 48px; border-radius: 12px; }
}
