:root {
  --ink: #0f1f2e;
  --ink-2: #364553;
  --muted: #66737f;
  --line: #e2e6ea;
  --line-strong: #cdd4da;
  --surface: #ffffff;
  --paper: #f7f7f4;
  --navy: #0b1d2e;
  --navy-2: #12304a;
  --teal: #1f8f81;
  --teal-bright: #7bd0c8;
  --teal-wash: #e8f5f3;
  --copper: #e0895a;
  --danger: #a33a22;
  --danger-wash: #fdf1ec;
  --radius: 12px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--paper);
  margin: 0;
  min-width: 320px;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

/* Layout */

.page {
  display: grid;
  grid-template-columns: minmax(420px, 5fr) 7fr;
  min-height: 100vh;
}

.auth {
  background: var(--surface);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 28px clamp(24px, 4vw, 56px);
}

.auth-body {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.panel {
  display: grid;
  gap: 20px;
  max-width: 380px;
  width: 100%;
}

/* Brand */

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  flex: none;
  height: 36px;
  width: 36px;
}

.brand-mark rect {
  fill: var(--navy);
}

.brand-mark path {
  fill: none;
  stroke: var(--teal-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-name {
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-by {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

/* Panel content */

.panel-heading h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.panel-heading p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 8px 0 0;
}

.kicker {
  color: var(--teal) !important;
  font-size: 13px !important;
  font-weight: 600;
  margin: 0 0 6px !important;
}

/* Sign in / Activate invite toggle: only shown when an invite link offers a real choice. */
.auth-mode-row {
  background: #f0f2f4;
  border-radius: 10px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
}

.auth-mode-row:has(#activate-invite-button[hidden]) {
  display: none;
}

.auth-mode-row button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-height: 36px;
}

.auth-mode-row button.active {
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 31, 46, 0.08), 0 1px 6px rgba(15, 31, 46, 0.06);
  color: var(--ink);
}

.status-note {
  background: var(--teal-wash);
  border-radius: 10px;
  color: #145c53;
  font-size: 14px;
  line-height: 1.45;
  padding: 11px 14px;
}

.status-note.is-error {
  background: var(--danger-wash);
  color: var(--danger);
}

/* Form */

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form label > span {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.login-form input {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  height: 46px;
  outline: none;
  padding: 0 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.login-form input::placeholder {
  color: #a3adb6;
}

.login-form input:hover {
  border-color: #b3bdc6;
}

.login-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(31, 143, 129, 0.16);
}

.login-form input:disabled {
  background: #f4f6f7;
  color: #7d8891;
}

.code-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
}

.btn-primary {
  background: var(--navy);
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  height: 48px;
  margin-top: 4px;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover {
  background: var(--navy-2);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:focus-visible,
.btn-quiet:focus-visible,
.tenant-card:focus-visible,
.auth-mode-row button:focus-visible {
  outline: 3px solid rgba(31, 143, 129, 0.4);
  outline-offset: 2px;
}

.btn-primary[aria-disabled="true"] {
  opacity: 0.6;
}

.mfa-step {
  display: grid;
  gap: 16px;
}

.mfa-enrollment {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px;
}

.mfa-enrollment img {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 176px;
  padding: 8px;
  width: 176px;
}

.mfa-enrollment p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  text-align: center;
}

.mfa-enrollment .manual-code {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  padding: 8px 10px;
  word-break: break-all;
}

.secure-note {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: center;
  margin: -4px 0 0;
}

.secure-note svg {
  fill: none;
  height: 15px;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-width: 1.7;
  width: 15px;
}

.panel-foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  font-size: 14px;
  gap: 8px;
  line-height: 1.5;
  padding-top: 20px;
}

.panel-foot p {
  margin: 0;
}

.panel-foot a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}

.panel-foot a:hover {
  text-decoration: underline;
}

/* Workspace picker */

.tenant-cards {
  display: grid;
  gap: 10px;
}

.tenant-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  width: 100%;
}

.tenant-card:hover {
  border-color: var(--teal);
  box-shadow: 0 6px 18px rgba(15, 31, 46, 0.08);
  transform: translateY(-1px);
}

