@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* Paleta: Turf Green, White, Prussian Blue, Strawberry Red, Oxblood */
:root {
  --green: #226e3a;
  --green-dark: #18522b;
  --green-deep: #123f21;
  --green-mid: #3d8a57;
  --green-soft: #e4f0e8;
  --green-wash: #f2f8f4;
  --white: #fefefe;
  --ink: #101935;
  --ink-soft: #566079;
  --ink-faint: #8a92a8;
  --red: #fb3640;
  --red-soft: #fee9ea;
  --oxblood: #960200;
  --line: #dde4e0;
  --line-strong: #c3cdc8;
  --bg: #f6f9f7;
  --male: #4a62a8;
  --female: #f0646b;
  --neutral: #9aa89e;
  --radius: 14px;
  --shadow: 0 10px 30px -14px rgba(16, 25, 53, 0.35);
  --top-h: 58px;
  --font-display: 'Fraunces', Georgia, serif;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  line-height: 1.45;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--green); }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- botones ---------- */
.btn, button.primary, button.ghost, button.danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
button.primary { background: var(--green); color: var(--white); }
button.primary:hover { background: var(--green-dark); }
button.primary:disabled { opacity: 0.6; cursor: default; }
button.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
button.ghost:hover { background: var(--green-wash); border-color: var(--green-mid); }
button.danger { background: var(--white); border-color: var(--red); color: var(--oxblood); }
button.danger:hover { background: var(--red-soft); }
button.small { padding: 6px 12px; font-size: 0.85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- formularios ---------- */
label.field, fieldset.field { display: block; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
label.field > span, fieldset.field > legend, .lbl { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 5px; color: var(--ink); padding: 0; }
.opt { font-weight: 400; color: var(--ink-faint); }
input[type='text'], input[type='password'], input[type='date'], input[type='number'], input[type='search'], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--white);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34, 110, 58, 0.18); }
textarea { resize: vertical; min-height: 64px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.fecha-row { display: grid; grid-template-columns: 0.8fr 1.4fr 1fr; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--white); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; font-size: 0.88rem; color: var(--ink-soft); }
.seg button.on { background: var(--green); color: var(--white); }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-block; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 999px; font-weight: 500; cursor: pointer; background: var(--white); }
.choice input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-deep); font-weight: 600; }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(34, 110, 58, 0.25); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; font-size: 0.95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex: none; }
.form-error { color: var(--oxblood); background: var(--red-soft); border-radius: 10px; padding: 9px 12px; margin: 0 0 12px; font-size: 0.9rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.sub-box { background: var(--green-wash); border: 1px solid var(--green-soft); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.sub-box h4 { font-size: 0.95rem; margin-bottom: 10px; }

/* ---------- pantalla de acceso ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--green) 0%, var(--green-deep) 100%); }
.gate-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 20px; padding: 32px 26px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5); text-align: center; }
.gate-card .logo { width: 84px; height: 66px; margin: 0 auto 10px; display: block; }
.gate-card h1 { font-size: 1.7rem; margin-bottom: 4px; color: var(--ink); }
.gate-card p { margin: 0 0 20px; color: var(--ink-soft); }
.gate-card form { text-align: left; }
.gate-card .primary { width: 100%; margin-top: 4px; }
.gate-foot { margin-top: 16px; font-size: 0.85rem; text-align: center; }

/* ---------- barra superior ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: var(--top-h); padding: 0 16px; background: var(--green); color: var(--white); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; white-space: nowrap; }
.brand svg { width: 34px; height: 28px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; border: 0; color: rgba(254, 254, 254, 0.78); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.tabs button:hover { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.tabs button.on { background: var(--white); color: var(--green-deep); }
.tabs button b { font-weight: inherit; }
.tabs .short, .tab-ic { display: none; }
.actions { display: flex; gap: 8px; align-items: center; position: relative; }
.actions .primary { background: var(--white); color: var(--green-deep); padding: 8px 14px; }
.actions .primary:hover { background: var(--green-soft); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.35); background: transparent; color: var(--white); font-size: 1.2rem; line-height: 1; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.menu { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--white); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); padding: 6px; z-index: 40; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 0.95rem; }
.menu a:hover, .menu button:hover { background: var(--green-wash); }
.menu .who { padding: 8px 12px; font-size: 0.82rem; color: var(--ink-soft); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ---------- vistas ---------- */
.view { display: none; }
.view.on { display: block; }
.view-pad { max-width: 1040px; margin: 0 auto; padding: 18px 16px 60px; }
.subbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--white); border-bottom: 1px solid var(--line); }
.subbar .hint { color: var(--ink-soft); font-size: 0.85rem; }

