/* Pulso Ciudadano - estilos compartidos (landing y panel) */
:root {
  --navy: #1f3864;
  --blue: #2e5c8a;
  --blue-soft: #e9f0f8;
  --teal: #0f9d8f;
  --teal-soft: #dff5f2;
  --amber: #f2a33a;
  --amber-soft: #fff3df;
  --red: #c8423b;
  --red-soft: #fde8e6;
  --green: #2f9e5b;
  --ink: #1b2536;
  --muted: #5c6b80;
  --line: #d7e0eb;
  --bg: #f4f7fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 56, 100, .06), 0 8px 24px rgba(31, 56, 100, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--blue); }
h1, h2, h3, h4 { line-height: 1.2; color: var(--navy); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.3rem; border-radius: 12px; border: 2px solid transparent; font: 600 1rem var(--font); cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 4px 14px rgba(31, 56, 100, .28); }
.btn-primary:hover { background: #17294b; }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 4px 14px rgba(15, 157, 143, .3); }
.btn-teal:hover { background: #0c8277; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--blue-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: .45rem .8rem; font-size: .875rem; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Landing */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(244, 247, 251, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--navy); text-decoration: none; font-size: 1.15rem; letter-spacing: -.01em; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; align-items: center; gap: 1.2rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--blue); }
@media (max-width: 720px) { .nav .hide-sm { display: none; } }

.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 85% -10%, #cfe3f6 0, transparent 60%), radial-gradient(900px 480px at -10% 110%, #d6f1ec 0, transparent 55%), var(--bg); padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 4rem); }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin-bottom: 1rem; }
.eyebrow::before { content: ""; width: 28px; height: 3px; background: var(--teal); border-radius: 3px; }
.hero h1 { max-width: 18ch; }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 56ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.pulse-line { position: absolute; right: -40px; top: 40px; width: min(560px, 60vw); opacity: .5; pointer-events: none; }
.pulse-line path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: dash 3.5s ease-out forwards, none; }
@keyframes dash { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse-line path { animation: none; stroke-dashoffset: 0; } }

section { padding: clamp(2.2rem, 5vw, 4rem) 0; }
.section-head { max-width: 62ch; margin-bottom: 2rem; }
.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; border: 1px solid #e6edf5; }
.track { display: flex; flex-direction: column; border-top: 6px solid var(--teal); }
.track.a { border-top-color: var(--blue); }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--teal-soft); color: #0b6f65; margin-bottom: .7rem; align-self: flex-start; }
.track.a .badge { background: var(--blue-soft); color: var(--blue); }
.track h3 { font-size: 1.5rem; }
.track ul { padding-left: 1.2rem; color: var(--muted); }
.track .spacer { flex: 1; }
.code-form { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.code-input { flex: 1 1 160px; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: 12px; font: 700 1.3rem var(--font); letter-spacing: .25em; text-transform: uppercase; text-align: center; min-width: 0; }
.code-input:focus { border-color: var(--teal); outline: none; }
.err { color: var(--red); font-weight: 600; min-height: 1.4em; margin: .5rem 0 0; }

.step-n { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; margin-bottom: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .5rem 1rem; font-weight: 600; color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.formula { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 1.6rem 1.8rem; }
.formula h3, .formula h2 { color: #fff; }
.formula code { background: rgba(255, 255, 255, .12); padding: .15rem .5rem; border-radius: 6px; font-size: .95rem; }
.privacy { background: var(--teal-soft); border-radius: var(--radius); padding: 1.6rem; }
.privacy li { margin-bottom: .4rem; }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }

/* Formularios (panel) */
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; font: 1rem var(--font); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(46, 92, 138, .15); }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; align-items: center; }
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.flash.ok { background: var(--teal-soft); color: #0b6f65; }
.flash.err { background: var(--red-soft); color: var(--red); }
.flash.info { background: var(--blue-soft); color: var(--blue); }

/* Panel */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #dbe6f5; padding: 1.2rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 1.2rem 1rem; }
.side h4 { color: #8fb0d8; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; padding: 1rem 1.2rem .3rem; margin: 0; }
.side a.item { display: block; padding: .55rem 1.2rem; color: #dbe6f5; text-decoration: none; font-weight: 500; border-left: 4px solid transparent; }
.side a.item:hover { background: rgba(255, 255, 255, .08); }
.side a.item.on { background: rgba(255, 255, 255, .13); border-left-color: var(--amber); color: #fff; }
.side .who { padding: 1rem 1.2rem; font-size: .85rem; color: #9db7d9; border-top: 1px solid rgba(255,255,255,.1); margin-top: 1rem; }
.main { padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem; min-width: 0; }
.main > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.main > header h1 { font-size: 1.7rem; margin: 0; }
.topbar-mobile { display: none; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: none; }
  .side.open { display: block; }
  .topbar-mobile { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; padding: .7rem 1rem; }
}
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.4rem; }
.kpi { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); border-left: 5px solid var(--blue); }
.kpi .v { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.teal { border-left-color: var(--teal); } .kpi.amber { border-left-color: var(--amber); } .kpi.red { border-left-color: var(--red); }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0; }
.tabs a:hover { background: var(--blue-soft); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--amber); }
table.t { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: .93rem; }
table.t th { background: var(--navy); color: #fff; text-align: left; padding: .6rem .8rem; font-weight: 600; font-size: .85rem; position: sticky; top: 0; }
table.t td { padding: .55rem .8rem; border-top: 1px solid #edf1f6; vertical-align: top; }
table.t tr:nth-child(even) td { background: #f8fafd; }
.table-wrap { overflow-x: auto; border-radius: 12px; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--teal-soft); color: #0b6f65; } .pill.red { background: var(--red-soft); color: var(--red); } .pill.amber { background: var(--amber-soft); color: #9a5b00; } .pill.gray { background: #eceff4; color: #5b6676; }
.chart-box { background: #fff; border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.chart-box h3 { font-size: 1rem; margin-bottom: .6rem; }
.chart-box canvas { max-height: 340px; }
.map-box { height: 460px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.note { background: var(--amber-soft); border-left: 5px solid var(--amber); padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; font-size: .92rem; }
.heat td.c { text-align: center; font-weight: 700; }
.bar { height: 10px; border-radius: 6px; background: var(--blue-soft); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.login-box { max-width: 420px; margin: 8vh auto; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: #fff; border-radius: var(--radius); border: 2px dashed var(--line); }
.inline-form { display: inline; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }

@media print {
  .side, .topbar-mobile, .actions, .tabs, .btn, .no-print { display: none !important; }
  .admin { display: block; }
  body { background: #fff; }
  .card, .kpi, .chart-box, table.t { box-shadow: none; border: 1px solid #ccc; }
  .main { padding: 0; }
}
