/* CoFam — Ocean & Coral. Titular = teal, coparent = coral. */
:root {
  --navy: #183F4B; --navy-2: #0F2B33; --teal: #4B9B9A; --teal-ink: #2F7B7A; --aqua: #DFF1ED;
  --ivory: #F8FAF9; --white: #FFFFFF; --coral: #E79C87; --coral-soft: #FBE7E0; --coral-ink: #B9634B;
  --muted: #5B7A80; --line: #D6E6E2; --ok: #2F8A6E; --warn: #B9634B; --amber-soft: #FFF3DC; --amber: #8A5A00;
  --radius: 18px;
  --display: "Poppins", "Avenir Next", system-ui, sans-serif;
  --body: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: var(--body); background: var(--ivory); color: var(--navy); font-size: 15px; line-height: 1.45; min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
p { margin: 0; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* Barra superior */
#topbar { background: var(--navy); color: var(--white); padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px; position: sticky; top: 0; z-index: 10; }
.tb-row { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; }
.tb-logo { width: 34px; height: 34px; border-radius: 9px; }
.tb-titles { flex: 1; min-width: 0; }
#title { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sub { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: rgba(255,255,255,.1); border: 0; color: var(--white); width: 40px; height: 40px; border-radius: 12px; font-size: 24px; line-height: 1; cursor: pointer; flex: none; }
.live { width: 8px; height: 8px; border-radius: 50%; background: #7FD3B4; box-shadow: 0 0 0 3px rgba(127,211,180,.25); }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 640px; margin: 10px auto 0; }
.month-label { background: none; border: 0; color: var(--white); font-family: var(--display); font-weight: 600; font-size: 18px; cursor: pointer; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view { display: grid; gap: 14px; }
.center-msg { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--white); border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); }
.card.flush { padding: 4px 14px; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span:first-child, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--ivory); border-radius: 12px; padding: 12px; font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--teal); }
.pass { position: relative; display: block; }
.pass input { padding-right: 48px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 18px; cursor: pointer; padding: 6px; }
.big-amt .amt-input { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--ivory); border-radius: 14px; padding: 4px 12px; }
.big-amt .amt-input b { font-family: var(--display); font-size: 26px; color: var(--muted); }
.big-amt .amt-input:focus-within { outline: 3px solid var(--teal); outline-offset: 2px; }
.big-amt input:focus-visible { outline: none; }
.big-amt input { border: 0 !important; background: none !important; font-family: var(--display); font-size: 28px; font-weight: 700; padding: 6px 0 !important; }
.msg { font-size: 14px; background: var(--aqua); color: var(--navy); border-radius: 12px; padding: 10px 12px; }
.msg.err { background: var(--coral-soft); color: var(--coral-ink); }

.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-family: var(--display); font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--navy); color: var(--white); }
.btn.teal { background: var(--teal); color: var(--white); }
.btn.coral { background: var(--coral); color: var(--navy-2); }
.btn.ghost { background: var(--aqua); color: var(--navy); }
.btn.danger-ghost { background: none; color: var(--coral-ink); border: 1px solid var(--coral-soft); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--teal-ink); font-weight: 600; cursor: pointer; padding: 6px; justify-self: center; }
.link-btn.left { justify-self: start; padding-left: 0; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }

.seg { display: flex; background: var(--ivory); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: none; padding: 10px 8px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--navy); color: var(--white); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 8px 13px; font-size: 14px; font-weight: 500; cursor: pointer; }
.pill.on { background: var(--teal); border-color: var(--teal); color: var(--white); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle > span { display: grid; gap: 2px; }
.toggle small { font-size: 12.5px; }
.toggle input { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--white); top: 3px; left: 3px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--teal); }
.toggle input:checked::after { left: 21px; }
.file-drop { display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; cursor: pointer; color: var(--muted); font-size: 14px; }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop::before { content: "📎"; }

