﻿:root {
  /* Paleta institucional SFGM — neutral y reutilizable */
  --brand: #17324D;
  --brand-mid: #46627A;
  --brand-deep: #17324D;
  --brand-soft: #e8eef3;
  --accent: #2E9FAF;
  --accent-deep: #247f8c;
  --accent-soft: #d7f0f3;
  --sand: #eef2f6;
  --ink: #2D3945;
  --ink-muted: #5a6a78;
  --surface: #F4F7FA;
  --surface-elevated: #ffffff;
  --line: #dce3ea;
  --line-strong: #c5d0db;
  --warning: #c26a0a;
  --warning-soft: #fff1de;
  --danger: #c0392b;
  --danger-soft: #fde8e6;
  --success: #0f7a5a;
  --success-soft: #e3f7ef;
  --shadow-soft: 0 16px 40px rgba(23, 50, 77, 0.1);
  --shadow-lift: 0 4px 16px rgba(23, 50, 77, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-display: "Outfit", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --nav-width: 256px;
  --header-height: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
html, body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.app-body {
  height: 100vh;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--ink-muted); font-size: 0.9rem; }
.mono { font-family: var(--font-mono); font-size: 0.85rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.45rem; padding: 0.65rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 650; font-size: 0.875rem;
  letter-spacing: 0.01em; cursor: pointer;
  transition: transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.btn .icon,
.btn svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--brand-deep);
  color: #fff; box-shadow: 0 6px 16px rgba(11, 31, 51, 0.22);
}
.btn-primary:hover { background: var(--brand); }
.btn-ghost {
  background: #fff; border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--brand-mid); color: var(--brand); }
.btn-accent {
  background: var(--accent);
  color: #042830; box-shadow: 0 6px 16px rgba(20, 184, 198, 0.25);
}
.btn-accent:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.panel {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.15rem;
  box-shadow: var(--shadow-lift);
  min-width: 0;
  max-width: 100%;
}
.panel-title {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 650;
  color: var(--brand-deep); margin-bottom: .85rem; letter-spacing: -0.01em;
}

.grid-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
  width: 100%;
}
.kpi {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 1rem 1.05rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  animation: rise .55s var(--ease) both;
}
.kpi::after {
  content: ""; position: absolute; right: -18px; top: -18px;
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, rgba(5,191,219,.14), transparent 70%);
  pointer-events: none;
}
.kpi-label {
  font-size: .74rem; color: var(--ink-muted); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700;
}
.kpi-value {
  margin-top: .4rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.kpi-hint {
  margin-top: .35rem;
  font-size: .76rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.kpi-accent { border-color: #9fe6f1; background: linear-gradient(165deg, #fff 35%, var(--accent-soft)); }
.kpi-warn { border-color: #f0c48a; background: linear-gradient(165deg, #fff 35%, var(--warning-soft)); }
.kpi-good { border-color: #8fd9bc; background: linear-gradient(165deg, #fff 35%, var(--success-soft)); }
.kpi-default { background: linear-gradient(165deg, #fff 40%, #f7fbfd); }

.meter {
  margin-top: .85rem; height: 7px; border-radius: 999px;
  background: #e8eef1; overflow: hidden;
}
.meter > span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-mid), var(--accent));
  animation: fillBar 1s var(--ease) both;
}

.badge {
  display: inline-flex; align-items: center; padding: .22rem .6rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; border-radius: 6px; border: 1px solid transparent;
}
.badge-demo { color: var(--brand); background: var(--brand-soft); border-color: #b7e4ec; }
.badge-roadmap { color: var(--ink-muted); background: #f1f5f7; border-color: var(--line); }
.badge-expansion { color: #6b635c; background: var(--sand); border-color: #e2d6c8; }
.badge-active { color: var(--success); background: var(--success-soft); border-color: #a7e4cb; }

.soft {
  display: inline-flex; align-items: center; padding: .18rem .55rem;
  font-size: .75rem; font-weight: 700; border-radius: 999px;
}
.soft-neutral { background: #eef3f5; color: var(--ink-muted); }
.soft-success { background: var(--success-soft); color: var(--success); }
.soft-warning { background: var(--warning-soft); color: var(--warning); }
.soft-danger { background: var(--danger-soft); color: var(--danger); }
.soft-info { background: var(--accent-soft); color: var(--accent-deep); }

.page-header {
  display: flex; justify-content: space-between; gap: 1rem;
  align-items: flex-start; margin-bottom: 1.4rem;
  animation: fadeSlide .5s var(--ease) both;
  min-width: 0;
  max-width: 100%;
}
.page-header > div { min-width: 0; flex: 1 1 auto; }
.eyebrow {
  font-size: .74rem; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-mid); margin-bottom: .4rem;
}
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.page-header h1 {
  font-family: var(--font-display); font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-weight: 700; color: var(--brand-deep); line-height: 1.15; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.page-desc { margin-top: .5rem; max-width: 58ch; color: var(--ink-muted); font-size: .92rem; }
.page-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
  flex: 0 1 auto; max-width: 100%;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 480px; font-size: .86rem; }
th {
  text-align: left; padding: .7rem .75rem; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-muted); background: #f7fafb;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 750;
}
td {
  padding: .7rem .75rem;
  border-bottom: 1px solid #e8eef1;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f4fafb; }
tr.clickable { cursor: pointer; }
tr.selected { background: var(--brand-soft) !important; }

.field { display: grid; gap: .35rem; }
.field label { font-size: .8rem; font-weight: 700; color: var(--ink-muted); }
.field input, .field select {
  padding: .72rem .85rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px rgba(5, 191, 219, 0.18);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1.1rem;
  width: 100%;
  max-width: 100%;
  align-items: start;
}
.stack { display: grid; gap: 1rem; min-width: 0; }

.detail-panel {
  position: sticky;
  top: 0.75rem;
  align-self: start;
  display: grid;
  gap: .9rem;
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow-y: auto;
}
.detail-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.detail-panel-head .panel-title { margin-bottom: 0; }
.detail-owner-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--brand-deep);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem .75rem;
  margin: 0;
  padding: .75rem 0 0;
  border-top: 1px solid var(--line);
}
.detail-grid > div { min-width: 0; }
.detail-span-2 { grid-column: 1 / -1; }
.detail-grid dt {
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
  margin-bottom: .15rem;
}
.detail-grid dd {
  margin: 0;
  font-size: .88rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.detail-saldo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
}
.detail-saldo-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-muted);
}
.detail-saldo-value {
  margin-top: .15rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand-deep);
}
.detail-adeudos {
  margin: 0;
  max-height: 12rem;
  overflow-y: auto;
}
.detail-adeudos li > span:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}
.detail-empty {
  display: grid;
  place-items: center;
  min-height: 10rem;
  text-align: center;
}

/* Shell — patrón institucional (topbar blanca + sidebar navy) */
.shell {
  height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}
.sidebar {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--brand-deep);
  color: #e2e8f0;
  z-index: 30;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 4px 0 24px rgba(11, 31, 51, 0.12);
}
.brand-block {
  flex-shrink: 0;
  min-height: var(--header-height);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .65rem 1rem;
  background: var(--brand);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand-mark {
  display: inline-flex; width: 8px; height: 8px; border-radius: 50%;
  margin-right: .4rem; flex-shrink: 0;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(20,184,198,.28);
}
.muni {
  margin: .35rem 0 0;
  font-size: .68rem;
  color: rgba(186, 210, 222, .9);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-block .badge { margin-top: .4rem; }
.sidebar-user-chip {
  margin: .75rem .75rem 0;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user-chip .role-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-weight: 750;
}
.sidebar-user-chip .user-meta {
  margin-top: .15rem;
  font-size: .72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .85rem .65rem;
}
.nav-label {
  margin: .55rem .55rem .3rem;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #7b8fa3;
  font-weight: 700;
}
.nav-label:first-child { margin-top: .2rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .7rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: .875rem;
  font-weight: 550;
  border-left: 3px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-ico {
  width: 1.35rem; height: 1.35rem; border-radius: 6px;
  display: grid; place-items: center;
  background: transparent; color: #94a3b8; flex-shrink: 0;
}
.nav-ico .icon,
.nav-ico svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link:hover .nav-ico { color: #fff; }
.nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--accent);
  box-shadow: none;
}
.nav-link.active .nav-ico {
  background: transparent;
  color: var(--accent);
}
.sidebar-foot {
  flex-shrink: 0;
  padding: .75rem .75rem .9rem;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  margin-top: auto;
}
.sidebar .role-label {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); font-weight: 750;
}
.sidebar .user-name {
  margin-top: .2rem; font-size: .85rem; color: #fff; font-weight: 650;
  display: flex; align-items: center; gap: .35rem;
}
.logout {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  margin-top: .65rem; width: 100%; text-align: center;
  border: 1px solid rgba(255,255,255,.12); color: #e2e8f0; padding: .5rem .65rem;
  border-radius: var(--radius-sm); font-size: .8rem; font-weight: 650;
  transition: background .2s ease, border-color .2s ease;
}
.logout .icon,
.logout svg { width: .95rem; height: .95rem; }
.logout:hover { background: rgba(255,255,255,.08); border-color: rgba(248,113,113,.4); color: #fecaca; }
.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.topbar {
  flex-shrink: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 31, 51, 0.04);
  z-index: 20;
  min-width: 0;
  max-width: 100%;
}
.top-hint {
  font-size: .82rem;
  color: var(--ink-muted);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exit-demo {
  font-size: .86rem;
  color: var(--brand);
  font-weight: 750;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.exit-demo .icon,
.exit-demo svg { width: .95rem; height: .95rem; }
.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  flex: 0 0 auto;
  align-items: center;
  gap: .4rem;
}
.menu-btn .icon,
.menu-btn svg { width: 1rem; height: 1rem; }
.top-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 650;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #c5e8ef;
  flex: 0 0 auto;
  white-space: nowrap;
}
.top-chip .icon,
.top-chip svg { width: .9rem; height: .9rem; }
.top-chip::before { display: none; }

/* Lucide icons */
.icon,
[data-lucide] {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 2;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.18em;
}
.icon-inline {
  width: .95rem;
  height: .95rem;
  margin-right: .2rem;
  vertical-align: -0.15em;
}
.icon-title {
  width: 1.05rem;
  height: 1.05rem;
  margin-right: .35rem;
  color: var(--brand-mid);
  vertical-align: -0.12em;
}
.icon-kpi {
  width: .9rem;
  height: .9rem;
  margin-right: .3rem;
  vertical-align: -0.12em;
  opacity: .9;
}
.kpi-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .15rem;
}
.panel-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.user-name {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.35rem 1.35rem 2.5rem;
  animation: contentIn .4s var(--ease) both;
  container-type: inline-size;
  container-name: main;
}
.content > * {
  max-width: 100%;
  min-width: 0;
}
.backdrop { position: fixed; inset: 0; background: rgba(5, 33, 42, .45); border: 0; z-index: 25; }

/* Landing */
.hero {
  position: relative; min-height: 100vh; display: grid; place-items: center;
  overflow: hidden; color: #f8fafc;
  background:
    linear-gradient(120deg, rgba(11, 31, 51, .94) 0%, rgba(19, 78, 111, .82) 48%, rgba(26, 107, 138, .7) 100%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #0b1f33, #134e6f);
}
.hero-glow {
  position: absolute; inset: auto -12% -28% 35%; height: 62%;
  background: radial-gradient(circle, rgba(5,191,219,.35), transparent 62%);
  pointer-events: none; animation: drift 14s ease-in-out infinite alternate;
}
.hero-wave {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background:
    radial-gradient(ellipse at 20% 100%, rgba(242,235,227,.18), transparent 50%),
    radial-gradient(ellipse at 70% 120%, rgba(5,191,219,.22), transparent 45%);
  pointer-events: none; animation: waveSoft 8s ease-in-out infinite alternate;
}
.hero-inner {
  position: relative; z-index: 1; width: min(980px, calc(100% - 2.5rem));
  padding: 2.5rem 0 4rem; animation: heroIn .75s var(--ease) both;
}
.kicker {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 750; color: #9fe6f1; margin-bottom: 1.1rem;
}
.hero-brand {
  font-family: var(--font-display); font-size: clamp(4.2rem, 14vw, 8rem);
  font-weight: 700; letter-spacing: -.035em; line-height: .9; margin-bottom: .7rem;
  text-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.tagline {
  font-family: var(--font-display); font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  font-weight: 560; max-width: 16ch; line-height: 1.2; margin-bottom: 1.1rem;
  color: #f2ebe3;
}
.support { max-width: 40ch; font-size: 1.08rem; color: #d7e8ef; margin-bottom: 1.9rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.6rem; }
.cta-ghost {
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); color: #fff;
  border-radius: 999px;
}
.cta-ghost:hover { background: rgba(255,255,255,.16); }
.muni-note { font-size: .88rem; color: #9db8c3; }

.section { padding: 4.5rem 1.5rem 5.5rem; max-width: 1040px; margin: 0 auto; }
.section-title {
  font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.35rem);
  color: var(--brand-deep); margin-bottom: .7rem; letter-spacing: -0.02em;
}
.section-lead { color: var(--ink-muted); max-width: 52ch; margin-bottom: 2rem; font-size: 1.02rem; }
.module-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .65rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.module-chip {
  flex: 1 1 auto;
  min-width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding: 1rem 1rem;
  text-align: center;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f3fbfd);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.3;
  color: var(--brand);
  box-shadow: var(--shadow-lift);
  animation: rise .55s var(--ease) both;
  transition: transform .22s var(--ease), border-color .22s var(--ease);
  white-space: nowrap;
}
.module-chip:hover { transform: translateY(-3px); border-color: #9fe6f1; }
.module-chip:nth-child(2) { animation-delay: .05s; }
.module-chip:nth-child(3) { animation-delay: .1s; }
.module-chip:nth-child(4) { animation-delay: .15s; }
.module-chip:nth-child(5) { animation-delay: .2s; }
.module-chip:nth-child(6) { animation-delay: .25s; }
.module-chip:nth-child(7) { animation-delay: .3s; }

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: .5rem;
  width: 100%;
}
.pillar {
  min-width: 0;
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-lift);
  animation: rise .55s var(--ease) both;
}
.pillar h3 {
  font-family: var(--font-display); font-size: 1.15rem; color: var(--brand-deep);
  margin-bottom: .45rem;
}
.pillar p { color: var(--ink-muted); font-size: .92rem; }
.pillar-num {
  display: inline-block; margin-bottom: .7rem; font-family: var(--font-mono);
  font-size: .78rem; font-weight: 700; color: var(--brand-mid);
}

.section-alt {
  background:
    linear-gradient(180deg, transparent, rgba(232,246,248,.65) 20%, rgba(232,246,248,.65) 80%, transparent),
    var(--surface);
}

/* Login — tarjeta institucional (inspirado, no clon) */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(at 0% 0%, rgba(19, 78, 111, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(20, 184, 198, 0.05) 0px, transparent 50%),
    var(--surface);
}
.login-top {
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.login-top-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.login-top-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 800;
  color: var(--brand-deep);
  line-height: 1.1;
}
.login-top-brand small {
  display: block;
  font-size: .62rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-deep);
}
.login-help {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: .78rem;
  font-weight: 650;
  color: var(--ink-muted);
}
.login-help:hover { background: #fff; color: var(--brand); }
.login-help svg { width: .9rem; height: .9rem; }

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}
.login-card {
  width: min(960px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr);
  min-height: 520px;
}

