/* assets/css/tracking.css – check-in sheet, daily check card, effectiveness, doctor report */

/* ── Check-in bottom sheet (non-modal) ─────────────────────── */
.rk-ci-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 900;
  display: flex;
  justify-content: center;
  padding: 0 .75rem calc(.75rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  transform: translateY(110%);
  opacity: 0;
  transition: transform .22s ease-out, opacity .22s ease-out;
}
.rk-ci-sheet.is-open { transform: translateY(0); opacity: 1; }
.rk-ci-body {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  background: var(--s1, #0d1018);
  color: var(--text, #e8e4dc);
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--r, 14px);
  box-shadow: 0 -6px 40px rgba(0,0,0,.45);
  padding: 1rem 1rem .75rem;
  font-family: Outfit, system-ui, sans-serif;
}
.rk-ci-title {
  margin: 0 0 .6rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}
.rk-ci-title:focus { outline: none; }
.rk-ci-title:focus-visible { outline: 2px solid var(--accent, #8b9cf4); outline-offset: 3px; border-radius: 4px; }
.rk-ci-sub { margin: 0 0 .6rem; font-size: 0.85rem; color: var(--text2, #9aa0b0); line-height: 1.45; }

.rk-ci-segs { display: inline-flex; gap: .25rem; margin-bottom: .7rem; padding: .2rem; background: var(--s2, #131720); border-radius: 999px; }
.rk-ci-seg {
  min-height: 36px;
  padding: .3rem .9rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text2, #9aa0b0);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.rk-ci-seg.is-active { background: var(--accent, #8b9cf4); color: #0b0d14; }

.rk-ci-scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: .25rem; }
.rk-ci-num {
  min-height: 44px;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--rs, 8px);
  background: var(--s2, #131720);
  color: var(--text, #e8e4dc);
  font: inherit;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
}
.rk-ci-num:hover { border-color: var(--accent, #8b9cf4); }
.rk-ci-num.is-selected { background: var(--accent, #8b9cf4); color: #0b0d14; }
.rk-ci-num:focus-visible,
.rk-ci-seg:focus-visible,
.rk-ci-skip:focus-visible,
.rk-ci-link:focus-visible { outline: 2px solid var(--accent, #8b9cf4); outline-offset: 2px; }
@media (max-width: 380px) {
  .rk-ci-scale { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.rk-ci-scale-legend { display: flex; justify-content: space-between; margin-top: .3rem; font-size: 0.8rem; color: var(--text2, #9aa0b0); }

.rk-ci-actions { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: .7rem; }
.rk-ci-skip {
  min-height: 44px;
  padding: .4rem 1.1rem;
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--rs, 8px);
  background: var(--s2, #131720);
  color: var(--text, #e8e4dc);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.rk-ci-link {
  min-height: 44px;
  margin-right: auto;
  padding: .4rem .2rem;
  border: 0;
  background: none;
  color: var(--text2, #9aa0b0);
  font: inherit;
  font-size: 0.84rem;
  text-decoration: underline;
  cursor: pointer;
}

.rk-ci-result {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .7rem .9rem;
  margin-bottom: .5rem;
  border-radius: var(--rs, 8px);
  background: var(--s2, #131720);
  border-left: 4px solid var(--muted, #565e70);
}
.rk-ci-result.is-better { border-left-color: var(--success, #7ec8a0); }
.rk-ci-result.is-worse  { border-left-color: var(--warning, #c4a065); }
.rk-ci-result-label { font-size: 1.1rem; font-weight: 600; }
.rk-ci-result-detail { font-size: 0.82rem; color: var(--text2, #9aa0b0); font-variant-numeric: tabular-nums; }

/* ── Daily check card / effectiveness (mount target) ──────── */
.rk-tr { display: grid; gap: .9rem; }
.rk-tr-card {
  background: var(--s1, #0d1018);
  border: 1px solid var(--border, rgba(255,255,255,.06));
  border-radius: var(--r, 14px);
  padding: 1rem;
}
.rk-tr-title { margin: 0 0 .2rem; font-size: 1.05rem; font-weight: 500; }
.rk-tr-h3 { margin: 0 0 .6rem; font-size: 1rem; font-weight: 500; }
.rk-tr-h4 { margin: .8rem 0 .4rem; font-size: 0.8rem; font-weight: 500; color: var(--text2, #9aa0b0); text-transform: uppercase; letter-spacing: .04em; }
.rk-tr-muted { margin: 0 0 .6rem; font-size: 0.82rem; color: var(--text2, #9aa0b0); line-height: 1.45; }
.rk-tr-small { font-size: 0.84rem; }
.rk-tr-form { display: grid; gap: .8rem; }
.rk-tr-field { display: grid; gap: .3rem; }
.rk-tr-label { font-size: 0.85rem; font-weight: 500; }
.rk-tr-hint { font-size: 0.84rem; color: var(--text2, #9aa0b0); }
.rk-tr-value { margin-top: -.5rem; font-size: 0.84rem; color: var(--accent2, #c4a882); min-height: 1em; }

.rk-tr-choices { display: flex; flex-wrap: wrap; gap: .3rem; }
.rk-tr-choices--energy,
.rk-tr-choices--pain { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); }
@media (max-width: 380px) {
  .rk-tr-choices--energy,
  .rk-tr-choices--pain { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.rk-tr-choice,
.rk-tr-chip {
  min-height: 44px;
  padding: .35rem .7rem;
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--rs, 8px);
  background: var(--s2, #131720);
  color: var(--text, #e8e4dc);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  touch-action: manipulation;
}
.rk-tr-choices--energy .rk-tr-choice,
.rk-tr-choices--pain .rk-tr-choice { padding: 0; font-variant-numeric: tabular-nums; }
.rk-tr-choices--mood .rk-tr-choice { font-size: 1.15rem; min-width: 44px; }
.rk-tr-chip { border-radius: 999px; min-height: 40px; }
.rk-tr-choice[aria-pressed="true"],
.rk-tr-chip[aria-pressed="true"] {
  background: var(--accent, #8b9cf4);
  border-color: var(--accent, #8b9cf4);
  color: #0b0d14;
}
.rk-tr-choices--mood .rk-tr-choice[aria-pressed="true"] { background: var(--glow, rgba(139,156,244,.14)); color: inherit; }
.rk-tr-choice:focus-visible,
.rk-tr-chip:focus-visible,
.rk-tr-note:focus-visible,
.rk-tr-link:focus-visible,
.rk-tr-details summary:focus-visible { outline: 2px solid var(--accent, #8b9cf4); outline-offset: 2px; }
.rk-tr-chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.rk-tr-details summary { cursor: pointer; font-size: 0.85rem; font-weight: 500; padding: .4rem 0; min-height: 44px; display: flex; align-items: center; }
.rk-tr-details[open] summary { margin-bottom: .3rem; }

.rk-tr-note {
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .7rem;
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--rs, 8px);
  background: var(--s2, #131720);
  color: var(--text, #e8e4dc);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}
.rk-tr-row { display: flex; justify-content: flex-end; }
.rk-tr-save { min-height: 44px; }
.rk-tr-status { margin: 0; min-height: 1.2em; font-size: 0.8rem; color: var(--text2, #9aa0b0); }

.rk-tr-effect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.rk-tr-effect-head { display: flex; justify-content: space-between; gap: .5rem; font-size: 0.85rem; }
.rk-tr-effect-label { font-weight: 500; overflow-wrap: anywhere; }
.rk-tr-effect-val { font-size: 0.84rem; white-space: nowrap; }
.rk-tr-effect-val.is-better { color: var(--success, #7ec8a0); }
.rk-tr-effect-val.is-worse  { color: var(--warning, #c4a065); }
.rk-tr-effect-val.is-same   { color: var(--text2, #9aa0b0); }
.rk-tr-bar { display: block; height: 8px; margin: .3rem 0; border-radius: 999px; background: var(--s3, #1a2030); overflow: hidden; }
.rk-tr-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--muted, #565e70); transition: width .3s ease-out; }
.rk-tr-bar.is-better .rk-tr-bar-fill { background: var(--success, #7ec8a0); }
.rk-tr-bar.is-worse .rk-tr-bar-fill  { background: var(--warning, #c4a065); }
.rk-tr-effect-meta { font-size: 0.84rem; color: var(--text2, #9aa0b0); font-variant-numeric: tabular-nums; }
.rk-tr-disclaimer { margin: .8rem 0 0; font-size: 0.84rem; color: var(--text2, #9aa0b0); font-style: italic; }

.rk-tr-switch { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-size: 0.85rem; cursor: pointer; }
.rk-tr-switch input { width: 20px; height: 20px; accent-color: var(--accent, #8b9cf4); }
.rk-tr-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.rk-tr-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .3rem .8rem;
  border: 1px solid var(--border2, rgba(255,255,255,.1));
  border-radius: var(--rs, 8px);
  color: var(--text, #e8e4dc);
  font-size: 0.8rem;
  text-decoration: none;
}
.rk-tr-link:hover { border-color: var(--accent, #8b9cf4); }

@media (prefers-reduced-motion: reduce) {
  .rk-ci-sheet,
  .rk-tr-bar-fill { transition: none; }
}

/* ── Doctor report (standalone page) ──────────────────────── */
.rk-report-body {
  margin: 0;
  background: #f4f2ee;
  color: #1a1e2c;
  font-family: Outfit, system-ui, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.rk-report {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  background: #fff;
  min-height: 100vh;
  box-sizing: border-box;
}
.rk-report-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.2rem; }
.rk-report-ranges { display: flex; gap: .3rem; }
.rk-report-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .3rem .9rem;
  border: 1px solid #cfd3dc;
  border-radius: 8px;
  background: #fff;
  color: #1a1e2c;
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}
.rk-report-btn.is-active { background: #1a1e2c; color: #fff; border-color: #1a1e2c; }
.rk-report-btn--primary { background: #4a5ac8; border-color: #4a5ac8; color: #fff; margin-left: auto; }
.rk-report-btn--ghost { background: transparent; }
.rk-report-btn:focus-visible { outline: 2px solid #4a5ac8; outline-offset: 2px; }

.rk-report-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #1a1e2c; padding-bottom: .8rem; }
.rk-report-head h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.rk-report-sub { margin: .2rem 0 0; color: #50586a; font-size: .9rem; }
.rk-report-meta { display: grid; grid-template-columns: auto auto; gap: .15rem .8rem; margin: 0; font-size: .85rem; }
.rk-report-meta dt { color: #50586a; }
.rk-report-meta dd { margin: 0; font-weight: 500; }
.rk-report-disclaimer { margin: .8rem 0 0; padding: .5rem .7rem; background: #f4f2ee; border-radius: 6px; font-size: .78rem; color: #50586a; }

.rk-report-section { margin-top: 1.4rem; break-inside: avoid; page-break-inside: avoid; }
.rk-report-section h2 { margin: 0 0 .6rem; font-size: 1.05rem; font-weight: 600; }
.rk-report-section h3 { margin: 1rem 0 .4rem; font-size: .92rem; font-weight: 600; }
.rk-report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
@media (max-width: 640px) { .rk-report-cols { grid-template-columns: 1fr; } }

.rk-report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 560px) { .rk-report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rk-report-kpis > div { padding: .6rem .7rem; border: 1px solid #e2e4ea; border-radius: 8px; }
.rk-report-kpis .k { display: block; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rk-report-kpis .l { display: block; font-size: .72rem; color: #50586a; }

.rk-report-chart { display: block; width: 100%; height: auto; }
.rk-report-chart .grid { stroke: #e2e4ea; stroke-width: 1; }
.rk-report-chart .axis { font-size: 10px; fill: #50586a; font-family: Outfit, system-ui, sans-serif; }
.rk-report-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rk-report-chart.is-pain .line { stroke: #a83030; }
.rk-report-chart.is-pain .pt { fill: #a83030; }
.rk-report-chart.is-energy .line { stroke: #2a7848; }
.rk-report-chart.is-energy .pt { fill: #2a7848; }

.rk-report-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rk-report-table th,
.rk-report-table td { padding: .3rem .4rem; text-align: left; border-bottom: 1px solid #eceef2; vertical-align: middle; }
.rk-report-table th[scope="row"] { font-weight: 400; width: 45%; }
.rk-report-table thead th { font-weight: 600; color: #50586a; font-size: .75rem; }
.rk-report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk-report-table .bar span { display: block; height: 8px; border-radius: 4px; background: #4a5ac8; min-width: 2px; }
.rk-report-hint,
.rk-report-empty { font-size: .75rem; color: #50586a; margin: .4rem 0 0; }
.rk-report-notes { margin: 0; padding-left: 1.1rem; font-size: .82rem; }
.rk-report-notes li { margin-bottom: .25rem; }
.rk-report-notes time { color: #50586a; font-variant-numeric: tabular-nums; margin-right: .3rem; }
.rk-report-foot { margin-top: 2rem; padding-top: .6rem; border-top: 1px solid #e2e4ea; font-size: .72rem; color: #50586a; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  .no-print { display: none !important; }
  .rk-report-body { background: #fff; }
  .rk-report { max-width: none; padding: 0; min-height: 0; }
  .rk-report-section h2 { font-size: 11pt; }
  .rk-report-kpis > div { border-color: #ccc; }
  a { color: inherit; text-decoration: none; }
}