/* Cuenta */
.auth-hero { display: grid; justify-items: center; gap: 6px; padding: 18px 0 6px; text-align: center; }
.auth-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 14px 30px -16px rgba(24,63,75,.6); }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: -.03em; }
.wordmark span:last-child { color: var(--teal); }
.tagline { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.lang-row { display: flex; justify-content: center; gap: 6px; }
.lang-row button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.lang-row button.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
#authSeg { margin-bottom: 16px; }
.set-row .link-btn { padding: 0; }
.invite-note { background: var(--aqua); border-color: var(--aqua); }
.step-tag { font-size: 12px; font-weight: 700; color: var(--teal-ink); letter-spacing: .08em; text-transform: uppercase; }
.kid-inputs { display: grid; gap: 8px; }
.pct-row { display: flex; justify-content: space-between; font-weight: 600; font-variant-numeric: tabular-nums; }
.pa { color: var(--teal-ink); } .pb { color: var(--coral-ink); }

/* Inicio */
.balance { background: linear-gradient(135deg, var(--navy), var(--teal)); color: var(--white); border-radius: 22px; padding: 18px; display: grid; gap: 12px; }
.balance small { opacity: .85; font-size: 12.5px; }
.balance .big { font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1; }
.bar { height: 10px; border-radius: 999px; overflow: hidden; display: flex; background: rgba(255,255,255,.22); }
.bar i { display: block; height: 100%; }
.bar i.a { background: var(--aqua); } .bar i.b { background: var(--coral); }
.legend { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.owe { background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; font-size: 14px; display: grid; gap: 2px; }
.owe b { font-size: 16px; }
.owe small { opacity: .85; }
.av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--white); font-size: 12px; font-weight: 700; flex: none; text-transform: uppercase; }
.av.a { background: var(--teal); } .av.b { background: var(--coral); }
.balance .av { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.sect { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; font-family: var(--body); margin-top: 4px; }
.alert { border-radius: 16px; padding: 14px; display: grid; gap: 10px; background: var(--white); border: 1px solid var(--line); }
.alert.coral { background: var(--coral-soft); border-color: var(--coral-soft); }
.alert.aqua { background: var(--aqua); border-color: var(--aqua); }
.alert.amber { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--amber); }
.alert b { font-size: 15px; }
.alert .row-btns .btn { flex: 0 1 auto; }

