/* BeyondHealth navy / blue / gold / cream customer portal palette */
:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --panel: #ffffff;
  --ink: #071424;
  --muted: #637085;
  --line: #dde3eb;
  --navy: #0b1f36;
  --navy-soft: #e8eef5;
  --gold: #c7a65a;
  --gold-soft: #f5ecd6;
  --shadow: 0 18px 50px rgba(7, 20, 36, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(23, 84, 140, 0.14), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(199, 166, 90, 0.18), transparent 28rem),
    var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

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

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

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  background: rgba(246, 247, 241, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--navy), #17548c);
  color: white;
  font-weight: 800;
}

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

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

.portal-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.portal-header nav a,
.ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 34px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.55fr);
  gap: 28px;
  align-items: center;
  margin: 18px 0 26px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(2.25rem, 7vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

p,
li {
  color: var(--muted);
  line-height: 1.72;
}

.login-card,
#testForm,
#referralForm,
#profileForm,
#balanceForm {
  display: grid;
  gap: 16px;
}

#balanceForm {
  gap: 12px;
}

#balanceForm h2,
#balanceForm .fine-print {
  margin-bottom: 0;
}

#balanceForm .form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#measurementNote {
  min-height: 76px;
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcf8;
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(199, 166, 90, 0.22);
}

.primary-button,
.secondary-button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--navy), #17548c);
  color: white;
  cursor: pointer;
  padding: 13px 18px;
  text-decoration: none;
  font-weight: 800;
}

.primary-button:hover,
.primary-link:hover {
  background: #061224;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--gold-soft);
  color: var(--navy);
}

