/* BioHealth Score — patient portal styles (colours from the design deck) */
:root {
  --ink: #0c2d33;
  --ink-2: #0b4f5c;
  --teal: #077f8c;
  --teal-soft: #e6f2f3;
  --mint: #02c39a;
  --mint-soft: #e7f7ee;
  --amber: #f2b134;
  --amber-soft: #fdf3dc;
  --amber-ink: #7a5300;
  --red: #e55934;
  --red-soft: #fbece7;
  --red-ink: #8a2a12;
  --plum: #a8577a;
  --plum-soft: #f6e9ef;
  --bg: #f4f8f8;
  --card: #ffffff;
  --line: #dbe6e7;
  --muted: #5b7479;
  --radius: 14px;
  --shadow: 0 2px 14px rgba(12, 45, 51, .07);
  --serif: "Lora", Georgia, serif;
  --sans: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--teal); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
svg.icon { width: 1.25em; height: 1.25em; vertical-align: -.2em; flex: none; }

/* ---------- layout ---------- */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; color: var(--mint); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .nav button { color: #cfe3e5; text-decoration: none; padding: 8px 12px; border-radius: 8px; font: inherit; font-size: .95rem; white-space: nowrap; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--teal); color: #fff; }
.nav form { margin: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 48px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 0; }
.page-head .btn, .page-head .pill { white-space: nowrap; flex: none; }
.head-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; flex: none; }
.head-icon svg { width: 28px; height: 28px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 32px; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 12px 16px; border-radius: 10px; border: 1px solid; }
.messages .success { background: var(--mint-soft); border-color: #a9e5c8; color: #135a3f; }
.messages .warning { background: var(--amber-soft); border-color: #f0d18e; color: var(--amber-ink); }
.messages .error { background: var(--red-soft); border-color: #f1b8a6; color: var(--red-ink); }
.messages .info { background: var(--teal-soft); border-color: #b9d9dc; color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 10px; border: 2px solid var(--teal); background: var(--teal); color: #fff; font: 700 1rem var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-outline { background: #fff; color: var(--teal); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal); padding-left: 8px; padding-right: 8px; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-plum { background: var(--plum); border-color: var(--plum); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.card-head { background: var(--ink-2); color: #fff; padding: 14px 20px; display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.card-head a { color: inherit; text-decoration: none; }
.card-body { padding: 20px; }
.card-foot { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 700; font-size: .95rem; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.banner { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 20px; }
.banner strong { font-weight: 700; }
.banner .btn { margin-left: auto; background: var(--teal); border-color: var(--teal); }
.banner-dim { color: #b6cdd0; }
.banner svg { color: var(--mint); width: 26px; height: 26px; }

.callout { border-radius: var(--radius); padding: 16px 20px; border: 1px solid; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.callout-ok { background: var(--mint-soft); border-color: #a9e5c8; }
.callout-warn { background: var(--amber-soft); border-color: #f0d18e; color: var(--amber-ink); }
.callout-red { background: var(--red-soft); border-color: #f1b8a6; color: var(--red-ink); }
.callout .btn { margin-left: auto; }

/* ---------- status pills ---------- */
.pill { display: inline-block; padding: 8px 18px; border-radius: 999px; font-weight: 700; text-align: center; }
.pill-block { display: block; }
.pill-green { background: var(--mint); color: #053b2c; }
.pill-yellow { background: var(--amber); color: #4a3200; }
.pill-red { background: var(--red); color: #fff; }
.pill-none, .pill-unknown { background: #e3eaeb; color: var(--muted); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.tag-green { background: var(--mint-soft); color: #13684a; }
.tag-yellow { background: var(--amber-soft); color: var(--amber-ink); }
.tag-red { background: var(--red-soft); color: var(--red-ink); }
.tag-unknown { background: #eef2f3; color: var(--muted); }
.text-green { color: #13684a; } .text-yellow { color: var(--amber-ink); } .text-red { color: var(--red-ink); }

/* ---------- system cards (dashboard) ---------- */
.system-card .card-body p { margin: 10px 0 0; }
.system-card .pill { margin-bottom: 8px; }
.system-card .card-head svg { width: 26px; height: 26px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; }
.field label, .field-label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--ink-2); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=tel], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(7,127,140,.15); }
.field .help { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.field .help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--red-ink); font-size: .9rem; font-weight: 700; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-row div { display: contents; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; color: var(--ink); margin: 0; }
.radio-row label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); font-weight: 700; }
.radio-row input { accent-color: var(--teal); }

.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--mint); }

/* consent cards */
.consent-card .card-body { min-height: 150px; color: var(--muted); }
.consent-card .card-foot { color: var(--ink); }
.consent-card .card-head svg { width: 24px; height: 24px; }
.optional-tag { font-family: var(--sans); font-weight: 400; font-size: .8rem; opacity: .8; margin-left: auto; }

/* risk factor tiles */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tiles > div { display: contents; }
.tiles label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 150px; padding: 20px 14px 44px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 700; box-shadow: var(--shadow); }
.tiles label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.tiles input { position: absolute; right: 12px; bottom: 12px; margin: 0; width: 22px; height: 22px; accent-color: var(--mint); }
.tiles label:has(input:checked) .head-icon { background: var(--teal); color: #fff; }
.tiles .head-icon svg { width: 26px; height: 26px; }

/* help cards */
.help-card { text-align: center; display: flex; flex-direction: column; }
.help-card .card-body { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.help-card .circle { width: 60px; height: 60px; border-radius: 50%; background: var(--plum-soft); color: var(--plum); display: grid; place-items: center; }
.help-card .circle svg { width: 30px; height: 30px; }
.help-card p { flex: 1; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: .78rem; font-weight: 700; color: var(--teal); }
.eyebrow.plum { color: var(--plum); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; background: #eef4f4; }
table.data td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters a { padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); background: #fff; font-size: .9rem; }
.filters a.on { border-color: var(--teal); background: var(--teal); color: #fff; }

/* checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .grow { flex: 1; }

/* ---------- charts ---------- */
.chart-card .card-body { display: grid; gap: 16px; grid-template-columns: 220px 1fr; align-items: center; }
.chart-box { position: relative; height: 220px; }
.chart-meta h3 { margin-bottom: 2px; }
.chart-meta .big { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; }
details.history-list summary { cursor: pointer; color: var(--teal); font-weight: 700; padding: 8px 20px 14px; }
details.history-list table { margin: 0 20px 16px; width: calc(100% - 40px); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .85rem; color: var(--muted); margin: 0 0 16px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .lg-green::before { background: #c5f0e0; } .legend .lg-yellow::before { background: #fbe7bd; } .legend .lg-red::before { background: #f7d2c6; }

/* ---------- auth / landing ---------- */
.auth-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 440px; }
.logo-box { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 22px; border: 1.5px solid var(--teal); background: var(--teal-soft); border-radius: var(--radius); margin-bottom: 24px; }
.logo-box svg { width: 56px; height: 56px; color: var(--teal); }
.logo-box span { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--ink-2); line-height: 1.1; text-align: left; }
.tagline { text-align: center; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.1rem; margin: 0 0 4px; }

@media (max-width: 700px) {
  .topbar-inner { flex-wrap: wrap; }
  .nav { margin-left: 0; width: 100%; flex-wrap: wrap; overflow: visible; }
  .nav a, .nav button { padding: 6px 10px; }
  .chart-card .card-body { grid-template-columns: 1fr; }
  .banner .btn, .callout .btn { margin-left: 0; width: 100%; }
  .page-head { flex-wrap: wrap; }
  .page-head .head-icon { display: none; }
}
