/* Login visuals adapted from bdsh; source recorded in bdsh-provenance.json. */
:root {
  /* ===== Color (light) — DEFAULT ===== */
  --bg:            #fbfbfc;
  --surface-1:     #ffffff;
  --surface-2:     #f4f4f6;
  --surface-3:     #ebebee;
  --border:        #e2e2e7;
  --border-strong: #cbcbd2;

  --text-1:        #18181b;
  --text-2:        #52525b;
  --text-3:        #a1a1aa;
  --text-disabled: #d4d4d8;

  --accent:        #2B43C9;
  --accent-hover:  #2235A1;
  --accent-soft:   rgba(43, 67, 201, 0.10);

  /* ===== Brand accent — tech blue (softtech-inspired palette).
     The historical "--mint" variable names are preserved to minimise
     diff against existing component CSS; the role is now "primary brand
     accent", not literally green. Status/success green lives in
     --success-* tokens below. */
  --mint:        #E9ECFF;
  --mint-strong: #2B43C9;
  --mint-dark:   #2235A1;
  --mint-soft:   var(--mint);

  --success:       #22c55e;
  --success-strong:#22c55e;
  --success-soft:  #dcfce7;
  --warning:       #d97706;
  --warning-soft:  rgba(217, 119, 6, 0.12);
  --danger:        #dc2626;
  --danger-soft:   rgba(220, 38, 38, 0.08);

  /* ===== Typography ===== */
  --font-sans:
    "Microsoft YaHei UI", "PingFang SC", "Microsoft JhengHei",
    -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI',
    'Roboto', 'Hiragino Sans GB', sans-serif;
  --font-mono:
    ui-monospace, 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;

  /* Type scale — base shifted +2px from mockup numbers for desktop legibility.
     Each step keeps its line-height ratio. */
  --text-xs-size:  13px;  --text-xs-line:  18px;
  --text-sm-size:  14px;  --text-sm-line:  20px;
  --text-md-size:  15px;  --text-md-line:  22px;
  --text-lg-size:  16px;  --text-lg-line:  24px;
  --text-xl-size:  18px;  --text-xl-line:  26px;
  --text-2xl-size: 22px;  --text-2xl-line: 30px;
  --text-3xl-size: 30px;  --text-3xl-line: 38px;

  /* ===== Spacing ===== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  /* ===== Radius =====
     NOTE: --radius-md was deliberately overridden to 13px to match the
     mockup's nav button / chip rounding (see spec §4.1.4). It is now
     intentionally larger than --radius-lg (8px) and --radius-xl (12px),
     which keep their original panel/card values to avoid breaking 14+
     existing usage sites. Do not "fix" the ordering by renaming. */
  --radius-sm: 4px;
  --radius-md: 13px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 999px;

  /* ===== Shadow (light) ===== */
  --shadow-sm: 0 1px 2px  rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  /* ===== Motion ===== */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:   120ms;
  --dur-normal: 180ms;

  /* ===== Mockup semantic aliases (UI/index.html parity) ===== */
  --ink:    var(--text-1);
  --muted:  var(--text-2);
  --line:   var(--border);
  --panel:  var(--surface-1);
  --soft:   #f7fafb;
  --softer: #fbfdfe;

  /* ===== Mockup radius / shadow (additive) ===== */
  --radius:      18px;
  --shadow:      0 18px 48px rgba(23, 32, 26, 0.10);
  --shadow-soft: 0 10px 26px rgba(23, 32, 26, 0.05);
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 var(--font-sans); }
button, input { font: inherit; }
.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 22px;
  padding: 28px;
  background:
    linear-gradient(135deg, var(--mint-soft), transparent 36%),
    radial-gradient(circle at 88% 8%, var(--mint-soft), transparent 24%),
    var(--bg);
  color: var(--text-1);
  overflow: hidden;
}

.login-shell > .login-brand,
.login-shell > .login-card {
  position: relative;
  z-index: 1;
}

/* ───── 3D background layer ─────────────────────────────────────────────
   Floating blurred orbs at varied depths + receding perspective grid.
   Pointer-events disabled so the form stays fully interactive. */