.login-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  background: linear-gradient(145deg, #0b1f33 0%, #134e6f 55%, #1a6b8a 100%);
}
.login-hero-glow {
  position: absolute;
  width: 14rem; height: 14rem;
  border-radius: 50%;
  background: rgba(20, 184, 198, .22);
  bottom: -3rem; left: -3rem;
  pointer-events: none;
}
.login-hero-inner { position: relative; z-index: 1; }
.login-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  font-size: .68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #ccecf0;
  margin-bottom: 1rem;
}
.login-pill svg { width: .85rem; height: .85rem; }
.login-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.login-hero-sub {
  margin-top: .35rem;
  font-size: .72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
}
.login-hero-copy {
  margin-top: 1rem;
  font-size: .84rem;
  color: rgba(226, 240, 245, .85);
  max-width: 28ch;
  line-height: 1.45;
}
.login-hero .login-points {
  margin-top: 1.25rem;
  list-style: none;
  display: grid;
  gap: .45rem;
}
.login-hero .login-points li {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: #d7e8ef;
}
.login-hero .login-points li::before { display: none; }
.icon-point,
.login-hero .login-points svg {
  width: .95rem;
  height: .95rem;
  color: var(--accent);
  flex-shrink: 0;
}
.login-hero-foot {
  position: relative;
  z-index: 1;
  font-size: .72rem;
  color: rgba(148, 180, 196, .9);
}

