:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-strong: #fbfaf7;
  --soft: #eef5f2;
  --line: #dedbd2;
  --text: #1f2421;
  --muted: #68726d;
  --teal: #16715f;
  --blue: #385f8f;
  --amber: #8f672f;
  --red: #a33a32;
  --shadow: 0 10px 26px rgba(42, 38, 30, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

.dashboard-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand {
  color: var(--teal);
  font-weight: 850;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar nav a {
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}

.topbar nav a[aria-current="page"] {
  color: var(--teal);
}

.login-band {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  padding: 0 16px;
  cursor: pointer;
}

.button.secondary,
.mode-actions button {
  background: var(--soft);
  color: var(--text);
}

.mode-actions button.active {
  background: var(--teal);
  color: #fff;
}

.login-panel button {
  width: 100%;
  margin-top: 16px;
}

.status {
  min-height: 22px;
  color: var(--red);
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.dashboard-band,
.content-grid {
  padding-inline: clamp(18px, 4vw, 44px);
  width: min(1180px, 100%);
  margin-inline: auto;
}

.dashboard-band {
  padding-top: 34px;
}

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

.dashboard-heading p:not(.eyebrow) {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 760px;
}

.mode-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.scenario-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 24px;
  padding: 16px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 44px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel.wide {
  grid-column: 1 / -1;
}

.dashboard-main-grid.dashboard-product-mode {
  align-items: start;
}

.dashboard-main-grid.dashboard-product-mode .products-panel,
.dashboard-main-grid.dashboard-product-mode .account-panel {
  min-height: 100%;
}

.dashboard-main-grid.dashboard-patient-mode .account-panel {
  grid-column: 1 / -1;
}

.hero-panel {
  min-height: 280px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.12rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.primary-action {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface-strong), var(--soft));
  border: 1px solid rgba(22, 113, 95, 0.12);
  border-radius: 8px;
  margin-bottom: 16px;
}

.primary-action h3 {
  margin: 0;
  font-size: 1.35rem;
}

.primary-action p {
  margin: 0;
  color: var(--muted);
}

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

.metric-box,
.product-row,
.patient-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.metric-box span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
}

.metric-box strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.product-list,
.patient-list,
.journey {
  display: grid;
  gap: 10px;
}

.product-row {
  display: grid;
  gap: 8px;
}

.product-row h3,
.patient-row h3 {
  margin: 0;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 900;
  color: var(--teal);
  background: var(--soft);
}

.pill.locked {
  color: var(--amber);
  background: #fff4e6;
}

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

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

.actions .button {
  min-height: 34px;
  font-size: 0.86rem;
  padding-inline: 10px;
}

.patient-row {
  display: grid;
  gap: 12px;
}

.patient-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.patient-meta div {
  background: var(--soft);
  border-radius: 8px;
  padding: 10px;
}

.patient-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.journey-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.journey-step.locked {
  background: #fff8ef;
}

.journey-step strong {
  display: block;
  text-transform: capitalize;
}

.customer-grid {
  padding-top: 0;
}

.customer-tool-grid,
.account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.customer-tool,
.account-box,
.team-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.customer-tool {
  display: grid;
  gap: 8px;
  min-height: 150px;
  align-content: start;
  padding: 16px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.customer-tool:hover {
  border-color: rgba(143, 103, 47, 0.42);
  background: var(--surface-strong);
  transform: translateY(-1px);
}

.tool-kicker,
.account-box span,
.team-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
}

.tool-kicker {
  color: var(--teal);
  text-transform: uppercase;
}

.customer-tool small {
  color: var(--muted);
  line-height: 1.35;
}

.account-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  min-width: 0;
}

.team-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(120px, 0.8fr));
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.team-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.team-row strong,
.team-row span {
  overflow-wrap: anywhere;
}

.team-row.current {
  background: var(--soft);
}

@media (max-width: 980px) {
  .dashboard-heading,
  .content-grid,
  .scenario-controls,
  .metric-grid,
  .patient-meta,
  .journey,
  .customer-tool-grid,
  .account-summary,
  .team-row {
    grid-template-columns: 1fr;
  }

  .dashboard-heading {
    display: grid;
  }

  .mode-actions {
    justify-content: flex-start;
  }
}

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

  .dashboard-heading h1 {
    font-size: 2rem;
  }
}
