:root {
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #16233a;
  --muted: #5b6776;
  --border: #dde4ee;
  --blue: #1f5fc6;
  --blue-dark: #123f8c;
  --blue-soft: #e6effc;
  --red: #e0303f;
  --red-soft: #fde9eb;
  --orange: #f07c1b;
  --orange-soft: #fff0e2;
  --yellow: #f2c418;
  --amber: #a55b00;
  --amber-soft: #fff1dc;
  --green: #2e8b57;
  --green-soft: #e3f4ea;
  --teal-soft: #e8f3ef;
  --focus: #ffbf47;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 35, 58, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #18202a;
    --surface-2: #212b37;
    --text: #e8edf3;
    --muted: #a3afbd;
    --border: #334050;
    --blue: #6ea8ff;
    --blue-dark: #9cc3ff;
    --blue-soft: #1b2d45;
    --red: #ff6b7f;
    --red-soft: #3a1d23;
    --orange: #ff9a4a;
    --orange-soft: #3a2614;
    --yellow: #f2c418;
    --teal-soft: #15292a;
    --amber: #ffb35c;
    --amber-soft: #3a2a14;
    --green: #5fd391;
    --green-soft: #173126;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--blue); color: #fff;
  position: sticky; top: 0; z-index: 1000;
}
@media (prefers-color-scheme: dark) { .topbar { background: #0b2a4f; } }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; }
.topnav { display: flex; gap: 14px; }
.topnav a { color: #fff; text-decoration: none; font-size: .95rem; opacity: .95; }
.topnav a:hover { text-decoration: underline; }
.net { padding: 8px 16px; background: var(--amber-soft); color: var(--amber); font-weight: 600; text-align: center; }

main { max-width: 960px; margin: 0 auto; padding: 16px; min-height: 60vh; }
main:focus { outline: none; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 24px 16px 40px; }
.loading { color: var(--muted); padding: 32px 0; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.row.tight > * { flex: 0 0 auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }

/* Botones principales */
.actions { display: grid; gap: 12px; margin: 8px 0 20px; }
@media (min-width: 720px) { .actions { grid-template-columns: repeat(3, 1fr); } }
.big {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 92px; padding: 16px 18px; border-radius: var(--radius);
  text-decoration: none; color: #fff; font-size: 1.3rem; font-weight: 700; box-shadow: var(--shadow);
}
.big small { font-size: .9rem; font-weight: 400; opacity: .95; }
.big.red { background: #c8102e; }
.big.blue { background: #0b4f9c; }
.big.amber { background: #8a4b00; }
.big:active { transform: translateY(1px); }

/* Formularios */
label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
.field { margin-bottom: 14px; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=tel], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; padding: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { color: #08111c; } }
.btn.secondary { background: var(--surface); color: var(--blue); border-color: var(--border); }
.btn.danger { background: var(--red); }
.btn.ok { background: var(--green); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .92rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--blue); text-decoration: underline; cursor: pointer; padding: 4px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600;
}
.chip[aria-pressed=true] { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed=true] { color: #08111c; } }
.chip .tag { font-weight: 400; font-size: .8rem; opacity: .85; }

.need-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: var(--surface-2); }
.need-row .row > * { flex: 1 1 110px; }
.need-row strong { display: block; margin-bottom: 6px; }

.counter { display: flex; align-items: center; gap: 6px; }
.counter input { text-align: center; max-width: 80px; }
.counter button { width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.3rem; cursor: pointer; }

.notice { padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); margin: 8px 0; font-size: .95rem; }
.notice.warn { background: var(--amber-soft); }
.notice.err { background: var(--red-soft); color: var(--red); font-weight: 600; }
.notice.ok { background: var(--green-soft); }

/* Estadísticas */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .num { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .88rem; }
.tile .sub { font-size: .8rem; color: var(--muted); }

.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* Mapa */
.map { height: 380px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); position: relative; z-index: 0; }
.map .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 16px; }
@media (min-width: 720px) { .map { height: 460px; } }
.leaflet-popup-content { font: 15px/1.4 system-ui, sans-serif; margin: 12px 14px; }
.leaflet-popup-content h3 { margin: 0 0 4px; font-size: 1.05rem; }
.leaflet-popup-content ul { margin: 4px 0; padding-left: 18px; }

/* Listas de necesidades */
.need-card { display: flex; flex-direction: column; gap: 6px; }
.need-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.need-card h3 { margin: 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.b-pendiente { background: var(--red-soft); color: var(--red); }
.b-asignada { background: var(--blue-soft); color: var(--blue); }
.b-en_camino { background: var(--amber-soft); color: var(--amber); }
.b-parcial { background: var(--amber-soft); color: var(--amber); }
.b-entregada { background: var(--green-soft); color: var(--green); }
.b-anulada { background: var(--surface-2); color: var(--muted); }
.b-verif { background: var(--green-soft); color: var(--green); }
.b-rep { background: var(--surface-2); color: var(--muted); }
.b-new { background: var(--amber-soft); color: var(--amber); }

.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.8rem; font-weight: 800; letter-spacing: .06em; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; display: inline-block; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #17202b; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 2000; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.err { background: #a30d26; }

dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 32px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
dialog .dlg { padding: 18px; max-height: 85vh; overflow: auto; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.tabs a { white-space: nowrap; padding: 8px 12px; border-radius: 99px; text-decoration: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .93rem; }
.tabs a[aria-current=page] { background: var(--blue); color: #fff; border-color: var(--blue); }
@media (prefers-color-scheme: dark) { .tabs a[aria-current=page] { color: #08111c; } }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .78rem; text-align: center; margin-left: 4px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.photo { max-width: 100%; max-height: 320px; border-radius: 10px; }
.preview { max-width: 160px; border-radius: 8px; display: block; margin-top: 8px; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { width: auto; min-height: 38px; padding: 6px 8px; flex: 1 1 90px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* Ajustes para pantallas pequeñas */
.brand span { white-space: nowrap; }
.code-box { white-space: nowrap; }
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: .95rem; }
  .topnav { gap: 10px; }
  .topnav a { font-size: .85rem; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 8px; }
  .code-box { font-size: 1.5rem; }
}

/* Aviso de emergencia: riesgo inmediato para la vida */
.emergency { padding: 12px 14px; border-radius: 10px; margin: 10px 0 14px; background: var(--red-soft); color: var(--text); border-left: 5px solid var(--red); font-size: .95rem; }
.emergency a { color: var(--red); font-weight: 800; font-size: 1.05rem; }

/* ===== Diseño de la portada (encabezado, héroe, tarjetas) ===== */
.topbar { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); padding: 10px 20px; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
@media (prefers-color-scheme: dark) { .topbar { background: var(--surface); } }
.brand { color: var(--text); gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-size: 1.3rem; font-weight: 800; color: var(--blue-dark); letter-spacing: -.01em; white-space: nowrap; }
.brand-tag { font-size: .62rem; letter-spacing: .14em; color: var(--muted); font-weight: 600; margin-top: 3px; white-space: nowrap; }
.topnav { align-items: center; gap: 22px; }
.topnav a { color: var(--text); font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.topnav a:hover { text-decoration: none; color: var(--blue); }
.topnav a[aria-current=page] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.topnav .login { background: var(--blue); color: #fff; padding: 8px 16px; border-radius: 10px; border: 0; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.topnav .login:hover { color: #fff; filter: brightness(1.08); }
@media (max-width: 760px) {
  .topbar { padding: 8px 12px; flex-wrap: wrap; row-gap: 4px; }
  .brand-name { font-size: 1.05rem; }
  .brand-tag { display: none; }
  .topnav { gap: 14px; overflow-x: auto; width: 100%; order: 3; padding-bottom: 2px; }
  .topnav a { font-size: .88rem; white-space: nowrap; }
  .topnav .login { margin-left: auto; padding: 6px 12px; }
  .hide-sm { display: inline; }
}

main.home { max-width: none; padding: 0 0 16px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 760px) { .wrap { padding: 0 12px; } }

.hero {
  position: relative; overflow: hidden; color: #fff; padding: 46px 0 96px;
  background:
    radial-gradient(ellipse at 52% 78%, rgba(255, 214, 120, .95) 0, rgba(255, 170, 70, .6) 14%, rgba(240, 120, 50, 0) 42%),
    linear-gradient(180deg, #2a3f63 0%, #b2604a 48%, #f0a04b 70%, #6f5a3c 100%);
}
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'%3E%3Cpath d='M0 170 L120 110 L230 150 L360 80 L470 140 L600 95 L720 150 L850 70 L980 130 L1100 90 L1200 120 L1200 300 L0 300Z' fill='%234a5d3a' opacity='.75'/%3E%3Cpath d='M0 220 L150 170 L300 210 L420 160 L560 215 L700 175 L860 225 L1000 180 L1200 215 L1200 300 L0 300Z' fill='%232f4529'/%3E%3C/svg%3E") bottom/100% 100% no-repeat; }
.hero .wrap { position: relative; z-index: 1; display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.02; margin: 0 0 12px; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,.35); letter-spacing: -.02em; }
.hero p { font-size: 1.1rem; max-width: 460px; text-shadow: 0 1px 6px rgba(0,0,0,.4); margin: 0; }
.hero-pills { display: flex; gap: 18px; background: rgba(13, 30, 52, .78); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 12px 18px; font-size: .82rem; line-height: 1.25; }
.hero-pills div { display: flex; align-items: center; gap: 8px; }
.hero-pills svg { width: 26px; height: 26px; flex: none; }
@media (max-width: 760px) { .hero { padding: 26px 0 72px; } .hero-pills { display: none; } .hero p { font-size: 1rem; } }

.action-shell { position: relative; z-index: 2; margin-top: -58px; }
.action-cards { display: grid; gap: 12px; background: var(--surface); padding: 10px; border-radius: 18px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .action-cards { grid-template-columns: repeat(3, 1fr); } }
.action-card { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 12px; color: #fff; text-decoration: none; min-height: 96px; }
.action-card svg.ic { width: 46px; height: 46px; flex: none; }
.action-card .t { font-size: 1.25rem; font-weight: 800; line-height: 1.15; }
.action-card .d { font-size: .9rem; opacity: .95; }
.action-card .go { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.action-card .go svg { width: 16px; height: 16px; }
.action-card.red { background: linear-gradient(135deg, #e8414d, #c8202f); } .action-card.red .go { color: #d12634; }
.action-card.blue { background: linear-gradient(135deg, #2a74de, #1650b8); } .action-card.blue .go { color: #1d5fc6; }
.action-card.green { background: linear-gradient(135deg, #3a9a62, #237447); } .action-card.green .go { color: #2a7d4f; }

.statbar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); margin: 14px 0; padding: 6px; }
@media (min-width: 760px) { .statbar { grid-template-columns: repeat(5, 1fr); } }
.stat { display: flex; align-items: center; gap: 12px; padding: 12px; }
@media (min-width: 760px) { .stat + .stat { border-left: 1px solid var(--border); } }
.stat .ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat .ico svg { width: 24px; height: 24px; }
.stat .n { font-size: 1.55rem; font-weight: 800; line-height: 1.05; }
.stat .l { font-size: .82rem; color: var(--muted); line-height: 1.2; }

.home-grid { display: grid; gap: 14px; }
@media (min-width: 960px) { .home-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.panel { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; }
.panel-h { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.panel-h svg { width: 26px; height: 26px; color: var(--blue); flex: none; }
.panel-h h2 { margin: 0; font-size: 1.2rem; }
.panel-h p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.panel-h .more { margin-left: auto; white-space: nowrap; font-size: .85rem; padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); text-decoration: none; font-weight: 600; }
.panel .map { border: 0; border-radius: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; background: var(--surface); padding: 8px 12px; border-radius: 10px; margin-top: 8px; border: 1px solid var(--border); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.lvl-alta { background: var(--red); } .lvl-media { background: var(--orange); } .lvl-baja { background: var(--yellow); } .lvl-sin { background: var(--green); }
.pin-num { width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-family: system-ui, sans-serif; }
.pin-num.lvl-baja { color: #3a2e00; }

.topneeds { list-style: none; margin: 0; padding: 0; }
.topneeds li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.topneeds li:last-child { border-bottom: 0; }
.cat-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; grid-row: span 2; }
.topneeds .nm { font-size: .95rem; }
.topneeds .ct { font-weight: 700; font-size: .95rem; text-align: right; }
.topneeds .tr { grid-column: 2 / 4; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.topneeds .tr span { display: block; height: 100%; border-radius: 99px; }

.recent { display: grid; gap: 10px; }
.recent-item { display: grid; grid-template-columns: 64px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-decoration: none; color: var(--text); }
.recent-item:hover { border-color: var(--blue); }
.recent-item .thumb { width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; font-size: 30px; }
.recent-item h3 { margin: 0 0 2px; font-size: 1rem; }
.recent-item .meta { font-size: .8rem; color: var(--muted); }
.recent-item .need { font-size: .88rem; } .recent-item .need strong { display: block; }
.recent-item .when { text-align: center; font-size: .78rem; color: var(--muted); }
.pill { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; margin-bottom: 6px; white-space: nowrap; }
@media (max-width: 640px) {
  .recent-item { grid-template-columns: 52px 1fr auto; }
  .recent-item .thumb { width: 52px; height: 52px; font-size: 24px; }
  .recent-item .need { grid-column: 2 / 3; }
  .recent-item .when { grid-column: 3; grid-row: 1 / 3; }
}

.side-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; }
.side-card.soft { background: var(--teal-soft); }
.feat h3 { margin: 0; font-size: 1.15rem; }
.feat .meta { font-size: .85rem; color: var(--muted); }
.feat-banner { height: 92px; border-radius: 12px; margin: 8px 0 10px; background: linear-gradient(180deg, #7fb2c9 0%, #9cc48f 45%, #3f7a45 100%); position: relative; overflow: hidden; }
.feat-banner::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 92' preserveAspectRatio='none'%3E%3Cpath d='M0 50 L50 30 L100 45 L160 20 L220 42 L300 28 L300 92 L0 92Z' fill='%23356b3a'/%3E%3Cpath d='M0 70 L80 58 L160 72 L240 60 L300 70 L300 92 L0 92Z' fill='%23244d29'/%3E%3C/svg%3E") bottom/100% 100% no-repeat; }
.btn.pillbtn { border-radius: 999px; }
.btn.green { background: var(--green); }

.cta-band { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--teal-soft); border-radius: 16px; padding: 18px 20px; margin-top: 14px; }
.cta-band svg.big-ic { width: 54px; height: 54px; color: var(--green); flex: none; }
.cta-band h2 { margin: 0; font-size: 1.2rem; }
.cta-band p { margin: 2px 0 0; font-size: .9rem; color: var(--muted); }
.cta-band .btn { margin-left: auto; }
.home .emergency { margin: 14px 0 0; }
.footer { padding-top: 8px; }
.cta-band > div { flex: 1 1 300px; }
@media (max-width: 640px) { .cta-band .btn { margin-left: 0; width: 100%; } }

/* ===== Portada: emergencia por terremoto ===== */
.hero { background: #1d2b44 url("/img/portada-terremoto.svg") right bottom / cover no-repeat; padding: 40px 0 100px; }
.hero::after { display: none; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 20, 36, .82) 0%, rgba(10, 20, 36, .55) 45%, rgba(10, 20, 36, 0) 75%); }
.hero .wrap { align-items: flex-end; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 700; letter-spacing: .04em; margin-bottom: 14px; }
.hero-badge svg { width: 20px; height: 20px; color: #ff5a66; }
.hero h1 .accent { color: #7cc4ff; }
.hero .lead { max-width: 560px; font-size: 1.08rem; margin-bottom: 18px; }
.hero-cta { display: inline-flex; align-items: center; gap: 10px; background: var(--red); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 700; text-decoration: none; box-shadow: 0 4px 14px rgba(224, 48, 63, .4); }
.hero-cta:hover { filter: brightness(1.06); }
.hero-cta svg { width: 20px; height: 20px; }
.hero-card { display: flex; align-items: center; gap: 12px; background: rgba(13, 30, 52, .82); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 12px 16px; }
.hero-card svg { width: 40px; height: 40px; flex: none; }
.hero-card strong { display: block; font-size: 1.05rem; }
.hero-card span { font-size: .8rem; opacity: .9; }
@media (max-width: 760px) { .hero-card { display: none; } .hero { padding: 24px 0 76px; background-position: 70% bottom; } .hero::before { background: rgba(10, 20, 36, .62); } }

.stat .delta { font-size: .75rem; color: var(--green); font-weight: 600; }

.sos-band { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--red-soft); border-radius: 16px; padding: 16px 20px; margin-top: 14px; }
.sos-band .sos { width: 56px; height: 56px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--red); font-weight: 900; font-size: .8rem; flex: none; box-shadow: var(--shadow); }
.sos-band h2 { margin: 0; font-size: 1.15rem; }
.sos-band p { margin: 2px 0 0; font-size: .9rem; color: var(--muted); }
.sos-band > div { flex: 1 1 260px; }
.sos-calls { display: flex; gap: 10px; flex-wrap: wrap; }
.sos-calls a { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 8px 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-width: 112px; }
.sos-calls a svg { width: 24px; height: 24px; color: var(--red); flex: none; }
.sos-calls b { display: block; color: var(--red); font-size: 1.15rem; line-height: 1; }
.sos-calls small { color: var(--muted); font-size: .75rem; }

.info-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .info-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.info-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.info-card .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; color: #fff; }
.info-card .ico svg { width: 26px; height: 26px; }
.info-card h3 { margin: 0 0 6px; }
.info-card p, .info-card li { font-size: .95rem; }
.info-card ol, .info-card ul { padding-left: 20px; margin: 6px 0 12px; }
.page-hero { background: linear-gradient(135deg, var(--blue-dark), var(--blue)); color: #fff; border-radius: 16px; padding: 22px; margin-bottom: 16px; }
.page-hero h1 { margin: 0 0 6px; }
.page-hero p { margin: 0; opacity: .95; }
@media (max-width: 760px) {
  .topnav .login { position: absolute; top: 10px; right: 12px; }
  .topbar .brand { padding-right: 130px; }
  .panel-h { flex-wrap: wrap; }
  .panel-h > div { flex: 1 1 200px; }
}
@media (max-width: 760px) {
  .topbar .brand { padding-right: 0; }
  .brand img { width: 32px; height: 32px; }
  .brand-name { font-size: .95rem; }
  .topnav .login { padding: 6px 10px; font-size: .82rem; top: 12px; }
  .hero h1 { font-size: 1.8rem; }
}
@media (max-width: 360px) { .topnav .login svg { display: none; } }

/* Botones de WhatsApp en el panel */
.btn.wa { background: #1fa855; color: #fff; }
.btn.wa:hover { filter: brightness(1.05); }
/* Etiquetas y botones dentro de filas: tamaño natural, sin estirarse */
.row > .badge, .row > .btn, .row > strong, .row.tight > * { flex: 0 0 auto; }
.need-row .row { justify-content: space-between; }
.need-row .row > span:not(.badge):not(.row) { flex: 1 1 220px; }
.need-row .row > span.row.tight { flex: 0 0 auto; gap: 8px; align-items: center; }

/* Ayuda por familia */
.fam-needs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fam-needs li { display: flex; align-items: center; gap: 10px; }
.fam-needs li > span:nth-child(2) { flex: 1; }
.fam-needs .cat-ico { width: 32px; height: 32px; font-size: 17px; grid-row: auto; }
.need-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-weight: 400; }
.need-pick:has(input[type=checkbox]:checked) { border-color: var(--blue); background: var(--blue-soft); }
.need-pick input[type=checkbox] { width: 24px; height: 24px; flex: none; }
.need-pick .cat-ico { width: 36px; height: 36px; grid-row: auto; }
.need-pick .np-txt { flex: 1 1 160px; display: flex; flex-direction: column; }
.need-pick .np-qty { display: flex; align-items: center; gap: 6px; }
.need-pick .np-qty input { width: 90px; min-height: 42px; }

/* Historia y afectación de la familia */
.story { margin: 8px 0; padding: 10px 14px; border-left: 4px solid var(--blue); background: var(--blue-soft); border-radius: 0 10px 10px 0; font-style: italic; font-size: .95rem; }
.story a { font-style: normal; font-weight: 600; }
.aff-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.aff-tag { background: var(--red-soft); color: var(--red); font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }

/* Fotos de las familias */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 10px 16px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; font-weight: 700; color: var(--blue); background: var(--surface); }
.photo-pick:hover { border-color: var(--blue); }
.photo-prev { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photo-prev figure { position: relative; margin: 0; }
.photo-prev img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; display: block; }
.photo-prev .rm { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }
.fam-card.has-cover { padding-top: 0; overflow: hidden; }
.fam-cover { display: block; position: relative; width: calc(100% + 32px); margin: 0 -16px 12px; padding: 0; border: 0; cursor: zoom-in; background: var(--surface-2); }
.fam-cover img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.count-pill { position: absolute; right: 10px; bottom: 10px; background: rgba(10, 20, 36, .75); color: #fff; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.gallery { display: grid; gap: 8px; margin: 12px 0; }
.gallery.g1 { grid-template-columns: 1fr; }
.gallery.g2 { grid-template-columns: 1fr 1fr; }
.gallery.g3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.gallery.g3 > button:first-child { grid-row: span 2; }
.gallery button { padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.gallery img { display: block; width: 100%; height: 100%; min-height: 140px; max-height: 420px; object-fit: cover; }
.gallery.g1 img { aspect-ratio: 16 / 9; }
.recent-item .thumb.photo { overflow: hidden; padding: 0; }
.recent-item .thumb.photo img { width: 100%; height: 100%; object-fit: cover; }
.viewer img { display: block; width: 100%; max-height: 72vh; object-fit: contain; border-radius: 10px; background: #000; }
dialog:has(.viewer) { max-width: 920px; }
/* Fotos en el panel */
.media-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.media-item { width: 150px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.media-item img { width: 100%; height: 110px; object-fit: cover; display: block; cursor: zoom-in; }
.media-item .mi-b { padding: 6px; display: flex; flex-direction: column; gap: 4px; font-size: .78rem; }
.media-item .btn { min-height: 30px; padding: 4px 8px; font-size: .78rem; }
.fam-cover img { max-height: 240px; }
@media (min-width: 900px) {
  #h-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  #h-list > p { grid-column: 1 / -1; margin: 0; }
  #h-list .card { margin: 0; }
}
.media-item .badge { white-space: normal; text-align: center; }

/* ===== Gráficos de estadísticas ===== */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-rest: #e3e7ed; --viz-grid: #e8ebf0; }
@media (prefers-color-scheme: dark) { :root { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-rest: #2c3744; --viz-grid: #2a3440; } }
.viz-grid { display: grid; gap: 14px; }
@media (min-width: 860px) { .viz-grid { grid-template-columns: 1fr 1fr; } .viz-wide { grid-column: 1 / -1; } }
.hbars { display: grid; gap: 10px; }
.hb-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px; align-items: center; border-radius: 6px; }
.hb-row:focus-visible { outline: 2px solid var(--focus); }
.hb-label { font-size: .9rem; color: var(--text); }
.hb-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb-bar { display: block; height: 20px; border-radius: 0 4px 4px 0; min-width: 3px; }
.hb-val { font-size: .85rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.prog { display: flex; gap: 2px; flex: 1; height: 20px; }
.prog > span { display: block; height: 100%; }
.prog > span:first-child { border-radius: 0 4px 4px 0; }
.prog > span:first-child[style*="width:0%"] { display: none; }
.stack100 { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.stack100 > span { display: block; height: 100%; min-width: 4px; }
.stack100 > span:first-child { border-radius: 4px 0 0 4px; }
.stack100 > span:last-child { border-radius: 0 4px 4px 0; }
.legend-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; }
.legend-list i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cols-wrap { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.cols-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .75rem; color: var(--muted); height: 160px; text-align: right; }
.cols { display: flex; gap: 2px; align-items: flex-end; height: 160px; border-bottom: 1px solid var(--viz-grid); background: linear-gradient(var(--viz-grid) 1px, transparent 1px) top / 100% 50%; position: relative; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; cursor: default; }
.col:hover .col-bar, .col:focus-visible .col-bar { filter: brightness(1.12); }
.col-bar { display: block; width: 100%; max-width: 24px; background: var(--viz-1); border-radius: 4px 4px 0 0; }
.col-x { position: absolute; top: calc(100% + 6px); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.cols-wrap { margin-bottom: 26px; }
.viz-tip { position: absolute; z-index: 3000; background: #16233a; color: #fff; font-size: .82rem; padding: 6px 10px; border-radius: 8px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 240px; }

.fam-help .hb-track { flex-wrap: wrap; }
.fam-help .prog > span { border-radius: 0; }
.fam-help .prog > span:last-child { border-radius: 0 4px 4px 0; }
.fam-help .btn { margin-left: auto; }
@media (max-width: 640px) { .hb-row { grid-template-columns: 1fr; gap: 4px; } }

/* Aviso: la plataforma no recibe dinero */
.money-banner { display: flex; gap: 12px; align-items: flex-start; background: #fff4d6; border: 2px solid #f2c418; border-radius: 14px; padding: 14px 16px; margin: 14px 0; color: #3a2e00; font-size: .97rem; line-height: 1.45; }
.money-banner .mb-ico { font-size: 1.6rem; line-height: 1; }
.money-banner strong { color: #2a2100; }
.money-banner.compact { padding: 10px 14px; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .money-banner { background: #3a2f0c; border-color: #a98500; color: #f5e7b8; } .money-banner strong { color: #fff3c4; } }