.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row .t { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.row .s { font-size: 12.5px; color: var(--muted); }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.row .amt small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.row.off { opacity: .55; }
.empty { padding: 22px 6px; text-align: center; color: var(--muted); font-size: 14px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; }
.chip.ok { background: var(--aqua); color: var(--ok); }
.chip.obj { background: var(--coral-soft); color: var(--coral-ink); }
.chip.wait { background: var(--amber-soft); color: var(--amber); }
.chip.edit, .chip.fix, .chip.mine { background: var(--ivory); color: var(--muted); border: 1px solid var(--line); }

.support { display: grid; gap: 8px; }
.sup-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.sup-row b { font-variant-numeric: tabular-nums; }

/* Detalle */
.detail-head { display: grid; gap: 6px; text-align: center; padding: 6px 0 4px; }
.detail-head .big { font-family: var(--display); font-weight: 700; font-size: 36px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.receipt-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.hist { display: grid; gap: 8px; font-size: 13.5px; }
.hist div { border-left: 3px solid var(--line); padding-left: 10px; }

/* Fijos y reparto */
.fijo-group { display: grid; gap: 8px; }
.exc-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.exc-row .pct-row { grid-column: 1 / -1; font-size: 13px; }
.exc-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.intro { font-size: 14px; }

/* Reporte */
.report { display: grid; gap: 14px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.rtable th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: right; font-weight: 700; padding: 6px 0; }
.rtable th:first-child, .rtable td:first-child { text-align: left; }
.rtable td { padding: 9px 0; border-top: 1px solid var(--line); text-align: right; }
.rtable tr.tot td { font-weight: 700; border-top: 2px solid var(--navy); }
.rtable tr.due td { color: var(--muted); }
.result { background: var(--aqua); border-radius: 16px; padding: 14px 16px; display: grid; gap: 3px; }
.result .big { font-family: var(--display); font-weight: 700; font-size: 22px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.report-head img { width: 40px; height: 40px; border-radius: 10px; }
.print-only { display: none; }

/* Ajustes */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .v { color: var(--muted); font-size: 14px; text-align: right; }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; font-size: 13px; }
.plan-box { display: grid; gap: 10px; }
.plan-price { font-family: var(--display); font-weight: 700; font-size: 30px; }
.plan-price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 0 4px; }
.foot a { color: var(--teal-ink); font-weight: 600; text-decoration: none; }

/* Barra inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--white); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
.tabbar button { background: none; border: 0; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; padding: 4px 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--navy); }
.tabbar button.on svg { stroke: var(--teal); }
.tabbar .fab { justify-self: center; width: 58px; height: 58px; border-radius: 50%; background: var(--navy); color: var(--white); place-items: center; margin-top: -26px; box-shadow: 0 10px 22px -10px rgba(24,63,75,.8); }
.tabbar .fab svg { width: 28px; height: 28px; stroke: var(--white) !important; stroke-width: 2.4; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 10px 24px -12px rgba(0,0,0,.5); }

@media print {
  #topbar, .tabbar, .no-print, .toast { display: none !important; }
  body { background: #fff; padding: 0; }
  main { max-width: none; padding: 0; }
  .view:not(#v-reporte) { display: none !important; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block; }
  .result { background: #eef7f5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ================= Family Hub ================= */
.greet { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.greet h2 { font-size: 21px; }
.greet small { color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.pill .dot { margin-right: 6px; }
.kid-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--ivory); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px 1px 6px; }
.av.x { background: var(--muted); }

/* Línea del día */
.tl { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 64px 1fr; gap: 10px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; width: 100%; }
.ev time { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 11px; text-align: right; white-space: nowrap; }
.ev .box { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; }
.ev .box.off { opacity: .6; }
.ev .box.off .t { text-decoration: line-through; }
.ev .t { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev .s { font-size: 12.5px; color: var(--muted); }
.ride { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; }
.ride > span { display: inline-flex; align-items: center; gap: 5px; }
.ride em { font-style: normal; color: var(--muted); }
.ride .av { width: 20px; height: 20px; font-size: 10px; }
button.alert { text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; }

/* Tareas */
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--white); color: var(--white); font-weight: 700; cursor: pointer; flex: none; display: grid; place-items: center; font-size: 14px; }
.task.done .chk { background: var(--teal); border-color: var(--teal); }
.task-t { background: none; border: 0; text-align: left; padding: 0; cursor: pointer; display: grid; gap: 2px; flex: 1; min-width: 0; }
.task-t b { font-weight: 600; font-size: 14.5px; }
.task-t small { color: var(--muted); font-size: 12.5px; }
.task.done .task-t b { text-decoration: line-through; color: var(--muted); }
.chk-mini { width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--muted); flex: none; }

/* Semana */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.week-nav b { font-family: var(--display); font-size: 17px; cursor: pointer; }
.days { display: grid; gap: 10px; }
.day { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: start; }
.day .d { border-radius: 12px; padding: 7px 0; text-align: center; font-weight: 700; font-size: 12px; background: var(--white); border: 1px solid var(--line); color: var(--muted); }
.day .d big { display: block; font-family: var(--display); font-size: 19px; line-height: 1.1; color: var(--navy); }
.day.today .d { background: var(--navy); border-color: var(--navy); color: var(--white); }
.day.today .d big { color: var(--white); }
.day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.day li button { width: 100%; display: flex; gap: 8px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; text-align: left; cursor: pointer; }
.day li button.off span { text-decoration: line-through; color: var(--muted); }
.day li button small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day li span { min-width: 0; }
.empty-day { color: var(--line); padding: 8px 4px; }

/* Más y Agregar */
.ico { width: 34px; height: 34px; border-radius: 10px; background: var(--aqua); display: grid; place-items: center; flex: none; }
.ico svg { width: 19px; height: 19px; stroke: var(--navy); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico svg .acc { stroke: var(--coral-ink); }
.soon { display: grid; gap: 4px; background: var(--ivory); border-style: dashed; }
.sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 6px; align-content: start; text-align: left; cursor: pointer; }
.opt b { font-family: var(--display); font-weight: 600; font-size: 15px; }
.opt small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }

/* Modo */
.mode-pick { display: grid; gap: 10px; }
.mode-pick button { background: var(--white); border: 2px solid var(--line); border-radius: 16px; padding: 14px; text-align: left; display: grid; gap: 4px; cursor: pointer; }
.mode-pick button b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.mode-pick button small { color: var(--muted); font-size: 13px; }
.mode-pick button.on { border-color: var(--teal); box-shadow: 0 0 0 4px var(--aqua); }