.tenant-card:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.tenant-card-mark {
  align-items: center;
  background: var(--teal-wash);
  border-radius: 10px;
  color: var(--teal);
  display: inline-flex;
  flex: none;
  font-size: 16px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.tenant-card-admin .tenant-card-mark {
  background: var(--navy);
  color: var(--teal-bright);
}

.tenant-card-text {
  flex: 1;
  min-width: 0;
}

.tenant-card-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.tenant-card-role {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 2px;
  text-transform: capitalize;
}

.tenant-card-arrow {
  color: #9aa5ae;
  font-size: 22px;
  transition: color 0.15s, transform 0.15s;
}

.tenant-card:hover .tenant-card-arrow {
  color: var(--teal);
  transform: translateX(2px);
}

.account-empty {
  background: var(--paper);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  padding: 14px 16px;
}

.btn-quiet {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  justify-self: start;
  padding: 0 16px;
}

.btn-quiet:hover {
  background: var(--paper);
}

/* Footer */

.auth-foot {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 12px;
  justify-content: space-between;
}

.auth-foot nav {
  display: flex;
  gap: 18px;
}

.auth-foot a {
  text-decoration: none;
}

.auth-foot a:hover {
  color: var(--ink);
}

/* Story side */

.story {
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(123, 208, 200, 0.18), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(224, 137, 90, 0.12), transparent 60%),
    linear-gradient(160deg, #0d2338 0%, var(--navy) 55%, #08151f 100%);
  color: #ffffff;
  display: flex;
  overflow: hidden;
  padding: clamp(36px, 4.5vw, 64px);
  position: relative;
}

.story::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  inset: 0;
  mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 75%);
  position: absolute;
}

.story-inner {
  align-self: center;
  margin: 0 auto;
  max-width: 560px;
  position: relative;
  width: 100%;
}

.story-kicker {
  color: var(--teal-bright);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
}

.story h2 {
  font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0;
}

.story-lede {
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  line-height: 1.6;
  margin: 18px 0 0;
  max-width: 500px;
}

.preview {
  margin: 28px 0 0;
}

.preview-card {
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  padding: 20px;
}

.preview-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.preview-tag {
  background: rgba(224, 137, 90, 0.16);
  border-radius: 999px;
  color: #f2b08b;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
}

.preview-sample {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.preview-item {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.preview-item strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
}

.preview-item span {
  color: rgba(255, 255, 255, 0.55);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.preview-cost {
  text-align: right;
}

.preview-cost strong {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.preview-cost .up {
  color: #f2b08b;
  font-weight: 600;
}

.preview-spark {
  display: block;
  height: 64px;
  margin-top: 14px;
  width: 100%;
}

.spark-area {
  fill: url(#spark-fill);
}

.spark-line {
  fill: none;
  stroke: var(--teal-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.preview-cause {
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  font-size: 13.5px;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
}

.preview-cause strong {
  color: #ffffff;
  font-weight: 600;
}

.cause-dot {
  background: var(--copper);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(224, 137, 90, 0.2);
  flex: none;
  height: 8px;
  width: 8px;
}

.preview-stats {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  padding-top: 14px;
}

.preview-stats span {
  color: rgba(255, 255, 255, 0.5);
  display: block;
  font-size: 12px;
}

.preview-stats strong {
  display: block;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-top: 3px;
}

.story-points {
  display: grid;
  gap: 16px;
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}

.story-points li {
  align-items: flex-start;
  color: rgba(255, 255, 255, 0.68);
  display: flex;
  font-size: 15px;
  gap: 14px;
  line-height: 1.5;
}

.story-points strong {
  color: #ffffff;
  font-weight: 600;
}

.point-icon {
  align-items: center;
  background: rgba(123, 208, 200, 0.12);
  border-radius: 9px;
  display: inline-flex;
  flex: none;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.point-icon svg {
  fill: none;
  height: 17px;
  stroke: var(--teal-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 17px;
}

/* 404 */

.notfound {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px 16px;
  place-items: center;
}

.notfound .panel {
  text-align: left;
}

.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notfound-actions a {
  align-items: center;
  display: inline-flex;
  padding: 0 18px;
  text-decoration: none;
}

/* Responsive */

@media (max-width: 980px) {
  .page {
    grid-template-columns: 1fr;
  }

  .auth {
    min-height: auto;
    padding: 20px 16px 24px;
  }

  .auth-body {
    padding: 36px 0 40px;
  }

  .auth-foot {
    display: none;
  }

  .story {
    padding: 56px 16px 64px;
  }

  .story-inner {
    max-width: 560px;
  }
}

@media (max-width: 480px) {
  .panel-heading h1 {
    font-size: 25px;
  }

  .story h2 {
    font-size: 30px;
  }

  .preview-cost strong {
    font-size: 22px;
  }

  .preview-stats strong {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
