/* La Aplicación del Hogar — estilos (móvil primero, modo claro y oscuro) */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --surface-3: #e7e3da;
  --ink: #1d2126;
  --ink-2: #545b63;
  --ink-3: #858c94;
  --line: #e4e0d6;
  --accent: #1f7a5a;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1e9;
  --accent-text: #186147;
  --danger: #c0392b;
  --danger-soft: #fbe9e6;
  --warn: #a86a00;
  --warn-soft: #fdf1d8;
  --ok: #1f7a5a;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 10px rgb(0 0 0 / 0.04);
  --shadow-up: 0 -2px 16px rgb(0 0 0 / 0.08);
  --cat-medico: #d64545;
  --cat-familia: #2e9e6a;
  --cat-social: #8e5bd9;
  --cat-pago: #c98a00;
  --cat-viaje: #2f7fd1;
  --cat-trabajo: #5b6b7f;
  --cat-otro: #8a8f98;
  --radius: 16px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --surface: #1b1f24;
    --surface-2: #232830;
    --surface-3: #2c323b;
    --ink: #eceef0;
    --ink-2: #aab1b8;
    --ink-3: #7d858d;
    --line: #2d333b;
    --accent: #4cc38a;
    --accent-ink: #0a1f15;
    --accent-soft: #173428;
    --accent-text: #6fd6a3;
    --danger: #f07b6b;
    --danger-soft: #3a1f1c;
    --warn: #f0b84e;
    --warn-soft: #3a2e14;
    --ok: #4cc38a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-up: 0 -2px 16px rgb(0 0 0 / 0.5);
    --cat-medico: #f07b7b;
    --cat-familia: #5fd19a;
    --cat-social: #b694f0;
    --cat-pago: #f2c14e;
    --cat-viaje: #6faef2;
    --cat-trabajo: #9aa9bc;
    --cat-otro: #a0a6ae;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121417;
  --surface: #1b1f24;
  --surface-2: #232830;
  --surface-3: #2c323b;
  --ink: #eceef0;
  --ink-2: #aab1b8;
  --ink-3: #7d858d;
  --line: #2d333b;
  --accent: #4cc38a;
  --accent-ink: #0a1f15;
  --accent-soft: #173428;
  --accent-text: #6fd6a3;
  --danger: #f07b6b;
  --danger-soft: #3a1f1c;
  --warn: #f0b84e;
  --warn-soft: #3a2e14;
  --ok: #4cc38a;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-up: 0 -2px 16px rgb(0 0 0 / 0.5);
  --cat-medico: #f07b7b;
  --cat-familia: #5fd19a;
  --cat-social: #b694f0;
  --cat-pago: #f2c14e;
  --cat-viaje: #6faef2;
  --cat-trabajo: #9aa9bc;
  --cat-otro: #a0a6ae;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

html.sheet-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0.4em 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.muted { color: var(--ink-3); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.late { color: var(--danger); font-weight: 600; }
.up { color: var(--danger); }
.down { color: var(--ok); }

.splash {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  font-size: 56px;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ------------------------------------------------------------- estructura */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title small { display: block; color: var(--ink-3); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title h1 { font-size: 1.45rem; letter-spacing: -0.01em; }
.topbar-me { text-decoration: none; }
.topbar-me .av { width: 36px; height: 36px; font-size: 1rem; }

.netpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.netpill .ic { width: 16px; height: 16px; }
.netpill.off { background: var(--warn-soft); color: var(--warn); }

.livedot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); opacity: 0.5; }
.livedot.on { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px calc(var(--tabbar-h) + var(--safe-b) + 96px);
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 0 4px var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tabbar a.on { color: var(--accent-text); }
.tabbar a.on .ic { stroke-width: 2.4; }

.fab {
  position: fixed;
  right: max(16px, calc(50% - 304px));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 25;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(0.95); }

/* ------------------------------------------------------------ componentes */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}

.card.list, .list.card { padding: 0; overflow: hidden; }
.card-title { font-size: 0.95rem; margin-bottom: 10px; }
.section-title { font-size: 1rem; margin: 20px 4px 8px; }

.group { margin: 0 0 14px; }
.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 4px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.group-title .count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}