.login-form-side {
  padding: 1.5rem 1.4rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}
.login-panel-head { margin-bottom: 1rem; }
.login-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 800;
  color: var(--brand-deep);
  letter-spacing: -0.02em;
}
.login-lead {
  margin-top: .35rem;
  color: var(--ink-muted);
  font-size: .84rem;
}

.roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  flex: 1;
}
.roles-grid > form { min-width: 0; }
.roles-grid > form:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.role-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: .55rem;
  width: 100%;
  height: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  padding: .7rem .75rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.role-btn:hover {
  border-color: var(--brand-mid);
  background: #fff;
  box-shadow: var(--shadow-lift);
  transform: none;
}
.role-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.role-avatar .icon,
.role-avatar svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: #fff;
}
.role-admin .role-avatar { background: linear-gradient(145deg, #17324D, #46627A); }
.role-ejec .role-avatar { background: linear-gradient(145deg, #46627A, #2E9FAF); }
.role-teso .role-avatar { background: linear-gradient(145deg, #17324D, #2E9FAF); }
.role-rec .role-avatar { background: linear-gradient(145deg, #247f8c, #2E9FAF); }
.role-cat .role-avatar { background: linear-gradient(145deg, #46627A, #5a7a94); }
.role-ciu .role-avatar { background: linear-gradient(145deg, #5a6a78, #8a9aaa); }

.role-copy { min-width: 0; display: grid; gap: 0; }
.role-btn .role-label {
  display: block;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
  color: var(--brand-mid);
  line-height: 1.2;
}
.role-name {
  display: block;
  font-weight: 750;
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .7rem;
  color: var(--ink-muted);
  line-height: 1.3;
  margin-top: .15rem;
}
.role-go {
  opacity: .35;
  color: var(--brand);
}
.role-btn:hover .role-go { opacity: 1; }
.role-go svg { width: .95rem; height: .95rem; }

.login-note {
  margin-top: 1rem;
  text-align: center;
  font-size: .72rem;
  color: var(--ink-muted);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--brand-deep);
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28ch;
}

@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; min-height: 0; }
  .login-hero { min-height: auto; padding: 1.25rem 1.15rem; }
  .login-hero-copy,
  .login-hero .login-points { display: none; }
  .login-form-side { padding: 1.15rem 1rem 1rem; }
}
@media (max-width: 640px) {
  .roles-grid { grid-template-columns: 1fr; }
  .roles-grid > form:last-child:nth-child(odd) { grid-column: auto; }
  .role-go { display: none; }
  .topbar-title { display: none; }
}
/* Modules catalog */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 1rem;
  width: 100%;
}
.mod-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff;
  padding: 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .7rem; min-height: 190px;
  box-shadow: var(--shadow-lift);
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
  animation: rise .45s var(--ease) both;
}
.mod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.mod-card.on { border-color: #7ee0ef; background: linear-gradient(180deg, #fff, #f0fbfd); }
.mod-card h2 { font-family: var(--font-display); font-size: 1.08rem; color: var(--brand-deep); }
.mod-card .desc { color: var(--ink-muted); font-size: .88rem; flex: 1; }
.mod-foot { border-top: 1px solid var(--line); padding-top: .7rem; }
.switch { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 700; cursor: pointer; }
.switch input { width: 1.05rem; height: 1.05rem; accent-color: var(--brand-mid); }
.locked { font-size: .82rem; color: var(--ink-muted); font-weight: 650; }

/* Interop flow */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: .55rem;
  margin-bottom: 1.3rem;
  padding: .85rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, #fff, #f7fbfd),
    radial-gradient(120% 80% at 50% 0%, rgba(20, 184, 198, .08), transparent 60%);
  border: 1px solid var(--line);
  animation: rise .5s var(--ease) both;
  max-width: 100%;
}
.flow-node {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 150px;
  justify-content: center;
  min-height: 3.15rem;
  padding: .8rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-deep);
  font-weight: 750;
  font-size: .92rem;
  text-align: center;
  box-shadow: var(--shadow-lift);
  max-width: 100%;
  line-height: 1.25;
}
.flow-node .icon,
.flow-node svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  stroke: currentColor;
}
.flow-core {
  flex: 1.15 1 170px;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand-mid));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(11, 31, 51, .22);
}
.flow-core .icon,
.flow-core svg {
  color: #fff;
  stroke: #fff;
}
.flow-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-deep);
  flex: 0 0 auto;
}
.flow-arrow .icon,
.flow-arrow svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke: currentColor;
}

