/* Natursara · estilos comunes (app + enlace del paciente) */
@font-face { font-family: 'Montserrat'; src: url(fonts/Montserrat-Light.ttf) format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url(fonts/Montserrat-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url(fonts/Montserrat-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url(fonts/Montserrat-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --brand: #781355; --brand-2: #A9AB11; --brand-soft: #F6ECF2;
  --bg: #FAF7F9; --bg-card: #FFFFFF; --ink: #2A2229; --muted: #7A6F78; --line: #ECE3E9;
  --good: #1E8E4A; --good-bg: #E5F4EA; --bad: #D32F2F; --bad-bg: #FCE8E8; --same: #8A8290; --same-bg: #F0EDF0;
  --sil-fill: #F8EEF4; --sil-edge: #E2C6D6; --sil-stroke: #781355;
  --radius: 18px; --shadow: 0 1px 2px rgba(60, 20, 45, .06), 0 6px 20px rgba(60, 20, 45, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #D46AA6; --brand-soft: #3A2532; --bg: #17121A; --bg-card: #221B24; --ink: #F2ECF0; --muted: #A99DA6; --line: #352B36;
    --good: #4CC27A; --good-bg: #1D3426; --bad: #FF6B6B; --bad-bg: #3D2224; --same: #A79DA6; --same-bg: #2C252D;
    --sil-fill: #46323F; --sil-edge: #2E2029; --sil-stroke: #D46AA6; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #D46AA6; --brand-soft: #3A2532; --bg: #17121A; --bg-card: #221B24; --ink: #F2ECF0; --muted: #A99DA6; --line: #352B36;
  --good: #4CC27A; --good-bg: #1D3426; --bad: #FF6B6B; --bad-bg: #3D2224; --same: #A79DA6; --same-bg: #2C252D;
  --sil-fill: #46323F; --sil-edge: #2E2029; --sil-stroke: #D46AA6; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 'Montserrat', system-ui, sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }

.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 0 0 14px; border: 1px solid var(--line); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card.empty { text-align: center; color: var(--muted); }

/* resumen */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-v { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-v small { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-s { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.good { background: var(--good-bg); border-color: transparent; }
.stat.bad { background: var(--bad-bg); border-color: transparent; }
.motiv { margin: 0 2px 14px; font-size: 14px; color: var(--muted); font-style: italic; }

/* segmentado */
.seg { display: inline-flex; background: var(--brand-soft); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--bg-card); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* silueta */
.sil-wrap { display: flex; justify-content: center; }
.silueta { width: 100%; max-width: 440px; height: auto; display: block; }
.sil-lbl { font: 600 13px 'Montserrat', sans-serif; fill: var(--muted); }
.sil-val { font: 700 14px 'Montserrat', sans-serif; }
.player { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.play { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 15px; display: grid; place-items: center; }
.player-track { flex: 1; min-width: 0; }
.player input[type=range] { width: 100%; accent-color: var(--brand); margin: 0; }
.player-lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); justify-content: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.good { background: var(--good); height: 4px; border-radius: 2px; }
.legend i.bad { background: var(--bad); height: 4px; border-radius: 2px; }
.legend i.ghost { border: 1.5px dashed #9B8F99; }

/* tira de siluetas por visita */
.strip-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }
.sil-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.sil-strip button { flex: none; width: 74px; border: 1.5px solid var(--line); background: var(--bg-card); border-radius: 14px; padding: 6px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sil-strip button.on { border-color: var(--brand); background: var(--brand-soft); }
.sil-strip .silueta.mini { width: 100%; height: 96px; }
.strip-d { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.strip-w { font-size: 11.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* gráfica */
.chips-sel { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin: 0 -4px 4px; padding-left: 4px; scrollbar-width: none; }
.chips-sel button { flex: none; border: 1px solid var(--line); background: var(--bg-card); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.chips-sel button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax { font: 500 11px 'Montserrat', sans-serif; fill: var(--muted); }
.ch-val { font: 700 12px 'Montserrat', sans-serif; fill: var(--ink); }
.ch-dot { fill: var(--bg-card); stroke: var(--brand); stroke-width: 2.5; }
.ch-dot.last { fill: var(--brand); }
.ch-band { fill: var(--brand-2); opacity: .16; }
.ch-band-t { font: 600 10px 'Montserrat', sans-serif; fill: #7E800C; }

/* tabla */
.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.tbl tbody th { text-align: left; font-weight: 600; }
.tbl tbody th small { color: var(--muted); font-weight: 400; }
.tbl tr:last-child th, .tbl tr:last-child td { border-bottom: 0; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.chip.sm { font-size: 11px; padding: 2px 7px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.same { background: var(--same-bg); color: var(--same); }
.chip.none { color: var(--muted); }
.vs-prev { display: block; font-size: 10.5px; font-weight: 700; }
.vs-prev.good { color: var(--good); } .vs-prev.bad { color: var(--bad); } .vs-prev.same { color: var(--same); }
.legend-txt { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 2px; }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.same { background: var(--same); }

@media (max-width: 380px) {
  .stat-v { font-size: 18px; }
  .stats { gap: 7px; }
}
