/* Mesh Aibonito: estilo basado en corillo.live */
:root {
  --navy: #06143f;
  --navy-2: #0b1d55;
  --text: #f5f8ff;
  --muted: #a4b6e6;
  --orange: #ff6a3d;
  --yellow: #ffd23f;
  --red: #ff2d55;
  --green: #35e0a1;
  --violet: #8b95ff;
  --gray: #6f7fae;
  --surface: rgba(245, 248, 255, .07);
  --surface-2: rgba(245, 248, 255, .1);
  --line: rgba(245, 248, 255, .1);
  --r-card: 22px;
  --r-tile: 13px;
  --side-w: 208px;
  --top-h: 60px;
  --display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  background: var(--navy);
  color: var(--text);
  font: 15px/1.5 "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); }
b { font-weight: 700; }
code { font: 600 .85em ui-monospace, "SF Mono", Consolas, monospace; background: var(--surface-2); padding: .15em .5em; border-radius: 999px; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; }
svg:has(> use) { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.c-orange { color: var(--orange); } .c-yellow { color: var(--yellow); } .c-red { color: var(--red); }
.c-green { color: var(--green); } .c-violet { color: var(--violet); }

/* ------------------------------------------------------------ barra superior */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 1100;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(6, 20, 63, .9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--orange); color: var(--navy); display: grid; place-items: center; font-size: 19px; }
.brand-mark svg { stroke-width: 2.4; }
.brand-text { font: 600 20px/1 var(--display); letter-spacing: -.02em; }
.brand-text b { font-weight: 800; }
.icon-btn { background: none; border: 0; color: var(--text); width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; font-size: 22px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.fresh-pill {
  margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0;
  background: var(--surface-2); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--muted);
}
.fresh-pill #freshness-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fresh-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.fresh-pill.ok .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(53, 224, 161, .15); }
.fresh-pill.stale { color: var(--yellow); } .fresh-pill.stale .dot { background: var(--yellow); }
.fresh-pill.error { color: var(--red); } .fresh-pill.error .dot { background: var(--red); }

/* ------------------------------------------------------------ barra lateral */
.sidebar {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w); z-index: 1050;
  display: flex; flex-direction: column; padding: 14px 10px 20px; overflow-y: auto;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255, 106, 61, .09), transparent 60%), var(--navy);
  border-right: 1px solid var(--line);
}
.side-hdr { margin: 4px 8px 6px; font-size: 12.8px; font-weight: 700; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px 0 6px; border-radius: 18px;
  text-decoration: none; font-size: 16px; font-weight: 700; color: var(--text);
}
.side-nav.small a { font-size: 14px; height: 32px; }
.side-nav a:hover { background: rgba(245, 248, 255, .07); }
.side-nav a.active { background: rgba(245, 248, 255, .15); }
.tile { width: 30px; height: 30px; border-radius: var(--r-tile); display: grid; place-items: center; font-size: 16px; flex: none; }
.side-nav.small .tile { width: 26px; height: 26px; font-size: 13px; border-radius: 10px; }
.tile.big { width: 46px; height: 46px; font-size: 22px; border-radius: 15px; }
.t-orange { background: rgba(255, 106, 61, .16); color: var(--orange); }
.t-yellow { background: rgba(255, 210, 63, .16); color: var(--yellow); }
.t-red { background: rgba(255, 45, 85, .16); color: var(--red); }
.t-green { background: rgba(53, 224, 161, .16); color: var(--green); }
.t-violet { background: rgba(139, 149, 255, .18); color: var(--violet); }
.side-nav a.active .tile { background: var(--orange); color: var(--navy); }
.side-card {
  margin-top: auto; padding: 14px; border-radius: var(--r-card);
  background: radial-gradient(90% 90% at 100% 0%, rgba(255, 106, 61, .26), transparent 70%), var(--surface);
}
.side-card-title { margin: 0; font-weight: 700; font-size: 15px; }
.side-card-text { margin: 4px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(3, 10, 32, .6); z-index: 1040; }