.fine-print {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.partner-attribution {
  margin: 0;
  border: 1px solid rgba(199, 166, 90, 0.38);
  border-radius: 14px;
  background: var(--gold-soft);
  color: var(--navy);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 800;
}

.partner-attribution span,
.partner-attribution strong,
.partner-attribution a {
  display: block;
}

.partner-attribution a {
  margin-top: 6px;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.form-error {
  margin: 0;
  border: 1px solid rgba(160, 39, 39, 0.28);
  border-radius: 14px;
  background: #fff1ef;
  color: #8a1f1f;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 750;
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 24px;
  padding-bottom: 42px;
}

.dashboard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.grid {
  display: grid;
  gap: 24px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.steps {
  padding-left: 1.3rem;
}

.inline-form {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 10px;
  margin: 20px 0;
}

.timeline,
.referral-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li,
.referral-list li,
.result-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcf8;
  padding: 14px 16px;
}

.timeline time,
.referral-list strong,
.result-card strong,
.result-card span {
  display: block;
}

.timeline time,
.result-card strong {
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.philosophy {
  position: relative;
  overflow: hidden;
  border-color: rgba(199, 166, 90, 0.28);
  background:
    radial-gradient(circle at top right, rgba(23, 84, 140, 0.11), transparent 18rem),
    linear-gradient(145deg, #fffdf8, #f8f1df);
}

.philosophy h2 {
  max-width: 760px;
  color: var(--navy);
}

.philosophy-copy {
  display: grid;
  max-width: 820px;
  gap: 12px;
}

.philosophy-copy p {
  margin: 0;
}

.philosophy-orbit {
  position: absolute;
  right: -70px;
  top: -90px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(199, 166, 90, 0.24);
  border-radius: 50%;
}

.philosophy-orbit::after {
  content: "";
  position: absolute;
  inset: 48px;
  border: 1px solid rgba(11, 31, 54, 0.12);
  border-radius: 50%;
}

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

.resource-grid a {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, #fbfcf8, var(--gold-soft));
  padding: 18px;
  text-decoration: none;
  font-weight: 850;
}

.resource-grid a:hover {
  border-color: rgba(199, 166, 90, 0.65);
}

.referral-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcf8;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.referral-card strong,
.referral-card span,
.referral-card small {
  display: block;
}

.referral-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.referral-action-btn {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.referral-edit-form {
  display: grid;
  gap: 10px;
}

.referral-edit-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.18s;
}

.referral-edit-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(199, 166, 90, 0.2);
}

.referral-edit-textarea {
  resize: vertical;
  min-height: 72px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(160, 39, 39, 0.3);
  border-radius: 14px;
  background: #fff1ef;
  color: #8a1f1f;
  cursor: pointer;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s;
}

.danger-button:hover {
  background: #ffe4e0;
}

#deleteTestBtn {
  padding: 10px 14px;
  font-size: 0.88rem;
}

.status-message {
  border: 1px solid rgba(199, 166, 90, 0.38);
  border-radius: 16px;
  background: var(--gold-soft);
  color: var(--navy);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 750;
}

.status-message.is-ok {
  border-color: rgba(38, 120, 71, 0.28);
  background: #edf8f0;
  color: #1f6840;
}

.status-message.is-warn {
  border-color: rgba(199, 166, 90, 0.42);
  background: var(--gold-soft);
  color: #73561d;
}

.status-message.is-error {
  border-color: rgba(160, 39, 39, 0.28);
  background: #fff1ef;
  color: #8a1f1f;
}

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

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-picker {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.product-picker-controls {
  align-items: end;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-chip {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto;
  gap: 2px 8px;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(199, 166, 90, 0.34);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--navy);
  padding: 7px 8px 7px 12px;
  font-size: 0.86rem;
  font-weight: 750;
}

.product-chip small {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.product-chip button {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 20, 36, 0.08);
  color: var(--navy);
  cursor: pointer;
  font-weight: 900;
}

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

.checkbox-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.checkbox-line input {
  width: auto;
  margin-top: 4px;
}

.notice-box,
.placeholder-box,
.result-chip {
  border: 1px solid rgba(199, 166, 90, 0.34);
  border-radius: 16px;
  background: #fffaf0;
  color: var(--navy);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.result-chip:empty {
  display: none;
}

.balance-list {
  display: grid;
  gap: 14px;
}

.balance-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcf8;
  padding: 14px 16px;
}

.balance-card strong,
.balance-card span,
.balance-card small {
  display: block;
}

.balance-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.balance-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}

.balance-toggle {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.balance-card-header small {
  color: var(--muted);
  font-weight: 750;
}

.balance-card-body {
  display: grid;
  gap: 10px;
}

.balance-metric-list {
  display: grid;
  gap: 10px;
}

.balance-metric {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(199, 166, 90, 0.28);
  border-radius: 14px;
  background: #fffdf7;
  padding: 12px;
}

.balance-metric-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.balance-metric-head span {
  font-size: 1rem;
  font-weight: 900;
  color: var(--navy);
}

.balance-metric small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.balance-metric p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.balance-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #c94334 0%, #e6b64d 50%, #4f9f64 100%);
}

.balance-bar span {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 2px 8px rgba(7, 20, 36, 0.24);
  transform: translate(-50%, -50%);
}

.balance-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.balance-card-actions .secondary-button,
.balance-card-actions .danger-button {
  min-width: 104px;
  padding: 9px 14px;
  font-size: 0.84rem;
}

@media (max-width: 860px) {
  .portal-header,
  .dashboard-top {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-header nav {
    justify-content: flex-start;
  }

  .hero,
  .two-columns,
  .form-grid.compact,
  .resource-grid {
    grid-template-columns: 1fr;
  }

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

  .form-grid,
  .form-grid.compact,
  .balance-values {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.2rem, 16vw, 3.4rem);
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .panel {
    border-radius: 22px;
  }

  .portal-header nav a,
  .ghost-button {
    width: 100%;
    text-align: center;
  }
}
.portal-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 28px 18px 42px;
  color: #5d5770;
}
.portal-legal-footer p {
  width: 100%;
  margin: 0 0 4px;
  text-align: center;
  font-weight: 800;
}
.portal-legal-footer a {
  border: 1px solid rgba(124, 103, 174, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.76);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.partner-attribution.is-selector {
  display: grid;
  gap: 10px;
}

.partner-attribution.is-selector strong,
.partner-attribution.is-selector span,
.partner-attribution.is-selector select,
.partner-attribution.is-selector button,
.partner-attribution.is-selector small {
  min-width: 0;
  max-width: 100%;
}

.partner-attribution.is-selector span {
  color: var(--navy);
  font-weight: 650;
  line-height: 1.45;
}

.partner-attribution.is-selector select {
  background: #fffdf8;
}

.partner-attribution.is-selector button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.selector-pending {
  color: #7a5a16;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .portal-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-header nav {
    justify-content: flex-start;
  }

  .hero,
  .two-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-top {
    flex-direction: column;
  }

  .inline-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

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

  .portal-header {
    gap: 14px;
    padding: 14px 0;
  }

  .brand {
    max-width: 100%;
  }

  .portal-header nav a,
  .ghost-button {
    min-height: 40px;
    padding: 9px 12px;
  }

  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  .hero {
    gap: 18px;
    margin-top: 12px;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.35rem);
  }

  .login-card,
  #testForm,
  #referralForm {
    gap: 14px;
  }

  .primary-button,
  .secondary-button,
  .primary-link {
    width: 100%;
    min-height: 46px;
  }

  .partner-strip {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .portal-header {
    position: static;
  }

  .hero {
    align-items: start;
    margin-top: 10px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: clamp(2rem, 7vw, 3.5rem);
  }
}