.pill {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  line-height: 18px;
  text-align: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8rem;
  white-space: nowrap;
}
.tag .ic { width: 15px; height: 15px; }
.tag.late { background: var(--danger-soft); color: var(--danger); }
.tag.doing { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* avatares */
.av {
  --c: var(--ink-3);
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}
.av-xs { width: 22px; height: 22px; font-size: 0.68rem; }
.av-none { background: var(--surface-3); color: var(--ink-3); }
.av.turn { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.avatars { display: inline-flex; gap: 2px; }

/* filas de listas */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.row:last-child { border-bottom: 0; }
button.row:active, .row-main:active { background: var(--surface-2); }
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
  background: none;
  border: 0;
  text-align: left;
  border-radius: 8px;
}
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--ink-3);
  font-size: 0.82rem;
}
.row-meta .ic { width: 14px; height: 14px; }
.row-side { flex: none; display: inline-flex; align-items: center; gap: 4px; }

.check {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  background: transparent;
  color: transparent;
  padding: 0;
  position: relative;
}
.check::after { content: ""; position: absolute; inset: -8px; } /* área de toque de 48px */
.check .ic { width: 18px; height: 18px; stroke-width: 3; }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check:not(.static):active { transform: scale(0.9); }
.check.static { width: 26px; height: 26px; }
.check.static .ic { width: 15px; height: 15px; }

.task.doing { background: color-mix(in srgb, var(--warn-soft) 60%, transparent); }
.task.late .check { border-color: var(--danger); }
.task.done .row-title, .item.checked .row-title { text-decoration: line-through; color: var(--ink-3); }

.item.checked .qty { opacity: 0.6; }
.qty {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  vertical-align: 1px;
}

/* botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn .ic { width: 19px; height: 19px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost.danger { color: var(--danger); background: transparent; border-color: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 0.88rem; border-radius: 10px; }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.btn[disabled], .icon-btn[disabled] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
}
.icon-btn:active { background: var(--surface-2); }

.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }

.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.button-row .btn { flex: 1 1 auto; }

/* barra de herramientas y paginación */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.seg {
  display: inline-flex;
  flex: 1;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}
.seg button {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chip-toggle {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.85rem;
}
.chip-toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

.pager { display: flex; align-items: center; gap: 4px; margin: 6px 0 10px; }
.pager h2 { flex: 1; text-align: center; font-size: 1.05rem; }

/* estados vacíos y carga */
.empty { text-align: center; padding: 40px 20px; }
.empty-emoji { font-size: 48px; margin-bottom: 8px; }
.empty h3 { font-size: 1.15rem; margin-bottom: 4px; }
.empty p { color: var(--ink-3); margin-bottom: 16px; }

.allgood {
  padding: 14px 16px;
  margin: 8px 0;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
  text-align: center;
}
.allgood.small { padding: 10px; font-size: 0.92rem; }

.loading { display: flex; justify-content: center; gap: 6px; padding: 48px 0; }
.loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); animation: bounce 0.9s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: 0.15s; }
.loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---------------------------------------------------------------- avisos */

#toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 86px); /* por encima del botón + */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 4px; }
:root:not([data-theme="light"]) .toast button { color: var(--accent); }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* --------------------------------------------------------- hojas inferiores */

dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-up);
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
dialog.sheet.closing { animation: sheet-down 0.18s ease-in forwards; }
dialog.sheet::backdrop { background: rgb(0 0 0 / 0.45); animation: fade 0.2s; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.sheet-form { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-form.busy { opacity: 0.7; pointer-events: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 18px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 1.12rem; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 4px 18px calc(18px + var(--safe-b)); overscroll-behavior: contain; }
.sheet-error {
  margin: 0 18px calc(12px + var(--safe-b));
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
  flex: none;
}
.sheet-actions {
  position: sticky;
  bottom: calc(-18px - var(--safe-b));
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -18px calc(-18px - var(--safe-b));
  padding: 12px 18px calc(12px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.sheet-actions .btn.primary { flex: 1; max-width: 260px; }
.sheet-small .sheet-actions { position: static; }

.action-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.action-list .btn { justify-content: flex-start; }

.detail p { margin: 0 0 10px; }
.detail .tag { margin: 0 4px 4px 0; }
.notes { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.rotation-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.turn-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 3px; border-radius: 99px; background: var(--surface-2); font-size: 0.88rem; }
.turn-pill.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }

.warn-box { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 0.92rem; }
.warn-box ul { margin: 6px 0; padding-left: 18px; }

/* ------------------------------------------------------------ formularios */

.field { display: block; margin: 0 0 14px; }
.field-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field small { display: block; color: var(--ink-3); font-size: 0.8rem; margin-top: 5px; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; min-width: 0; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 16px; /* evita el zoom de iOS al escribir */
  outline: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="date"], input[type="time"] { min-width: 0; }
input[type="search"] { margin-bottom: 10px; }
.search { margin-bottom: 12px; }
.stack .field:last-of-type { margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; border: 0; padding: 0; background: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.chip > span i { font-style: normal; }
.chip input:checked + span, .chip.on > span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-member > span { padding-left: 4px; }
.chip .order { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; }

.switch { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; margin: 0; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.checklist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.check-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; grid-row: span 2; }
.check-row small { color: var(--ink-3); grid-column: 2; font-size: 0.8rem; }
.check-row small:empty { display: none; }
.check-row.disabled { opacity: 0.55; }

.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 40dvh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; font-weight: 600; }
.pick .end { margin-left: auto; color: var(--accent-text); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.colors { display: flex; flex-wrap: wrap; gap: 10px; }
.color-dot { position: relative; cursor: pointer; }
.color-dot input { position: absolute; opacity: 0; }
.color-dot span { --c: #888; display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); }
.color-dot input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }

.form-error { padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: 0.92rem; }

/* ---------------------------------------------------------------- acceso */

.auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.auth-card .field { text-align: left; }
.auth-logo { font-size: 52px; margin-bottom: 6px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card > p { margin-bottom: 20px; }

/* --------------------------------------------------------------------- hoy */

.hello { margin: 4px 4px 14px; }
.hello h2 { font-size: 1.3rem; }
.hello p { color: var(--ink-3); margin: 2px 0 0; }

.home-card .card-head { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: inherit; margin: -4px -6px 6px 0; }
.home-card .card-head h2 { font-size: 1rem; }
.home-card .card-head .ic { color: var(--ink-3); }
.home-card .list { margin: 0 -16px; border-top: 1px solid var(--line); }
.home-card .list:last-child { margin-bottom: -14px; }
.home-card .row { padding-left: 16px; padding-right: 16px; }
.subhead { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin: 10px 0 6px; }
.done-list { list-style: none; margin: 10px 0 0; padding: 0; color: var(--ink-2); font-size: 0.88rem; }
.done-list li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.done-list .ic { width: 16px; height: 16px; color: var(--ok); stroke-width: 3; }
.done-list small { color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.meal-today { display: flex; flex-direction: column; gap: 6px; }
.meal-line { display: flex; justify-content: space-between; gap: 12px; }
.meal-line span { color: var(--ink-2); }
.meal-line b { text-align: right; }
.meal-line b.muted { font-weight: 500; }

.balance-even { color: var(--accent-text); font-weight: 600; }
.debt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.debt-line .amount { color: var(--danger); }

/* ---------------------------------------------------------------- tareas */

.rotation { display: inline-flex; gap: 3px; align-items: center; }
.routine { min-height: 60px; }
.meter-row { display: grid; grid-template-columns: minmax(80px, auto) 1fr auto; align-items: center; gap: 10px; margin: 8px 0; }
.meter-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.meter { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { --c: var(--accent); --pct: 0%; display: block; height: 100%; width: var(--pct); border-radius: 99px; background: var(--c); }
.meter-val { font-weight: 700; min-width: 2ch; text-align: right; }

/* -------------------------------------------------------------- calendario */

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 6px; }
.dow { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--ink-3); padding: 4px 0; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 0 4px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
}
.day .num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 600; font-size: 0.92rem; }
.day.out { background: transparent; color: var(--ink-3); }
.day.today .num { background: var(--accent); color: var(--accent-ink); }
.day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.dots { display: flex; gap: 3px; align-items: center; min-height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cat-otro); }
.dots b { font-size: 0.6rem; line-height: 6px; color: var(--ink-3); }

.cat-medico { --cat: var(--cat-medico); }
.cat-familia { --cat: var(--cat-familia); }
.cat-social { --cat: var(--cat-social); }
.cat-pago { --cat: var(--cat-pago); }
.cat-viaje { --cat: var(--cat-viaje); }
.cat-trabajo { --cat: var(--cat-trabajo); }
.cat-otro { --cat: var(--cat-otro); }
.dots i[class^="cat-"] { background: var(--cat); }

.event { gap: 10px; }
.ev-time { width: 78px; flex: none; font-size: 0.82rem; font-weight: 700; color: var(--ink-2); line-height: 1.2; }
.ev-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--cat, var(--cat-otro)); flex: none; margin: 4px 0; }
.event.clash { background: color-mix(in srgb, var(--warn-soft) 70%, transparent); }
.day-free { padding: 6px 4px; margin: 0; }
.week-day.is-today .group-title { color: var(--accent-text); }
.timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tl-item { display: flex; align-items: stretch; gap: 8px; }
.tl-hour { width: 46px; flex: none; font-weight: 700; font-size: 0.85rem; color: var(--ink-3); padding-top: 18px; }
.tl-item .event { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.tl-item .ev-time { width: auto; min-width: 0; display: none; }

/* ----------------------------------------------------------------- comidas */

.meal-day { padding: 12px 14px 6px; }
.meal-day h3 { font-size: 1rem; margin: 0 0 6px; }
.meal-day h3 .muted { font-weight: 500; font-size: 0.9rem; }
.meal-day.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.meal-day.past { opacity: 0.6; }
.meal-slot {
  display: grid;
  grid-template-columns: 26px 88px 1fr;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  padding: 6px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
}
.slot-ic { font-size: 1.05rem; }
.slot-label { color: var(--ink-3); font-size: 0.88rem; }
.slot-val { font-weight: 600; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.slot-val .ic { width: 16px; height: 16px; color: var(--accent-text); }
.meal-slot.empty .slot-val { color: var(--ink-3); font-weight: 500; }

/* ------------------------------------------------------------------ compra */

.addbar {
  position: sticky;
  top: calc(64px + var(--safe-t));
  z-index: 10;
  display: flex;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 6px 0;
  background: var(--bg);
}
.addbar input { flex: 1; background: var(--surface) !important; }
.addbar .btn { width: 50px; padding: 0; }
.item { min-height: 54px; }
.aisle.cart .group-title { color: var(--ink-3); }

.staples { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.staple {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 96px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow);
}
.staple:active { transform: scale(0.97); }
.st-ic { font-size: 1.4rem; }
.st-name { font-weight: 700; line-height: 1.2; }
.st-name small { font-weight: 500; color: var(--ink-3); }
.st-state { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--accent-text); }
.st-state .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.staple.in { background: var(--accent-soft); border-color: var(--accent); }
.staple.editing .st-state { color: var(--ink-2); }

/* ------------------------------------------------------------------ gastos */

.balance .btn { margin: 8px 8px 0 0; }
.month-summary .big-number { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.budget { margin-top: 10px; }
.budget-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.budget-bar i { --pct: 0%; display: block; height: 100%; width: var(--pct); border-radius: 99px; background: var(--accent); }
.budget.near .budget-bar i { background: var(--warn); }
.budget.over .budget-bar i { background: var(--danger); }
.budget.over p { color: var(--danger); font-weight: 600; }

.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "bar bar"; gap: 4px 10px; }
.cat-name { grid-area: name; font-weight: 600; font-size: 0.92rem; }
.cat-val { grid-area: val; font-weight: 700; font-size: 0.92rem; text-align: right; }
.cat-val small { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.cat-bar { grid-area: bar; height: 8px; }
.cat-bar i { --pct: 0%; display: block; height: 100%; width: var(--pct); min-width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }

.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 130px; margin-top: 10px; }
.tcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; border: 0; background: none; padding: 0; }
.tbar { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.tbar i { --pct: 0%; display: block; width: 100%; height: var(--pct); border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 35%, var(--surface-2)); }
.tcol.sel .tbar i { background: var(--accent); }
.tlabel { font-size: 0.75rem; color: var(--ink-3); font-weight: 600; text-transform: capitalize; }
.tcol.sel .tlabel { color: var(--ink); }

.paid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 8px 0; }
.paid-row .muted { margin-left: auto; font-size: 0.85rem; }

.expense .ex-ic { font-size: 1.35rem; width: 30px; text-align: center; flex: none; }
.ex-amount { font-weight: 800; white-space: nowrap; }
.expense.settle .ex-amount { color: var(--ink-3); font-weight: 700; }

.amount-field .amount-input { display: flex; align-items: center; gap: 8px; }
.amount-field input { font-size: 2rem !important; font-weight: 800; min-height: 60px; text-align: right; }
.amount-input > span { font-size: 1.6rem; font-weight: 700; color: var(--ink-3); }

/* ----------------------------------------------------------------- ajustes */

.member.inactive { opacity: 0.55; }

/* ------------------------------------------------------- pantallas anchas */

@media (min-width: 720px) {
  .view { padding-top: 20px; }
  .tabbar { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
