:root {
  --night: #151a16;
  --night-soft: #202721;
  --paper: #f6f7f3;
  --surface: #ffffff;
  --ink: #181c19;
  --muted: #697169;
  --line: #d8ddd6;
  --line-strong: #aeb8ae;
  --echo: #4c825f;
  --echo-soft: #e7f0e8;
  --sky: #08a7dd;
  --orange: #f57a1f;
  --red: #e52c2c;
  --danger: #ad332d;
  --sans: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(310px, 42%) minmax(0, 1fr);
  border-top: 4px solid var(--echo);
}

.identity-pane {
  position: relative;
  min-height: calc(100vh - 4px);
  min-height: calc(100dvh - 4px);
  display: flex;
  flex-direction: column;
  padding: max(34px, env(safe-area-inset-top)) 42px max(30px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: var(--night);
  color: #f7f8f4;
}
.identity-pane::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: 26px;
  width: 8px;
  height: 8px;
  background: var(--orange);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 10px;
  color: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.brand-mobile { display: none; color: var(--ink); }

.tracer-echo-mark {
  --mark-h: 18px;
  --bar-w: 3px;
  --bar-gap: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  height: var(--mark-h);
  gap: var(--bar-gap);
}
.tracer-echo-mark i {
  display: block;
  flex: 0 0 var(--bar-w);
  width: var(--bar-w);
  background: var(--sky);
}
.tracer-echo-mark i:nth-child(1) { height: 34%; background: var(--sky); }
.tracer-echo-mark i:nth-child(2) { height: 72%; background: var(--orange); }
.tracer-echo-mark i:nth-child(3) { height: 100%; background: var(--red); }
.tracer-echo-mark i:nth-child(4) { height: 68%; background: var(--echo); }
.tracer-echo-mark i:nth-child(5) { height: 38%; background: var(--sky); }
.tracer-echo-mark-sm { --mark-h: 20px; --bar-w: 3px; --bar-gap: 2px; }
.tracer-echo-mark-symphony { --mark-h: 74px; --bar-w: 9px; --bar-gap: 7px; }

.identity-lockup {
  width: min(470px, 100%);
  margin: auto 0;
  padding: 52px 0 70px;
}
.symphony-mark {
  position: relative;
  width: min(430px, 100%);
  height: 122px;
  display: flex;
  align-items: center;
}
.symphony-mark > span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #425046;
}
.symphony-mark > span:nth-child(1) { top: 33px; width: 58%; }
.symphony-mark > span:nth-child(2) { top: 60px; width: 78%; }
.symphony-mark > span:nth-child(3) { top: 87px; width: 48%; }
.symphony-mark .tracer-echo-mark { position: relative; z-index: 1; padding-right: 18px; background: var(--night); }
.identity-name { margin: 18px 0 0; font-size: clamp(42px, 6vw, 74px); font-weight: 400; line-height: 1; }
.identity-signature { margin: 0; color: #8f9c92; font-size: 12px; }

.auth-pane {
  min-width: 0;
  min-height: calc(100vh - 4px);
  min-height: calc(100dvh - 4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(44px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(44px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  overflow-y: auto;
}
.auth-card { width: min(440px, 100%); }
.auth-header { margin-bottom: 26px; }
.product-label { margin: 0 0 8px; color: var(--echo); font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: 34px; font-weight: 520; line-height: 1.12; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.auth-tab {
  position: relative;
  height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.auth-tab[aria-selected="true"] { color: var(--ink); }
.auth-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 20px;
  bottom: -1px;
  height: 2px;
  background: var(--echo);
}
.auth-tab:last-child { text-align: right; }
.auth-tab:last-child::after { left: 20px; right: 0; }

.field-group { margin-bottom: 18px; }
.field-group > label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 650; }
.field-qualifier { color: var(--muted); font-size: 11px; font-weight: 500; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
input.invite-code-input { font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
input:hover { border-color: #8f9a90; }
input:focus { border-color: var(--echo); outline-color: var(--echo); }
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"][aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }

.password-field { display: grid; grid-template-columns: minmax(0, 1fr) 66px; }
.password-field input { border-radius: 5px 0 0 5px; }
.password-toggle {
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background: #edf0eb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.password-toggle:hover { background: var(--surface); color: var(--ink); }

.password-requirements {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  margin: 9px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  list-style: none;
}
.password-requirements li::before { content: "○"; display: inline-block; width: 15px; color: #929b93; }
.password-requirements li.valid { color: var(--echo); }
.password-requirements li.valid::before { content: "●"; color: var(--echo); }

.legal-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.legal-consent input { width: 17px; height: 17px; margin: 0; accent-color: var(--echo); }
.legal-consent a { color: var(--ink); text-underline-offset: 2px; }

.form-error {
  min-height: 20px;
  margin: -5px 0 10px;
  color: var(--danger);
  font-size: 12px;
}
.form-error.success { color: var(--echo); }
.submit-button, .secondary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
}
.submit-button { border: 1px solid var(--night); background: var(--night); color: #fff; }
.submit-button:hover { border-color: var(--echo); background: var(--echo); }
.submit-button:disabled { cursor: wait; opacity: .62; }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--echo); color: var(--echo); }
.button-loading { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation: none; border-color: #fff; } }

.verification-view { padding: 14px 0; }
.verification-mark { height: 64px; display: flex; align-items: center; gap: 6px; margin-bottom: 30px; }
.verification-mark span { width: 7px; background: var(--sky); }
.verification-mark span:nth-child(1) { height: 24px; }
.verification-mark span:nth-child(2) { height: 43px; background: var(--orange); }
.verification-mark span:nth-child(3) { height: 62px; background: var(--red); }
.verification-mark span:nth-child(4) { height: 40px; background: var(--echo); }
.verification-mark span:nth-child(5) { height: 22px; }
.verification-message { margin: 18px 0 26px; color: var(--muted); overflow-wrap: anywhere; }
.noscript-message { color: var(--danger); font-size: 13px; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .identity-pane {
    min-height: 92px;
    height: 92px;
    padding: max(20px, env(safe-area-inset-top)) 22px 18px;
  }
  .identity-pane::after, .identity-lockup, .identity-signature { display: none; }
  .auth-pane {
    min-height: calc(100dvh - 96px);
    align-items: flex-start;
    padding: 34px max(22px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  }
  .brand-mobile { display: none; }
  h1 { font-size: 30px; }
}

@media (max-width: 420px) {
  .auth-pane { padding: 28px max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .auth-header { margin-bottom: 20px; }
  .auth-tabs { margin-bottom: 22px; }
  .password-requirements { grid-template-columns: 1fr; }
}

@media (max-width: 760px) and (max-height: 620px) {
  .identity-pane {
    min-height: 72px;
    height: 72px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: 14px;
  }
  .auth-pane { min-height: calc(100dvh - 76px); padding-top: 24px; }
}