.tree-host { position: relative; height: calc(100dvh - var(--top-h) - 56px); min-height: 360px; overflow: hidden; user-select: none; -webkit-user-select: none; cursor: grab; }
.tree-host:active { cursor: grabbing; }
.tree-host.mode-grafico { background: var(--white); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.tree-host.mode-arbol { background: radial-gradient(ellipse at 50% 100%, #2f8a4d 0%, var(--green) 45%, var(--green-dark) 100%); }
.tree-svg { width: 100%; height: 100%; display: block; }
.empty-tree { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: inherit; z-index: 5; }
.empty-tree .box { max-width: 380px; }
.empty-tree h2 { font-size: 1.6rem; margin: 10px 0 8px; }
.empty-tree svg { width: 110px; height: auto; }
.mode-arbol .empty-tree { color: var(--white); }

.zoom-controls { position: absolute; right: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 6; cursor: default; }
.zoom-controls button { min-width: 42px; height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--white); color: var(--ink); font-weight: 700; font-size: 1.1rem; box-shadow: 0 4px 12px -6px rgba(16, 25, 53, 0.4); }
.zoom-controls button[data-z='fit'] { font-size: 0.8rem; }
.zoom-controls button:hover { background: var(--green-wash); }

/* tarjetas (gráfico) */
.link { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.link.cross { stroke-dasharray: 5 5; stroke: var(--ink-faint); }
.couple { fill: none; stroke: var(--green-mid); stroke-width: 2.5; }
.couple-dot { fill: var(--green); }
.card { cursor: pointer; }
.card-bg { fill: var(--white); stroke: var(--line-strong); stroke-width: 1.2; filter: drop-shadow(0 3px 6px rgba(16, 25, 53, 0.1)); }
.card:hover .card-bg { stroke: var(--green); }
.card.sel .card-bg { stroke: var(--green); stroke-width: 2.6; }
.card.dead .card-bg { fill: #f1f4f2; }
.card.baby .card-bg { stroke-dasharray: 5 4; stroke: var(--female); fill: #fff6f6; }
.card .t1 { font: 700 13px var(--font); fill: var(--ink); }
.card .t2 { font: 500 12px var(--font); fill: var(--ink-soft); }
.card .t3 { font: 500 11px var(--font); fill: var(--ink-faint); }
.plus .hit { fill: transparent; }
.plus .dot { fill: var(--green); stroke: var(--white); stroke-width: 2; }
.plus path { stroke: var(--white); stroke-width: 2; stroke-linecap: round; fill: none; }
.plus { cursor: pointer; }
.plus:hover .dot { fill: var(--red); }

/* árbol ilustrado */
.branches path { fill: none; stroke: var(--white); stroke-linecap: round; opacity: 0.95; }
.trunk { fill: var(--white); }
.ground { fill: rgba(255, 255, 255, 0.14); }
.family-name { font: 600 34px 'Fraunces', Georgia, serif; fill: var(--white); letter-spacing: 0.02em; }
.leaf { cursor: pointer; }
.leaf .leaf-body { fill: var(--white); stroke: rgba(16, 25, 53, 0.1); stroke-width: 1; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.22)); }
.leaf .stem { stroke: var(--white); stroke-width: 3; stroke-linecap: round; }
.leaf:hover .leaf-body { fill: #f4fbf6; }
.leaf.sel .leaf-body { stroke: var(--red); stroke-width: 3; }
.leaf.dead .leaf-body { fill: #d9e6dd; }
.leaf.baby .leaf-body { fill: rgba(254, 254, 254, 0.2); stroke: var(--white); stroke-width: 2; stroke-dasharray: 6 4; filter: none; }
.leaf .t1 { font: 700 12.5px var(--font); fill: var(--ink); text-anchor: middle; }
.leaf .t2 { font: 500 11px var(--font); fill: var(--ink-soft); text-anchor: middle; }
.leaf .t3 { font: 500 10px var(--font); fill: var(--ink-faint); text-anchor: middle; }
.leaf.baby .t1, .leaf.baby .t2, .leaf.baby .t3 { fill: var(--white); }
.leaf .plus .dot { fill: var(--red); }
.leaf .plus:hover .dot { fill: var(--oxblood); }
.leaf .sexdot { stroke: var(--white); stroke-width: 1.5; }
.mode-arbol .zoom-controls button { background: rgba(254, 254, 254, 0.95); }

/* ---------- ficha lateral ---------- */
.drawer { position: fixed; z-index: 50; background: var(--white); box-shadow: -10px 0 40px -18px rgba(16, 25, 53, 0.5); overflow-y: auto; top: var(--top-h); right: 0; bottom: 0; width: min(400px, 100vw); border-left: 1px solid var(--line); padding: 18px 18px 40px; }
.drawer-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.drawer h2 { font-size: 1.4rem; line-height: 1.2; }
.drawer .close { border: 0; background: var(--green-wash); border-radius: 8px; width: 34px; height: 34px; font-size: 1.2rem; flex: none; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.badge { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-deep); }
.badge.m { background: #e6ebf8; color: var(--male); }
.badge.f { background: var(--red-soft); color: #c23a41; }
.badge.baby { background: #fff0d9; color: #8a5600; }
.facts { margin: 0 0 16px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.drawer h3 { font-size: 1rem; margin: 18px 0 8px; }
.rel-list { display: flex; flex-direction: column; gap: 6px; }
.rel-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-align: left; width: 100%; }
.rel-item:hover { border-color: var(--green-mid); background: var(--green-wash); }
.rel-item small { color: var(--ink-soft); display: block; font-weight: 400; }
.rel-item b { font-weight: 600; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.game-box { border: 1px solid var(--green-soft); background: var(--green-wash); border-radius: 12px; padding: 14px; }
.game-box .url { word-break: break-all; font-size: 0.85rem; background: var(--white); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; margin: 8px 0; }
.game-box .btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- ventanas ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(16, 25, 53, 0.55); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--white); border-radius: 18px; padding: 22px 20px; box-shadow: var(--shadow); }
.modal h2 { font-size: 1.35rem; margin-bottom: 4px; }
.modal .lead { color: var(--ink-soft); margin: 0 0 16px; font-size: 0.95rem; }
.rel-choices { display: grid; gap: 8px; }
.rel-choice { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--white); }
.rel-choice:hover:not(:disabled) { border-color: var(--green); background: var(--green-wash); }
.rel-choice:disabled { opacity: 0.45; cursor: not-allowed; }
.rel-choice b { display: block; }
.rel-choice small { color: var(--ink-soft); }
.rel-choice .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--green-soft); display: grid; place-items: center; flex: none; font-size: 1.1rem; color: var(--green-deep); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; background: var(--ink); color: var(--white); padding: 11px 18px; border-radius: 999px; font-size: 0.92rem; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- chips y filtros ---------- */
.tl-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-faint); display: inline-block; }
.chip.on { color: var(--ink); border-color: var(--ink-soft); }

/* ---------- línea de tiempo ---------- */
.tl-stage { position: relative; height: calc(100dvh - var(--top-h) - 64px); min-height: 380px; background: var(--white); border-top: 1px solid var(--line); overflow: hidden; cursor: grab; user-select: none; -webkit-user-select: none; }
.tl-svg { display: block; width: 100%; height: 100%; }
.tl-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); }
.axis { stroke: var(--ink-faint); stroke-width: 2; }
.tick { stroke: var(--ink-faint); stroke-width: 1.5; }
.tick.minor { stroke: var(--line-strong); }
.tick-label { font: 600 12px var(--font); fill: var(--ink-soft); }
.tick-label.small { font-size: 10px; font-weight: 500; }
.today { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0.7; }
.today-label { font: 700 11px var(--font); fill: var(--red); }
.lbl { cursor: pointer; }
.stem { stroke: var(--line-strong); stroke-width: 1.2; }
.lbl .lt { font: 600 12px var(--font); fill: var(--ink); }
.lbl .ld { font: 500 11px var(--font); fill: var(--ink-soft); }
.lbl .lt, .lbl .ld { paint-order: stroke; stroke: var(--white); stroke-width: 5px; stroke-linejoin: round; }
.lbl-hit { fill: transparent; }
.lbl:hover .lt { fill: var(--green); }
.dot { cursor: pointer; stroke: var(--white); stroke-width: 2; }
.dot:hover { stroke: var(--ink); }
.clu { cursor: pointer; }
.clu-n { font: 700 11px var(--font); fill: var(--white); pointer-events: none; }
.dot.tp-mezcla, .chip.tp-mezcla i { fill: var(--ink-soft); background: var(--ink-soft); }
.dot.tp-nacimiento, .chip.tp-nacimiento i { fill: var(--green); background: var(--green); }
.dot.tp-matrimonio, .chip.tp-matrimonio i { fill: var(--red); background: var(--red); }
.dot.tp-defuncion, .chip.tp-defuncion i { fill: var(--ink-faint); background: var(--ink-faint); }
.dot.tp-evento, .chip.tp-evento i { fill: var(--male); background: var(--male); }
.dot.tp-probable, .chip.tp-probable i { fill: #e9a53b; background: #e9a53b; }
.tl-filters .chip:not(.on) i { background: var(--line-strong); }

/* ---------- calendario ---------- */
.cal-top { margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cal-nav h3 { flex: 1; text-align: center; text-transform: capitalize; font-size: 1.35rem; }
.cal-nav button[data-nav='-1'], .cal-nav button[data-nav='1'] { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--white); font-size: 1.3rem; }
.cal-nav .ghost { margin-left: 4px; }
.cal-top .tl-filters { padding: 8px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; padding: 4px 0; }
.cal-cell { min-height: 82px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 5px; text-align: left; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.cal-cell.sel { background: var(--green-wash); border-color: var(--green); }
.cal-num { font-family: var(--font-display); font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); }
.cal-cell.today .cal-num { color: var(--green); }
.cal-chip { display: block; font-size: 0.7rem; line-height: 1.3; padding: 1px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-more { font-size: 0.68rem; color: var(--ink-soft); }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.ev-cumple.cal-chip, .ev-cumple.cal-dot, .chip.ev-cumple i { background: var(--green-soft); }
.ev-cumple.cal-chip { color: var(--green-deep); }
.ev-cumple.cal-dot, .chip.ev-cumple i { background: var(--green); }
.ev-aniversario.cal-chip { background: var(--red-soft); color: var(--oxblood); }
.ev-aniversario.cal-dot, .chip.ev-aniversario i { background: var(--red); }
.ev-fecha.cal-chip { background: #e6ebf8; color: var(--male); }
.ev-fecha.cal-dot, .chip.ev-fecha i { background: var(--male); }
.cal-detail, .cal-next { margin-top: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.cal-detail h4, .cal-next h4 { font-size: 1.05rem; margin-bottom: 8px; }
.cal-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.cal-item:last-child { border-bottom: 0; }
.cal-item .when { min-width: 64px; font-weight: 700; color: var(--green-deep); font-size: 0.88rem; text-transform: capitalize; }
.cal-item:hover { background: var(--green-wash); }

/* ---------- estadísticas ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--green); line-height: 1.1; }
.kpi span { color: var(--ink-soft); font-size: 0.85rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.card-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card-box h3 { font-size: 1.1rem; margin-bottom: 10px; }
.stat-note { margin: 0 0 10px; color: var(--ink-soft); font-size: 0.92rem; }
.stat-foot { margin: 10px 0 0; color: var(--ink-faint); font-size: 0.8rem; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 74px 1fr 28px; gap: 10px; align-items: center; font-size: 0.85rem; }
.bar-label { color: var(--ink-soft); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--green-wash); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green-mid); border-radius: 6px; }
.bar-row.is-top .bar-fill { background: var(--green); }
.bar-row.is-top .bar-label, .bar-row.is-top .bar-val { color: var(--green-deep); font-weight: 700; }
.bar-val { text-align: right; font-weight: 600; }
.bars.wide .bar-row { grid-template-columns: minmax(96px, 44%) 1fr 28px; }
.bars.wide .bar-label { white-space: normal; line-height: 1.2; }
.num-list { list-style: none; margin: 0; padding: 0; }
.num-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.num-list li:last-child { border-bottom: 0; }
.num-list span { color: var(--ink-soft); }
.num-list b { font-weight: 700; color: var(--ink); }

/* ---------- admin ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 22px 16px 70px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tabs button { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font-weight: 600; }
.admin-tabs button.on { background: var(--green); border-color: var(--green); color: var(--white); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; }
.log-row { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.log-row:last-child { border-bottom: 0; }
.log-row .meta { color: var(--ink-soft); font-size: 0.8rem; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--green-soft); color: var(--green-deep); }
.tag.warn { background: #fff0d9; color: #8a5600; }
.tag.red { background: var(--red-soft); color: var(--oxblood); }
.del-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.del-row:last-child { border-bottom: 0; }
.del-row .btns { display: flex; gap: 8px; }

/* ---------- pagina publica del bebe ---------- */
.baby-body { background: linear-gradient(180deg, var(--green-wash), var(--white) 320px); min-height: 100dvh; }
.baby-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 60px; }
.baby-hero { text-align: center; padding: 38px 0 14px; }
.baby-hero svg { width: 78px; height: auto; }
.baby-hero h1 { font-size: clamp(2rem, 7vw, 3rem); color: var(--green-dark); margin: 6px 0 4px; }
.baby-hero p { margin: 0; color: var(--ink-soft); }
.baby-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 24px 22px; margin-top: 16px; }
.baby-card .primary { width: 100%; margin-top: 6px; padding: 14px; font-size: 1.02rem; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.reveal { background: var(--green); color: var(--white); border-radius: 18px; padding: 22px; margin-top: 16px; text-align: center; }
.reveal h2 { color: var(--white); font-size: 1.6rem; margin-bottom: 6px; }
.reveal p { margin: 4px 0; opacity: 0.95; }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.dash .box { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.dash h3 { font-size: 1.05rem; margin-bottom: 8px; }
.gauge { display: block; width: 100%; max-width: 280px; margin: 0 auto; }
.gauge-legend { text-align: center; color: var(--ink-soft); font-size: 0.85rem; margin-top: 6px; }
.top3 { margin: 0; padding: 0; list-style: none; counter-reset: top; }
.top3 li { counter-increment: top; padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.top3 li:last-child { border-bottom: 0; }
.top3 li::before { content: counter(top) '.'; color: var(--green); font-weight: 700; }
.top3 small { color: var(--ink-soft); margin-left: auto; white-space: nowrap; }
.mini-tabs { display: flex; justify-content: center; gap: 8px; margin: 22px 0 6px; }
.mini-tabs button { padding: 9px 22px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font-weight: 600; color: var(--ink-soft); }
.mini-tabs button.on { background: var(--green); border-color: var(--green); color: var(--white); }
.bcal-month { margin-top: 22px; }
.bcal-month h3 { text-align: center; text-transform: capitalize; margin-bottom: 10px; }
.bcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.bcal-cell { min-height: 58px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 5px; }
.bcal-cell.empty { background: transparent; border-color: transparent; }
.bcal-cell.real { border-color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.bcal-cell .n { font-family: var(--font-display); font-size: 0.78rem; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.ini { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 0.62rem; font-weight: 700; color: var(--white); margin: 0 2px 2px 0; }
.ini.nino { background: var(--male); }
.ini.nina { background: var(--female); }
.ini.neutral { background: var(--green); }
.glist { margin-top: 20px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.glist-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.glist-row:last-child { border-bottom: 0; }
.glist-row .date { font-weight: 700; min-width: 140px; }
.glist-row .names { flex: 1; color: var(--ink-soft); font-size: 0.92rem; }
.count { background: var(--green); color: var(--white); border-radius: 999px; font-size: 0.75rem; font-weight: 700; padding: 2px 9px; white-space: nowrap; }
.pill-nino { color: var(--male); font-weight: 700; }
.pill-nina { color: #c23a41; font-weight: 700; }
.legend-note { text-align: center; color: var(--ink-faint); font-size: 0.8rem; margin-top: 24px; }

@media (max-width: 720px) {
  :root { --bar-h: 62px; --top-h: 52px; }
  /* encabezado delgado: nombre de la familia, agregar persona y menú */
  .top { gap: 8px; padding: 0 10px; justify-content: space-between; }
  .brand { min-width: 0; font-size: 1.05rem; }
  .brand svg { flex: none; width: 30px; height: 24px; }
  .brand span { overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
  .icon-btn { width: 40px; height: 40px; }
  /* pestañas abajo, al alcance del pulgar */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; flex: none; gap: 0; overflow: visible; height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); background: var(--white); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px -14px rgba(16, 25, 53, 0.45); }
  .tabs button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; border-radius: 12px; color: var(--ink-soft); font-size: 0.7rem; }
  .tabs button:hover { background: none; color: var(--ink-soft); }
  .tabs button.on { background: var(--green-wash); color: var(--green-deep); }
  .tab-ic { display: block; width: 24px; height: 22px; }
  .tabs .full { display: none; }
  .tabs .short { display: inline; }
  main { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  /* barra de vistas en una sola fila */
  .subbar { padding: 6px 10px; }
  .subbar .hint { display: none; }
  .seg button { padding: 6px 11px; font-size: 0.8rem; }
  .tree-host { height: calc(100dvh - var(--top-h) - var(--bar-h) - 45px - env(safe-area-inset-bottom)); min-height: 300px; }
  .tl-filters { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; scrollbar-width: none; }
  .tl-filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 5px 10px; font-size: 0.8rem; }
  .tl-stage { height: calc(100dvh - var(--top-h) - var(--bar-h) - 50px - env(safe-area-inset-bottom)); min-height: 300px; }
  .toast { bottom: calc(var(--bar-h) + 16px + env(safe-area-inset-bottom)); }
  /* zoom más discreto */
  .zoom-controls { right: 8px; bottom: 10px; gap: 5px; }
  .zoom-controls button { min-width: 40px; height: 40px; padding: 0 8px; font-size: 1.05rem; opacity: 0.94; }
  .zoom-controls button[data-z='fit'] { font-size: 0.68rem; }
  .drawer { top: auto; height: 78dvh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px -18px rgba(16, 25, 53, 0.5); }
  .cal-cell { min-height: 52px; padding: 4px; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; }
  .dash { grid-template-columns: 1fr; }
  .glist-row { flex-wrap: wrap; }
  .glist-row .date { min-width: 0; }
  .bcal-cell { min-height: 46px; padding: 3px; }
  .ini { width: 18px; height: 18px; font-size: 0.55rem; }
  .fecha-row { grid-template-columns: 0.8fr 1.3fr 1fr; }
}

.rel-summary { margin: 4px 0 14px; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.4; }

/* árbol ilustrado en domo */
.cross-layer .cross { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; stroke-dasharray: 6 6; }
.joints .bridge { stroke: var(--white); stroke-width: 6; stroke-linecap: round; opacity: 0.95; }
.joint circle { fill: var(--white); stroke: var(--red); stroke-width: 2; }
.joint path { fill: var(--red); }
.joint.open path { fill: none; stroke: var(--red); stroke-width: 1.6; }
