/* Conjunto Residencial Ibarí: prototipo.
   Identidad: naturaleza y comunidad (verde bosque, terracota de ladrillo, crema).
   Pensado para personas mayores: letra de 18 px o más, contraste alto, botones de 58 px
   y todo visible sin menús escondidos. */

/* Atkinson Hyperlegible dibuja el cero tachado, que confunde en montos de dinero:
   solo los dígitos vienen de Public Sans (OFL), que tiene un cero normal. */
@font-face { font-family: 'Cifras'; src: url('../fonts/public-sans-cifras.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0030-0039; }

:root {
  color-scheme: light;
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --surface-2: #EFEADF;
  --text: #1B2A21;
  --muted: #475A4E;
  --border: #8A9A8F;
  --border-soft: #E0DACC;
  --input-bg: #FFFFFF;
  --primary: #1F6B45;
  --primary-hover: #17573A;
  --on-primary: #FFFFFF;
  --primary-soft: #E2EFE5;
  --primary-text: #1A5C3B;
  --accent: #B4532A;
  --accent-soft: #F8E6DA;
  --ok: #15803D;
  --ok-bg: #DCFCE7;
  --ok-text: #14532D;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --warn-text: #78350F;
  --bad: #B91C1C;
  --bad-hover: #991B1B;
  --bad-bg: #FEE2E2;
  --bad-text: #7F1D1D;
  --on-bad: #FFFFFF;
  --info-bg: #E2EFE5;
  --info-text: #17462F;
  --ring: #B4532A;
  --deep: #163D2A;
  --on-deep: #F3EFE4;
  --shadow: 0 1px 2px rgba(27, 42, 33, .05), 0 6px 18px rgba(27, 42, 33, .06);
  --shadow-lg: 0 18px 50px rgba(27, 42, 33, .16);
  --radius: 20px;
  --tap: 3.25rem;
  --dur: 180ms;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1712;
    --surface: #17221B;
    --surface-2: #203028;
    --text: #F2EFE6;
    --muted: #C9D2C8;
    --border: #6E8275;
    --border-soft: #2C3D33;
    --input-bg: #121C16;
    --primary: #86D3A2;
    --primary-hover: #A8E2BC;
    --on-primary: #0B2014;
    --primary-soft: #1C3426;
    --primary-text: #95DCAE;
    --accent: #F0A27A;
    --accent-soft: #3A2419;
    --ok: #4ADE80;
    --ok-bg: #0F2E1C;
    --ok-text: #86EFAC;
    --warn: #FBBF24;
    --warn-bg: #33240A;
    --warn-text: #FCD34D;
    --bad: #F87171;
    --bad-hover: #FCA5A5;
    --bad-bg: #3A1414;
    --bad-text: #FCA5A5;
    --on-bad: #1A0505;
    --info-bg: #1C3426;
    --info-text: #CDEBD7;
    --ring: #F0A27A;
    --deep: #0A120D;
    --on-deep: #F2EFE6;
    --shadow: none;
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1712;
  --surface: #17221B;
  --surface-2: #203028;
  --text: #F2EFE6;
  --muted: #C9D2C8;
  --border: #6E8275;
  --border-soft: #2C3D33;
  --input-bg: #121C16;
  --primary: #86D3A2;
  --primary-hover: #A8E2BC;
  --on-primary: #0B2014;
  --primary-soft: #1C3426;
  --primary-text: #95DCAE;
  --accent: #F0A27A;
  --accent-soft: #3A2419;
  --ok: #4ADE80;
  --ok-bg: #0F2E1C;
  --ok-text: #86EFAC;
  --warn: #FBBF24;
  --warn-bg: #33240A;
  --warn-text: #FCD34D;
  --bad: #F87171;
  --bad-hover: #FCA5A5;
  --bad-bg: #3A1414;
  --bad-text: #FCA5A5;
  --on-bad: #1A0505;
  --info-bg: #1C3426;
  --info-text: #CDEBD7;
  --ring: #F0A27A;
  --deep: #0A120D;
  --on-deep: #F2EFE6;
  --shadow: none;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .45);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
html.big { font-size: 21px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cifras', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
h1, h2, h3 { line-height: 1.22; margin: 0 0 .5rem; text-wrap: balance; }
h1, h2, .h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2, .h2, .h2-like { font-size: 1.32rem; }
.h2-like { font-family: var(--serif); font-weight: 700; }
h3, .h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--primary-text); text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
h1:focus, h2:focus, main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.meta { color: var(--muted); display: block; }
.lead { font-size: 1.08rem; color: var(--muted); }
.center { text-align: center; }
.break { word-break: break-all; }
.bad-text { color: var(--bad-text); font-weight: 700; }
.ok-strong { color: var(--ok-text); }
.loading { padding: 2rem 16px; text-align: center; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 60; background: var(--primary); color: var(--on-primary); padding: .75rem 1rem; border-radius: 10px; font-weight: 700; }
.skip:focus { top: 12px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.ic { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 2rem; height: 2rem; }
.ic-xl { width: 3rem; height: 3rem; }
.ic-xxl { width: 4.5rem; height: 4.5rem; color: var(--ok); }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-height: 48px; min-width: 0; }
.logo-mark { width: 46px; height: 46px; flex: none; }
.lm-bg { fill: var(--primary); }
.lm-fg { fill: var(--on-primary); }
.lm-fg-s { stroke: var(--on-primary); }
.lm-bg-s { stroke: var(--primary); }
.logo-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.logo-text strong { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; }
.logo-text small { font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-light { color: #FFFFFF; }
.logo-light .logo-text small { color: rgba(255, 255, 255, .85); }
.logo-light .lm-bg { fill: #FFFFFF; }
.logo-light .lm-fg { fill: #1F6B45; }
.logo-light .lm-fg-s { stroke: #1F6B45; }
.logo-light .lm-bg-s { stroke: #FFFFFF; }
.proto-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.proto-pill .ic { width: 1.05em; height: 1.05em; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; letter-spacing: .02em; margin-bottom: .6rem; }
.eyebrow .ic { width: 1.2em; height: 1.2em; }

/* =====================================================================
   PÁGINA PRINCIPAL PÚBLICA
   ===================================================================== */
.site-head { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft); }
.site-head-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
.site-links { display: none; }
.site-link { min-height: 48px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; transition: background-color var(--dur), color var(--dur); }
.site-link:hover { background: var(--primary-soft); color: var(--primary-text); }
.site-actions { display: flex; gap: 10px; align-items: center; }

.hero { position: relative; padding: 28px 0 36px; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60rem 30rem at 85% 10%, var(--primary-soft), transparent 60%), radial-gradient(40rem 24rem at 0% 100%, var(--accent-soft), transparent 60%); pointer-events: none; }
.hero-grid { position: relative; display: grid; gap: 28px; align-items: center; }
.hero h1 { font-size: clamp(2.05rem, 7vw, 3.4rem); line-height: 1.1; margin-bottom: 1rem; }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 36rem; margin-bottom: 1.4rem; }
.hero-ctas { display: grid; gap: 12px; margin-bottom: 1.4rem; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hero-points li { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.hero-points .ic { color: var(--primary-text); }
.hero-art { position: relative; order: -1; margin-bottom: 14px; }
@media (max-width: 420px) { .site-head .logo-text small { display: none; } }
.hero-art img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: 40% 70%; border-radius: 28px; box-shadow: var(--shadow-lg); }
.hero-float { position: absolute; left: 14px; bottom: -18px; display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border: 1px solid var(--border-soft); }
.hero-float .ic { color: var(--accent); width: 1.8rem; height: 1.8rem; }
.hero-float span { display: flex; flex-direction: column; line-height: 1.3; }
.hero-float small { color: var(--muted); font-size: .95rem; }

.stats { background: var(--deep); color: var(--on-deep); margin-top: 28px; }
.stats-grid { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 auto; padding-top: 22px; padding-bottom: 22px; }
.stats-grid li { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; text-align: center; }
.stats-grid strong { font-family: var(--serif); font-size: 2rem; line-height: 1.1; }
.stats-grid span { opacity: .9; }

.section { padding: 56px 0; }
.section-alt { background: var(--surface-2); }
.section-title { font-size: clamp(1.7rem, 5vw, 2.4rem); margin-bottom: .6rem; }
.section-lead { font-size: 1.1rem; color: var(--muted); max-width: 44rem; margin-bottom: 1.8rem; }
.services, .zonas, .contact-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.service, .contact { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.service p { color: var(--muted); flex: 1; }
.service-ic { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-text); margin-bottom: 14px; }
.service-ic .ic { width: 28px; height: 28px; }
.service-cta { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; font-weight: 700; text-decoration: none; }
.service-cta:hover span { text-decoration: underline; }
.avisos-grid { display: grid; gap: 16px; align-items: start; }
.news-list { display: grid; gap: 14px; }
.news { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.news p:last-child { margin-bottom: 0; }
.news-date { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; margin-bottom: .3rem; }
.news-date .ic { width: 1.1em; height: 1.1em; }
.zona { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.zona-img { aspect-ratio: 16 / 9; background-image: url('../img/ibari.svg'); background-size: 320%; background-repeat: no-repeat; }
.zona-body { padding: 18px 20px 20px; }
.zona-body h3 { display: flex; align-items: center; gap: 10px; }
.zona-body h3 .ic { color: var(--primary-text); }
.zona-body p { color: var(--muted); }
.zona-h { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; color: var(--text) !important; margin: 0; }
.zona-h .ic { width: 1.15em; height: 1.15em; margin-top: .2em; color: var(--accent); }
.contact p:last-child { margin-bottom: 0; }

.site-foot { background: var(--deep); color: var(--on-deep); padding: 40px 0 24px; }
.foot-grid { display: grid; gap: 20px; align-items: center; }
.foot-grid p { margin: 10px 0 0; opacity: .9; }
.foot-actions { display: grid; gap: 10px; }
.foot-legal { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .15); }
.foot-legal p { margin: 0; font-size: .95rem; opacity: .85; }
.btn-light { background: #FFFFFF; color: #17573A; }
.btn-light:hover { background: #E2EFE5; }
.btn-outline-light { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, .6); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .1); }

/* =====================================================================
   INGRESO Y REGISTRO
   ===================================================================== */
.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; }
.auth-art { position: relative; min-height: 210px; overflow: hidden; background: var(--deep); }
.auth-art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 45% 75%; }
.auth-art-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 30, 19, .55) 0%, rgba(10, 30, 19, .15) 45%, rgba(10, 30, 19, .7) 100%); }
.auth-art-text { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 18px 16px; color: #FFFFFF; gap: 16px; }
.auth-quote { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.auth-points { display: none; }
.auth-main { display: flex; flex-direction: column; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; max-width: 560px; width: 100%; margin: 0 auto; padding: 14px 16px 0; }
.auth-form { width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 16px 48px; }
.card-form { padding: 26px 22px; }
.demo-card { border: 2px dashed var(--border); background: var(--surface-2); box-shadow: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; margin: 4px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }

/* =====================================================================
   PANELES (residente y administración)
   ===================================================================== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border-soft); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.topbar .logo-mark { width: 42px; height: 42px; }
.topbar .logo-text strong { font-size: 1.25rem; }
.btn-top { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--border-soft); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; flex: none; transition: background-color var(--dur), border-color var(--dur); }
.btn-top:hover { border-color: var(--primary); }
.demo-strip { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 4px 16px; background: var(--warn-bg); color: var(--warn-text); font-size: .9rem; font-weight: 700; text-align: center; }
.demo-strip .ic { width: 1.1em; height: 1.1em; }
.desk-only { display: none; }
.sidebar { display: none; }

.mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border-soft); box-shadow: 0 -6px 20px rgba(27, 42, 33, .06); padding-bottom: env(safe-area-inset-bottom); }
.mainnav ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.mainnav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 66px; padding: 8px 2px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: min(.88rem, 16px); text-align: center; transition: color var(--dur), background-color var(--dur); }
.mainnav a .ic { width: 28px; height: 28px; }
.mainnav a[aria-current="page"] { color: var(--primary-text); }
.mainnav a[aria-current="page"] .ic { background: var(--primary-soft); border-radius: 999px; padding: 2px 14px; width: 56px; box-sizing: content-box; height: 26px; }
.mainnav a:hover { color: var(--primary-text); }

.main { max-width: 760px; margin: 0 auto; padding: 20px 16px calc(100px + env(safe-area-inset-bottom)); }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; margin: -6px 0 6px -6px; padding: 0 10px 0 4px; font-weight: 700; text-decoration: none; border-radius: 10px; }
.back:hover { background: var(--primary-soft); }
.section-t { margin: 28px 0 12px; }

/* bienvenida con ilustración */
.welcome { position: relative; display: flex; align-items: stretch; min-height: 150px; margin: 0 0 18px; border-radius: var(--radius); overflow: hidden; background: var(--primary-soft); border: 1px solid var(--border-soft); }
.welcome-text { position: relative; z-index: 1; padding: 20px 20px 18px; max-width: 62%; }
.welcome-text h1 { font-size: 1.75rem; margin-bottom: .2rem; }
.welcome-sub { margin: 0; color: var(--muted); font-weight: 700; }
.welcome .eyebrow { margin-bottom: .3rem; }
.welcome-art { position: absolute; inset: 0 0 0 46%; background: url('../img/ibari.svg') 60% 70% / cover no-repeat; -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%); mask-image: linear-gradient(90deg, transparent 0%, #000 38%); }
.dash { display: grid; gap: 0 20px; }
.dash-col { min-width: 0; }

/* ---------- tarjetas y avisos ---------- */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
fieldset.card { min-inline-size: 0; }
fieldset.card > legend { float: left; width: 100%; }
fieldset.card > legend + * { clear: both; }
.card-accent { border: 2px solid var(--primary); }
.kicker { display: flex; align-items: center; gap: 8px; color: var(--primary-text); font-weight: 700; margin-bottom: .4rem; }
.kicker .ic { width: 1.2em; height: 1.2em; }
.alert { display: flex; gap: 14px; align-items: flex-start; padding: 20px; border-radius: var(--radius); border: 2px solid; margin: 0 0 16px; }
.alert > div { min-width: 0; flex: 1; }
.alert h2 { margin-bottom: .35rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-text); }
.alert-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-text); }
.alert-info { background: var(--info-bg); border-color: var(--primary); color: var(--info-text); }
.alert .actions { margin-top: 14px; }
.alert-inline { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 2px solid var(--bad); background: var(--bad-bg); color: var(--bad-text); font-weight: 700; margin-bottom: 16px; }
.alert-inline[hidden] { display: none; }
.status h2 { font-size: 1.45rem; }
.num-lg { font-size: 1.5rem; font-weight: 700; display: inline-block; font-variant-numeric: tabular-nums; }
.ok-text { display: flex; gap: 8px; align-items: flex-start; color: var(--ok-text); font-weight: 700; }
.success { text-align: center; padding: 8px 0 16px; }
.success h1 { margin-top: .5rem; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); border: 2px dashed var(--border-soft); border-radius: var(--radius); }
.empty .ic { width: 2.5rem; height: 2.5rem; }

/* ---------- chips de estado (siempre icono + texto, nunca solo color) ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; border: 2px solid; font-weight: 700; font-size: .95rem; white-space: nowrap; line-height: 1.5; vertical-align: middle; font-family: 'Cifras', 'Atkinson Hyperlegible', system-ui, sans-serif; }
.chip .ic { width: 1.1em; height: 1.1em; }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad); }
.chip-info { background: var(--info-bg); color: var(--info-text); border-color: var(--primary); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: .65rem 1.25rem; border-radius: 14px; border: 2px solid transparent; font: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer; transition: background-color var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur); -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled) { filter: brightness(.94); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }
.btn-xl { min-height: 3.9rem; font-size: 1.15rem; }
.btn-sm { min-height: 48px; padding: .4rem .9rem; font-size: 1rem; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px rgba(31, 107, 69, .22); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary-text); border-color: var(--primary); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); }
.btn-danger { background: var(--bad); color: var(--on-bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-hover); }
.btn-ghost { background: transparent; color: var(--primary-text); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger-text { color: var(--bad-text); padding-left: .5rem; }
.btn-left { justify-content: flex-start; text-align: left; }
.btn-left > span { display: flex; flex-direction: column; }
.btn-left small { font-weight: 400; font-size: .95rem; color: inherit; opacity: .9; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions > .btn { flex: 1 1 auto; }
.stack { display: grid; gap: 12px; margin-top: 16px; }
.card > .btn-block, .card > .stack { margin-top: 12px; }
.spin { width: 1.2em; height: 1.2em; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- formularios ---------- */
.field { margin: 0 0 20px; }
label, legend { font-weight: 700; }
.field > label { display: block; margin-bottom: 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { padding: 0; margin-bottom: .6rem; }
.help { color: var(--muted); margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=tel], input[type=search], input[type=password], input[type=date], input[type=time], select, textarea {
  display: block; width: 100%; min-height: var(--tap); padding: .6rem .9rem; font: inherit; font-size: 1.05rem; color: var(--text); background: var(--input-bg);
  border: 2px solid var(--border); border-radius: 12px; transition: border-color var(--dur);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--ring); outline-offset: 2px; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.error { display: flex; gap: 8px; align-items: flex-start; color: var(--bad-text); font-weight: 700; margin: 8px 0 0; }
.error:empty { display: none; }
.pass { display: flex; gap: 8px; }
.pass input { flex: 1; min-width: 0; }
.pass-btn { flex: none; border: 2px solid var(--border-soft); }
.search { position: relative; }
.search > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 3rem; }
::placeholder { color: var(--muted); opacity: .85; }

.choice { display: flex; align-items: center; gap: 14px; min-height: 3.6rem; padding: 14px 16px; margin: 0 0 10px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 400; flex-wrap: wrap; transition: border-color var(--dur), background-color var(--dur); }
.choice:hover { border-color: var(--primary); }
.choice input { width: 28px; height: 28px; margin: 0; flex: none; accent-color: var(--primary); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.choice > .ic { color: var(--primary-text); }
.choice-body { display: flex; flex-direction: column; flex: 1 1 10rem; min-width: 0; }
.choice-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.grid-2 { display: grid; gap: 0 12px; }
.grid-2 .choice { margin-bottom: 10px; }

/* pasos */
.steps-box { margin: 4px 0 20px; }
.steps-label { margin-bottom: 8px; font-size: 1.08rem; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; padding: 0; }
.steps li { height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.steps li.done, .steps li.current { background: var(--primary); border-color: var(--primary); }
.steps-next { color: var(--muted); margin: 0; }
.paybar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--surface); border: 2px solid var(--primary); border-radius: var(--radius); padding: 14px 16px; margin-top: 8px; box-shadow: var(--shadow-lg); }
.paybar p { margin-bottom: 10px; font-size: 1.1rem; }
.paybar strong { font-size: 1.35rem; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 16px 0 0; padding-top: 14px; border-top: 2px solid var(--border-soft); font-size: 1.15rem; }
.total-line strong { font-size: 1.5rem; }

/* filtros */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.filter { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: .4rem 1rem; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color var(--dur), border-color var(--dur); }
.filter:hover { border-color: var(--primary); }
.filter[aria-current="true"], .filter[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.filters-card .filters { margin-bottom: 8px; }
.filters-card .field:last-child { margin-bottom: 0; }

/* listas */
.list { list-style: none; margin: 0; padding: 0; }
.rows { list-style: none; margin: 0 0 4px; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.rows li:last-child { border-bottom: 0; }
.rows li > div:first-child { min-width: 0; }
.row-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; margin: 4px 0 12px; }
.totals > div { background: var(--surface-2); border-radius: 14px; padding: 10px 14px; }
.totals strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.inv-top > div { min-width: 0; flex: 1 1 12rem; }
.inv-top p { margin-bottom: .2rem; }
.facts { display: grid; gap: 12px; margin: 12px 0; }
.facts > div { display: grid; gap: 2px; }
.facts dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; }
.facts dt .ic { width: 1.15em; height: 1.15em; }
.facts dd { margin: 0 0 0 calc(1.15em + 8px); font-weight: 700; }
.as-head { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.datebox { flex: none; min-width: 74px; padding: 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); text-align: center; border: 2px solid var(--accent); }
.datebox .d { display: block; font-family: var(--serif); font-size: 1.8rem; font-weight: 700; line-height: 1; }
.datebox .m { display: block; font-weight: 700; text-transform: uppercase; font-size: .95rem; }
.agenda { padding-left: 1.5rem; margin: 0 0 14px; }
.agenda li { padding: 4px 0; }
.quote { border-left: 4px solid var(--primary); padding: 6px 0 6px 14px; margin: 12px 0; }
.reply { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.reply-h { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--primary-text); margin-bottom: 4px; }
.reply p:last-child { margin: 0; }
.thumb { display: block; max-height: 260px; border-radius: 12px; border: 1px solid var(--border-soft); margin: 10px 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result-summary { font-size: 1.05rem; }
.tarifas { margin-top: 16px; }
.tarifas summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; color: var(--primary-text); cursor: pointer; }

/* resultados de votación */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.res-top { display: flex; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 6px; }
.res-top strong { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar { height: 16px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 8px; }
.bar-lg { height: 22px; border-radius: 11px; margin: 4px 0 4px; }

/* administración */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: var(--radius); border: 2px solid var(--border-soft); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; box-shadow: var(--shadow); transition: border-color var(--dur); }
.kpi:hover { border-color: var(--primary); }
.kpi-wide { grid-column: 1 / -1; }
.kpi-l { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--muted); }
.kpi-n { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-go { display: inline-flex; align-items: center; gap: 4px; color: var(--primary-text); font-weight: 700; }
.kpi-go .ic { width: 1em; height: 1em; }
.kpi-ok { border-color: var(--ok); }
.kpi-ok .kpi-l { color: var(--ok-text); }
.kpi-bad { border-color: var(--bad); }
.kpi-bad .kpi-l, .kpi-bad .kpi-n { color: var(--bad-text); }
.table-wrap { display: none; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-soft); }
.table th, .table td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 700; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--primary-soft); }
.table td:first-child, .table td:last-child, .table .meta { white-space: nowrap; }