/* Pagos / filtros / listas */
.form-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  width: 100%;
  max-width: 100%;
}
.form-row { margin-bottom: 1rem; }
.form-row .field,
.filters .field {
  flex: 1 1 220px;
  min-width: 0;
}
.field-sm {
  flex: 0 1 180px !important;
  min-width: 0;
}
.field input,
.field select {
  width: 100%;
  max-width: 100%;
}

.pagos-result {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.1rem;
  animation: rise .45s var(--ease) both;
  width: 100%;
}
.owner {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 700;
  color: var(--brand-deep);
  overflow-wrap: anywhere;
}
.total-box {
  margin: .8rem 0;
  padding: .9rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  min-width: 0;
}
.total-box strong {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  color: var(--brand-deep);
  overflow-wrap: anywhere;
}
.adeudo-list { list-style: none; display: grid; gap: .45rem; margin: .5rem 0 1rem; }
.adeudo-list li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
  min-width: 0;
}
.adeudo-list li > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.adeudo-list li > span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}
.recibo {
  align-self: start;
  border-color: #8fd9bc;
  background: linear-gradient(180deg, #fff, var(--success-soft));
  animation: pop .45s var(--ease) both;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  max-width: 100%;
}
.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }

.status-list { list-style: none; display: grid; gap: .15rem; min-width: 0; }
.status-list li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.status-list li > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mod-card-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: flex-start;
  min-width: 0;
}
.mod-card-head h2 {
  min-width: 0;
  flex: 1 1 auto;
}
.mod-card-head .badge {
  flex: 0 0 auto;
}
.inline-form { display: inline; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes contentIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateX(0) scale(1); } to { transform: translateX(-48px) scale(1.05); } }
@keyframes waveSoft { from { opacity: .7; transform: translateY(0); } to { opacity: 1; transform: translateY(-10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@keyframes fillBar { from { width: 0; } }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(5,191,219,.2); }
  50% { box-shadow: 0 0 0 8px rgba(5,191,219,.08); }
}

/* â€”â€” Responsividad global â€”â€” */
@media (max-width: 1400px) {
  .grid-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .pagos-result { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .pillars { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
}

@container main (max-width: 980px) {
  .grid-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .pagos-result { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
}

@container main (max-width: 560px) {
  .grid-kpis { grid-template-columns: 1fr; }
  .adeudo-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
  }
  .adeudo-list li > span:last-child { white-space: normal; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; max-height: none; }
}

@media (max-width: 900px) {
  body.app-body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 290px);
    height: 100vh;
    max-height: 100vh;
    transform: translateX(-105%);
    transition: transform .3s var(--ease);
    z-index: 40;
  }
  .sidebar.open { transform: none; }
  .main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .content {
    overflow-x: hidden;
    overflow-y: visible;
  }
  .menu-btn { display: inline-flex; }
  .top-hint { display: none; }
  .topbar {
    padding: 0 1rem;
    gap: .65rem;
  }
  .exit-demo { font-size: .8rem; white-space: nowrap; }
  .section { padding: 3rem 1.15rem 3.5rem; }
  .module-strip {
    justify-content: center;
  }
  .module-chip {
    flex: 1 1 9.5rem;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .page-header { flex-direction: column; }
  .content { padding: 1rem .95rem 2rem; }
  .btn { width: auto; max-width: 100%; }
  .form-row .btn,
  .filters .btn { width: 100%; }
  .form-row .field,
  .filters .field,
  .field-sm {
    flex: 1 1 100% !important;
  }
  .total-box { flex-direction: column; align-items: flex-start; }
  .flow-arrow { display: none; }
  .flow {
    flex-direction: column;
    align-items: stretch;
    gap: .45rem;
  }
  .flow-node,
  .flow-core {
    flex: 1 1 auto;
  }
  .cta-row .btn { width: 100%; }
  .hero-inner { width: min(100%, calc(100% - 1.5rem)); }
  .support { font-size: 1rem; }
}

@media (max-width: 560px) {
  .grid-kpis { grid-template-columns: 1fr; }
  .hero-brand { font-size: clamp(3.2rem, 16vw, 4.5rem); }
  .tagline { max-width: 100%; }
  .mod-card { min-height: 0; }
  .top-chip { display: none; }
}

/* —— P0: portal ciudadano, analítica, alertas —— */
.kpi-danger .kpi-value { color: var(--danger); }
.panel-subtitle {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--brand);
  margin: 1rem 0 0.4rem;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 520px;
}
.form-stack .btn { align-self: flex-start; }

.trend-bars { display: flex; flex-direction: column; gap: 0.65rem; }
.trend-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
}
.trend-mes { font-size: 0.8rem; font-weight: 700; color: var(--ink-muted); }
.trend-track {
  height: 0.55rem;
  background: var(--brand-soft);
  border-radius: 999px;
  overflow: hidden;
}
.trend-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-mid), var(--accent));
  border-radius: inherit;
}
.trend-val { font-size: 0.78rem; color: var(--ink-muted); }

