/* Care — seguimiento de tratamientos. Sistema de diseño clínico:
   chrome grafito neutro + color con significado por tipo de evento, tipografía disciplinada, íconos SVG de trazo. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #62626b;
  --line: #e5e5e9;
  --line-strong: #cfcfd6;
  --primary: #1f2937;          /* grafito: botones y acciones */
  --primary-strong: #111827;   /* acentos de texto y selección */
  --primary-ink: #ffffff;
  --primary-soft: #ececf0;
  --primary-hover: #111827;
  --ok: #15803d;
  --ok-ink: #ffffff;
  --ok-bg: #e5f3ea;
  --warn: #955d00;
  --warn-bg: #f8f0dd;
  --bad: #b42323;
  --bad-bg: #f9e8e8;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05);
  /* el color lleva significado: un color por tipo de evento */
  --t-med: #2563eb;       /* medicamento — azul */
  --t-cita: #7c3aed;      /* cita — violeta */
  --t-medicion: #e11d48;  /* medición — rojo */
  --t-otro: #d97706;      /* otro — ámbar */
  /* paleta de miembros */
  --p0: #0e7490; --p1: #4d7c0f; --p2: #a16207; --p3: #be185d; --p4: #6d28d9; --p5: #c2410c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101013;
    --surface: #191920;
    --ink: #ececf1;
    --muted: #9b9ba6;
    --line: #292933;
    --line-strong: #3d3d4a;
    --primary: #ececf1;          /* invertido: botón claro sobre fondo oscuro */
    --primary-strong: #ffffff;
    --primary-ink: #18181b;
    --primary-soft: #26262f;
    --primary-hover: #ffffff;
    --ok: #4bbe7e;
    --ok-ink: #0b2517;
    --ok-bg: #15301f;
    --warn: #d3a04d;
    --warn-bg: #322c1a;
    --bad: #e06c6c;
    --bad-bg: #3a2022;
    --shadow: none;
    --t-med: #6aa4f8;
    --t-cita: #a78bfa;
    --t-medicion: #fb7185;
    --t-otro: #f0b432;
    --p0: #53b7d5; --p1: #97ba58; --p2: #d6ab4e; --p3: #dd7aa8; --p4: #a78bfa; --p5: #e08d5b;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-size: .88rem; }

/* íconos SVG de trazo */
.ic { width: 18px; height: 18px; vertical-align: -4px; flex-shrink: 0; }
.ic.sm { width: 15px; height: 15px; vertical-align: -3px; }

/* chip de tipo: el color identifica medicamento / cita / medición / otro */
.tchip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 7px; vertical-align: -7px;
  margin-right: 3px; color: var(--tc, var(--muted));
  background: color-mix(in srgb, var(--tc, var(--muted)) 13%, transparent);
}
.tchip .ic { width: 14px; height: 14px; vertical-align: 0; }
.tchip.med { --tc: var(--t-med); }
.tchip.cita { --tc: var(--t-cita); }
.tchip.medicion { --tc: var(--t-medicion); }
.tchip.otro { --tc: var(--t-otro); }

/* ------------------------------------------------------------- login */
#login { min-height: 100dvh; }
#login-box { margin: 12vh auto 40px; }
#login:has(#login-box:not([hidden])) { display: flex; align-items: flex-start; justify-content: center; padding: 0 24px; }
.login-box {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 26px 24px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.login-brand img { width: 40px; height: 40px; border-radius: 10px; }
.login-brand b { font-size: 1.35rem; letter-spacing: -.01em; }
.login-box .tagline { margin: 0 0 22px; font-size: .88rem; }
.login-box label {
  display: block; font-size: .76rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 4px;
}
.login-box input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--bg); color: var(--ink);
  font-size: 1rem;
}
.login-box input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.login-box .primary { margin-top: 18px; }
button.primary {
  width: 100%; padding: 11px; border: 0; border-radius: 9px;
  background: var(--primary); color: var(--primary-ink);
  font-size: .95rem; font-weight: 600;
  box-shadow: var(--shadow);
}
button.primary:hover { background: var(--primary-hover); }
button.primary:disabled { opacity: .6; }
button.linklike {
  display: block; width: 100%; margin-top: 14px;
  border: 0; background: none; color: var(--primary-strong); font-weight: 600; font-size: .9rem;
}
#login .err { margin-top: 12px; }