/* aviso flotante */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40; display: none; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto; padding: 14px 16px; border-radius: 14px; border: 2px solid; font-weight: 700; box-shadow: var(--shadow-lg); }
.toast.show { display: flex; animation: up 200ms ease-out; }
.toast > span { flex: 1; }
.toast-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok); }
.toast-bad { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad); }
.toast-x { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 2px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* diálogo de confirmación */
dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 0; border-radius: 22px; padding: 24px 20px 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(6, 18, 11, .6); }
dialog .actions { margin-top: 20px; }
dialog .choice { margin-bottom: 8px; }

/* ---------- celulares grandes y tabletas ---------- */
@media (min-width: 600px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .hero-ctas { display: flex; flex-wrap: wrap; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .services, .zonas { grid-template-columns: 1fr 1fr; }
  .foot-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .welcome-text h1 { font-size: 2rem; }
  .welcome { min-height: 170px; }
}

/* ---------- escritorio ---------- */
@media (min-width: 900px) {
  .desk-only { display: inline-flex; }
  .site-links { display: flex; gap: 2px; }
  .hero { padding: 64px 0 72px; }
  .hero-grid { grid-template-columns: 1fr 1.1fr; gap: 56px; }
  .hero-points { grid-template-columns: 1fr; }
  .hero-ctas { display: grid; grid-auto-columns: 1fr; width: fit-content; }
  .hero-float { left: -24px; bottom: 28px; }
  .hero-art { order: 0; margin-bottom: 0; }
  .dash-col:last-child .facts { grid-template-columns: 1fr; }
  .stats { margin-top: 0; }
  .section { padding: 88px 0; }
  .services { grid-template-columns: repeat(4, 1fr); }
  .zonas { grid-template-columns: repeat(4, 1fr); }
  .avisos-grid { grid-template-columns: 1fr 1.2fr; gap: 24px; }
  .contact-grid { grid-template-columns: repeat(3, 1fr); }
  .foot-grid { grid-template-columns: 1fr auto; }

  .auth-page { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .auth-art { min-height: 100vh; min-height: 100dvh; position: sticky; top: 0; height: 100vh; height: 100dvh; }
  .auth-art-text { padding: 40px 48px; }
  .auth-quote { font-size: 2.6rem; max-width: 22rem; }
  .auth-points { display: grid; gap: 10px; list-style: none; margin: 16px 0 0; padding: 0; font-weight: 700; font-size: 1.1rem; text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
  .auth-points li { display: flex; gap: 10px; align-items: center; }
  .auth-art-text > div, .auth-art-text .auth-quote { margin-top: auto; }
  .auth-top { padding: 28px 40px 0; max-width: 640px; }
  .auth-form { max-width: 640px; padding: 16px 40px 56px; }

  /* panel con barra lateral */
  .app { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--border-soft); }
  .side-user { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); }
  .side-user > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .side-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-user small { color: var(--muted); font-size: .95rem; }
  .avatar { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent); color: #FFFFFF; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
  .side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
  .side-nav a { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 14px; border-radius: 14px; color: var(--text); text-decoration: none; font-weight: 700; transition: background-color var(--dur), color var(--dur); }
  .side-nav a:hover { background: var(--primary-soft); color: var(--primary-text); }
  .side-nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
  .side-bottom { margin-top: auto; display: grid; gap: 6px; }
  .side-btn { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border: 0; border-radius: 14px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
  .side-btn:hover { background: var(--surface-2); }
  .side-bottom .proto-pill { justify-self: start; margin-top: 8px; }
  .topbar, .mainnav { display: none; }
  .main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 32px 40px 56px; }
  .main-narrow { max-width: 900px; }
  .welcome { min-height: 190px; }
  .welcome-text { padding: 28px 32px; }
  .welcome-text h1 { font-size: 2.3rem; }
  .welcome-art { left: 52%; }
  .welcome-text { max-width: 56%; }
  .dash { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.55fr); }
  .kpi-wide { grid-column: auto; }
  .kpi-n { font-size: 1.6rem; overflow-wrap: normal; white-space: nowrap; }
  .mob-list { display: none; }
  .table-wrap { display: block; overflow-x: auto; }
  .paybar { bottom: 16px; }
  .toast { bottom: 24px; }
}


