/* Fuentes auto-alojadas (la CSP no permite cargarlas de fuera). Figtree es variable: un solo fichero cubre 400–800. */
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/fonts/figtree-latin.woff2") format("woff2"); }
/* Material Symbols Rounded: subconjunto con solo los iconos usados y el eje FILL (0..1). Para añadir uno hay que volver a generar el fichero (docs/APLICACION.md). */
@font-face { font-family: "Material Symbols Rounded"; font-style: normal; font-weight: 400; font-display: block; src: url("/fonts/material-symbols-rounded.woff2") format("woff2"); }

:root {
  color-scheme: light dark; /* controles nativos (selector de fecha, teclado) acordes al tema */
  --bg: #f4f5f1; --card: #ffffff; --text: #1d2521; --muted: #66726c; --line: #e3e7e2; --seg: #e9ece7;
  --bar: rgba(255, 255, 255, .86);
  --primary: #1f6f5c; --primary-text: #ffffff; --tint: #e1eee8; --star: #e8a317; --danger: #b3261e;
  --p2: #8a4f86; --p2-tint: #f3e7f2;
  --warn: #8a5a00; --warn-bg: #fff3d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412; --card: #1a201d; --text: #e8ede9; --muted: #9aa7a0; --line: #29312d; --seg: #232a26;
    --bar: rgba(26, 32, 29, .86);
    --primary: #3aa88c; --primary-text: #0b1210; --tint: #1a2d26; --star: #f0b43a; --danger: #ff8a80;
    --p2: #d6a0d2; --p2-tint: #2f2231;
    --warn: #ffd37a; --warn-bg: #3a2f10;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.35 Figtree, -apple-system, BlinkMacSystemFont, sans-serif; -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
body.sheet-open { overflow: hidden; }
button, input, textarea, select { font-family: inherit; }
[hidden] { display: none !important; }

/* Iconos: el nombre va en data-i y se pinta con la ligadura de la fuente (así el texto del nodo queda vacío) */
.ms { display: inline-block; flex: none; font-family: "Material Symbols Rounded"; font-weight: 400; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; font-variation-settings: "FILL" 0; user-select: none; }
.ms::before { content: attr(data-i); }
.ms.fill { font-variation-settings: "FILL" 1; }

/* Personas: yo = verde de la marca, la otra persona = morado, sin asignar = gris */
.p-me { --pc: var(--primary); --pt: var(--tint); }
.p-other { --pc: var(--p2); --pt: var(--p2-tint); }
.p-none { --pc: var(--muted); --pt: var(--seg); }
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pc); color: var(--card); font-size: 12px; font-weight: 700; line-height: 1; }
.avatar::before { content: attr(data-initial); }

.loading, .center { text-align: center; color: var(--muted); margin-top: 30vh; }
main { max-width: 640px; margin: 0 auto; padding: 6px 20px calc(124px + env(safe-area-inset-bottom)); }
h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.screen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0 18px; }
.screen-head .titles { min-width: 0; }
.sub { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; padding-top: 6px; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 16px; background: var(--primary); color: var(--primary-text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; }
.pill-btn .ms { font-size: 20px; }
.pill-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 700; }
.round-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--text); cursor: pointer; }
.round-btn.big { width: 44px; height: 44px; }
.round-btn:disabled { opacity: .6; cursor: default; }
.link-btn { border: 0; background: transparent; padding: 8px 0 8px 8px; color: var(--primary); font-size: 14px; font-weight: 700; cursor: pointer; }

.login { text-align: center; margin-top: 22vh; padding: 0 24px; }
.login img { width: 96px; height: 96px; border-radius: 22px; }
.login p { color: var(--muted); }
.login .error { color: var(--danger); }

/* Formularios de añadir */
.add { display: flex; gap: 8px; margin-bottom: 18px; }
.add input { flex: 1; min-width: 0; min-height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); font: inherit; font-size: 16px; /* 16px evita el zoom de iOS */ }
.add .btn { min-height: 50px; }

