/* ONCOALIADO RD - estilos. Paleta: azul petróleo (confianza) + rosa (cinta rosa) sobre crema cálida. */
:root {
  --bg: #fbf7f3;
  --surface: #ffffff;
  --surface-2: #f4ede6;
  --ink: #1d2a30;
  --ink-2: #4f5d63;
  --line: #e4dad0;
  --brand: #0f4c5c;
  --brand-ink: #ffffff;
  --rose: #c8506f;
  --rose-soft: #f7e1e7;
  --good: #2e7d4f;
  --warn: #b36b00;
  --crit: #b3261e;
  --crit-soft: #fbe3e1;
  --focus: #f2b134;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 42, 48, .06), 0 6px 20px rgba(29, 42, 48, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12191c; --surface: #1a2428; --surface-2: #223035; --ink: #eef3f4; --ink-2: #b4c2c6;
    --line: #2f3f45; --brand: #5fb3c6; --brand-ink: #06232a; --rose: #f08aa4; --rose-soft: #3a2229;
    --crit-soft: #3d1d1b; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 1.05rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--rose) 0 38%, transparent 39%), var(--brand); }
.brand-text b { color: var(--rose); }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .topnav button { font: inherit; font-size: .88rem; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; }
.topnav a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.net { background: var(--warn); color: #fff; padding: 8px 16px; font-size: .9rem; text-align: center; }
main:focus, main:focus-visible { outline: none; }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 120px; outline: none; }
main.wide { max-width: 1120px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 6px 0 12px; }
h2 { font-size: 1.2rem; margin: 22px 0 8px; }
h3 { font-size: 1.02rem; margin: 14px 0 6px; }
p { margin: 8px 0; }
.lead { font-size: 1.08rem; color: var(--ink-2); }
.muted { color: var(--ink-2); font-size: .92rem; }
.small { font-size: .85rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.rose { background: var(--rose-soft); border-color: transparent; }
.card.crit { background: var(--crit-soft); border-color: var(--crit); }
a.card { text-decoration: none; color: inherit; display: block; }
a.card h3 { color: var(--brand); }
td select { min-width: 190px; min-height: 40px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.chart { width: 100%; height: auto; display: block; color: var(--ink); }
.row input, .row select { width: auto; flex: 1; min-width: 180px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; font-weight: 600; }
.btn.alt { background: transparent; color: var(--brand); }
.btn.rose { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn.crit { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
.hint { font-weight: 400; color: var(--ink-2); font-size: .88rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.err { color: var(--crit); font-weight: 600; margin: 8px 0; }

/* Termómetro 0-10 */
.thermo { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin: 10px 0; }
.thermo button { font: inherit; min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 700; }
.thermo button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.thermo-legend { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-2); }

/* Opciones tipo escala */
.scale { display: grid; gap: 6px; }
.scale button { font: inherit; text-align: left; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.scale button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Programa: pasos del día */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps > li { position: relative; padding: 14px 14px 14px 56px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 10px 0; }
.steps > li::before { counter-increment: s; content: counter(s); position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--rose-soft); color: var(--rose); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps > li.done::before { content: "✓"; background: var(--good); color: #fff; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--rose)); width: 0; transition: width .4s; }
.days { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.days span { opacity: .55; }
.days a, .days span { display: flex; align-items: center; justify-content: center; min-height: 34px; border-radius: 8px; font-size: .82rem; text-decoration: none;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.days a.done { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.days a.today { border: 2px solid var(--rose); color: var(--rose); font-weight: 800; }
.script { white-space: pre-wrap; font-size: 1.04rem; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin-right: 6px; }
.tag.rose { background: var(--rose-soft); color: var(--rose); }
.tag.crit { background: var(--crit); color: #fff; }
.tag.warn { background: #fff1d6; color: var(--warn); }
audio, video { width: 100%; margin: 8px 0; border-radius: 10px; }

/* CALMA */
.calma-btn { position: fixed; right: 16px; bottom: 18px; z-index: 30; width: 74px; height: 74px; border-radius: 50%; border: 0;
  background: var(--rose); color: #fff; font: 800 .86rem var(--font); letter-spacing: .04em; box-shadow: 0 8px 24px rgba(200, 80, 111, .45); cursor: pointer; }
.calma { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: auto; padding: 18px 16px 40px; }
.calma-inner { max-width: 560px; margin: 0 auto; text-align: center; }
.breath { width: 210px; height: 210px; margin: 26px auto; border-radius: 50%; background: radial-gradient(circle, var(--rose-soft), var(--brand) 140%);
  display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 800; font-size: 1.2rem; transform: scale(.6); }
.breath.in { transition: transform 4s ease-in-out; transform: scale(1); }
.breath.out { transition: transform 6s ease-in-out; transform: scale(.6); }
@media (prefers-reduced-motion: reduce) { .breath.in, .breath.out { transition: none; } }
.crisis { text-align: left; }
.crisis .btn { margin: 6px 0; }

/* Workshop */
.agenda { list-style: none; padding: 0; margin: 0; }
.agenda li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0; background: var(--surface); }
.agenda li.now { border: 2px solid var(--rose); background: var(--rose-soft); }
.agenda li.past { opacity: .6; }
.agenda .min { flex: none; width: 54px; font-weight: 700; color: var(--ink-2); }
.timer { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bar .track { grid-column: 1 / -1; height: 18px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--brand); width: 0; }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.qr img { width: 220px; height: 220px; image-rendering: pixelated; display: block; }
.projection { font-size: 1.5rem; }
.projection h1 { font-size: 2.6rem; }
.projection .bar .track { height: 34px; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }

.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 45; max-width: 90vw; }
.foot { max-width: 760px; margin: 0 auto; padding: 0 16px 110px; color: var(--ink-2); font-size: .8rem; text-align: center; }
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  html { font-size: 16px; }
  .thermo { grid-template-columns: repeat(6, 1fr); }
  .days { grid-template-columns: repeat(6, 1fr); }
  .topnav a, .topnav button { padding: 5px 8px; font-size: .8rem; }
}
@media print { .calma-btn, .topbar, .foot { display: none; } body { background: #fff; } }

/* Dashboard segmentado (v1.2) */
.filters h3 { margin-top: 0; }
.filters-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.filters-grid label { margin-top: 0; }
.filters-grid select, .filters-grid input { width: 100%; }
.chip { border: 0; cursor: pointer; font: inherit; font-size: .82rem; }
.chip:hover, .chip:focus-visible { background: var(--rose); color: #fff; }
svg .clickable:hover rect:last-of-type { opacity: .8; }
.grid > *, .grid2 > *, .card { min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.filters .check input { width: auto; flex: 0 0 auto; }
.filters input[type=date] { padding: 10px 12px; min-height: 44px; }
