/* Tareas · estilo iOS: fondo agrupado, tarjetas blancas redondeadas, filas de 52 px, mucho aire. Celu primero; desde 900 px aparece la barra lateral. */
:root {
  --bg: #F2F2F7; --card: #FFFFFF; --t: #000000; --s: #8E8E93; --s2: #3C3C43; --line: rgba(60, 60, 67, .14);
  --acc: #FF6B2C; --red: #FF3B30; --green: #34C759; --blue: #0A84FF; --amber: #FF9F0A;
  --velo: rgba(0, 0, 0, .35); --comp: rgba(242, 242, 247, .86); --circ: #C7C7CC;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --card: #1C1C1E; --t: #FFFFFF; --s: #8E8E93; --s2: #EBEBF5; --line: rgba(84, 84, 88, .55); --velo: rgba(0, 0, 0, .6); --comp: rgba(0, 0, 0, .8); --circ: #48484A; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--ui); color: var(--t); background: var(--bg); font-size: 17px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
textarea { resize: none; }

/* ---------- Entrar ---------- */
#entrar { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.ent { text-align: center; display: grid; gap: 10px; justify-items: center; width: min(100%, 360px); }
.entIco { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .35); margin-bottom: 8px; }
.ent h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.ent p { margin: 0 0 14px; color: var(--s); font-size: 16px; }
#pinForm { position: relative; }
.pinCajas { display: flex; gap: 12px; justify-content: center; }
.pinCajas i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--s); transition: background .15s, transform .15s; }
.pinCajas i.on { background: var(--t); border-color: var(--t); transform: scale(1.05); }
.pinCajas.mal { animation: sacudir .4s; }
@keyframes sacudir { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-10px) } 75% { transform: translateX(10px) } }
#pin { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 24px; }
.entErr { color: var(--red); font-size: 15px; min-height: 22px; font-weight: 600; }

/* ---------- Estructura ---------- */
#app { display: flex; min-height: 100dvh; }
#lado { display: none; }
#main { flex: 1; min-width: 0; max-width: 720px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 112px) max(16px, env(safe-area-inset-left, 0px)); }
#cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 8px 4px 6px; }
.sub { font-size: 15px; color: var(--s); font-weight: 600; text-transform: lowercase; }
h1#cabTit { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1.05; margin: 2px 0 0; }