.login-shell__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-shell__scene-bg {
  position: absolute;
  left: 66px;
  top: 188px;
  width: min(1160px, 62vw);
  min-width: 900px;
  height: auto;
  object-fit: contain;
  object-position: center center;
  opacity: 0.74;
  filter: saturate(0.88) brightness(1.04) contrast(0.90);
  transform: translateZ(0);
  -webkit-mask-image:
    linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 6%, rgba(0, 0, 0, 0.72) 16%, rgba(0, 0, 0, 0.96) 30%, rgba(0, 0, 0, 0.88) 78%, rgba(0, 0, 0, 0.20) 100%),
    radial-gradient(ellipse at 46% 56%, rgba(0, 0, 0, 0.98) 0 43%, rgba(0, 0, 0, 0.78) 58%, rgba(0, 0, 0, 0.28) 76%, rgba(0, 0, 0, 0) 92%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.92) 15%, rgba(0, 0, 0, 0.92) 78%, rgba(0, 0, 0, 0) 100%);
          mask-image:
    linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 6%, rgba(0, 0, 0, 0.72) 16%, rgba(0, 0, 0, 0.96) 30%, rgba(0, 0, 0, 0.88) 78%, rgba(0, 0, 0, 0.20) 100%),
    radial-gradient(ellipse at 46% 56%, rgba(0, 0, 0, 0.98) 0 43%, rgba(0, 0, 0, 0.78) 58%, rgba(0, 0, 0, 0.28) 76%, rgba(0, 0, 0, 0) 92%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.92) 15%, rgba(0, 0, 0, 0.92) 78%, rgba(0, 0, 0, 0) 100%);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
}

/* Perspective grid — tilted backward, faded top/bottom so it reads as a
   floor extending toward a vanishing point. */
.login-shell__grid {
  position: absolute;
  inset: -10% -25% -40% -25%;
  background-image:
    linear-gradient(to right, rgba(27, 109, 225, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(27, 109, 225, 0.10) 1px, transparent 1px);
  background-size: 84px 84px, 84px 84px;
  transform: perspective(900px) rotateX(62deg) translateY(20%);
  transform-origin: center top;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.65) 28%,
    rgba(0, 0, 0, 0.85) 50%,
    rgba(0, 0, 0, 0) 100%
  );
          mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.65) 28%,
    rgba(0, 0, 0, 0.85) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  opacity: 0.7;
}

/* Soft floating orbs. Each gets its own size, position, color stop, and
   drift animation so the motion feels organic rather than synchronized. */
.login-shell__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  will-change: transform;
}
.login-shell__orb--1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(79, 148, 240, 0.55), transparent 70%);
  top: -140px; left: 6%;
  animation: orbFloat1 32s ease-in-out infinite;
}
.login-shell__orb--2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(27, 109, 225, 0.45), transparent 70%);
  bottom: -120px; left: 36%;
  animation: orbFloat2 44s ease-in-out infinite;
}
.login-shell__orb--3 {
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(147, 184, 232, 0.40), transparent 70%);
  top: 14%; right: -110px;
  animation: orbFloat3 38s ease-in-out infinite;
}
.login-shell__orb--4 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(230, 240, 251, 0.85), transparent 70%);
  bottom: 6%; right: 18%;
  animation: orbFloat4 50s ease-in-out infinite;
}
.login-shell__orb--5 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), transparent 70%);
  top: 44%; left: 34%;
  animation: orbFloat5 28s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(40px, 60px, 0); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(-55px, -45px, 0); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(-65px, 55px, 0); }
}
@keyframes orbFloat4 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(30px, -50px, 0); }
}
@keyframes orbFloat5 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(-30px, 40px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell__orb { animation: none !important; }
}

[data-theme='dark'] .login-shell__grid {
  background-image:
    linear-gradient(to right, rgba(79, 148, 240, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79, 148, 240, 0.16) 1px, transparent 1px);
}
[data-theme='dark'] .login-shell__orb--1 {
  background: radial-gradient(circle, rgba(79, 148, 240, 0.42), transparent 70%);
}
[data-theme='dark'] .login-shell__orb--2 {
  background: radial-gradient(circle, rgba(27, 109, 225, 0.36), transparent 70%);
}
[data-theme='dark'] .login-shell__orb--3 {
  background: radial-gradient(circle, rgba(147, 184, 232, 0.20), transparent 70%);
}
[data-theme='dark'] .login-shell__orb--4 {
  background: radial-gradient(circle, rgba(48, 80, 130, 0.50), transparent 70%);
}
[data-theme='dark'] .login-shell__orb--5 {
  background: radial-gradient(circle, rgba(220, 235, 255, 0.10), transparent 70%);
}

.login-shell .mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 24px;
  color: var(--text-1);
}