/* —— Gráficas —— */
.chart-caption { margin: -0.35rem 0 0.85rem; font-size: 0.82rem; }
.chart-block { width: 100%; min-width: 0; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin-bottom: 0.85rem;
}
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.swatch-accent { background: var(--accent); }
.swatch-brand { background: var(--brand-mid); opacity: 0.45; }
.swatch-good { background: var(--success); }
.swatch-warn { background: var(--warning); }

.vchart {
  position: relative;
  height: 220px;
  padding: 0.25rem 0 0;
}
.vchart-grid {
  position: absolute;
  inset: 0 0 2.6rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.vchart-grid > span {
  display: block;
  border-top: 1px dashed var(--line);
  opacity: 0.9;
}
.vchart-bars {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  padding-bottom: 2.6rem;
}
.vchart-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.vchart-pair {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  min-height: 0;
}
.vbar {
  position: relative;
  width: min(18px, 42%);
  border-radius: 6px 6px 2px 2px;
  transition: filter .18s var(--ease), transform .18s var(--ease);
  cursor: default;
}
.vbar:hover { filter: brightness(1.06); transform: translateY(-2px); }
.vbar-prog {
  background: color-mix(in srgb, var(--brand-mid) 38%, #e8eef3);
  border: 1px solid color-mix(in srgb, var(--brand-mid) 35%, transparent);
}
.vbar-rec {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 4px 10px rgba(46, 159, 175, 0.28);
}
.vbar-rec.is-over {
  background: linear-gradient(180deg, #3cb8a8 0%, var(--success) 100%);
  box-shadow: 0 4px 10px rgba(15, 122, 90, 0.22);
}
.vbar-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s var(--ease);
  z-index: 2;
}
.vbar:hover .vbar-tip { opacity: 1; }
.vchart-label {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}
.vchart-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}
.vchart-pct.is-over { color: var(--success); }

.chart-donut-wrap {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 1.15rem;
  align-items: center;
}
.donut-visual {
  position: relative;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.donut-svg { width: 100%; height: 100%; display: block; }
.donut-seg { transition: stroke-width .18s var(--ease); }
.donut-visual:hover .donut-seg { stroke-width: 17; }
.donut-center {
  position: absolute;
  inset: 28%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 50%;
  background: #fff;
}
.donut-center span {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.05rem;
  color: var(--brand);
  line-height: 1;
}
.donut-center small {
  font-size: 0.65rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-top: 0.2rem;
}
.donut-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.donut-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
}
.donut-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donut-meta {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.hchart { display: flex; flex-direction: column; gap: 0.7rem; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(5rem, 7.5rem) 1fr auto;
  gap: 0.65rem;
  align-items: center;
}
.hbar-label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar-track {
  height: 0.7rem;
  background: var(--brand-soft);
  border-radius: 999px;
  overflow: hidden;
}
.hbar-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-mid), var(--accent));
}
.hbar-val { font-size: 0.72rem; color: var(--ink-muted); }