/* Píldoras de secciones (celu) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 4px 14px; margin: 0 -4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 13px; border-radius: 999px; background: var(--card); font-size: 15px; font-weight: 600; color: var(--t); border: 1px solid transparent; }
.chip .pt { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--s)); }
.chip .n { color: var(--s); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--t); color: var(--bg); }
.chip.on .n { color: var(--bg); opacity: .7; }
.chip.on .pt { box-shadow: 0 0 0 2px var(--bg); }

/* Foco */
.foco { display: block; width: 100%; text-align: left; background: linear-gradient(135deg, rgba(255, 107, 44, .14), rgba(255, 159, 10, .10)); border: 1px solid rgba(255, 107, 44, .22); border-radius: 18px; padding: 14px 16px; margin: 0 0 18px; display: grid; gap: 6px; }
.foco .etq { margin: 0; color: #C2410C; font-size: 12px; }
.foco b { font-size: 15.5px; font-weight: 600; line-height: 1.4; }
.foco small { font-size: 13.5px; color: var(--s2); opacity: .85; line-height: 1.35; }
.foco small em { font-style: normal; font-weight: 700; }

/* Aviso de primera vez (una sola idea, un botón) */
.card.tip { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 18px; margin: 0 0 18px; position: relative; }
.card.tip > div { flex: 1; display: grid; gap: 2px; }
.card.tip b { font-size: 16px; }
.card.tip span { font-size: 14px; color: var(--s); }
.btn { background: var(--acc); color: #fff; font-weight: 700; font-size: 15px; padding: 9px 16px; border-radius: 999px; }
.card.tip .x { color: var(--s); font-size: 20px; line-height: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }

/* Grupos y tarjetas */
.etq { font-size: 13px; font-weight: 600; color: var(--s); text-transform: uppercase; letter-spacing: .04em; padding: 0 16px; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.etq.rojo { color: var(--red); }
.etq .n { font-weight: 600; color: var(--s); text-transform: none; letter-spacing: 0; }
.etq.tog { cursor: pointer; }
.etq.tog svg { width: 14px; height: 14px; transition: transform .2s; }
.etq.tog.abierto svg { transform: rotate(90deg); }
.card { background: var(--card); border-radius: 16px; overflow: hidden; }
.vacio { color: var(--s); font-size: 15px; padding: 14px 16px; }
.libre { color: var(--s); font-size: 14px; padding: 2px 16px 0; margin-top: -2px; }

/* Fila */
.fila { position: relative; display: grid; grid-template-columns: 44px 1fr; align-items: center; min-height: 54px; background: var(--card); touch-action: pan-y; }
.fila + .fila::before { content: ""; position: absolute; left: 56px; right: 0; top: 0; border-top: 1px solid var(--line); }
.fila .cuerpo { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 16px 13px 0; min-width: 0; cursor: pointer; }
.fila .txt { min-width: 0; display: grid; gap: 3px; }
.fila .tt { font-size: 17px; line-height: 1.3; word-wrap: break-word; }
.fila .meta { font-size: 13.5px; color: var(--s); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fila .meta .sep { opacity: .5; }
.fila .nota { font-size: 13.5px; color: var(--s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .meta .pt { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--s)); }
.fila .meta .ven { color: var(--red); font-weight: 600; }
.fila .meta .hoyd { color: var(--acc); font-weight: 600; }
.fila .pri { font-weight: 800; letter-spacing: -.05em; margin-right: 4px; }
.fila .pri.a { color: var(--red); } .fila .pri.m { color: var(--amber); }
.fila .rep { font-size: 12px; }
.fila.hecha .tt { color: var(--s); text-decoration: line-through; text-decoration-color: var(--circ); }
.fila .circ { width: 44px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; margin-left: 6px; align-self: start; }
.fila .circ i { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--circ); display: grid; place-items: center; transition: background .15s, border-color .15s, transform .15s; }
.fila .circ svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.fila.hecha .circ i { background: var(--c, var(--acc)); border-color: var(--c, var(--acc)); }
.fila.hecha .circ svg { opacity: 1; transform: scale(1); }
.fila .circ:active i { transform: scale(.9); }
.fila .del { position: absolute; right: 0; top: 0; bottom: 0; width: 88px; background: var(--red); color: #fff; font-weight: 700; font-size: 15px; display: grid; place-items: center; transform: translateX(100%); transition: transform .2s; }
.fila .mov { transition: transform .2s; }
.fila.abierta .mov { transform: translateX(-88px); }
.fila.abierta .del { transform: translateX(0); }
.fila .mov { display: grid; grid-template-columns: 44px 1fr; align-items: start; background: var(--card); grid-column: 1 / -1; }
.fila.nueva { animation: aparecer .25s ease-out; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.pie { text-align: center; color: var(--s); font-size: 14px; padding: 26px 0 0; }
.pie a { color: var(--acc); font-weight: 600; text-decoration: none; }

/* Compositor abajo (como WhatsApp) */
.comp { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(16px, env(safe-area-inset-left, 0px)); background: var(--comp); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); border-top: 1px solid var(--line); z-index: 20; }
.comp input { flex: 1; min-width: 0; height: 46px; border-radius: 23px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; font-size: 17px; outline: none; }
.comp input:focus { border-color: var(--acc); }
.comp button { width: 46px; height: 46px; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 6px 16px -8px rgba(255, 107, 44, .8); transition: transform .12s; }
.comp button:active { transform: scale(.94); }

/* Hoja (sheet) */
.hoja { position: fixed; inset: 0; z-index: 40; }
.hoja .velo { position: absolute; inset: 0; background: var(--velo); }
.hoja .panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; background: var(--bg); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: subir .25s ease-out; box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); }
@keyframes subir { from { transform: translateY(40px); opacity: .6 } to { transform: none; opacity: 1 } }
.asa { width: 38px; height: 5px; border-radius: 3px; background: var(--circ); margin: 8px auto 0; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 6px; }
.ph b { font-size: 17px; font-weight: 700; }
.txtbtn { color: var(--acc); font-size: 17px; padding: 8px 4px; min-width: 70px; text-align: left; }
.txtbtn.fuerte { font-weight: 700; text-align: right; }
.pc { overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.pc .etq { margin: 18px 0 8px; }
.card.ins { padding: 4px 16px; }
.card.ins textarea { display: block; width: 100%; border: 0; background: none; outline: none; padding: 12px 0; font-size: 17px; line-height: 1.35; }
.card.ins textarea + textarea { border-top: 1px solid var(--line); font-size: 16px; color: var(--s2); }
.card.ins textarea::placeholder { color: var(--s); }
#fTit { font-weight: 600; }
.opc { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.opc button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 13px; border-radius: 999px; background: var(--bg); font-size: 15px; font-weight: 600; border: 1px solid transparent; }
.opc button .pt { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--s)); }
.opc button.on { background: var(--t); color: var(--bg); }
.opc button.on .pt { box-shadow: 0 0 0 2px var(--bg); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); margin: 12px 16px; padding: 3px; border-radius: 11px; background: var(--bg); }
.seg button { padding: 8px 0; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--s2); }
.seg button.on { background: var(--card); color: var(--t); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.rowi { display: flex; justify-content: space-between; align-items: center; min-height: 50px; padding: 6px 16px; border-top: 1px solid var(--line); font-size: 17px; }
.rowi input[type=date] { border: 0; background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 16px; color: var(--t); }
.sw { position: relative; width: 51px; height: 31px; flex: 0 0 auto; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 16px; background: var(--circ); transition: background .2s; }
.sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s; }
.sw input:checked + i { background: var(--green); }
.sw input:checked + i::after { transform: translateX(20px); }
.peligro { display: block; width: 100%; margin-top: 22px; padding: 14px; border-radius: 14px; background: var(--card); color: var(--red); font-size: 17px; font-weight: 600; }
.ayuda { color: var(--s); font-size: 13.5px; padding: 0 16px; margin: 14px 0 0; line-height: 1.4; }

