:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --surface: #15181b;
  --surface-2: #1d2226;
  --surface-3: #283039;
  --surface-raised: #191d21;
  --line: #343c45;
  --line-soft: rgba(215, 228, 242, 0.1);
  --text: #f3f5f7;
  --text-muted: #b0bac4;
  --text-dim: #7f8b97;
  --accent: #4ea1ff;
  --accent-strong: #72b6ff;
  --success: #30c48d;
  --warning: #f0b84f;
  --danger: #ff6565;
  --info: #6ab6ff;
  --purple: #ac8cff;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #10161b 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
  scrollbar-color: #56616d #15191d;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    filter 140ms ease,
    transform 140ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--accent-strong);
}

::selection {
  color: #06111d;
  background: var(--accent-strong);
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 22px;
  padding: 32px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup h1,
.brand-lockup p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: 28px;
  line-height: 1.1;
}

.brand-lockup p {
  color: var(--text-muted);
  margin-top: 6px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #f4f7fb, #9bb6cf);
  color: #111417;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.brand-mark.logo-mark {
  overflow: hidden;
  padding: 5px;
  background: #f8fbff;
}

.brand-mark.logo-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  font-size: 13px;
  padding: 3px;
}

.loader-bar {
  width: min(340px, 68vw);
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: loadingSweep 1.1s ease-in-out infinite;
}

@keyframes loadingSweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

.login-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 18%, rgba(34, 123, 255, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(8, 20, 35, 0.92), rgba(10, 17, 20, 0.96)),
    var(--bg);
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
  gap: clamp(24px, 5vw, 78px);
  align-items: center;
  padding: clamp(22px, 5vw, 72px);
}

.login-panel {
  background: rgba(23, 25, 27, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 36px);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 28px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.tab-button,
.bottom-tabs button,
.segmented-control button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.tab-button.is-active,
.bottom-tabs button.is-active,
.segmented-control button.is-active {
  color: var(--text);
  background: var(--surface-3);
}

.auth-form {
  display: none;
  gap: 15px;
}

.auth-form.is-active {
  display: grid;
}

.login-context {
  display: grid;
  gap: 18px;
  align-content: center;
  min-height: min(720px, calc(100vh - 120px));
  padding: clamp(18px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(16, 17, 18, 0.82), rgba(16, 17, 18, 0.36)),
    url("../assets/logos/pulsecad-ambient.png") center / cover;
  box-shadow: var(--shadow);
}

.context-logo {
  width: min(390px, 100%);
  max-height: 100px;
  object-fit: contain;
  border-radius: var(--radius);
  background: rgba(248, 251, 255, 0.96);
  padding: 10px 16px;
}

.context-card {
  max-width: 660px;
}

.context-card h2 {
  font-size: clamp(34px, 6vw, 66px);
  line-height: 1.02;
  margin: 0 0 18px;
}

.context-card p {
  max-width: 640px;
  color: #c8d0d8;
  font-size: 18px;
  line-height: 1.65;
}

.context-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.context-grid span {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.config-warning,
.auth-status {
  margin: 14px 0 0;
  color: var(--warning);
  line-height: 1.45;
}

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

.auth-status.error {
  color: var(--danger);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text-dim);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  line-height: 1.45;
}

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

@media (max-width: 940px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-context {
    order: -1;
  }
}

@media (max-width: 620px) {
  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    align-items: flex-start;
  }
}