/* Tarjetas y filas */
.items { list-style: none; margin: 0 0 14px; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; min-height: 56px; padding: 16px 0 16px 16px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.check { flex: none; width: 24px; height: 24px; border: 2px solid var(--primary); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--primary-text); }
.check .ms { font-size: 17px; }
.done .check { background: var(--primary); }
.item-main .text { min-width: 0; line-height: 24px; /* igual que la casilla: la primera línea queda alineada */ overflow-wrap: anywhere; /* una URL o una palabra larga se parte en vez de cortarse */ }
.done .text { color: var(--muted); text-decoration: line-through; }
.item-star, .item-del { flex: none; align-self: flex-start; height: 56px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.item-star { width: 44px; }
.item-star .ms { font-size: 22px; }
.item-star.on { color: var(--star); }
.item-star.on .ms { font-variation-settings: "FILL" 1; }
.item-del { width: 48px; }
.item-del .ms { font-size: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 4px 8px; }
.card-head .label { font-size: 14px; font-weight: 700; color: var(--muted); }
.empty { padding: 18px; color: var(--muted); text-align: center; }
.empty-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 20px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.empty-card .ms { font-size: 40px; }
.banner { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.error { margin: 0 0 12px; color: var(--danger); font-size: 15px; font-weight: 600; }

/* Barra de pestañas inferior */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; height: calc(86px + env(safe-area-inset-bottom)); padding: 0 calc(8px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(8px + env(safe-area-inset-left)); background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.tab { flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.tab .pillicon { display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: 15px; background: transparent; transition: background .2s; }
.tab .ms { font-size: 23px; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"] .pillicon { background: var(--tint); }
.tab[aria-current="page"] .ms { font-variation-settings: "FILL" 1; }

/* Aviso breve */
.toast-region { position: fixed; left: 20px; right: 20px; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 40; display: flex; justify-content: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 600px; padding: 13px 16px; border-radius: 16px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.toast .ms { font-size: 20px; }

/* Hojas inferiores */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .28s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; height: min(760px, 90dvh); display: flex; flex-direction: column; background: var(--bg); border-radius: 30px 30px 0 0; transform: translateY(105%); transition: transform .34s cubic-bezier(.2, .8, .2, 1); outline: none; }
.sheet.tall { height: min(780px, 92dvh); }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-handle { width: 38px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--line); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 20px 12px; }
.sheet-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.sheet-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--seg); color: var(--text); cursor: pointer; }
.sheet-close .ms { font-size: 20px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 20px 20px; }
.sheet-foot { padding: 12px 20px calc(34px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .btn { width: 100%; min-height: 52px; font-size: 17px; }

/* Habituales */
.common-open .ms { color: var(--star); font-variation-settings: "FILL" 1; }
.common-section { margin-bottom: 18px; }
.common-section h3 { margin: 0 4px 8px; font-size: 14px; font-weight: 700; color: var(--muted); }
.common-section .items { border-radius: 18px; margin-bottom: 0; }
.common-item { border-bottom: 1px solid var(--line); }
.common-item:last-child { border-bottom: 0; }
.common-label { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; }
.common-label input { position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; left: 16px; }
.common-label .box { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--muted); border-radius: 7px; color: #fff; }
.common-label .box .ms { font-size: 17px; visibility: hidden; }
.common-label input:checked + .box { background: var(--primary); border-color: var(--primary); }
.common-label input:checked + .box .ms { visibility: visible; }
.common-label input:disabled + .box { background: var(--line); border-color: var(--line); }
.common-label input:focus-visible + .box { outline: 2px solid var(--primary); outline-offset: 2px; }
.common-label .text { flex: 1; overflow-wrap: anywhere; }
.common-label input:disabled ~ .text { color: var(--muted); }
.common-note { flex: none; font-size: 13px; color: var(--muted); }

/* Calendario */
.cal-days-strip { display: flex; gap: 6px; margin: 0 -20px 18px; padding: 0 20px 2px; overflow-x: auto; scrollbar-width: none; }
.cal-days-strip::-webkit-scrollbar { display: none; }
.day-chip { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 46px; height: 68px; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); cursor: pointer; }
.day-chip .dow { font-size: 12px; font-weight: 600; opacity: .75; }
.day-chip .num { font-size: 19px; font-weight: 800; line-height: 1.1; }
.day-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day-chip[data-has-events="true"] .dot { background: var(--primary); }
.day-chip.today { border-color: var(--primary); }
.day-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.day-chip[aria-pressed="true"] .dot { background: transparent; }
.day-chip[aria-pressed="true"][data-has-events="true"] .dot { background: var(--primary-text); }
.refresh-btn.spinning .ms { animation: giro .6s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.loading-inline { color: var(--muted); text-align: center; margin: 0 0 16px; font-size: 14px; }
.cal-day { margin-bottom: 18px; }
.cal-day-title { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 8px; font-size: 15px; font-weight: 800; }
.cal-day-title .detail { font-size: 14px; font-weight: 400; color: var(--muted); }
.cal-day-title.today { color: var(--primary); }
.cal-events { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.cal-event { border-bottom: 1px solid var(--line); }
.cal-event:last-child { border-bottom: 0; }
.cal-event-btn { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 14px 16px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cal-time { flex: none; width: 52px; display: flex; flex-direction: column; }
.cal-time .t1 { font-size: 14px; font-weight: 700; color: var(--primary); }
.cal-time .t2 { font-size: 13px; color: var(--muted); }
.cal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-title { font-weight: 700; overflow-wrap: anywhere; }
.cal-loc, .cal-desc { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.cal-loc { display: flex; align-items: center; gap: 4px; }
.cal-loc .ms { font-size: 16px; }
.cal-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Formulario de evento (hoja) */
.cal-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 20px 0; }
.sheet-bar h2 { margin: 0; font-size: 17px; font-weight: 800; }
.bar-btn { min-width: 64px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 17px; font-weight: 500; cursor: pointer; }
.bar-btn.cancel { text-align: left; }
.bar-btn.save { text-align: right; font-weight: 800; }
.bar-btn:disabled { opacity: .45; cursor: default; }
.cal-form .sheet-body { display: flex; flex-direction: column; gap: 16px; padding: 8px 20px 40px; }
.title-input { width: 100%; height: 56px; padding: 0 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); font-size: 20px; font-weight: 700; }
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.form-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: 0; }
.form-row > .ms { color: var(--muted); font-size: 22px; }
.form-row .row-label { flex: 1; min-width: 0; }
.form-row input[type="text"] { flex: 1; min-width: 0; height: 100%; min-height: 54px; border: 0; background: transparent; color: var(--text); font-size: 16px; outline: none; }
.form-row.top { align-items: flex-start; padding-top: 14px; }
.form-row textarea { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1.35; resize: none; outline: none; padding: 0 0 12px; }
.form-row input[type="date"], .form-row input[type="datetime-local"] { height: 38px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--seg); color: var(--text); font-size: 15px; font-weight: 600; min-width: 0; }
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background .2s; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked ~ .track { background: var(--primary); }
.switch input:checked ~ .knob { transform: translateX(20px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.form-error { margin: 0; color: var(--danger); font-size: 15px; font-weight: 600; }
.form-note { margin: 0; font-size: 13px; color: var(--muted); }
.legal { font-size: 14px; margin-top: 28px; }
.legal a { color: var(--muted); }
main h2 { font-size: 18px; margin: 20px 0 6px; }
main ul { padding-left: 20px; }
main ul.items, main ul.cal-events { padding-left: 0; }

/* Inicio */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0 20px; }
.home-head .date { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.avatar-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-size: 17px; font-weight: 700; cursor: pointer; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 52px; z-index: 5; min-width: 150px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.menu button { width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; }
.home-cards { display: flex; flex-direction: column; gap: 14px; }
.home-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.home-card-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.home-card-head .badge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint); color: var(--primary); }
.home-card-head .badge .ms { font-size: 19px; }
.home-card-head .name { font-size: 17px; font-weight: 700; }
.home-card-head .extra { margin-left: auto; font-size: 14px; color: var(--muted); }
.home-card-head .extra.link { font-weight: 600; color: var(--primary); }
.home-card-head .chev { flex: none; font-size: 20px; color: var(--primary); }
.home-card-head .extra + .chev { margin-left: 0; }
.home-card-head .name + .chev { margin-left: auto; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--primary); color: var(--primary-text); font-size: 13px; font-weight: 700; }
.home-rows { list-style: none; margin: 0; padding: 0; }
.home-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 11px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.home-row .when { flex: none; width: 76px; font-size: 14px; font-weight: 700; color: var(--primary); }
.home-row .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.home-row .what b { font-weight: 600; }
.home-row .where { display: block; font-size: 14px; color: var(--muted); }
.home-empty { margin: 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.quick-add { display: flex; gap: 8px; }
.quick-add input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--bg); color: var(--text); font-size: 16px; }
.quick-add .square { flex: none; width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 14px; background: var(--primary); color: var(--primary-text); cursor: pointer; }

/* Tareas */
.seg { display: flex; gap: 0; margin-bottom: 14px; padding: 4px; border-radius: 14px; background: var(--seg); }
.filter { flex: 1; min-width: 0; height: 38px; padding: 0 6px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.task-add { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; padding: 6px 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.task-add input[type="text"] { width: 100%; height: 46px; padding: 0 10px; border: 0; background: transparent; color: var(--text); font-size: 17px; outline: none; }
.task-add-row { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.assign-chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.assign-chips::-webkit-scrollbar { display: none; }
.assign-chip { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px 0 5px; border: 1px solid var(--line); border-radius: 17px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.assign-chip .avatar { background: var(--seg); color: var(--muted); }
.assign-chip[aria-pressed="true"] { border-color: var(--pc); background: var(--pt); color: var(--pc); }
.assign-chip[aria-pressed="true"] .avatar { background: var(--pc); color: var(--card); }
.task-add .btn { flex: none; margin-left: auto; min-height: 38px; padding: 0 16px; border-radius: 12px; font-size: 15px; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) 50px; }
.task .item-main { grid-column: 1; grid-row: 1; justify-self: stretch; width: 100%; min-height: 54px; padding: 15px 0 8px 16px; }
.task .item-del { grid-column: 2; grid-row: 1; width: 50px; height: 54px; }
.task:not(.owned) .item-main { padding-bottom: 15px; }
.task .item-assign { grid-column: 1; grid-row: 2; justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 28px; margin: 0 0 13px 52px; padding: 0 8px 0 3px; max-width: calc(100% - 64px); border: 0; border-radius: 14px; background: var(--pt); color: var(--pc); font-size: 13px; font-weight: 700; cursor: pointer; }
.task .item-assign .avatar { width: 22px; height: 22px; font-size: 11px; }
.task .item-assign .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .item-assign .ms { font-size: 16px; }
.task.done { grid-template-columns: minmax(0, 1fr) auto 50px; align-items: center; }
.task.done .item-main { grid-row: 1; min-height: 54px; padding: 15px 0 15px 16px; }
.task.done .avatar { width: 22px; height: 22px; font-size: 11px; grid-column: 2; grid-row: 1; background: var(--pt); color: var(--pc); }
.task.done .item-del { grid-column: 3; }

/* Avisos */
.push-toggle .ms { font-size: 22px; }
.push-toggle:disabled { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .switch .track, .switch .knob, .tab .pillicon { transition: none; }
  .refresh-btn.spinning .ms { animation: none; }
}

/* ---- Fecha límite de las tareas ---- */
.due-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 0 10px; color: var(--muted); font-size: 14px; font-weight: 700; }
.due-field .due-input { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--seg); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; }
.task .item-meta { grid-column: 1; grid-row: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 13px 52px; min-width: 0; }
.task .item-meta .item-assign { margin: 0; }
.due-wrap { display: inline-flex; align-items: center; gap: 2px; }
.item-due { position: relative; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--seg); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.item-due.empty { background: transparent; border: 1px dashed var(--line); padding: 0 9px; }
.item-due.overdue { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
/* El selector nativo cubre la etiqueta sin verse: tocarla abre el calendario del móvil */
.item-due .due-pick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.item-due:focus-within, .due-clear:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.due-clear { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: -6px -4px -6px 0; border-radius: 20px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.due-clear .ms { font-size: 16px; }
.task.done .item-meta { display: none; }
.cal-task .cal-time .t1 { color: var(--muted); }
.cal-task.overdue .cal-time .t2 { color: var(--danger); font-weight: 700; }