.login-shell .mark-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  /* Mac-app-icon style: brand-blue gradient + white "Y" + drop shadow. */
  background: linear-gradient(135deg, var(--mint-strong), var(--mint-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 6px 14px rgba(27, 109, 225, 0.30);
}

.login-logo {
  display: block;
  width: min(260px, 58vw);
  height: auto;
  object-fit: contain;
}

.login-logo--brand {
  width: min(320px, 58vw);
}

.login-logo--card {
  width: 172px;
}

.login-brand {
  position: relative;
  overflow: visible;
  padding: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.login-brand::after {
  content: none;
}

.login-title {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 86px 0 22px;
  font-size: 50px;
  line-height: 1.12;
  letter-spacing: 0;
  color: var(--text-1);
}

.login-title__highlight {
  color: #2B43C9;
}

.login-sub {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1.8;
}

.brand-strip {
  position: absolute;
  left: 46px;
  right: 46px;
  bottom: 42px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.brand-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.brand-card b {
  display: block;
  margin-bottom: 8px;
  color: var(--text-1);
  font-size: var(--text-lg-size);
}

.brand-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
}

.login-card__title {
  margin: 22px 0 26px;
  font-size: 28px;
  color: var(--text-1);
}

.login-card__tabs {
  display: flex;
  gap: 26px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--border);
}

.login-card__tab {
  position: relative;
  padding: 0 2px 10px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.login-card__tab:hover {
  color: var(--text-1);
}

.login-card__tab--active {
  color: var(--text-1);
  font-weight: 600;
}

.login-card__tab--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: var(--mint-strong);
}

.login-card__code-row {
  display: flex;
  gap: 10px;
}

.login-card__code-row input {
  flex: 1;
  min-width: 0;
}

.login-card__send-code {
  flex: none;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--mint-strong);
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.login-card__send-code:hover:not(:disabled) {
  border-color: var(--mint-strong);
}

.login-card__send-code:disabled {
  color: var(--text-3);
  cursor: not-allowed;
}

.login-card__form {
  display: block;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card .field label {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  color: var(--text-2);
}

.login-card .field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.login-card .field input:focus {
  border-color: var(--mint-strong);
  background: var(--surface-1);
  box-shadow: 0 0 0 4px var(--mint-soft);
}

.login-card__submit {
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--mint-strong);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--mint-soft);
  transition: background-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.login-card__submit:hover:not(:disabled) {
  background: var(--mint-dark);
}

.login-card__submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-card__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-card__error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

.login-card__hint {
  margin-top: 18px;
  padding: 13px;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}

.login-version {
  position: fixed;
  right: 24px;
  bottom: 18px;
  z-index: 2;
  color: var(--text-3);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  pointer-events: none;
}

@media (max-width: 1180px) {
  .login-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .login-brand {
    min-height: auto;
  }
  .login-shell__scene-bg {
    left: -30%;
    top: 250px;
    width: 142%;
    min-width: 0;
    opacity: 0.20;
  }
  .brand-strip {
    position: static;
    margin-top: 32px;
  }
}


/* DSH password form and compact browser layouts. */
.login-card__intro { margin: -12px 0 24px; color: var(--text-2); font-size: 14px; }
.login-card__password { position: relative; }
.login-card .field .login-card__password input { padding-right: 66px; }
.login-card__password-toggle { position: absolute; top: 0; right: 6px; bottom: 0; border: 0; background: transparent; color: var(--mint-strong); padding: 0 10px; cursor: pointer; font-size: 14px; }
button:focus-visible { outline: 2px solid var(--mint-strong); outline-offset: 4px; }
.login-card .field input[aria-invalid=true] { border-color: var(--danger); }
.login-card__error:empty { display: none; }
.login-card__submit { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; min-height: 48px; }
.login-card__spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: login-spin .8s linear infinite; }
[aria-busy=true] .login-card__spinner { display: block; }
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-version { position: absolute; }
@media (min-width: 1181px) { .login-shell { min-height: max(740px, 100svh); } }
@media (max-width: 1180px) {
  .login-shell { min-height: 100svh; grid-template-columns: 1fr 1fr; align-content: center; padding: 32px; gap: 24px; }
  .login-brand { padding: 12px; align-self: center; }
  .login-title { margin-top: 42px; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.3; }
  .brand-strip { grid-template-columns: 1fr; gap: 18px; margin-top: 40px; }
  .brand-card p { font-size: 14px; }
  .login-shell__scene-bg { top: 200px; left: -220px; width: 920px; opacity: .25; }
}
@media (max-width: 680px) {
  .login-shell { grid-template-columns: 1fr; align-content: center; gap: 26px; padding: 28px 20px 54px; }
  .login-brand { padding: 0 4px; }
  .login-logo--brand { width: 160px; }
  .login-title { margin: 24px 0 0; font-size: 29px; line-height: 1.35; }
  .brand-strip { display: none; }
  .login-card { padding: 26px; }
  .login-logo--card { display: none; }
  .login-card__title { margin-top: 0; font-size: 26px; }
  .login-shell__scene-bg { top: 0; left: -190px; width: 820px; opacity: .16; }
  .login-version { right: 20px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