/* Formularios del hub */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rides { display: grid; gap: 10px; }
.ride-row { display: grid; gap: 6px; background: var(--ivory); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.ride-row b { font-size: 13px; }
.person { display: grid; grid-template-columns: 64px 1fr; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.person select, .person input { padding: 9px 10px; font-size: 15px; }
.person input { grid-column: 2; }
.small-amt { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--ivory); border-radius: 12px; padding: 2px 12px; }
.small-amt b { color: var(--muted); }
.small-amt input { border: 0 !important; background: none !important; padding: 10px 0 !important; }
.small-amt:focus-within { outline: 3px solid var(--teal); outline-offset: 2px; }
.small-amt input:focus-visible { outline: none; }
.days-pick .pill { min-width: 52px; justify-content: center; text-align: center; }

/* Hijos */
.kid-av { width: 36px; height: 36px; border-radius: 12px; color: var(--white); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 16px; flex: none; }
.kid-av.big { width: 56px; height: 56px; border-radius: 18px; font-size: 24px; }
.kid-head { display: flex; align-items: center; gap: 12px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw-c { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw-c.on { box-shadow: 0 0 0 3px var(--navy); }
@media (max-width: 330px) { .sheet { grid-template-columns: 1fr; } .two { grid-template-columns: 1fr; } }

#hoyAlerts, #homeAlerts { display: grid; gap: 10px; }
#hoyAlerts:empty { display: none; }

/* ¿En qué se gastó? — la casa y los hijos */
.split-bar { height: 10px; border-radius: 999px; overflow: hidden; display: flex; background: var(--line); }
.split-bar i { display: block; height: 100%; }
.split-bar .casa { background: var(--navy); } .split-bar .hijos { background: var(--coral); }
.spend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.spend-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.spend-card.casa { border-top: 4px solid var(--navy); } .spend-card.hijos { border-top: 4px solid var(--coral); }
.spend-head { display: flex; gap: 8px; align-items: center; background: none; border: 0; padding: 2px; text-align: left; cursor: pointer; border-radius: 10px; }
.spend-head small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.spend-head b { font-family: var(--display); font-size: 19px; }
.spend-head .ico { width: 30px; height: 30px; }
.spend-card.hijos .ico { background: var(--coral-soft); }
.spend-head.on, .cat-row.on, .kid-chip.on { background: var(--aqua); }
.cat-list { display: grid; gap: 2px; }
.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: baseline; background: none; border: 0; padding: 6px 4px; text-align: left; cursor: pointer; border-radius: 8px; font-size: 13px; }
.cat-row .cat-n { min-width: 0; line-height: 1.25; }
.cat-row b { font-variant-numeric: tabular-nums; font-size: 13px; }
.cat-bar { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--ivory); overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; background: var(--navy); }
.spend-card.hijos .cat-bar i { background: var(--coral); }
.kid-split { display: grid; gap: 4px; }
.kid-chip { display: flex; align-items: center; gap: 6px; background: var(--ivory); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; text-align: left; }
.kid-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-chip b { font-variant-numeric: tabular-nums; }
.mov-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-chip { cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 12px; }
.cat-grp { display: grid; gap: 6px; }
.cat-grp + .cat-grp { margin-top: 8px; }
.cat-h { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rtable tr.grp td { font-weight: 700; background: var(--ivory); padding-left: 6px; padding-right: 6px; }
.rtable tr.sub td:first-child { padding-left: 14px; }
@media (max-width: 360px) { .spend { grid-template-columns: 1fr; } }

/* Pagos por hijo */
.pagos-pick { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pagos-pick .pill { white-space: nowrap; flex: none; }
.focus-card { background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--navy); border-radius: 18px; padding: 14px; display: grid; gap: 10px; }
.focus-head { display: flex; align-items: center; gap: 12px; }
.focus-head small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.focus-head b { font-family: var(--display); font-size: 26px; }
.bar.light { background: var(--ivory); }
.bar.light i.a { background: var(--teal); } .bar.light i.b { background: var(--coral); }
.cat-row.static { cursor: default; }

.kid-compare { display: grid; gap: 6px; }
.kc-row { display: flex; align-items: center; gap: 10px; background: var(--ivory); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; text-align: left; width: 100%; }
.kc-main { flex: 1; display: grid; gap: 6px; min-width: 0; }
.kc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.kc-top small { color: var(--muted); font-weight: 600; }
.kc-row .cat-bar { background: var(--white); height: 7px; }

/* ================= Rediseño: íconos, fotos, portada y gráficas ================= */
.cat-ic { --c: var(--navy); width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 14%, white); color: var(--c); }
.cat-ic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cat-ic.sm { width: 30px; height: 30px; border-radius: 9px; } .cat-ic.sm svg { width: 17px; height: 17px; }
.cat-ic.xs { width: 22px; height: 22px; border-radius: 7px; margin-right: 6px; vertical-align: -6px; } .cat-ic.xs svg { width: 13px; height: 13px; }
.ev .t .cat-ic { width: 26px; height: 26px; border-radius: 8px; } .ev .t .cat-ic svg { width: 15px; height: 15px; }
.ic-wrap { position: relative; display: inline-block; }
.ic-who { position: absolute; right: -5px; bottom: -5px; }
.ic-who .av { width: 18px; height: 18px; font-size: 9px; box-shadow: 0 0 0 2px var(--white); }
img.kid-av { object-fit: cover; border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--line); padding: 0; }
.kid-av.big { width: 64px; height: 64px; border-radius: 20px; font-size: 26px; }

