.portal-body {
  min-height: 100vh;
  background: var(--canvas);
}

.portal-header {
  min-height: 76px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
}

.portal-brand strong,
.portal-brand small {
  display: block;
}

.portal-brand strong {
  font-size: 20px;
}

.portal-brand small {
  color: var(--muted);
  font-size: 11px;
}

.portal-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
}

.portal-privacy {
  color: var(--muted);
  font-size: 13px;
}

.client-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 30px auto 60px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.client-intro {
  padding: 30px 38px 22px;
}

.client-intro h1 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
}

.client-intro p {
  margin: 6px 0 0;
  color: var(--muted);
}

.client-steps {
  padding: 0 38px 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.client-step {
  padding: 9px 7px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--line);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.client-step b {
  margin-right: 5px;
}

.client-step.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}

.client-step.complete {
  color: var(--sage);
}

.client-workspace {
  min-height: 520px;
  padding: 30px 38px 42px;
}

.client-section-title {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 24px;
}

.client-section-desc {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 13px;
}

.client-actions {
  position: sticky;
  bottom: 0;
  min-height: 76px;
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
}

.client-save-state {
  flex: 1;
  color: var(--sage);
  text-align: center;
  font-size: 12px;
}

.client-member,
.client-goal,
.client-coverage {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.client-card-head {
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
}

.client-card-head strong {
  color: var(--navy);
}

.client-card-body {
  padding: 18px;
}

.client-coverage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-coverage-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.client-coverage-item.enabled {
  background: var(--surface-blue);
  border-color: var(--blue-soft);
}

.coverage-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 650;
}

.coverage-details {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.coverage-details input {
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  font-size: 12px;
}

.client-review {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.review-block {
  padding: 18px;
  background: var(--surface-blue);
  border: 1px solid #dce8ed;
  border-radius: 10px;
}

.review-block h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 15px;
}

.review-block p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.consent-box {
  margin-top: 20px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffaf2;
  border: 1px solid #eadabf;
  border-radius: 10px;
}

.consent-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.submit-panel {
  margin-top: 20px;
  text-align: center;
}

.submit-panel .btn {
  min-width: 220px;
}

.submit-success {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
}

.submit-success i {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--sage);
  border-radius: 50%;
  font-size: 30px;
  font-style: normal;
}

.submit-success h2 {
  margin: 0;
  color: var(--navy);
}

.submit-success p {
  max-width: 480px;
  color: var(--muted);
}

.admin-body {
  min-height: 100vh;
  background: #f3f6f7;
}

.admin-shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 28px auto 60px;
}

.admin-login {
  width: min(460px, calc(100vw - 32px));
  margin: 60px auto;
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.admin-login h1 {
  margin: 0;
  color: var(--navy);
}

.admin-login > p {
  margin: 7px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.login-tabs {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.login-tab {
  padding: 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.login-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}

.login-form .field {
  margin-bottom: 14px;
}

.login-form .btn {
  width: 100%;
  margin-top: 8px;
}

.setup-warning {
  margin-bottom: 18px;
  padding: 13px;
  color: #805d22;
  background: var(--amber-bg);
  border: 1px solid #ead4af;
  border-radius: 9px;
  font-size: 12px;
}

.setup-steps {
  margin: 20px 0;
  padding-left: 22px;
  color: var(--text);
}

.setup-steps li {
  margin: 9px 0;
}

.admin-topbar,
.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-topbar {
  padding: 16px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-topbar strong {
  color: var(--navy);
  font-size: 18px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-heading {
  margin: 26px 0 16px;
}

.dashboard-heading h1 {
  margin: 0;
  color: var(--navy);
}

.dashboard-heading p {
  margin: 3px 0 0;
  color: var(--muted);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-panel {
  margin-top: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.dashboard-panel-head {
  padding: 16px 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.dashboard-panel-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 18px;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
}

.dashboard-table th {
  color: var(--muted);
  background: #fafbfb;
}

.dashboard-table td {
  color: var(--text);
}

.status-badge {
  padding: 4px 8px;
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 99px;
  font-size: 11px;
}

.dashboard-empty {
  padding: 45px 20px;
  color: var(--muted);
  text-align: center;
}

.invite-form {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
}

.invite-result {
  margin: 0 18px 18px;
  padding: 14px;
  background: var(--surface-blue);
  border-radius: 9px;
}

.invite-result input {
  margin-top: 8px;
}

@media (max-width: 820px) {
  .portal-header {
    padding-inline: 18px;
  }

  .portal-privacy {
    display: none;
  }

  .client-intro,
  .client-workspace {
    padding-inline: 20px;
  }

  .client-steps {
    padding-inline: 20px;
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(125px, 1fr));
  }

  .client-coverage-grid,
  .client-review,
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
  }

  .invite-form {
    grid-template-columns: 1fr;
  }

  .dashboard-panel {
    overflow-x: auto;
  }

  .dashboard-table {
    min-width: 720px;
  }
}

@media (max-width: 560px) {
  .client-shell {
    width: 100%;
    margin: 0;
    border-inline: 0;
    border-radius: 0;
  }

  .client-coverage-grid,
  .coverage-details,
  .client-review,
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .client-actions {
    padding-inline: 14px;
  }

  .client-save-state {
    display: none;
  }
}