/* Aviso abajo (toast) */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 86px); transform: translateX(-50%); z-index: 50; display: flex; gap: 16px; align-items: center; background: var(--t); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px); animation: aparecer .2s; }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(62vw, 420px); }
.toast button { color: var(--acc); font-weight: 700; font-size: 15px; flex: 0 0 auto; }

/* ---------- Escritorio (desde 900 px): barra lateral + columna ---------- */
@media (min-width: 900px) {
  body { font-size: 16px; }
  #lado { display: flex; flex-direction: column; gap: 4px; width: 264px; flex: 0 0 264px; padding: 26px 14px; background: var(--card); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
  .lItem { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; width: 100%; text-align: left; color: var(--t); }
  .lItem:hover { background: var(--bg); }
  .lItem.on { background: var(--t); color: var(--bg); }
  .lItem .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--c, var(--s)); color: #fff; flex: 0 0 auto; }
  .lItem .ico svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .lItem .n { margin-left: auto; color: var(--s); font-variant-numeric: tabular-nums; font-weight: 600; }
  .lItem.on .n { color: var(--bg); opacity: .75; }
  .lTit { font-size: 12px; color: var(--s); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 20px 12px 6px; }
  .lPie { margin-top: auto; padding: 12px; }
  .lPie button { color: var(--s); font-size: 14px; }
  .chips { display: none; }
  #main { max-width: 760px; padding: 30px 40px 120px; }
  h1#cabTit { font-size: 32px; }
  .fila .tt { font-size: 16px; }
  .fila .cuerpo { cursor: pointer; }
  .fila .cuerpo:hover .tt { color: var(--acc); }
  .fila .del { display: none; }
  .comp { left: 264px; justify-content: center; }
  .comp input { max-width: 640px; }
  .comp > * { position: relative; }
  .hoja .panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 520px; max-height: 86dvh; border-radius: 20px; animation: none; }
  .asa { display: none; }
  .ph { padding-top: 16px; }
  .toast { bottom: 100px; }
}