/* Portada de Hoy */
.hero-hoy { background: linear-gradient(140deg, var(--navy) 0%, #24606B 60%, var(--teal) 100%); color: var(--white); border-radius: 24px; padding: 18px; display: grid; gap: 14px;
  box-shadow: 0 18px 36px -22px rgba(24,63,75,.7); position: relative; overflow: hidden; }
.hero-hoy::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(231,156,135,.45), transparent 70%); pointer-events: none; }
.hero-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.hero-top small { opacity: .8; font-size: 12.5px; }
.hero-top h2 { font-size: 22px; line-height: 1.15; }
.fam-photo { width: 58px; height: 58px; border-radius: 18px; object-fit: cover; border: 2px solid rgba(255,255,255,.7); flex: none; }
.kid-stack { display: flex; flex: none; }
.kid-stack .kid-av { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--navy); box-shadow: none; font-size: 16px; }
.kid-stack .kid-av + .kid-av { margin-left: -12px; }
.hero-next { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); color: var(--white); border-radius: 16px; padding: 11px 12px; text-align: left; cursor: pointer; position: relative; z-index: 1; width: 100%; }
.hero-next.quiet { cursor: default; }
.hero-next .hn-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.hero-next small em { font-style: normal; color: var(--white); opacity: 1; }
.hn-go { font-size: 22px; opacity: .7; }
.hero-next small { opacity: .8; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.hero-next b { font-size: 15px; }
.hero-next .cat-ic { background: var(--white); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.hero-stats button { background: rgba(255,255,255,.1); border: 0; border-radius: 14px; padding: 10px 8px; color: var(--white); display: grid; gap: 1px; text-align: left; cursor: pointer; }
.hero-stats b { font-family: var(--display); font-size: 19px; line-height: 1.1; }
.hero-stats small { font-size: 11.5px; opacity: .85; line-height: 1.2; }

/* Dona y leyenda */
.donut-card { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; }
.donut { width: 140px; height: 140px; }
.donut circle { transition: stroke-dasharray .6s ease; }
.donut-n { font-family: var(--display); font-weight: 700; font-size: 19px; fill: var(--navy); }
.donut-s { font-size: 11px; fill: var(--muted); }
.donut-legend { display: grid; gap: 2px; min-width: 0; }
.donut-legend button { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 5px 6px; border-radius: 8px; font-size: 13px; cursor: pointer; text-align: left; }
.donut-legend button.on { background: var(--aqua); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .donut-card { grid-template-columns: 1fr; justify-items: center; } }

/* Últimos 6 meses */
.trend-box { display: grid; gap: 12px; }
.trend { display: grid; gap: 10px; }
.trend-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.trend-h b { font-family: var(--display); font-weight: 600; font-size: 15px; }
.legend-mini { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.legend-mini i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; }
.bar-col { background: none; border: 0; padding: 4px 0; display: grid; justify-items: center; gap: 4px; cursor: pointer; border-radius: 10px; }
.bar-col.on { background: var(--aqua); }
.bar-v { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 13px; }
.bar-col.on .bar-v { color: var(--navy); font-weight: 700; }
.bar-stack { width: 22px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 7px; overflow: hidden; background: var(--ivory); }
.bar-stack i { display: block; width: 100%; transition: height .5s ease; }
.bar-stack .c { background: var(--navy); } .bar-stack .h { background: var(--coral); }
.bar-col:not(.on) .bar-stack i { opacity: .55; }
.bar-l { font-size: 11px; font-weight: 600; color: var(--muted); }
.bar-col.on .bar-l { color: var(--navy); }

/* Comparado con el mes pasado */
.compare { display: grid; gap: 8px; }
.compare > b { font-family: var(--display); font-weight: 600; font-size: 15px; }
.cmp-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.cmp-row span:nth-child(2) { flex: 1; }
.cmp-row b { font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; min-width: 62px; text-align: center; }
.delta.up { background: var(--coral-soft); color: var(--coral-ink); } .delta.down { background: var(--aqua); color: var(--ok); }

/* Presupuestos */
.budget { display: grid; gap: 12px; }
.bud-row { display: flex; gap: 10px; align-items: center; }
.bud-main { flex: 1; display: grid; gap: 5px; min-width: 0; }
.bud-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bud-top b { font-variant-numeric: tabular-nums; }
.bud-bar { height: 8px; border-radius: 999px; background: var(--ivory); overflow: hidden; }
.bud-bar i { display: block; height: 100%; border-radius: 999px; background: var(--teal); transition: width .6s ease; }
.bud-row.warn .bud-bar i { background: #D9A43C; } .bud-row.over .bud-bar i { background: var(--coral-ink); }
.bud-row small { font-size: 12px; color: var(--muted); }
.bud-row.over small { color: var(--coral-ink); font-weight: 600; }
.budget-empty { display: flex; gap: 12px; align-items: center; text-align: left; cursor: pointer; background: var(--ivory); border-style: dashed; width: 100%; }
.budget-empty span:last-child { display: grid; gap: 2px; }
.budget-empty small { color: var(--muted); font-size: 12.5px; }
.bud-edit { display: grid; grid-template-columns: auto 1fr 110px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bud-edit:last-child { border-bottom: 0; }
.bud-edit > span:nth-child(2) { display: grid; gap: 1px; min-width: 0; }
.bud-edit small { color: var(--muted); font-size: 12px; }

/* Fotos */
.photo-btn { position: relative; background: none; border: 0; padding: 0; cursor: pointer; }
.photo-badge { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--white); }
.photo-badge svg, .fam-photo-empty svg { width: 15px; height: 15px; fill: none; stroke: var(--white); stroke-width: 2; stroke-linejoin: round; }
.fam-photo-set { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--ivory); border: 1px dashed var(--line); border-radius: 14px; padding: 10px; margin: 12px 0 4px; cursor: pointer; text-align: left; }
.fam-photo-set img, .fam-photo-empty { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; }
.fam-photo-empty { background: var(--teal); display: grid; place-items: center; }
.fam-photo-empty svg { width: 22px; height: 22px; }
.fam-photo-set span:last-child { display: grid; gap: 2px; }
.fam-photo-set small { color: var(--muted); font-size: 12.5px; }
.year-row { display: flex; justify-content: space-between; gap: 10px; background: var(--ivory); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; flex-wrap: wrap; }
.year-row span { color: var(--muted); font-weight: 600; }

/* Pequeñas animaciones */
@media (prefers-reduced-motion: no-preference) {
  .task.done .chk { animation: pop .35s cubic-bezier(.2,.9,.3,1.4); }
  @keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
  .view:not([hidden]) > * { animation: rise .3s ease both; }
  @keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
}

.slim-alert { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--amber-soft); color: var(--amber); border: 0; border-radius: 12px; padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; width: 100%; text-align: left; }
.slim-alert b { white-space: nowrap; }