/* ---------- asistente con IA ---------- */
.ai-cta { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin: 0 0 16px; border-radius: var(--radius); background: linear-gradient(120deg, var(--deep), color-mix(in srgb, var(--deep) 70%, var(--primary))); color: var(--on-deep); text-decoration: none; box-shadow: var(--shadow); }
.ai-cta > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ai-cta strong { font-family: var(--serif); font-size: 1.25rem; }
.ai-cta small { opacity: .9; font-size: 1rem; }
.ai-cta:hover { filter: brightness(1.08); }
.chat-card { padding: 0; overflow: hidden; }
.chat { max-height: min(62vh, 640px); min-height: 260px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
.chat-empty { text-align: center; color: var(--muted); margin: auto 0; }
.chat-empty .ic { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.chips .filter { text-align: left; }
.msg { max-width: min(46rem, 92%); padding: 12px 16px; border-radius: 18px; box-shadow: var(--shadow); }
.msg p:last-child { margin-bottom: 0; }
.msg-yo { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.msg-ia { align-self: flex-start; background: var(--surface); border: 1px solid var(--border-soft); border-bottom-left-radius: 6px; }
.msg-who { display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: .95rem; margin-bottom: 4px; opacity: .9; }
.msg-ia .msg-who { color: var(--accent); }
.prop { margin-top: 12px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--warn); background: var(--warn-bg); color: var(--text); }
.prop .kicker { color: var(--warn-text); }
.prop ul { margin: 6px 0 10px; padding-left: 1.2rem; }
.prop-hecha { border-color: var(--ok); background: var(--ok-bg); }
.prop-hecha .kicker { color: var(--ok-text); }
.prop-descartada { border-color: var(--border); background: var(--surface-2); opacity: .8; }
.prop-fallida { border-color: var(--bad); background: var(--bad-bg); }
.chat-form { display: flex; gap: 10px; align-items: flex-end; padding: 14px; border-top: 1px solid var(--border-soft); background: var(--surface); }
.chat-form textarea { flex: 1; min-height: 3.25rem; resize: vertical; }
.chat-card > .btn-ghost { margin: 0 14px 14px; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; word-break: break-all; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.qr { display: block; width: 220px; height: 220px; margin: 8px auto 12px; padding: 10px; background: #FFFFFF; border-radius: 16px; border: 1px solid var(--border-soft); }
.tfa-steps { padding-left: 1.4rem; margin: 0 0 8px; }
.tfa-steps li { padding: 4px 0; }
@media (max-width: 599px) { .chat-form { flex-direction: column; align-items: stretch; } }

/* pantallas anchas: listas en cuadrícula para no dejar espacio vacío */
@media (min-width: 1200px) {
  .main .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; align-items: start; }
  .main .list > li.card { margin: 0; }
  .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; align-items: start; }
  .cards-grid > .card, .cards-grid > .empty { margin: 0; }
  .main-narrow .list { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-art img, :root:not([data-theme="light"]) .zona-img, :root:not([data-theme="light"]) .welcome-art { filter: brightness(.88) saturate(.95); }
}
:root[data-theme="dark"] .hero-art img, :root[data-theme="dark"] .zona-img, :root[data-theme="dark"] .welcome-art { filter: brightness(.88) saturate(.95); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .spin { border-right-color: currentColor; opacity: .6; }
}
@media print {
  .topbar, .mainnav, .sidebar, .toast { display: none; }
  .main { padding: 0; }
}
