/* Calendario: semana (rejilla de horas), día (tira de la semana + un día), mes (7×6) y editor de bloques. */
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg--end { margin-left: auto; }

/* Rejilla de horas (06:00–24:00). --hour: alto de una hora. */
.cal-week { padding: 0; overflow: hidden; --hour: 42px; --cols: 7; }
.cal-head { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-head__day { padding: 10px 6px; text-align: center; border-left: 1px solid var(--line); font-size: 14px; font-weight: 600; background: transparent; border-top: 0; border-right: 0; border-bottom: 0; color: var(--ink); }
.cal-head__day small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 500; }
.cal-head__day b { display: block; }
.cal-head__day--today { background: var(--now-bg); }
.cal-head__day--today small { color: var(--now-ink); font-weight: 600; }
.cal-head__day--today b { width: 26px; height: 26px; margin: 0 auto; border-radius: 50%; background: var(--now); color: #fff; font-weight: 700; display: grid; place-items: center; }
.cal-body { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(0, 1fr)); }
.cal-hours { position: relative; height: calc(var(--hour) * 18); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-hours span { position: absolute; right: 6px; transform: translateY(-50%); }
.cal-day { position: relative; height: calc(var(--hour) * 18); border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line-2) 0 1px, transparent 1px var(--hour)); }
.cal-day--today { background-color: color-mix(in srgb, var(--now-bg) 55%, var(--surface)); }
.b {
  position: absolute; left: 4px; right: 4px; border-radius: 7px; border: 0; border-left: 3px solid; padding: 3px 7px;
  text-align: left; font-size: 11.5px; line-height: 1.25; font-weight: 600; color: var(--ink); overflow: hidden;
  display: flex; gap: 4px; align-items: flex-start; background: var(--cat-rutina-bg); border-color: var(--cat-rutina);
}
.b small { display: block; font-weight: 400; color: var(--ink-2); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b > span { min-width: 0; overflow: hidden; }
.b--w { background: var(--cat-trabajo-bg); border-color: var(--cat-trabajo); }
.b--s { background: var(--cat-salud-bg); border-color: var(--cat-salud); }
.b--o { background: var(--cat-social-bg); border-color: var(--cat-social); }
.b--p { background: var(--cat-personal-bg); border-color: var(--cat-personal); }
.b--e { background: var(--surface); border: 1.5px solid var(--cat-trabajo); border-left-width: 3px; }
.b--ghost { background: transparent; border: 1.5px dashed var(--box-line); color: var(--muted); }
.b--now { box-shadow: 0 0 0 2px var(--now); }
.b--over { box-shadow: -2px 0 0 var(--surface), 0 2px 8px rgb(0 0 0 / .12); }
.b--tiny { padding: 1px 7px; line-height: 1.1; }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--cat-rutina); margin-top: 1px; background: var(--surface); }
.dot--on { background: var(--accent); border-color: var(--accent); }
.dot--half { background: linear-gradient(90deg, var(--accent) 50%, var(--surface) 50%); border-color: var(--accent); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* Vista de un día */
.cal-strip { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 6px; }
.dy { display: grid; justify-items: center; gap: 4px; padding: 6px 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.dy b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--ink); text-transform: none; }
.dy[aria-pressed="true"] b { background: var(--now); color: #fff; }
.dy i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.dy i.on { background: var(--accent); }
.dy--today b { box-shadow: inset 0 0 0 1.5px var(--now); }
.cal-week--one { --cols: 1; }
.cal-week--one .cal-head { display: none; }
.cal-week--one .b { font-size: 13px; padding: 4px 9px; border-radius: 9px; left: 8px; right: 6px; }
.cal-week--one .b small { font-size: 11px; }
.cal-week--one .dot { width: 14px; height: 14px; }
@media (max-width: 1023px) { .cal-week--one { --hour: 34px; } }

/* Mes */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-month__head { background: var(--surface); padding: 8px 6px; text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.cal-month__day { background: var(--surface); min-height: 92px; padding: 8px; text-align: left; border: 0; display: flex; flex-direction: column; gap: 4px; color: var(--ink); font-size: 12px; }
.cal-month__day--out { color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.cal-month__day--today .cal-month__num { background: var(--now); color: #fff; }
.cal-month__num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.cal-month__meta { color: var(--muted); font-size: 11px; display: flex; flex-direction: column; gap: 2px; }
.cal-month__train { width: 6px; height: 6px; border-radius: 50%; background: var(--done); display: inline-block; margin-right: 4px; }
@media (max-width: 1023px) { .cal-month__day { min-height: 64px; padding: 5px; } .cal-month__meta { font-size: 10px; } }

/* Hábitos y tareas del día (columna derecha en escritorio, debajo en móvil) */
.cal-aside { display: flex; flex-direction: column; gap: 16px; }
.cal-tasks .chk + .chk { border-top: 1px solid var(--line-2); }

/* Editor de bloque (ventana / hoja) */
.block-form { display: grid; gap: 12px; }
.block-form .days { display: flex; flex-wrap: wrap; gap: 6px; }
.block-form .days label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.block-form .days input { accent-color: var(--now); margin: 0; }
.block-form__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.block-form__foot .btn--danger { color: var(--danger); }
.block-form__actions { display: flex; gap: 8px; margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.switch input { accent-color: var(--now); width: 18px; height: 18px; margin: 0; }
