:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #586476;
  --line: #d8dee8;
  --surface: #ffffff;
  --band: #f5f7fa;
  --accent: #0e7c7b;
  --warn: #9f2d20;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #172033;
  color: var(--ink);
  background: #eef2f6;
}
.topbar {
  min-height: 68px;
  padding: 14px 28px;
  background: #172033;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}
.topbar > div,
.topbar > nav {
  margin: 4px 0;
}
.topbar span {
  color: #cbd4df;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}
.brand-link {
  color: white;
  text-decoration: none;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: -5px;
}
.top-actions > * {
  margin: 5px;
}
.top-actions a,
.top-actions span,
.link-button {
  color: #edf4fb;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.top-actions span {
  color: #cbd4df;
}
.top-actions form {
  margin: 0;
}
.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
main {
  width: calc(100% - 28px);
  max-width: 1180px;
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto 56px;
}
h1, h2 { margin: 0 0 14px; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
.band, .panel {
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 16px;
}
.grid {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -8px;
}
.grid > * {
  display: block;
  margin: 8px;
  min-width: 240px;
  width: calc(100% - 16px);
}
.three > * { width: calc(33.333% - 16px); }
.two > * { width: calc(50% - 16px); }
label {
  color: #586476;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  display: block;
}
label > input,
label > select,
label > textarea,
label > span {
  margin-top: 7px;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d0da;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: white;
  color: #172033;
  color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
.upload-row, .checks, .actions, .result-head, .provider-list {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: -6px;
}
.upload-row > *,
.checks > *,
.actions > *,
.result-head > *,
.provider-list > * {
  margin: 6px;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #172033;
  color: var(--ink);
}
.checks input { width: 18px; min-height: 18px; }
.provider-list span {
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 700;
}
.hint {
  color: #586476;
  color: var(--muted);
  margin: 10px 0 16px;
}
button, .button {
  border: 0;
  background: #0e7c7b;
  background: var(--accent);
  color: white;
  padding: 12px 18px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
.ghost {
  background: transparent;
  border: 1px solid #8fa0b3;
}
.result-grid, .media-grid {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -8px -8px 8px;
  margin-bottom: 16px;
}
.result-grid > *,
.media-grid > * {
  margin: 8px;
  min-width: 280px;
  width: calc(50% - 16px);
}
.result-grid > .result-wide-panel,
.result-grid > .strategy-panel {
  width: calc(100% - 16px);
}
.media-grid img {
  width: 100%;
  max-height: 760px;
  object-fit: contain;
  background: white;
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.point-media {
  display: block;
  margin: 0 0 16px;
  grid-template-columns: 1fr;
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.point-media > div {
  width: 100%;
}
.point-media img {
  max-height: none;
  max-width: 1100px;
  width: 100%;
  width: min(100%, 1100px);
  display: block;
  margin: 0 auto;
}
.tongue-summary {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -9px 0 7px;
  align-items: start;
}
.tongue-summary > .summary-copy {
  margin: 9px;
  min-width: 280px;
  width: calc(100% - 148px);
}
.tongue-summary > .small-tongue {
  margin: 9px;
  width: 112px;
}
.small-tongue img {
  width: 100%;
  max-height: 112px;
  object-fit: contain;
  background: white;
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.summary-text {
  background: #fbfcfe;
  color: #172033;
  color: var(--ink);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  line-height: 1.45;
  max-height: none;
}
.warning { color: #9f2d20; color: var(--warn); font-weight: 700; }
.validation {
  color: #9f2d20;
  color: var(--warn);
  background: #fff5f2;
  border: 1px solid #efc8bf;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.validation:empty { display: none; }
.success {
  background: #eef8f2;
  border: 1px solid #b6dfc2;
  border-radius: 8px;
  color: #1d6b37;
  font-weight: 700;
  padding: 12px 16px;
}
.auth-shell {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-panel {
  max-width: 520px;
  width: 100%;
  width: min(100%, 520px);
}
.wide-auth {
  max-width: 920px;
  width: min(100%, 920px);
}
.login-choice {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}
.login-choice label {
  background: #f8faf9;
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: block;
  padding: 14px;
}
.login-choice input {
  margin-right: 8px;
}
.login-choice span {
  color: #173f30;
  color: var(--forest);
  font-weight: 800;
}
.login-choice small {
  color: #586476;
  color: var(--muted);
  display: block;
  line-height: 1.35;
  margin: 6px 0 0 24px;
}
.inline-link {
  color: #173f30;
  color: var(--forest);
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.success-message {
  background: #e7f6ee;
  border-color: #9ccdb3;
  color: #17613b;
}
.clinician-brand-card {
  align-items: center;
  background: #fffaf0;
  border: 1px solid #d8cfae;
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 16px 0 4px;
  padding: 16px;
}
.clinician-brand-card span {
  color: #586476;
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.clinician-brand-card strong {
  color: #173f30;
  color: var(--forest);
  display: block;
  font-size: 18px;
  margin-top: 4px;
}
.clinician-brand-card p {
  margin: 4px 0 0;
}
.auth-check {
  margin: 16px 0;
}
.auth-actions {
  margin-top: 18px;
}
.self-service-card {
  align-items: center;
  background: #f2f7f5;
  border: 1px solid #a8c3a0;
  border: 1px solid var(--sage);
  border-left: 5px solid #1f4d3a;
  border-left: 5px solid var(--forest);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 22px;
  padding: 18px;
}
.self-service-card strong {
  color: #1f4d3a;
  color: var(--forest);
  display: block;
  font-size: 18px;
  margin-bottom: 5px;
}
.self-service-card p {
  color: #586476;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}
.small-copy {
  color: #586476;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.align-end {
  align-items: end;
}
.admin-create-row {
  margin-top: 16px;
}
.table-wrap {
  overflow-x: auto;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
}
.user-table th,
.user-table td {
  border-bottom: 1px solid #d8dee8;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}
.user-table th {
  color: #586476;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}
.strategy-table td {
  font-size: 14px;
  line-height: 1.45;
  vertical-align: top;
}
.strategy-table {
  min-width: 860px;
}
.strategy-table thead th {
  background: #1f4d3a;
  color: #ffffff;
  font-size: 12px;
  letter-spacing: 0;
}
.strategy-table tbody tr:nth-child(even) {
  background: #faf9f6;
}
.strategy-table tbody tr:hover {
  background: #f1f6ef;
}
.strategy-table .point-cell {
  min-width: 104px;
}
.strategy-table .point-cell strong {
  background: #1f4d3a;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-size: 15px;
  line-height: 1;
  margin-bottom: 7px;
  padding: 7px 9px;
}
.strategy-table .point-cell span {
  color: #586476;
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
}
.channel-pill {
  background: #eef4ea;
  border: 1px solid #a8c3a0;
  border: 1px solid var(--sage);
  border-radius: 999px;
  color: #1f4d3a;
  color: var(--forest);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  padding: 6px 9px;
  white-space: normal;
}
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-weight: 700;
  padding: 6px 10px;
}
.status-pill.active {
  background: #e7f6ee;
  color: #17613b;
}
.status-pill.inactive {
  background: #f8e9e6;
  color: #8b2b20;
}
.dark-text {
  color: #172033;
  color: var(--ink);
}
.metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.metric-card {
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-left: 4px solid #0e7c7b;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  background: var(--surface);
  min-width: 160px;
  padding: 16px;
}
.metric-card span {
  display: block;
  color: #586476;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.metric-card strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}
.search-row label {
  flex: 1 1 320px;
}
.muted {
  color: #586476;
  color: var(--muted);
}
.patient-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.patient-summary span,
.patient-summary strong {
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
.visit-history {
  display: grid;
  gap: 14px;
}
.visit-card {
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  background: var(--surface);
  padding: 16px;
}
.visit-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid #d8dee8;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.visit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.clinical-dl {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}
.clinical-dl dt {
  color: #586476;
  color: var(--muted);
  font-weight: 700;
}
.clinical-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}
details {
  border-top: 1px solid #d8dee8;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
summary { cursor: pointer; font-weight: 700; }
.ai-grid {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -7px;
}
.ai-grid > * {
  margin: 7px;
  min-width: 260px;
  width: calc(33.333% - 14px);
}
.ai-card {
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}
.ai-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
.summary-list {
  margin: 0;
}
.summary-list dt {
  font-weight: 700;
  color: #172033;
  color: var(--ink);
  margin-top: 10px;
}
.summary-list dd {
  margin: 4px 0 0;
  color: #586476;
  color: var(--muted);
  line-height: 1.45;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
  background: #172033;
  color: #edf4fb;
  padding: 12px;
  border-radius: 6px;
}
.json-details {
  margin-top: 12px;
}
.json-details pre {
  font-size: 12px;
  max-height: 420px;
}
.wellness-hero {
  min-height: 620px;
  display: flex;
  align-items: end;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
  background:
    linear-gradient(90deg, rgba(12, 24, 29, 0.82), rgba(12, 24, 29, 0.34)),
    url("/images/tcm-wellness-hero.png") center/cover no-repeat;
}
.wellness-hero-content {
  max-width: 760px;
  width: 100%;
  width: min(760px, 100%);
  color: white;
  padding: 56px;
  padding: clamp(28px, 6vw, 72px);
}
.wellness-hero h1 {
  font-size: 56px;
  font-size: clamp(36px, 6vw, 66px);
  line-height: 1.04;
  margin-bottom: 18px;
}
.wellness-hero p {
  font-size: 18px;
  line-height: 1.55;
  color: #eef5ef;
  margin: 0 0 22px;
}
.landing-kicker {
  color: #c6e0d2 !important;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 13px !important;
}
.landing-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: -6px;
}
.landing-actions > * {
  margin: 6px;
}
.button.light,
.ghost.light {
  color: white;
  border-color: rgba(255,255,255,0.7);
}
.landing-band {
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  margin-bottom: 18px;
}
.flow-grid {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -7px;
}
.flow-grid article {
  margin: 7px;
  min-width: 220px;
  width: calc(25% - 14px);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfe;
}
.flow-grid span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dce9df;
  color: #244c32;
  font-weight: 800;
  margin-bottom: 14px;
}
.flow-grid h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.flow-grid p,
.landing-split p {
  color: #586476;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.landing-split {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -9px;
  align-items: stretch;
}
.landing-split > div,
.landing-note {
  margin: 9px;
  min-width: 280px;
  width: calc(66.666% - 18px);
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d8dee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.landing-note {
  width: calc(33.333% - 18px);
}
.landing-checks {
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 8px -5px -5px;
  margin-top: 18px;
}
.landing-checks span {
  margin: 5px;
  width: calc(50% - 10px);
  border-left: 4px solid #0e7c7b;
  border-left: 4px solid var(--accent);
  background: #f2f7f5;
  padding: 10px 12px;
  font-weight: 700;
  color: #27483d;
}

@supports (display: grid) {
  .grid {
    display: grid;
    gap: 16px;
    margin: 0;
  }
  .grid > * {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  label {
    display: grid;
    gap: 7px;
  }
  label > input,
  label > select,
  label > textarea,
  label > span {
    margin-top: 0;
  }
  .result-grid,
  .media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 16px;
  }
  .result-grid > *,
  .media-grid > * {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .result-grid > .result-wide-panel,
  .result-grid > .strategy-panel {
    grid-column: 1 / -1;
  }
  .tongue-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 18px;
    margin: 0 0 16px;
  }
  .tongue-summary > .summary-copy,
  .tongue-summary > .small-tongue {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .auth-shell {
    display: grid;
    place-items: center;
  }
  .ai-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
  }
  .ai-grid > * {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .wellness-hero {
    display: grid;
    min-height: min(680px, calc(100vh - 112px));
  }
  .flow-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
  }
  .flow-grid article {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .flow-grid span {
    display: inline-grid;
    place-items: center;
  }
  .landing-split {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
    gap: 18px;
    margin: 0;
  }
  .landing-split > div,
  .landing-note {
    margin: 0;
    min-width: 0;
    width: auto;
  }
  .landing-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 0;
  }
  .landing-checks span {
    margin: 0;
    width: auto;
  }
}

@media (max-width: 760px) {
  .three > *, .two > *, .result-grid > *, .media-grid > *, .ai-grid > *, .tongue-summary > .summary-copy, .tongue-summary > .small-tongue, .flow-grid article, .landing-split > div, .landing-note, .landing-checks span, .login-choice > * { width: calc(100% - 16px); }
  .three, .two, .result-grid, .media-grid, .ai-grid, .tongue-summary, .flow-grid, .landing-split, .landing-checks, .login-choice { grid-template-columns: 1fr; }
  .clinician-brand-card { align-items: flex-start; flex-direction: column; }
  .self-service-card { align-items: flex-start; flex-direction: column; }
  .topbar { align-items: flex-start; flex-direction: column; }
  main { width: calc(100% - 18px); width: min(100% - 18px, 1180px); margin-top: 12px; }
  .wellness-hero { min-height: 620px; }
  .wellness-hero-content { padding: 28px; }
}

@media (max-width: 760px) {
  @supports (display: grid) {
    .three > *, .two > *, .result-grid > *, .media-grid > *, .ai-grid > *, .tongue-summary > .summary-copy, .tongue-summary > .small-tongue, .flow-grid article, .landing-split > div, .landing-note, .landing-checks span, .login-choice > * {
      width: auto;
    }
  }
}
