/* Recordatorios: filas, entrada rápida y popover de posponer. Lo usan views/reminders.html y el widget del Dashboard.
   Solo tokens de shell.css (claro/oscuro salen solos). Tabs: .tabs de shell.css (las de «Tu foco»). */

/* ── Tipos: color de la paleta del logo. Rojo/ámbar quedan solo para estado (vencido/pospuesto). ── */
:root { --t-personal: var(--b-violet); --t-task: var(--b-blue); --t-event: var(--b-magenta); --t-shared: oklch(0.62 0.12 200); }
[data-t="personal"] { --c: var(--t-personal); }
[data-t="task"] { --c: var(--t-task); }
[data-t="event"] { --c: var(--t-event); }
[data-t="shared"] { --c: var(--t-shared); }

/* ── Fila: hora · check · título + etiquetas · acciones ── */
.r-list { list-style: none; margin: 0; padding: 0; }
.r-row {
  position: relative;
  display: grid; grid-template-columns: 52px 22px minmax(0, 1fr) auto; grid-template-areas: "tm chk main end" "tm . sub end";
  align-items: start; column-gap: 12px; padding: 9px 10px; border-radius: var(--r-md);
  transition: background-color var(--dur-fast) var(--ease);
}
.r-row:hover { background: color-mix(in oklch, var(--c) 6%, transparent); }
.r-tm { grid-area: tm; padding-top: 1px; text-align: right; font: 600 13px/20px var(--font); font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.r-tm small { display: block; font-size: 11px; font-weight: 500; line-height: 14px; color: var(--ink-3); }
.r-row.is-late .r-tm, .r-row.is-late .r-tm small { color: var(--late); }
.r-row.is-snoozed .r-tm { color: var(--today); }
.r-row.is-done .r-tm { color: var(--ink-3); font-weight: 500; }
.r-check {
  grid-area: chk; position: relative; z-index: 1; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--c); background: var(--surface); color: var(--c);
  transition: background-color var(--dur-fast) var(--ease), transform 120ms var(--ease);
}
.r-check svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-base) var(--ease); }
.r-check:hover { background: color-mix(in oklch, var(--c) 16%, var(--surface)); }
.r-check:hover svg { opacity: 0.6; transform: none; }
.r-check:active { transform: scale(0.9); }
.r-check[aria-checked="true"] { background: var(--c); color: var(--on-accent); }
.r-check[aria-checked="true"] svg { opacity: 1; transform: none; }
.r-main { grid-area: main; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.r-title { display: block; font-size: 14.5px; font-weight: 550; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--dur-base) var(--ease); }
.r-row.is-done .r-title, .r-row.is-completing .r-title { color: var(--ink-3); }
.r-row.is-done .r-title { text-decoration: line-through; text-decoration-color: color-mix(in oklch, var(--ink-3) 50%, transparent); }
.r-sub { grid-area: sub; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; }
.r-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink-2); font: 550 11.5px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.r-tag svg { width: 12px; height: 12px; flex: none; }
.r-tag.is-kind { background: color-mix(in oklch, var(--c) 12%, var(--surface)); color: color-mix(in oklch, var(--c) 78%, var(--ink)); }
a.r-tag.is-kind:hover { background: color-mix(in oklch, var(--c) 20%, var(--surface)); }
.r-tag.is-snoozed { background: var(--today-soft); color: var(--today); }
.r-av { display: inline-flex; }
.r-av .avatar { border: 2px solid var(--surface); box-sizing: content-box; }
.r-av .avatar + .avatar { margin-left: -6px; }
.r-av .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.r-end { grid-area: end; display: flex; align-items: center; gap: 8px; }
.r-acts { display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.r-row:hover .r-acts, .r-row:focus-within .r-acts, .r-row.is-late .r-acts { opacity: 1; }
.r-acts .icon-btn { width: 28px; height: 28px; }
.r-acts .icon-btn svg { width: 15px; height: 15px; }
.r-act { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 550 12px var(--font); white-space: nowrap; cursor: pointer; transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.r-act svg { width: 13px; height: 13px; }
.r-act:hover { border-color: var(--c); color: var(--ink); }
/* Compacta (widget del Dashboard): las acciones flotan sobre el final de la fila y no le quitan ancho al título */
.r-list.is-compact .r-row { grid-template-columns: 52px 22px minmax(0, 1fr); grid-template-areas: "tm chk main" "tm . sub"; }
.r-list.is-compact .r-end { position: absolute; top: 6px; right: 8px; }
.r-list.is-compact .r-acts { padding-left: 16px; background: linear-gradient(90deg, transparent, var(--surface) 16px); }
.r-list.is-compact .r-row.is-late:not(:hover, :focus-within) .r-acts { opacity: 0; }

/* ── Secciones de la página (Vencidos, Hoy, Mañana…) con raíl de línea de tiempo ── */
.r-sec { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 6px 8px 8px; }
.r-sec-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
.r-sec-h h2 { margin: 0; font: 650 14px var(--font); letter-spacing: -0.01em; }
.r-sec-h .n { min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink-3); font: 600 11.5px/20px var(--font); text-align: center; font-variant-numeric: tabular-nums; }
.r-sec-h .date { color: var(--ink-3); font-size: 12.5px; }
.r-sec-h .sec-act { margin-left: auto; padding: 4px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); font: 550 12.5px var(--font); cursor: pointer; }
.r-sec-h .sec-act:hover { background: var(--hover); color: var(--ink); }
.r-sec.is-late { border-color: color-mix(in oklch, var(--late) 22%, transparent); background: linear-gradient(180deg, var(--late-soft), var(--surface) 70px); }
.r-sec.is-late h2, .r-sec.is-late .sec-act { color: var(--late); }
.r-sec.is-late .n { background: var(--late); color: var(--on-accent); }
.r-sec.is-today h2 { color: var(--accent-ink); }
.r-sec.is-today .n { background: var(--accent-soft); color: var(--accent-ink); }
/* raíl: centro del check = padding 10 + hora 52 + hueco 12 + medio check 11 − medio raíl 1 */
.r-sec .r-row::before, .r-now::before { content: ""; position: absolute; left: 84px; top: 0; bottom: 0; width: 2px; background: var(--line-soft); }
.r-sec .r-list > :first-child::before { top: 20px; }
.r-sec .r-list > :last-child::before { bottom: calc(100% - 20px); }
.r-sec .r-list > :only-child::before { display: none; }
.r-now { position: relative; display: grid; grid-template-columns: 52px 22px 1fr; column-gap: 12px; align-items: center; padding: 2px 10px; }
.r-now b { text-align: right; font: 650 11px var(--font); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.r-now i { position: relative; z-index: 1; justify-self: center; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.r-now::after { content: ""; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), transparent); }
/* Sin fecha: sin columna de hora ni raíl */
.r-sec.is-nodate .r-row { grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "chk main end" ". sub end"; }
.r-sec.is-nodate .r-tm, .r-sec.is-nodate .r-row::before { display: none; }

