:root {
  color-scheme: dark;
  --bg: #101210;
  --surface: #171a18;
  --surface-strong: #1f2421;
  --surface-soft: #141715;
  --line: #2c342f;
  --line-strong: #3f4b44;
  --text: #f3f6f1;
  --muted: #a9b2aa;
  --muted-strong: #c8d0c7;
  --teal: #2dd4bf;
  --teal-deep: #0f766e;
  --amber: #f2c94c;
  --rose: #fb7185;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #101210 0%, #151614 46%, #101312 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.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;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 84px;
  margin: 0 auto;
  padding: 20px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-lockup,
.account-bar,
.profile-main,
.section-heading,
.lookup-band,
.apply-row {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 14px;
  min-width: 0;
}

.brand-mark,
.brand-logo {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(45, 212, 191, 0.55);
  border-radius: 8px;
  display: block;
  object-fit: contain;
  background: linear-gradient(145deg, rgba(45, 212, 191, 0.18), rgba(242, 201, 76, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.77rem;
  font-weight: 800;
  line-height: 1.2;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(1.25rem, 1.8vw, 1.65rem);
}

h2 {
  font-size: 1.1rem;
}

.account-bar {
  gap: 12px;
  min-width: 0;
}

.viewer-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.viewer-copy span,
.muted {
  color: var(--muted);
}

.viewer-copy strong {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: block;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.avatar-small {
  width: 40px;
  height: 40px;
}

.avatar-large {
  width: 96px;
  height: 96px;
}

.dashboard-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.lookup-band {
  justify-content: space-between;
  gap: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 24, 0.84);
  box-shadow: var(--shadow);
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  width: min(100%, 560px);
}

.text-input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0f0d;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.text-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.16);
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--teal);
  color: #071211;
  border-color: rgba(255, 255, 255, 0.12);
}

.primary-button:disabled {
  opacity: 0.42;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: var(--line-strong);
}

.workspace-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.profile-card,
.roles-card,
.login-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 24, 0.9);
  box-shadow: var(--shadow);
}

.profile-card,
.roles-card {
  padding: 18px;
}

.profile-main {
  gap: 16px;
  align-items: flex-start;
}

.profile-copy {
  min-width: 0;
}

.profile-copy h2 {
  font-size: 1.4rem;
}

.profile-copy .muted {
  margin: 8px 0 0;
}

.profile-facts {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-facts div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

dt {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

dd {
  margin: 0;
  color: var(--muted-strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.current-roles-block {
  margin-top: 18px;
}

.section-heading,
.roles-heading {
  justify-content: space-between;
  gap: 16px;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-list {
  margin-top: 10px;
}

.selectable-list {
  margin-top: 18px;
  min-height: 116px;
  align-content: flex-start;
}

.role-chip,
.empty-pill,
.count-pill {
  min-height: 34px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted-strong);
}

button.role-chip {
  appearance: none;
}

button.role-chip:hover {
  border-color: var(--role-color);
}

.role-chip.selected {
  color: #061211;
  background: var(--teal);
  border-color: var(--teal);
}

.role-chip.member-has:not(.selected) {
  border-color: rgba(242, 201, 76, 0.55);
  background: rgba(242, 201, 76, 0.08);
}

.role-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--role-color);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.role-chip.selected .role-dot {
  background: #061211;
}

.role-name {
  min-width: 0;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
}

.empty-pill,
.count-pill {
  color: var(--muted);
}

.count-pill {
  min-height: 30px;
  font-size: 0.82rem;
  flex: 0 0 auto;
}

.apply-row {
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.status-message {
  margin: 16px 0 0;
  color: var(--muted-strong);
  font-weight: 700;
}

.apply-row .status-message {
  margin: 0;
  min-width: 0;
}

.success-message {
  color: var(--teal);
}

.error-message {
  color: var(--rose);
}

.neutral-message {
  color: var(--amber);
}

.empty-state {
  margin-top: 18px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  padding: 24px;
}

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

.full-width {
  width: 100%;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-bar {
    width: 100%;
    justify-content: space-between;
  }

  .lookup-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .lookup-form,
  .workspace-grid,
  .profile-facts {
    grid-template-columns: 1fr;
  }

  .lookup-form {
    width: 100%;
  }

  .apply-row {
    align-items: stretch;
    flex-direction: column;
  }

  .apply-row .button {
    width: 100%;
  }
}

@media (max-width: 520px) {

  .dashboard-shell,
  .topbar {
    width: min(100% - 20px, 1180px);
  }

  .viewer-copy strong {
    max-width: 150px;
  }

  .profile-main {
    flex-direction: column;
  }

  .lookup-band,
  .profile-card,
  .roles-card,
  .login-panel {
    padding: 14px;
  }

  @media (max-width: 640px) {
    body {
      overflow-x: hidden;
    }

    .topbar,
    .dashboard-shell {
      width: 100%;
      padding-left: 12px;
      padding-right: 12px;
    }

    .topbar {
      min-height: auto;
      gap: 14px;
    }

    .brand-lockup {
      width: 100%;
    }

    .brand-logo,
    .brand-mark {
      width: 42px;
      height: 42px;
    }

    .account-bar {
      gap: 10px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(23, 26, 24, 0.7);
    }

    .viewer-copy {
      flex: 1;
    }

    .viewer-copy span {
      font-size: 0.78rem;
    }

    .viewer-copy strong {
      max-width: 100%;
      font-size: 0.92rem;
    }

    .ghost-button {
      min-height: 38px;
      padding: 0 12px;
    }

    .lookup-band {
      gap: 16px;
    }

    .lookup-form {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .lookup-form .button,
    .text-input {
      width: 100%;
      min-height: 46px;
    }

    .workspace-grid {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .profile-card,
    .roles-card,
    .empty-state {
      width: 100%;
    }

    .profile-main {
      align-items: center;
      text-align: center;
    }

    .avatar-large {
      width: 82px;
      height: 82px;
    }

    .profile-facts {
      gap: 8px;
    }

    .section-heading,
    .roles-heading {
      align-items: flex-start;
      flex-direction: column;
      gap: 8px;
    }

    .count-pill {
      align-self: flex-start;
    }

    .role-list {
      gap: 8px;
    }

    .role-chip,
    .empty-pill,
    .count-pill {
      min-height: 36px;
      max-width: 100%;
      font-size: 0.9rem;
    }

    .role-name {
      max-width: none;
    }

    .selectable-list {
      min-height: auto;
    }

    .apply-row {
      position: sticky;
      bottom: 0;
      z-index: 5;
      margin-left: -14px;
      margin-right: -14px;
      margin-bottom: -14px;
      padding: 14px;
      background: rgba(23, 26, 24, 0.96);
      backdrop-filter: blur(10px);
      border-top: 1px solid var(--line);
    }

    .apply-row .status-message {
      text-align: center;
    }

    .apply-row .button {
      min-height: 48px;
    }
  }

  @media (max-width: 380px) {
    .account-bar {
      flex-wrap: wrap;
    }

    .account-bar .ghost-button {
      width: 100%;
    }

    h1 {
      font-size: 1.15rem;
    }

    h2 {
      font-size: 1rem;
    }

    .profile-copy h2 {
      font-size: 1.2rem;
    }
  }

  .role-chip {
    height: auto;
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: flex-start;
  }

  .role-dot {
    margin-top: 5px;
  }

  .role-list {
    align-items: flex-start;
  }
}