:root {
  color-scheme: light;
  --ink: #101218;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --surface: #ffffff;
  --canvas: #f7f7f7;
  --accent: #111111;
  --accent-dark: #000000;
  --soft-accent: #eeeeee;
  --success: #157a55;
  --danger: #a83232;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

button,
a {
  font: inherit;
}

.portal-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.portal-header__inner,
.portal-main,
.portal-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.portal-header__inner {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
}

.brand__copy {
  display: grid;
  gap: 3px;
}

.brand__copy strong {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.brand__copy span {
  color: var(--muted);
  font-size: 14px;
}

.portal-header__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.portal-header__link {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.portal-header__link:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.portal-main {
  padding: 72px 0 96px;
}

.auth-layout {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.7fr);
  align-items: center;
  gap: clamp(48px, 8vw, 112px);
}

.auth-intro {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
}

h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.auth-intro > p:last-child {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.auth-panel,
.workspace-panel,
.account-panel,
.callback-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-panel {
  padding: 36px;
  box-shadow: 0 20px 50px rgba(16, 18, 24, 0.06);
}

.muted {
  color: var(--muted);
}

.auth-panel .muted {
  margin: 14px 0 28px;
  line-height: 1.6;
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.button:focus-visible {
  outline: 3px solid rgba(7, 84, 106, 0.28);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button--primary {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
}

.button--primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

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

.button--secondary,
.button--quiet {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button--secondary:hover,
.button--quiet:hover {
  border-color: #9aa8b7;
}

.access-note {
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.status-message {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-message[data-tone="error"] {
  color: var(--danger);
}

.status-message[data-tone="success"] {
  color: var(--success);
}

.workspace-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.workspace-heading h1 {
  font-size: clamp(38px, 5vw, 58px);
}

.workspace-heading .muted {
  margin: 10px 0 0;
}

.workspace-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.workspace-panel,
.account-panel {
  padding: 28px;
}

.count {
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--soft-accent);
  color: var(--accent);
  font-weight: 800;
}

.organization-list {
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.organization-row {
  padding: 20px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.organization-row:last-child {
  border-bottom: 0;
}

.organization-row strong,
.organization-row span {
  display: block;
}

.organization-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.role-badge {
  border-radius: 999px;
  padding: 7px 10px;
  background: #eef1f4;
  color: #3b4653;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.empty-state {
  margin: 22px 0 0;
  color: var(--muted);
}

.account-details {
  margin: 22px 0 0;
}

.account-details div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.account-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-details dd {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.portal-footer {
  min-height: 76px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.portal-footer a {
  color: var(--ink);
}

.callback-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.callback-panel {
  width: min(480px, 100%);
  padding: 40px;
  text-align: center;
}

.callback-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
}

.callback-panel h1 {
  font-size: 34px;
}

.callback-panel .muted {
  margin: 16px 0 24px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .portal-header__inner,
  .portal-main,
  .portal-footer {
    width: min(100% - 28px, 680px);
  }

  .portal-main {
    padding: 44px 0 72px;
  }

  .auth-layout,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    min-height: 0;
    gap: 36px;
  }

  .auth-panel {
    padding: 28px;
  }

  .workspace-heading {
    align-items: flex-end;
  }
}

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

  .brand__mark {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .brand__copy strong {
    font-size: 22px;
  }

  .brand__copy span,
  .portal-header__link {
    display: none;
  }

  h1 {
    font-size: 42px;
  }

  .workspace-heading,
  .panel-heading,
  .portal-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .organization-row {
    grid-template-columns: 1fr;
  }

  .portal-footer {
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
  }
}