/* ── Leyenda = filtro por tipo ── */
.r-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.r-legend > span { margin-right: 4px; color: var(--ink-3); font-size: 12.5px; }
.r-lg { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid color-mix(in oklch, var(--c) 28%, transparent); background: color-mix(in oklch, var(--c) 8%, var(--surface));
  color: var(--ink-2); font: 550 12.5px var(--font); transition: opacity var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.r-lg i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.r-lg b { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.r-lg[aria-pressed="false"] { opacity: 0.45; background: none; }

.stagger > * { animation: row-in var(--dur-base) var(--ease) backwards; animation-delay: calc(min(var(--i, 0), 8) * 35ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } }
.r-row.is-new { animation: row-in var(--dur-slow) var(--ease) backwards, new-glow 1800ms var(--ease) backwards; }
@keyframes new-glow { from, 30% { background-color: var(--accent-soft); } }

/* ── Popover de posponer ── */
.r-snooze { min-width: 248px; padding: 6px; }
.r-snooze-h { padding: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.r-snooze .menu-opt small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.r-snooze-custom { display: flex; gap: 6px; padding: 6px 4px 4px; }
.r-snooze-custom .field { flex: 1; min-width: 0; height: 32px; color-scheme: inherit; }

/* ── Estado vacío (mismo que el Dashboard) ── */
.empty { display: grid; place-items: center; gap: 6px; padding: 40px 16px; text-align: center; margin: auto 0; }
.empty-art { width: 64px; height: 48px; margin-bottom: 6px; }
.empty strong { font-size: 15px; }
.empty p { max-width: 36ch; color: var(--ink-3); font-size: 13px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .stagger > *, .r-row.is-new { animation-name: fade-in; }
  .r-check svg { transition: none; }
}
@keyframes fade-in { from { opacity: 0; } }
