*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: #0a1628;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page-wrap-root {
  min-height: 100vh;
}

.page-wrap {
  min-height: 100vh;
  display: flex;
  background: #0a1628;
}

/* ─── Left panel ─────────────────────────────────────────── */

.left-panel {
  display: none;
  width: 52%;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #0f1f3d;
}

@media (min-width: 1024px) {
  .left-panel {
    display: flex;
  }
}

.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.glow-tl {
  top: 80px;
  left: -60px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.18) 0%, transparent 70%);
}

.glow-br {
  bottom: 120px;
  right: -40px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, transparent 70%);
}

.left-inner {
  position: relative;
  z-index: 10;
  padding: 56px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 64px;
}

.brand-name {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
}

.headline {
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.headline-accent {
  color: #14b8a6;
}

.tagline {
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  line-height: 1.6;
  max-width: 380px;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
}

.feature-title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.feature-desc {
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-link {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: rgba(255, 255, 255, 0.5);
}

/* ─── Right panel ────────────────────────────────────────── */

.right-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.form-container {
  width: 100%;
  max-width: 420px;
}

.mobile-logo {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

@media (min-width: 1024px) {
  .mobile-logo {
    display: none;
  }
}

/* ─── Authenticated ───────────────────────────────────────── */

.welcome-box {
  color: #fff;
  margin-bottom: 24px;
}

.welcome-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.account-detail {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  margin-bottom: 4px;
}

/* ─── Steps ──────────────────────────────────────────────── */

.step-header {
  margin-bottom: 32px;
}

.step-title {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-sub {
  color: rgba(255, 255, 255, 0.45);
  font-size: 14px;
}

.email-display {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
}

/* ─── Form ───────────────────────────────────────────────── */

.form-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-label {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.portal-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px 10px 40px;
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border 0.2s;
}

.portal-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.portal-input:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* ─── Buttons ────────────────────────────────────────────── */

.portal-btn-primary {
  background: #0d9488;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-btn-primary:hover {
  background: #0f766e;
  transform: translateY(-1px);
}

.portal-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.portal-btn-ms {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 11px 20px;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
}

.portal-btn-ms:hover {
  background: rgba(255, 255, 255, 0.14);
}

.portal-btn-ms:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  margin-bottom: 24px;
  padding: 0;
}

/* ─── Error box ──────────────────────────────────────────── */

.error-box {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f87171;
  font-size: 13px;
}

/* ─── Divider ────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* ─── Spinner ────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Legal ──────────────────────────────────────────────── */

.legal-text {
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  text-align: center;
  margin-top: 28px;
}

/* ─── Tenant selector ────────────────────────────────────── */

.tenant-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.tenant-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  width: 100%;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.tenant-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.tenant-btn--inactive {
  opacity: 0.5;
  cursor: not-allowed;
}

.tenant-btn--inactive:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.tenant-status-badge {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Device limit notice ────────────────────────────────── */
/* Same glass surface, radius and type scale as .tenant-btn: this replaces the workspace
   list in place, so it should read as the same panel rather than a foreign dialog. */

.device-limit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
  text-align: left;
}

.device-limit__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-wrap: balance;
}

.device-limit__detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
}

.device-limit__error {
  margin: 0;
  font-size: 13px;
  color: #f87171;
}

.device-limit__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-limit__item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-limit__item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.device-limit__item-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-limit__item-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.device-limit__badge {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.device-limit__release,
.device-limit__retry,
.device-limit__cancel {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.device-limit__release:hover:not(:disabled),
.device-limit__retry:hover:not(:disabled),
.device-limit__cancel:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.device-limit__release:disabled,
.device-limit__retry:disabled,
.device-limit__cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.device-limit__actions {
  display: flex;
  gap: 8px;
}

.device-limit__retry {
  background: rgba(255, 255, 255, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .device-limit__release,
  .device-limit__retry,
  .device-limit__cancel {
    transition: none;
  }
}

/* ─── Account sign-out, demoted ───────────────────────────
   Shown instead of the primary button while a sign-in refusal is on screen. The device-limit
   notice offers per-device "Sign out" buttons; a full-width primary "Sign out" underneath them
   reads as the way out of the lockout, and it is the one control there that cannot free a slot.
   Quiet, self-describing, and still reachable for a user who genuinely wants another account. */

.account-signout-link {
  display: block;
  margin-top: 14px;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.2s;
}

.account-signout-link:hover {
  color: rgba(255, 255, 255, 0.8);
}

@media (prefers-reduced-motion: reduce) {
  .account-signout-link {
    transition: none;
  }
}

/* ─── Utility ────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─── Session-ended notice (licence architecture §10.4) ──────────
   One line above the sign-in surface saying why the user is here.
   Same quiet palette as the device-limit notice: informational, not
   an error — a policy-driven session end is normal behaviour. */

.session-ended-notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  text-align: left;
}