/* ------------------------------------------------------------- landing */
#landing { max-width: 720px; margin: 0 auto; padding: 40px 20px 10px; }
.land-hero { text-align: center; padding: 20px 0 10px; }
.land-hero h1 { font-size: 1.65rem; letter-spacing: -.01em; margin: 18px 0 10px; }
.land-hero p { max-width: 460px; margin: 0 auto; font-size: .95rem; }
.land-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px;
}
@media (min-width: 900px) { .land-grid { grid-template-columns: 1fr 1fr 1fr; } #landing { max-width: 980px; } }
@media (max-width: 560px) { .land-grid { grid-template-columns: 1fr; } }
.land-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
}
.land-card .ic { width: 22px; height: 22px; color: var(--primary-strong); }
.land-card b { display: block; margin: 8px 0 4px; font-size: .95rem; }
.land-card span { font-size: .85rem; color: var(--muted); }

.land-badge {
  display: inline-block; margin-top: 14px; padding: 4px 12px;
  border: 1px solid var(--line-strong); border-radius: 99px;
  font-size: .74rem; font-weight: 600; color: var(--muted);
  background: var(--surface);
}
.land-shots {
  display: flex; gap: 16px; margin: 34px -20px 0; padding: 6px 20px 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.land-shots::-webkit-scrollbar { display: none; }
.land-shots figure {
  flex: 0 0 auto; margin: 0; scroll-snap-align: center; text-align: center;
}
.land-shots img {
  width: 232px; border-radius: 22px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
  display: block;
}
.land-shots figcaption {
  font-size: .76rem; color: var(--muted); margin-top: 10px; max-width: 232px;
}
@media (min-width: 780px) { .land-shots { justify-content: center; } }
.land-sec { max-width: 560px; margin: 36px auto 0; }
.land-check { list-style: none; margin: 8px 0 0; padding: 0; }
.land-check li {
  position: relative; padding: 7px 0 7px 30px; font-size: .9rem;
  border-bottom: 1px solid var(--line);
}
.land-check li:last-child { border-bottom: 0; }
.land-check li::before {
  content: "✓"; position: absolute; left: 4px; top: 6px;
  color: var(--ok); font-weight: 800;
}
.land-faq {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; margin: 10px 0;
}
.land-faq summary { font-weight: 600; font-size: .92rem; cursor: pointer; }
.land-faq p { font-size: .87rem; color: var(--muted); margin: 8px 0 2px; }
.land-how { max-width: 520px; margin: 34px auto 0; }
.land-step { display: flex; gap: 14px; align-items: flex-start; margin: 16px 0; }
.land-step i {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-ink);
  font-style: normal; font-weight: 800; font-size: .9rem;
}
.land-step b { display: block; font-size: .95rem; }
.land-step span { font-size: .85rem; color: var(--muted); }

/* selector de miembro (login) */
.member-btn {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; margin-top: 10px; padding: 13px 16px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--bg); font-size: 1.02rem; font-weight: 600; cursor: pointer;
}
.member-btn:hover { border-color: var(--primary-strong); }
.member-btn .muted { font-size: .8rem; font-weight: 400; }

/* --------------------------------------------------------------- app */
#hdr {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
}
#hdr .inner {
  max-width: 720px; margin: 0 auto; padding: 0 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
