/* The clinic trends page. Shares the tokens, fonts and cards from styles.css. */
#app.wide { max-width: 980px; padding-bottom: 48px; }
.d-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; padding: 24px 0 8px; }
.d-top h1 { font-size: 34px; }
.badge-demo { display: inline-block; margin-left: 10px; padding: 3px 12px; border-radius: 999px; background: var(--sun); color: var(--sun-ink); font: 800 13px var(--font-body); vertical-align: middle; letter-spacing: 0.04em; }
.d-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.d-filters .field { margin-top: 0; }
.d-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.d-tile { background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 14px 16px; display: grid; }
.d-tile b { font: 600 32px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.d-tile span { color: var(--muted); font-size: 14px; font-weight: 700; }
.d-note { color: var(--muted); font-size: 14px; margin-top: 10px; }
.d-hold { text-align: center; padding: 28px 18px; }
.d-hold b { font: 600 26px var(--font-display); display: block; margin-bottom: 6px; }
.d-grid-wrap { overflow-x: auto; margin: 12px -4px 0; padding: 0 4px 6px; }
table.d-table { border-collapse: separate; border-spacing: 3px; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
.d-table th { font-weight: 800; color: var(--muted); font-size: 12px; text-align: center; padding: 2px 0; }
.d-table th.row { text-align: left; color: var(--ink); font-size: 14px; white-space: nowrap; padding-right: 10px; }
.d-table td.cell { text-align: center; min-width: 34px; height: 34px; border-radius: 8px; font-weight: 800; font-size: 12px; background: color-mix(in srgb, var(--fx) calc(var(--p) * 0.85%), color-mix(in srgb, var(--ink) 5%, var(--surface))); color: var(--ink); }
.d-table td.cell.hide { color: transparent; background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.d-table.meds td, .d-table.meds th { text-align: left; padding: 8px 10px; }
.d-table.meds { border-spacing: 0; }
.d-table.meds th { border-bottom: 2px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.d-table.meds td { border-bottom: 1px solid var(--line); vertical-align: top; }
.d-table.meds td.n { font-weight: 800; }
.fxchips { display: flex; gap: 6px; flex-wrap: wrap; }
.fxchip { padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--fx) 14%, var(--surface)); font-size: 13px; font-weight: 700; white-space: nowrap; }
.fxchip i { font-style: normal; color: var(--muted); font-weight: 600; }
.ch-band2 { fill: var(--accent); opacity: 0.16; stroke: none; }
.d-login { max-width: 460px; margin: 10vh auto 0; }
.d-login .btn { margin-top: 12px; }
.d-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 6px; }
.d-legend i { display: inline-block; width: 18px; height: 8px; border-radius: 4px; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.d-legend i.band { opacity: 0.25; height: 12px; }
@media (max-width: 560px) { .d-top h1 { font-size: 28px; } }
@media print { .d-filters, .d-login, .noprint { display: none !important; } }

/* ---------- switch between patient app and clinic page ---------- */
.view-switch { display: block; width: fit-content; margin: 10px max(16px, calc((100% - 980px) / 2 + 16px)) 0 auto; padding: 5px 12px; border-radius: 999px; font: 800 12px/1.2 var(--font-body); letter-spacing: 0.02em; color: var(--muted); background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; transition: background-color 0.18s ease, color 0.18s ease; }
.view-switch:hover, .view-switch:focus-visible { color: var(--accent-strong); background: var(--accent-soft); }
@media print { .view-switch { display: none; } }

/* ---------- more statistics ---------- */
.d-bars { display: grid; gap: 8px; margin-top: 10px; }
.d-bar { display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 10px; font-weight: 700; }
.d-bar .track { background: color-mix(in srgb, var(--ink) 7%, var(--surface)); border-radius: 999px; height: 14px; overflow: hidden; }
.d-bar .track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.d-bar b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- questions for patients and the Claude helper ---------- */
.d-qs { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 10px; }
.d-qs li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--ink) 4%, var(--surface)); flex-wrap: wrap; }
.d-qs li.off { opacity: 0.6; }
.d-qs li > div:first-child { flex: 1 1 260px; min-width: 0; }
.d-qbtns { display: flex; gap: 6px; }
.d-qform { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.d-qform h3 { margin-bottom: 4px; }
.d-chat { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; margin: 12px 0; padding: 4px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 16px; }
.msg.user { justify-self: end; background: var(--accent); color: var(--accent-ink); }
.msg.assistant { justify-self: start; background: color-mix(in srgb, var(--ink) 6%, var(--surface)); }
.proposal { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent); }
.proposal.done { box-shadow: none; color: var(--muted); font-weight: 700; }
.d-cform { display: flex; gap: 8px; }
.d-cform input { flex: 1; min-width: 0; font: inherit; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
@media print { .noprint { display: none !important; } }