/* ------------------------------------------------------------ botones y chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 24px; border-radius: 999px; border: 0;
  font: 700 15px "DM Sans", sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-white { background: var(--text); color: var(--navy); }
.btn-orange { background: var(--orange); color: var(--navy); }
.btn-navy { background: var(--navy); color: var(--text); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn:hover { filter: brightness(1.06); }
.btn-block { width: 100%; height: 36px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 700; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); display: inline-block; }

/* ------------------------------------------------------------ contenido */
.main { margin-left: var(--side-w); padding: var(--top-h) 40px 0; }
.section, .foot, .hero-inner, .hero-grid { max-width: 1180px; }
.section { padding-top: 56px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-title { font-size: 40px; letter-spacing: -1px; line-height: 1; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.section-sub { font: 400 14px "DM Sans", sans-serif; letter-spacing: 0; color: var(--muted); }
.eyebrow { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.note b { color: var(--text); }
.inline-ic { font-size: 14px; color: var(--yellow); vertical-align: -2px; margin-right: 6px; }
.panel { background: var(--surface); border-radius: var(--r-card); padding: 20px; min-width: 0; }

/* Hero */
.hero {
  position: relative; margin: 0 -40px; padding: 64px 40px 8px;
  background:
    radial-gradient(60% 70% at 85% 10%, rgba(139, 149, 255, .18), transparent 70%),
    radial-gradient(50% 60% at 10% 0%, rgba(255, 106, 61, .16), transparent 70%);
}
.hero-inner > * { max-width: 760px; }
.hero-title { font-size: clamp(38px, 6vw, 64px); line-height: 1; letter-spacing: -.025em; font-weight: 800; margin: 18px 0 16px; }
.hero-sub { font-size: 17px; line-height: 1.45; color: var(--text); opacity: .92; margin: 0 0 26px; max-width: 620px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.test-banner { margin-top: 20px; display: inline-block; background: rgba(255, 210, 63, .12); color: var(--yellow); border-radius: 14px; padding: 8px 14px; font-size: 13px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-top: 40px; }

.glow-card {
  border-radius: var(--r-card); padding: 22px;
  background: radial-gradient(90% 90% at 100% 0%, rgba(255, 106, 61, .26), transparent 70%), var(--surface);
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-title { font-size: 28px; letter-spacing: -.6px; line-height: 1.05; }
.status-pill { font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.status-pill.on { background: rgba(53, 224, 161, .16); color: var(--green); }
.status-pill.off { background: rgba(255, 45, 85, .16); color: var(--red); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 2px 0 0; font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
.battery-bar { margin-top: 18px; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.battery-bar span { display: block; height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .5s ease; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--surface); border-radius: var(--r-card); padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.stat-num { font: 800 44px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-lbl { display: flex; flex-direction: column; font-size: 13.5px; }
.stat-lbl small { color: var(--muted); font-size: 12.5px; }

/* Mapa */
.map-frame { border-radius: var(--r-card); overflow: hidden; background: var(--navy-2); }
#map { height: 480px; background: var(--navy-2); }
/* OpenStreetMap estándar, oscurecido y teñido de azul marino */
#map .leaflet-tile-pane { filter: invert(1) hue-rotate(195deg) brightness(.9) contrast(.85) saturate(.9) sepia(.15); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg, .mk { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.activo { background: var(--green); } .reciente { background: var(--yellow); } .inactivo { background: var(--gray); }
.leaflet-container { font-family: "DM Sans", system-ui, sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0e2266; color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.leaflet-popup-content-wrapper { border-radius: 16px; }
.leaflet-popup-content { font-size: 13.5px; line-height: 1.5; margin: 14px 16px; }
.leaflet-popup-content strong { font: 700 16px var(--display); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { background: #0e2266; color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: #15307f; color: var(--text); }
.leaflet-control-attribution { background: rgba(6, 20, 63, .75) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--text); }
.leaflet-tooltip { background: var(--text); color: var(--navy); border: 0; border-radius: 999px; font-weight: 700; padding: 3px 10px; box-shadow: none; }
.leaflet-tooltip-top::before { border-top-color: var(--text); }

/* Gráfica */
.chart { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: end; gap: 4px; height: 180px; padding-bottom: 22px; }
.bar { background: linear-gradient(180deg, var(--orange), rgba(255, 106, 61, .55)); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; cursor: pointer; transition: filter .15s; }
.bar:hover, .bar.sel { filter: brightness(1.25); }
.bar.sel { background: var(--yellow); }
.bar .lbl { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

/* Tabla */
.table-wrap { overflow-x: auto; padding: 6px 8px; }
table.nodes { width: 100%; border-collapse: collapse; font-size: 14px; }
.nodes th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 10px; white-space: nowrap; }
.nodes td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.nodes .name { font: 700 15px var(--display); }
.nodes .sub { color: var(--muted); font-size: 12.5px; }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 700; }
.rep-tag { display: inline-block; margin-left: 6px; font: 700 11px "DM Sans", sans-serif; color: var(--navy); background: var(--orange); padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }

/* Pasos */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.step { background: var(--surface); border-radius: var(--r-card); padding: 20px; display: flex; flex-direction: column; }
.step .tile { margin-bottom: 16px; }
.step h3 { font-size: 21px; letter-spacing: -.3px; margin-bottom: 8px; }
.step p, .step li { font-size: 14px; color: var(--text); opacity: .92; }
.step p { margin: 0 0 8px; }
.step ul { margin: 0 0 8px; padding-left: 1.1rem; }
.step li { margin-bottom: 6px; }
.step ul.cfg { list-style: none; padding: 0; }
.step ul.cfg li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); margin: 0; }
.step ul.cfg li span { color: var(--muted); }
.step-foot { margin-top: auto !important; padding-top: 6px; color: var(--muted) !important; font-size: 12.5px !important; opacity: 1 !important; }

/* CTA blanca (emergencias) */
.cta {
  background: var(--text); color: var(--navy); border-radius: 24px; padding: 30px 34px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px;
}
.cta-title { font-size: 32px; letter-spacing: -.8px; line-height: 1.05; }
.cta-text { margin: 8px 0 0; font-size: 15px; max-width: 640px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.prose h3 { font-size: 22px; margin-bottom: 8px; letter-spacing: -.3px; }
.prose ul { margin: 0; padding-left: 1.1rem; }
.prose li { margin-bottom: 8px; }
.prose p { margin: 0 0 12px; }
.prose .eyebrow { margin-top: 4px; }
.prose a { color: var(--orange); }

.foot { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 13px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--text); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: 260px; }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; padding: var(--top-h) 16px 0; }
  .hero { margin: 0 -16px; padding: 40px 16px 4px; }
  .section { padding-top: 44px; }
  .section-title { font-size: 32px; }
  .two-col { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: flex-start; padding: 24px; }
  .cta-title { font-size: 26px; }
  #map { height: 380px; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .brand-text { font-size: 18px; }
  .brand-mark { display: none; }
  .fresh-pill { padding: 7px 11px; font-size: 12px; max-width: 52vw; }
  .steps { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-num { font-size: 36px; }
  .nodes th:nth-child(5), .nodes td:nth-child(5), .nodes th:nth-child(7), .nodes td:nth-child(7) { display: none; }
}