.split-bar {
  display: flex;
  height: 1.1rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--brand-soft);
  margin-bottom: 0.75rem;
}
.split-vig { background: var(--success); }
.split-ven { background: var(--warning); }

@media (max-width: 720px) {
  .chart-donut-wrap { grid-template-columns: 1fr; }
  .donut-visual { max-width: 160px; }
  .vchart { height: 200px; }
  .hbar-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .hbar-val { justify-self: end; }
}

/* —— P1: mapa, admin, conciliación —— */
.ficha-tabs a.ficha-tab { text-decoration: none; cursor: pointer; }
.ficha-tabs a.ficha-tab:hover { filter: brightness(0.97); }

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
}
.map-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.map-legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: 1rem;
  align-items: start;
}
.map-panel { padding: 0.75rem; overflow: hidden; }
.leaflet-map {
  width: 100%;
  height: min(62vh, 560px);
  min-height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 1;
  background: #dce8ee;
}
.leaflet-map-mini {
  height: 220px;
  min-height: 200px;
}
.leaflet-control-attribution {
  display: none !important;
}
.sfgm-pin {
  background: transparent !important;
  border: none !important;
}
.sfgm-pin span {
  display: block;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(23, 50, 77, 0.35);
}
.map-svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}
.map-label {
  font-size: 11px;
  font-family: var(--font-body);
  fill: var(--brand-mid);
  font-weight: 700;
}
.map-parcel { cursor: pointer; }
.map-parcel:hover rect { filter: brightness(1.12); }
.mini-map {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.perm-table th,
.perm-table td {
  font-size: 0.82rem;
  white-space: nowrap;
}
.row-alert {
  background: color-mix(in srgb, var(--warning-soft) 70%, #fff);
}
.conc-highlight {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
  box-shadow: 0 4px 18px rgba(194, 106, 10, 0.08);
}

@media (max-width: 980px) {
  .map-layout { grid-template-columns: 1fr; }
  .param-grid { grid-template-columns: 1fr; }
}

.alert-list { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }
.alert-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.alert-item strong { font-size: 0.9rem; color: var(--ink); }
.alert-critica { border-left: 3px solid var(--danger); background: var(--danger-soft); }
.alert-alta { border-left: 3px solid var(--warning); background: var(--warning-soft); }
.alert-media { border-left: 3px solid var(--brand-mid); background: var(--brand-soft); }
.alert-ok { border-left: 3px solid var(--success); background: var(--success-soft); }

.ficha-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 1rem;
}
.ficha-tab {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-mid);
}
.ficha-tab.active {
  background: var(--brand);
  color: #fff;
}

.role-ejec .role-avatar { background: #e8eef3; color: var(--brand); }

/* Portal ciudadano */
.portal-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(46, 159, 175, 0.12), transparent 50%),
    var(--surface);
}
.portal-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.35rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.portal-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--brand);
}
.portal-brand small {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.portal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}
.portal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.portal-link .icon { width: 1rem; height: 1rem; }
.portal-link:hover,
.portal-link.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.portal-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.portal-user a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  color: var(--brand);
}
.portal-content {
  flex: 1;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1.15rem 2.5rem;
}
.portal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-muted);
  background: #fff;
}
.portal-help { max-width: 40rem; }

@media (max-width: 720px) {
  .portal-nav { margin-left: 0; width: 100%; order: 3; }
  .portal-user { margin-left: auto; }
}