#hdr .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.02rem; }
#hdr .brand .ic { width: 20px; height: 20px; color: var(--primary-strong); }
#hdr-group {
  font-size: .8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#view {
  max-width: 720px; margin: 0 auto;
  padding: 6px 14px calc(86px + env(safe-area-inset-bottom));
}
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 7px 0 calc(7px + env(safe-area-inset-bottom));
}
#tabs button {
  flex: 1; max-width: 170px; border: 0; background: none;
  color: var(--muted); font-size: .68rem; font-weight: 500; padding: 2px 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
#tabs button .ic { width: 21px; height: 21px; }
#tabs button.sel { color: var(--primary-strong); font-weight: 600; }

/* ------------------------------------------------------------ campanita */
#btn-bell {
  position: relative; border: 0; background: none; cursor: pointer;
  padding: 6px; border-radius: 9px; color: var(--muted);
  display: inline-flex; flex-shrink: 0;
}
#btn-bell:hover { background: var(--bg); }
#btn-bell.on { color: var(--primary-strong); }
#btn-bell .ic { width: 20px; height: 20px; }
.bellbadge {
  position: absolute; top: 0; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
#notifpop {
  position: fixed; top: 54px; right: 12px; z-index: 70;
  width: 400px; max-width: calc(100vw - 16px);
  max-height: 72vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 44px rgba(0, 0, 0, .22);
  padding: 14px 16px;
}
#notifpop .np-head h3 { margin: 0 0 10px; font-size: .92rem; }
.notif-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; margin-bottom: 10px; border: 0; cursor: pointer;
  border-radius: 10px; font-size: .82rem; font-weight: 600;
  background: var(--bg); color: var(--ink);
}
.notif-btn.on { background: var(--ok-bg); color: var(--ok); }
.notif-btn:disabled { opacity: .6; cursor: default; }
.n-row { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.n-row.new .n-title::after {
  content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--bad); margin-left: 6px;
}
.n-title { font-weight: 600; font-size: .88rem; }
.n-body { font-size: .8rem; color: var(--muted); white-space: pre-line; }
.n-when { font-size: .74rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 560px) {
  #notifpop { top: 50px; right: 8px; left: 8px; width: auto; }
}

/* ------------------------------------------------------------ tarjetas */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin: 10px 0;
  box-shadow: var(--shadow);
}
.section-title {
  margin: 20px 2px 4px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  display: flow-root;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row .time {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: .88rem;
  min-width: 3em; color: var(--muted);
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; }
.badge { white-space: nowrap; }
.row .notes { font-size: .82rem; color: var(--muted); margin-top: 1px; }
.row.done {
  background: var(--ok-bg); border-radius: 10px; border-top: 0;
  padding: 9px 10px; margin: 4px -6px;
}
.row.done + .row { border-top: 0; }
.row.done .title { font-weight: 500; }
.row.done .time { color: var(--ok); }
/* check circular toggle: gris = pendiente, verde = hecho */
.ck {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--line-strong); background: var(--bg);
  color: var(--muted); cursor: pointer; padding: 0;
}
.ck .ic { width: 18px; height: 18px; }
button.ck:hover { border-color: var(--ok); color: var(--ok); }
.ck.on { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
button.ck.on:hover { opacity: .85; }

.pill {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  white-space: nowrap;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  vertical-align: 1.5px; text-transform: uppercase;
  background: color-mix(in srgb, var(--pc, var(--primary-strong)) 12%, transparent);
  color: var(--pc, var(--primary-strong));
}
.pc0 { --pc: var(--p0); } .pc1 { --pc: var(--p1); } .pc2 { --pc: var(--p2); }
.pc3 { --pc: var(--p3); } .pc4 { --pc: var(--p4); } .pc5 { --pc: var(--p5); }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.btn-ok {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; border-radius: 8px; padding: 8px 13px;
  background: var(--primary); color: var(--primary-ink);
  font-weight: 600; font-size: .84rem; flex-shrink: 0;
}
.btn-ok:hover { background: var(--primary-hover); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 11px;
  background: var(--surface); font-size: .84rem; font-weight: 500; flex-shrink: 0;
}
.btn-ghost:hover { border-color: var(--primary-strong); color: var(--primary-strong); }
.btn-ghost.danger { color: var(--bad); }
.btn-icon {
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); padding: 6px 8px; flex-shrink: 0;
  color: var(--muted); display: inline-flex;
}
.btn-icon:hover { color: var(--bad); border-color: var(--bad); }

