/* Calculadora de sueño (prefijo sl-) — usa mm-tools.css */
.sl { --st-wake: rgba(var(--glass-tint), .42); --st-rem: #f036e1; --st-n1: #c9b8ff; --st-n2: #9a6bff; --st-n3: #5d3fd8; }
html[data-theme="light"] .sl { --st-wake: rgba(22, 16, 26, .32); --st-rem: #c81fb8; --st-n1: #b29cf5; --st-n2: #7b45f0; --st-n3: #45279e; }
.sl-night, .sl-facts { grid-column: 1 / -1; }

/* ---------- Entrada ---------- */
.sl-modes { margin-bottom: 24px; }
.sl-modes .tl-opt { align-items: center; }
.sl-time .pg-label { font-size: 13px; }
.sl-time-row { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.is-24 .sl-time-row { grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
.sl-time-row select.pg-input { height: 60px; min-height: 60px; font-size: 24px; letter-spacing: -0.02em; padding-left: 18px; border-radius: 16px; }
.sl-colon { font-family: 'JetBrains Mono', monospace; font-size: 24px; color: var(--paper-faint); text-align: center; }
.sl-ap { flex-wrap: nowrap; }
.sl-ap button { min-height: 44px; padding: 0 12px; }
@media (max-width: 400px) {
  .sl-time-row { grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
  .sl-ap { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
}
.sl-go { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 18px; }
.sl-go .tl-btn { min-height: 52px; font-size: 14.5px; }
@media (max-width: 480px) { .sl-go { grid-template-columns: 1fr; } }
.sl-range label output { font-size: 13px; color: var(--tl-acc); font-weight: 500; }
.sl-range .pg-range { height: 36px; margin: 0; cursor: pointer; }
.sl-range .help { line-height: 1.5; }
.sl-row2 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 640px) { .sl-row2 { grid-template-columns: 1fr; } }

/* ---------- Resultado ---------- */
.sl-out-h { margin-bottom: 14px; }
.sl-out-h .tl-pill { white-space: normal; text-align: right; }
.sl-empty { padding: 56px 24px; }
.sl-empty span { max-width: 340px; }
.sl-lead { margin: 4px 0 16px; font-size: 15px; line-height: 1.55; color: var(--paper-dim); }
.sl-lead b { color: var(--paper); font-weight: 600; white-space: nowrap; }
.sl-best, .sl-list { display: grid; gap: 10px; }
.sl-more-h { margin: 22px 0 12px; }

.sl-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--paper); cursor: pointer;
  padding: 12px 16px; min-height: 64px; border: 0; border-radius: 18px; background: var(--glass-bg); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s, background .2s, transform .2s cubic-bezier(.16,1,.3,1); animation: tlIn .45s cubic-bezier(.16,1,.3,1) both; }
.sl-opt:hover { box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--glass-bg-strong); }
.sl-opt:active { transform: scale(.985); }
.sl-opt.on { background: linear-gradient(135deg, rgba(240,54,225,.10), rgba(145,73,255,.10)); box-shadow: inset 0 0 0 1.5px #f036e1; }
.sl-list .sl-opt:nth-child(2) { animation-delay: 40ms; } .sl-list .sl-opt:nth-child(3) { animation-delay: 80ms; } .sl-list .sl-opt:nth-child(4) { animation-delay: 120ms; }
.sl-face { display: grid; place-items: center; }
.sl-face svg { width: 26px; height: 26px; }
.sl-opt.q-ok .sl-face { color: var(--tl-ok); } .sl-opt.q-warn .sl-face { color: var(--tl-warn); } .sl-opt.q-bad .sl-face { color: var(--tl-bad); }
.sl-opt-main { display: grid; gap: 3px; min-width: 0; }
.sl-opt-t { font-size: 21px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; }
.sl-opt-t small { font-family: 'DM Sans', system-ui, sans-serif; font-size: .5em; margin-left: 2px; letter-spacing: 0; color: var(--paper-dim); font-weight: 400; }
.sl-opt-s { font-size: 13px; color: var(--paper-dim); }
.sl-opt-tags { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sl-inage { font-size: 12px; color: var(--tl-ok); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.sl-inage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sl-opt.big { padding: 18px 20px; min-height: 92px; border-radius: 22px; }
.sl-opt.big .sl-face svg { width: 34px; height: 34px; }
.sl-opt.big .sl-opt-t { font-size: clamp(30px, 3.2vw, 40px); }
.sl-opt.big .sl-opt-s { font-size: 14px; }
@media (max-width: 480px) {
  .sl-opt { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; }
  .sl-opt-tags { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .sl-opt.big { padding: 16px; }
  .sl-opt.big .sl-opt-t { font-size: 30px; }
}
.sl-agebox { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--glass-bg-strong); box-shadow: inset 0 0 0 1px var(--line); }
.sl-agebox svg { flex-shrink: 0; margin-top: 2px; color: var(--paper-faint); }
.sl-agebox p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--paper-dim); }
.sl-agebox b { color: var(--paper); font-weight: 600; }
.sl-actions { margin-top: 18px; }
.sl-ics-note { margin-top: 12px; }

/* ---------- Hipnograma ---------- */
.sl-night-head, .sl-facts-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; }
.sl-night-title { font-size: clamp(20px, 2vw, 26px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin: 0; }
.sl-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--paper-dim); }
.sl-legend li { display: inline-flex; align-items: center; gap: 7px; }
.sl-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sl-legend .st-wake { background: var(--st-wake); } .sl-legend .st-rem { background: var(--st-rem); } .sl-legend .st-n1 { background: var(--st-n1); } .sl-legend .st-n2 { background: var(--st-n2); } .sl-legend .st-n3 { background: var(--st-n3); }
.sl-hyp { width: 100%; min-width: 0; margin: 22px 0 14px; overflow: hidden; }
.sl-hyp-svg { display: block; max-width: 100%; height: auto; font-family: inherit; }
.sl-row { fill: rgba(var(--glass-tint), .035); }
.sl-ylab, .sl-xlab, .sl-cyc-t { fill: var(--paper-faint); font-size: 12px; }
.sl-ylab { fill: var(--paper-dim); }
.sl-xlab { font-size: 12px; font-variant-numeric: tabular-nums; }
.sl-cyc-t { fill: var(--paper-dim); font-weight: 500; }
.sl-cyc-l { stroke: var(--line-strong); stroke-dasharray: 3 4; }
.sl-axis, .sl-tick { stroke: var(--line-strong); }
.sl-step { fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; }
.sl-seg { transform-box: fill-box; transform-origin: center; animation: slSeg .5s cubic-bezier(.16,1,.3,1) both; }
.sl-seg.st-wake { fill: var(--st-wake); } .sl-seg.st-rem { fill: var(--st-rem); } .sl-seg.st-n1 { fill: var(--st-n1); } .sl-seg.st-n2 { fill: var(--st-n2); } .sl-seg.st-n3 { fill: var(--st-n3); }
.sl-dot { fill: var(--paper); } .sl-dot.end { fill: #f036e1; stroke: var(--ink); stroke-width: 2; }
@keyframes slSeg { from { opacity: 0; transform: scaleY(.2); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sl-seg, .sl-opt { animation: none; } }

/* ---------- Datos ---------- */
.sl-facts-head .tl-sub { max-width: 440px; margin: 0; }
.sl-fact-grid { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 28px; }
.sl-fact-grid li { display: grid; gap: 12px; align-content: start; padding: 22px 0; border-top: 1px solid var(--line); }
.sl-fact-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--paper); background: linear-gradient(135deg, rgba(240,54,225,.16), rgba(145,73,255,.16)); box-shadow: inset 0 0 0 1px var(--line-strong); }
.sl-fact-grid h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.sl-fact-grid p { margin: 0; font-size: 14px; color: var(--paper-dim); line-height: 1.6; }
@media (max-width: 1100px) { .sl-fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .sl-fact-grid { grid-template-columns: 1fr; } .sl-fact-grid li { grid-template-columns: 40px minmax(0, 1fr); gap: 14px; } }
.sl-care { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; margin-top: 18px; padding-top: 26px; border-top: 1px solid var(--line); align-items: start; }
.sl-doc p + p { margin-top: 10px; }
.sl-disc { font-size: 12.5px !important; color: var(--paper-faint) !important; }
@media (max-width: 900px) { .sl-care { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Impresión ---------- */
@media print {
  html, html[data-theme="light"] { --paper: #16101a; --paper-dim: #3c3440; --paper-faint: #5e5562; --line: rgba(0,0,0,.12); --line-strong: rgba(0,0,0,.22); --glass-bg: transparent; --glass-bg-strong: rgba(0,0,0,.03); --glass-tint: 0, 0, 0; --ink: #fff; }
  .pg-hero, .pg-sec:not(.pg-tool), .sl-in, .sl-ics-note, .sl-facts { display: none !important; }
  .pg-tool .tl-app { grid-template-columns: 1fr; }
  .tl-panel { box-shadow: none !important; border: 1px solid #ddd; backdrop-filter: none !important; break-inside: avoid; }
  .sl-opt { animation: none; } .sl-seg { animation: none; }
}
