:root {
  --teamhub-bg: #f7f5f0;
  --teamhub-text: #171717;
  --teamhub-muted: #74777d;
  --teamhub-border: rgba(20, 20, 20, 0.16);
  --teamhub-surface: rgba(255, 255, 255, 0.96);
  --teamhub-ink: #111;
  --teamhub-success: #0b6b3a;
  --teamhub-gap: #9b2f17;
  --auth-bg: #f7fbff;
  --auth-blue: #1467f2;
  --auth-blue-dark: #0d55df;
  --focus-ring: rgba(20, 103, 242, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--teamhub-bg);
  color: var(--teamhub-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  margin: 0;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.auth-view {
  align-items: center;
  background: var(--auth-bg);
  color: var(--teamhub-text);
  display: flex;
  inset: 0;
  justify-content: flex-start;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(28px, 8.8vw, 148px);
  position: fixed;
  z-index: 1000;
}

.auth-grid-background {
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 255, 255, 0.98), transparent 34%),
    radial-gradient(circle at 82% 70%, rgba(210, 230, 255, 0.94), transparent 34%),
    linear-gradient(112deg, #ffffff 0%, #f8fbff 48%, #eaf4ff 100%);
  inset: 0;
  overflow: hidden;
  position: absolute;
}

.auth-bg-grid,
.auth-light-wash,
.auth-flow-scene {
  position: absolute;
}

.auth-bg-grid {
  animation: authGridDrift 32s linear infinite;
  background-image:
    linear-gradient(rgba(98, 148, 210, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 148, 210, 0.045) 1px, transparent 1px);
  background-size: 31px 31px;
  inset: 0;
  mask-image: linear-gradient(90deg, transparent 0 23%, rgba(0, 0, 0, 0.55) 42%, #000 100%);
}

.auth-light-wash {
  animation: authLightWash 14s ease-in-out infinite;
  background: linear-gradient(124deg, transparent 0 48%, rgba(255, 255, 255, 0.62) 51%, rgba(206, 229, 255, 0.24) 57%, transparent 64% 100%);
  height: 132%;
  opacity: 0.78;
  right: -12%;
  top: -16%;
  transform: translateX(10%) skewX(-14deg);
  width: 44%;
}

.auth-flow-scene {
  height: 100%;
  inset: 0 0 0 25%;
  width: 75%;
}

.auth-flow-line,
.auth-flow-arc {
  animation: authLineFlow 11s linear infinite, authLineFloat 16s ease-in-out infinite alternate;
  fill: none;
  stroke: url("#authFlow");
  stroke-dasharray: 8 16;
  stroke-linecap: round;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.auth-flow-arc {
  opacity: 0.22;
  stroke-dasharray: 2 0;
  stroke-width: 1;
}

.flow-a {
  opacity: 0.26;
}

.flow-b {
  animation-delay: -1.6s;
  opacity: 0.28;
}

.flow-c {
  animation-delay: -3s;
  opacity: 0.18;
}

.auth-flow-nodes circle {
  animation: authNodePulse 3.8s ease-in-out infinite;
  fill: #9fcaff;
  filter: drop-shadow(0 0 9px rgba(64, 137, 242, 0.3));
  opacity: 0.42;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
}

.auth-flow-nodes circle:nth-child(2n) {
  animation-delay: -1.2s;
}

.auth-flow-nodes circle:nth-child(3n) {
  animation-delay: -2s;
}

.auth-flow-packet {
  fill: var(--auth-blue);
  filter: drop-shadow(0 0 8px rgba(20, 103, 242, 0.38));
  opacity: 0.48;
  stroke: #fff;
  stroke-width: 2;
}

.packet-b {
  fill: #9fcaff;
}

.packet-c {
  fill: #72aef8;
}

.auth-layout {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(420px, 560px) 1fr;
  min-height: min(768px, calc(100vh - 80px));
  position: relative;
  width: min(1360px, 100%);
  z-index: 2;
}

.auth-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(197, 214, 236, 0.52);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(50, 79, 118, 0.13);
  align-content: center;
  display: grid;
  gap: 21px;
  max-width: 560px;
  min-height: min(704px, calc(100vh - 80px));
  padding: 60px 60px 58px;
  position: relative;
  width: 100%;
}

.auth-card::before {
  content: none;
}

.auth-logo-plate {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  justify-self: center;
  min-height: 78px;
  padding: 0;
}

.auth-logo {
  display: block;
  height: auto;
  width: min(318px, 100%);
}

.auth-card h1 {
  color: #1d2738;
  font-size: 30px;
  font-weight: 850;
  line-height: 1.2;
  margin: 2px 0 8px;
  text-align: center;
}

.auth-field {
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 0;
}

.auth-field-label {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.auth-input-wrap {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(178, 191, 210, 0.58);
  border-radius: 10px;
  display: grid;
  gap: 15px;
  grid-template-columns: 38px 1fr auto;
  min-height: 72px;
  padding: 0 22px;
}

.auth-input-wrap:focus-within {
  border-color: rgba(20, 103, 242, 0.62);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.auth-input-icon {
  color: #5c6372;
  display: grid;
  place-items: center;
}

.auth-input-icon svg,
.auth-input-action svg {
  fill: none;
  height: 28px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 28px;
}

.auth-input-wrap input {
  background: transparent;
  border: 0;
  color: #1f2937;
  font-size: 21px;
  font-weight: 500;
  min-width: 0;
  outline: 0;
}

.auth-input-wrap input::placeholder {
  color: #7d8696;
}

.auth-input-action {
  background: transparent;
  border: 0;
  color: #5c6372;
  cursor: pointer;
  display: grid;
  height: 38px;
  padding: 0;
  place-items: center;
  width: 38px;
}

.auth-options {
  align-items: center;
  display: flex;
  font-size: 15px;
  justify-content: flex-start;
  color: #1f2937;
  margin-top: 6px;
}

.auth-options label {
  align-items: center;
  display: inline-flex;
  gap: 12px;
}

.auth-options input {
  accent-color: var(--auth-blue);
  height: 22px;
  width: 22px;
}

.auth-primary-button,
.portal-button,
.portal-link {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  justify-content: center;
  min-height: 50px;
  text-decoration: none;
}

.auth-primary-button {
  background: var(--auth-blue);
  border: 1px solid var(--auth-blue);
  border-radius: 10px;
  box-shadow: 0 12px 22px rgba(20, 103, 242, 0.16);
  color: #fff;
  font-size: 20px;
  min-height: 66px;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.auth-primary-button:hover {
  background: var(--auth-blue-dark);
  border-color: var(--auth-blue-dark);
  box-shadow: 0 14px 24px rgba(13, 85, 223, 0.22);
  transform: translateY(-1px);
}

.auth-status {
  color: #5d6677;
  font-size: 15px;
  line-height: 1.4;
  margin: -8px 0 0;
  min-height: 22px;
  text-align: center;
}

.auth-status:empty {
  display: none;
}

@keyframes authGridDrift {
  to {
    background-position: 62px 31px;
  }
}

@keyframes authLightWash {
  0%,
  100% {
    transform: translateX(16%) skewX(-14deg);
  }

  50% {
    transform: translateX(-34%) skewX(-14deg);
  }
}

@keyframes authLineFlow {
  to {
    stroke-dashoffset: -272;
  }
}

@keyframes authLineFloat {
  from {
    transform: translateY(-7px);
  }

  to {
    transform: translateY(9px);
  }
}

@keyframes authNodePulse {
  0%,
  100% {
    opacity: 0.48;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1.28);
  }
}

.portal-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 32px;
}

.portal-header,
.portal-status-band {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.portal-kicker {
  color: var(--teamhub-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.portal-header h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

.portal-user {
  align-items: center;
  display: flex;
  gap: 14px;
  font-size: 14px;
  font-weight: 700;
}

.portal-button {
  background: #111;
  border: 1px solid #111;
  color: #fffdf8;
  min-height: 42px;
  padding: 0 18px;
}

.portal-button.secondary {
  background: transparent;
  color: var(--teamhub-text);
}

.portal-status-band,
.headers-preview {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--teamhub-border);
  border-radius: 8px;
  margin-top: 28px;
  padding: 18px;
}

.portal-status-band div {
  display: grid;
  gap: 5px;
}

.portal-status-band span {
  color: var(--teamhub-muted);
  font-size: 14px;
}

.portal-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 24px;
}

.portal-card {
  background: #fff;
  border: 1px solid var(--teamhub-border);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  min-height: 180px;
  padding: 18px;
}

.portal-card-code {
  color: var(--teamhub-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-card h2 {
  font-size: 21px;
  margin: 6px 0 0;
}

.status-ok,
.status-gap {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.status-ok {
  color: var(--teamhub-success);
}

.status-gap {
  color: var(--teamhub-gap);
}

.portal-link {
  align-self: end;
  background: #111;
  border: 1px solid #111;
  color: #fffdf8;
  min-height: 42px;
}

.headers-preview h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.headers-preview pre {
  background: #111;
  border-radius: 6px;
  color: #fffdf8;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  overflow: auto;
  padding: 16px;
}

[hidden] {
  display: none !important;
}

@media (max-height: 820px) {
  .auth-view {
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .auth-card {
    gap: 18px;
    padding-bottom: 42px;
    padding-top: 42px;
  }
}

@media (max-width: 860px) {
  .auth-view {
    align-items: flex-start;
    overflow: auto;
    padding: 16px;
  }

  .auth-bg-grid {
    mask-image: linear-gradient(#000, #000);
  }

  .auth-light-wash {
    right: -26%;
    width: 88%;
  }

  .auth-flow-scene {
    inset: 0 -52% 0 -20%;
    width: 172%;
  }

  .auth-layout {
    display: block;
    min-height: auto;
  }

  .auth-card {
    gap: 18px;
    min-height: auto;
    padding: 42px 28px 38px;
    width: min(100%, 440px);
  }

  .portal-shell {
    padding: 20px;
  }

  .portal-header,
  .portal-status-band,
  .portal-user {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .auth-card {
    padding: 34px 18px 30px;
  }

  .auth-logo {
    width: min(250px, 100%);
  }

  .auth-card h1 {
    font-size: 26px;
  }

  .auth-input-wrap {
    gap: 12px;
    min-height: 64px;
    padding: 0 16px;
  }

  .auth-input-wrap input {
    font-size: 18px;
  }

  .auth-options {
    font-size: 15px;
  }

  .auth-primary-button {
    font-size: 19px;
    min-height: 62px;
  }

  .auth-flow-scene {
    opacity: 0.72;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg-grid,
  .auth-light-wash,
  .auth-flow-line,
  .auth-flow-arc,
  .auth-flow-nodes circle {
    animation: none;
  }

  .auth-flow-packets {
    display: none;
  }
}