.chips { display: flex; gap: 6px; margin: 12px 0 2px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 8px; padding: 6px 13px; font-size: .84rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.chips button.sel {
  background: var(--primary-soft); border-color: var(--primary-strong);
  color: var(--primary-strong); font-weight: 600;
}
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: .92rem; }

/* ------------------------------------------------------------ formularios */
.gform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gform .full, .rform .full { grid-column: 1 / -1; }
.gform input, .gform select, .rform input, .rform select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: var(--bg); color: var(--ink); font: inherit;
  /* 16px mínimo: iOS hace auto-zoom al enfocar inputs más chicos y la
     barra de tabs fija queda flotando a media pantalla */
  font-size: 1rem;
}
.gform input:focus, .gform select:focus, .rform input:focus, .rform select:focus {
  outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent;
}
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slots button {
  border: 1px solid var(--line-strong); background: var(--bg);
  border-radius: 8px; padding: 7px 10px; font-size: .82rem;
}
.slots button.sel {
  border-color: var(--primary-strong); color: var(--primary-strong);
  background: var(--primary-soft); font-weight: 600;
}
.gval {
  display: inline-block; min-width: 3em; text-align: center;
  padding: 1px 7px; border-radius: 6px; font-weight: 700; font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
.gval.ok { background: var(--ok-bg); color: var(--ok); }
.gval.warn { background: var(--warn-bg); color: var(--warn); }
.gval.bad { background: var(--bad-bg); color: var(--bad); }
.gval.plain { background: var(--bg); border: 1px solid var(--line); }
.chart { width: 100%; height: auto; display: block; margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: .9rem; }
.stat-grid span { color: var(--muted); }
.stat-grid b { font-variant-numeric: tabular-nums; font-weight: 600; }

.rform { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.rform label {
  font-size: .72rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  display: block; margin-bottom: 4px;
}
.days { display: flex; gap: 5px; }
.days button {
  flex: 1; border: 1px solid var(--line-strong); background: var(--bg);
  border-radius: 7px; padding: 7px 0; font-size: .76rem;
}
.days button.sel {
  border-color: var(--primary-strong); color: var(--primary-strong);
  background: var(--primary-soft); font-weight: 700;
}
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }

/* -------------------------------------------------------------- reglas */
.rule-row { align-items: flex-start; }
.rule-meta { font-size: .78rem; color: var(--muted); margin-top: 1px; }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; margin-top: 2px; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong);
  transition: background .15s;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { left: 19px; }

/* ------------------------------------------------------------ calendario */
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 2px 10px;
}
.cal-head b { text-transform: capitalize; font-size: 1.02rem; }
.cal-head button {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 8px; padding: 4px 10px; color: var(--muted); display: inline-flex;
}
.cal-head button:hover { color: var(--primary-strong); border-color: var(--primary-strong); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  text-align: center; font-size: .62rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 2px 0;
}
.cal-day {
  min-height: 46px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); padding: 5px 0 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .82rem; cursor: pointer;
}
.cal-day .n { font-variant-numeric: tabular-nums; }
.cal-day.out { opacity: .35; }
.cal-day.today { border-color: var(--primary-strong); }
.cal-day.today .n { color: var(--primary-strong); font-weight: 700; }
.cal-day.sel { background: var(--primary); border-color: var(--primary); }
.cal-day.sel .n { color: var(--primary-ink); font-weight: 700; }
.cal-dots { display: flex; gap: 2.5px; flex-wrap: wrap; justify-content: center; max-width: 92%; min-height: 5px; }
.dot { width: 4.5px; height: 4.5px; border-radius: 50%; background: var(--line-strong); }
.dot.med { background: var(--t-med); }
.dot.cita { width: 5.5px; height: 5.5px; background: var(--t-cita); }
.dot.medicion { background: var(--t-medicion); }
.dot.otro { background: var(--t-otro); }
.dot.faded { opacity: .3; }
.cal-day.sel .dot { outline: 1px solid rgba(255,255,255,.75); }

/* leyenda de tipos bajo el calendario */
.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin: 10px 2px 0; font-size: .74rem; color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 7px; height: 7px; }

/* ------------------------------------------ time picker de ruedas (popup) */
.ann-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.timechip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--bg); padding: 11px 16px; cursor: pointer;
}
.timechip b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.timechip .ic { color: var(--muted); }
.timechip:hover { border-color: var(--primary-strong); }
#sheet {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 10, 14, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .18s;
}
#sheet.show { opacity: 1; }
.sheet-card {
  width: 100%; max-width: 430px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(24px); transition: transform .18s;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
}
#sheet.show .sheet-card { transform: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-head b { font-size: 1rem; }
.sheet-card .tpick { width: 100%; justify-content: center; height: 220px; }
.sheet-card .tpick .wspace { height: 88px; }  /* (220-44)/2 */
.sheet-card .wheel { width: 72px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn-ghost { flex: 1; justify-content: center; padding: 11px; }
.sheet-actions .btn-ok { flex: 2; justify-content: center; padding: 11px; font-size: .92rem; }
@media (min-width: 720px) {
  #sheet { align-items: center; }
  .sheet-card { border-radius: 20px; max-width: 380px; }
}
.tpick {
  position: relative; display: flex; align-items: stretch;
  height: 132px; padding: 0 6px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
  overflow: hidden;
}
.tpick::before {
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 40px; transform: translateY(-50%);
  background: var(--primary-soft); border-radius: 10px; pointer-events: none;
}
.tcolon {
  align-self: center; font-weight: 800; font-size: 1.15rem;
  color: var(--muted); z-index: 1; padding: 0 1px;
}
.wheel {
  width: 58px; overflow-y: auto; position: relative; z-index: 1;
  scroll-snap-type: y mandatory; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel { cursor: grab; }
.wheel.dragging {
  cursor: grabbing; scroll-snap-type: none;
  user-select: none; -webkit-user-select: none;
}
.wheel .wi { cursor: pointer; }
.wspace { height: 44px; flex-shrink: 0; }
.wi {
  height: 44px; display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center; flex-shrink: 0;
  font-size: 1.02rem; color: var(--muted); font-variant-numeric: tabular-nums;
  cursor: default;
}
.wi.sel { color: var(--ink); font-weight: 700; font-size: 1.18rem; }
.ann-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ck.ann { width: 52px; height: 52px; }
.ck.ann .ic { width: 25px; height: 25px; }

/* --------------------------------------------------------------- toast */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 16px; border-radius: 9px; font-size: .88rem; font-weight: 500;
  z-index: 99; max-width: 90vw; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

/* -------------------------------------------------------------- anclas */
.anchors {
  display: flex; gap: 8px; margin: 10px 0;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.anchors::-webkit-scrollbar { display: none; }
.anchors { padding: 3px; }
.anchors button {
  position: relative;
  flex: 1 0 auto; min-width: 112px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); padding: 15px 12px 13px; font-size: .92rem;
  box-shadow: var(--shadow);
}
.anchors button .ic { width: 24px; height: 24px; color: var(--muted); }
.anchors button b { font-weight: 600; }
.anchors button span { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* hecha = tarjeta rellena entera; el borde/outline queda SOLO para el filtro */
.anchors button.done { background: var(--ok); border-color: var(--ok); }
.anchors button.done b, .anchors button.done span,
.anchors button.done .ic { color: var(--ok-ink); }
.anchors button.done span { opacity: .85; }
.anchors button.done .cnt { background: color-mix(in srgb, var(--ok-ink) 22%, transparent); color: var(--ok-ink); }
.anchors button.done .cnt.mid { background: var(--warn); color: #fff; }
.anchors button.sel { outline: 2.5px solid var(--primary-strong); outline-offset: 2px; }
.cnt {
  position: absolute; top: 6px; right: 6px;
  font-style: normal; font-size: .68rem; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  background: var(--line); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cnt.ok { background: var(--ok); color: #fff; }
.cnt.mid { background: var(--warn); color: #fff; }

/* mini-form inline (anclas) */
.flbl {
  display: block; font-size: .68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px;
}
.finp {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit;
  font-size: .88rem;
}

/* ------------------------------------------------------------- progreso */
.progress {
  height: 6px; border-radius: 99px; background: var(--line); overflow: hidden;
}
.progress i {
  display: block; height: 100%; border-radius: 99px;
  background: var(--ok); transition: width .3s;
}

/* --------------------------------------------------------- cambiar PIN */
#pin-form {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px;
  padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line);
}
#pin-form input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: var(--bg); color: var(--ink); font: inherit;
}

/* ---------------------------------------------------------------- informe */
.report { max-width: 860px; }
.report h2 { margin: 8px 0 0; font-size: 1.3rem; }
.report h3 {
  margin: 20px 0 8px; font-size: .95rem;
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.report h4 { margin: 12px 0 6px; font-size: .85rem; color: var(--muted); }
.rtable {
  width: 100%; border-collapse: collapse; font-size: .84rem;
  background: var(--surface);
}
.rtable th, .rtable td {
  border: 1px solid var(--line); padding: 5px 9px; text-align: left;
  vertical-align: top;
}
.rtable th {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--bg);
}

@media print {
  #hdr, #tabs, .no-print, #toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  #view { padding: 0; max-width: none; margin: 0; }
  .report { max-width: none; }
  .muted { color: #555; }
  .rtable, .rtable th, .rtable td { border-color: #bbb; }
  .rtable th { background: #f2f2f2; color: #333; }
}

/* --------------------------------------------- columnas en desktop */
.cols { display: grid; grid-template-columns: 1fr; gap: 0 26px; align-items: start; }

/* -------------------------------------- desktop / ultra-wide: sidebar */
@media (min-width: 900px) {
  #app {
    display: grid; min-height: 100dvh;
    grid-template-columns: 224px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "hdr hdr" "nav main";
  }
  #hdr { grid-area: hdr; }
  #hdr .inner { max-width: none; padding: 0 26px; }
  #tabs {
    grid-area: nav; position: sticky; top: 57px; bottom: auto; left: auto; right: auto;
    align-self: start; height: calc(100dvh - 57px);
    display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 16px 12px; border-top: 0; border-right: 1px solid var(--line);
    background: var(--surface);
  }
  #tabs button {
    flex: none; max-width: none; width: 100%;
    flex-direction: row; justify-content: flex-start; gap: 11px;
    font-size: .88rem; padding: 10px 13px; border-radius: 9px;
  }
  #tabs button:hover { background: var(--bg); }
  #tabs button.sel { background: var(--primary-soft); }
  #tabs button .ic { width: 19px; height: 19px; }
  #view {
    grid-area: main; margin: 0; max-width: 1380px;
    padding: 14px 34px 48px; width: 100%;
  }
}
@media (min-width: 1080px) {
  .cols { grid-template-columns: 1fr 1fr; }
  .cols.cal { grid-template-columns: 5fr 4fr; }
  .rform, .login-box { max-width: 760px; }
}


/* pantallas angostas: compactar filas y botones */
@media (max-width: 400px) {
  .row { gap: 8px; }
  .row .time { min-width: 2.5em; font-size: .8rem; }
  .btn-ok { padding: 7px 10px; font-size: .8rem; }
  .anchors button { min-width: 98px; font-size: .84rem; padding: 12px 10px 10px; }
  #view { padding-left: 10px; padding-right: 10px; }
}
