:root {
    color-scheme: light dark;
    --bg: #f4f6f5; --surface: #ffffff; --ink: #18201d; --muted: #5a6560; --line: #dfe5e2;
    --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e3f4f1;
    --hero-bg: linear-gradient(135deg, #0d6a62 0%, #14a895 100%);
    --hero-ink: #0d6a62;
    --danger: #b3261e; --danger-soft: #fbeae8; --warn-soft: #fbf3dc;
    --shadow: 0 2px 6px rgba(15, 25, 22, .05), 0 8px 22px rgba(15, 25, 22, .05);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #111614; --surface: #1b221f; --ink: #eef2f0; --muted: #9faaa5; --line: #2e3733;
      --accent: #5eead4; --accent-ink: #0a201c; --accent-soft: #17332e;
      --danger: #ff8f86; --danger-soft: #3c2220; --warn-soft: #39321c;
      --shadow: 0 4px 16px rgba(0, 0, 0, .28);
    }
  }
  body[data-theme="servicios"] {
    --accent: #0f766e; --accent-soft: #e3f4f1;
    --hero-bg: linear-gradient(135deg, #0d6a62 0%, #14a895 100%); --hero-ink: #0d6a62;
  }
  body[data-theme="estadisticas"] {
    --accent: #1d4ed8; --accent-soft: #e6f0fe;
    --hero-bg: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%); --hero-ink: #1d4ed8;
  }
  body[data-theme="predial"] {
    --accent: #b45309; --accent-soft: #fef3dc;
    --hero-bg: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); --hero-ink: #92400e;
  }
  body[data-theme="vehiculos"] {
    --accent: #4f46e5; --accent-soft: #eeecfe;
    --hero-bg: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%); --hero-ink: #4338ca;
  }
  body[data-theme="ajustes"] {
    --accent: #0f766e; --accent-soft: #e3f4f1;
    --hero-bg: linear-gradient(135deg, #1e293b 0%, #0f766e 100%); --hero-ink: #0f766e;
  }
  @media (prefers-color-scheme: dark) {
    body[data-theme="servicios"] { --accent: #5eead4; --accent-ink: #08231e; --accent-soft: #17332e; }
    body[data-theme="estadisticas"] { --accent: #60a5fa; --accent-ink: #0c1d3d; --accent-soft: #172946; }
    body[data-theme="predial"] { --accent: #fbbf24; --accent-ink: #2b1804; --accent-soft: #3a2a12; }
    body[data-theme="vehiculos"] { --accent: #a78bfa; --accent-ink: #1c133b; --accent-soft: #271f47; }
    body[data-theme="ajustes"] { --accent: #5eead4; --accent-ink: #08231e; --accent-soft: #17332e; }
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
  .wrap { max-width: 1240px; margin: 0 auto; padding: 28px 24px 48px; }
  .top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
  h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
  .top-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .top-actions .btn { flex: none; padding-inline: 16px; }

  .picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 8px; }
  label.f { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
  input, select, textarea {
    width: 100%; min-height: 42px; padding: 8px 12px; font: inherit; color: inherit;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  }
  .address { color: var(--muted); font-size: .92rem; margin: 10px 0 20px; }
  .empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; margin-top: 16px; }
  .banner { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: .92rem; }
  .banner.err { background: var(--danger-soft); color: var(--danger); }

  .summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
  .tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
  .summary .tile:first-child, .kpi-grid .tile:first-child { border-top: 3px solid var(--accent); }
  .tile .k { font-size: .82rem; color: var(--muted); }
  .tile .v { font-size: 1.65rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
  .tile .s { font-size: .86rem; color: var(--muted); margin-top: 2px; }
  .tile .v.alert { color: var(--danger); }

  .apto-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 12px; }
  .apto-head h2 { margin: 0; font-size: 1.15rem; }
  .apto-address { font-size: .88rem; color: var(--muted); }
  .apto-total { flex: none; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(265px, 1fr)); gap: 16px; }
  .card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: border-color .18s ease, box-shadow .18s ease; }
  .card:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }
  .card header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
  .icon { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
  .icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .card h3 { font-size: 1.05rem; margin: 0; }
  .card .company { font-size: .88rem; color: var(--muted); }
  .amount { padding: 0 16px; font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
  .due { margin: 10px 16px 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); }
  .due .date { font-weight: 600; }
  .due .state { font-size: .86rem; }
  .due.alert { background: var(--danger-soft); color: var(--danger); }
  dl { margin: 12px 16px 14px; font-size: .88rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; }
  dt { color: var(--muted); }
  dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .pay { margin-top: auto; padding: 0 16px 12px; }
  .pay .btn { display: flex; }
  .help { margin-top: 8px; font-size: .84rem; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
  .check { padding: 0 16px 12px; font-size: .84rem; color: var(--muted); }
  .check a, .check button.link { color: var(--accent); font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
  .thumb { display: block; width: 100%; height: 170px; padding: 0; border: 0; border-block: 1px solid var(--line); background: #fff; cursor: zoom-in; }
  .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
  .actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 6px; }
  .tools { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 2px 16px 12px; font-size: .84rem; }
  .tools button { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
  .tools button.del { color: var(--danger); }
  details.hist { padding: 0 16px 14px; font-size: .84rem; }
  details.hist summary { cursor: pointer; color: var(--muted); }
  details.hist table { width: 100%; margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  details.hist td { padding: 3px 0; border-top: 1px solid var(--line); }
  details.hist td:nth-child(2) { text-align: right; }
  details.hist td:nth-child(3) { text-align: right; color: var(--muted); }
  .btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 10px;
    border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent);
    font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; text-align: center; cursor: pointer;
  }
  .btn.primary { background: var(--accent); color: var(--accent-ink); }
  .btn:hover { filter: brightness(1.08); }
  .btn:disabled { opacity: .55; cursor: progress; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .card.missing { border-style: dashed; box-shadow: none; }
  .card.missing .icon { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
  .missing-body { flex: 1; display: grid; place-content: center; text-align: center; padding: 24px 20px 32px; color: var(--muted); font-size: .92rem; }
  .missing-body strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
  .note { margin: 22px 0 0; font-size: .85rem; color: var(--muted); }

  dialog { padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); }
  dialog::backdrop { background: rgba(10, 15, 12, .6); }
  #viewer { width: min(1100px, 96vw); height: 94vh; max-height: none; overflow: hidden; }
  #viewer[open] { display: flex; flex-direction: column; }
  .viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .viewer-bar h3 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .viewer-bar .btn { flex: none; }
  #viewer iframe { flex: 1; width: 100%; border: 0; background: #525659; }
  .form { width: min(640px, 96vw); max-height: 92vh; }
  .form form { padding: 18px 20px 20px; }
  .form h3 { margin: 0 0 12px; font-size: 1.15rem; }
  .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid .full { grid-column: 1 / -1; }
  .need input, .need select { border-color: var(--danger); background: var(--warn-soft); }
  .form-actions { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }
  .form-actions .btn { flex: none; padding-inline: 18px; }
  .msg { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); font-size: .88rem; }
  .msg.err { background: var(--danger-soft); color: var(--danger); }
  [hidden] { display: none !important; }

  @media (max-width: 720px) {
    .wrap { padding: 14px 14px calc(86px + env(safe-area-inset-bottom, 0px)); }
    h1 { font-size: 1.38rem; }
    .top { gap: 10px; margin-bottom: 14px; }
    .top-actions { width: 100%; }
    .top-actions .btn { flex: 1 1 auto; min-height: 44px; padding-inline: 12px; font-size: .88rem; }
    .picker { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
    .summary .tile:first-child { grid-column: 1 / -1; }
    .tile { padding: 13px 14px; }
    .tile .v { font-size: 1.35rem; }
    .grid { grid-template-columns: minmax(0, 1fr); }
    .btn, input, select, textarea { min-height: 44px; }
    .tools button { min-height: 36px; padding: 6px 2px; }
    .viewer-bar { padding: 8px 10px; gap: 6px; }
    .viewer-bar h3 { font-size: .92rem; }
    .viewer-bar .btn { min-height: 38px; padding: 6px 10px; font-size: .84rem; }
    #viewer { width: 100vw; height: 100dvh; max-width: 100vw; border-radius: 0; }
    dialog.form { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; overflow-y: auto; }
    dialog.form form { padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
    .form-actions { flex-direction: row; }
    .form-actions .btn { flex: 1; }
  }

/* Portal */
.usernav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 18px; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .88rem; color: var(--muted); }
.usernav a { color: var(--muted); padding: 5px 10px; border-radius: 8px; font: inherit; font-weight: 600; text-decoration: none; transition: background .15s ease, color .15s ease; }
.usernav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.usernav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.usernav button { color: var(--accent); background: none; border: 0; padding: 5px 8px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.usernav button:hover { background: var(--accent-soft); }
.usernav .spacer { flex: 1; }
.usernav #nav-user { font-size: .84rem; padding-right: 4px; }
.inline-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.inline-link.del { color: var(--danger); }
.picker.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.flows { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.flow { display: flex; flex-direction: column; gap: 6px; padding: 20px; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.flow:hover { border-color: var(--accent); }
.flow h2 { margin: 8px 0 0; font-size: 1.15rem; }
.flow p { margin: 0; color: var(--muted); font-size: .92rem; }
.flow-total { margin-top: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.center {
  display: grid; place-items: center; min-height: 100dvh; padding: 16px;
  background: radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 46%),
              radial-gradient(circle at 86% 84%, rgba(14, 165, 233, .12), transparent 48%), var(--bg);
}
.login { width: min(420px, 100%); padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 42px rgba(15, 25, 22, .12); }
.login-hero { position: relative; overflow: hidden; padding: 26px 28px 22px; background: var(--hero-bg); color: #ffffff; }
.login-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 90% 15%, rgba(255, 255, 255, .24), transparent 55%); pointer-events: none; }
.login-hero .v-kicker { position: relative; font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; opacity: .88; }
.login-hero h1 { position: relative; font-size: 1.55rem; margin: 4px 0 0; color: #ffffff; }
.login-hero .sub { position: relative; margin: 4px 0 0; color: rgba(255, 255, 255, .88); font-size: .9rem; }
.login-body { padding: 24px 28px 28px; }
.login .btn { display: flex; width: 100%; min-height: 44px; border-radius: 10px; }
.sp { margin-top: 14px; }
.u-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.u-form .btn { flex: none; min-height: 42px; padding-inline: 16px; }
.users { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: .92rem; }
.users td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.users td:last-child { text-align: right; }
#u-msg { margin-top: 12px; overflow-wrap: anywhere; }
@media (max-width: 720px) { .picker.two, .u-form { grid-template-columns: minmax(0, 1fr); } }.cards.fill { grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); }
.picker.two { margin-bottom: 20px; }
.pay-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-row .btn { flex: 1 1 110px; }
.btn.done { background: var(--accent-soft); }
.help .inline-link { font-size: inherit; }
.alerta { display: block; margin: 8px 16px 0; padding: 7px 12px; border-radius: 8px; font-size: .88rem; font-weight: 600; text-decoration: none; border-left: 4px solid; }
.alerta small { display: block; font-weight: 400; color: inherit; opacity: .85; }
.alerta.roja { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alerta.amarilla { background: var(--warn-soft); color: var(--ink); border-color: #c79a1b; }
.alerta.grupo { margin: 0 0 12px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.alert-list .alerta { margin: 0; height: 100%; }
.alert-list a.alerta:hover { filter: brightness(.97); text-decoration: underline; }
.flow { position: relative; }
.badge { position: absolute; top: 14px; right: 14px; padding: 3px 10px; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: .8rem; font-weight: 700; }
.resaltado { outline: 3px solid var(--accent); outline-offset: 2px; scroll-margin-top: 16px; }
.card, .apto-head { scroll-margin-top: 16px; }

/* Bandeja automática, etiquetas y navegación móvil PWA */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--ink); }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.inbox { margin: 0 0 20px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--accent); box-shadow: var(--shadow); }
.inbox-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.inbox-head h2 { margin: 0; font-size: 1.05rem; }
.inbox-head small { color: var(--muted); font-size: .85rem; }
.inbox-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.inbox-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.inbox-item .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.inbox-item .amt { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.inbox-item .meta { font-size: .84rem; color: var(--muted); line-height: 1.4; }
.inbox-item .missing-fields { font-size: .82rem; color: var(--danger); font-weight: 600; }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.inbox-actions .btn { min-height: 38px; padding: 6px 10px; font-size: .86rem; }

.status-grid { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.status-items { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .9rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: middle; }
.status-dot.ok { background: var(--accent); }

.mobnav { display: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tab { min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.section-card { margin-bottom: 16px; }
.section-card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.section-sub { margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
.muted { color: var(--muted); }
.chk { display: flex; align-items: center; gap: 10px; font-size: .92rem; cursor: pointer; }
.chk input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.token-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.token-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.token-row code { flex: 1; min-width: 180px; padding: 8px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: .86rem; overflow-wrap: anywhere; }
.token-row .btn { flex: none; padding-inline: 14px; }
.codeblock { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: .8rem; overflow-x: auto; line-height: 1.45; }
.table-wrap { overflow-x: auto; }
.users th { text-align: left; padding: 6px 8px 8px 0; font-size: .8rem; color: var(--muted); font-weight: 600; }
.users th:last-child { text-align: right; }
.u-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px 12px; }

/* Estadísticas */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-bottom: 16px; }
.insight { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); font-size: .88rem; }
.insight.alerta { border-left-color: var(--danger); background: var(--danger-soft); }
.insight.exito { border-left-color: var(--accent); background: var(--accent-soft); }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
.chart-head h2 { margin: 0; font-size: 1.05rem; }
.svg-scroll { overflow-x: auto; }
.chart-svg { display: block; width: 100%; height: auto; min-height: 190px; }
.svg-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.svg-track { stroke: var(--line); }
.svg-val { fill: var(--ink); font-size: 11px; font-weight: 650; }
.svg-lbl { fill: var(--muted); font-size: 11px; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.legend-inline i, .donut-name i, .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.donut-svg { width: 148px; height: 148px; flex: none; margin: 0 auto; }
.donut-total { fill: var(--ink); font-size: 16px; font-weight: 700; }
.donut-legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 8px; }
.donut-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .88rem; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.donut-row:last-child { border-bottom: 0; padding-bottom: 0; }
.donut-meta { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.apto-stat { padding: 10px 0; border-top: 1px solid var(--line); }
.apto-stat:first-of-type { border-top: 0; padding-top: 0; }
.apto-stat-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: .92rem; }
.apto-stat-val { font-variant-numeric: tabular-nums; }
.hbar { display: flex; width: 100%; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg); gap: 1px; }
.hbar.thin { height: 7px; }
.hbar span { display: block; height: 100%; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.cons-card { display: flex; flex-direction: column; gap: 10px; }
.cons-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cons-head h3 { margin: 0; font-size: 1rem; }
.cons-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.cons-kpis strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.cons-list { display: flex; flex-direction: column; gap: 10px; }
.cons-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; margin-bottom: 3px; }
.cons-row-sub { font-size: .78rem; margin-top: 2px; }
.subtabs { display: flex; gap: 8px; margin-bottom: 14px; }
.subtabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 600; }
.subtabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Tarjeta horizontal para Impuestos (Predial y Vehículos) */
.cards.tax-list { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card.tax-card {
  display: grid;
  grid-template-columns: minmax(225px, 260px) minmax(0, 1fr) minmax(215px, 250px);
  align-items: stretch;
}
.tax-left { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding-bottom: 4px; }
.tax-left .pay { margin-top: auto; padding-top: 12px; }
.tax-mid { padding: 16px 20px; display: flex; align-items: flex-start; }
.tax-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; width: 100%; }
.tax-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tax-field.full { grid-column: 1 / -1; }
.tax-field span { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tax-field strong { font-size: .9rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tax-right { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg); }
.tax-right .thumb { height: 155px; border-top: 0; }
.tax-right .actions { padding: 12px 14px 6px; }
.tax-right .tools { padding: 2px 14px 12px; justify-content: space-between; }
.tax-hist { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 10px 18px 12px; }

@media (max-width: 920px) {
  .card.tax-card { grid-template-columns: minmax(0, 1fr); }
  .tax-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .tax-mid { padding: 14px 16px; }
  .tax-right { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .tax-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Ficha de Vehículo: Pico y Placa Bogotá, SOAT y Técnico-Mecánica */
.veh-panel { margin: 0 0 14px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.veh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.veh-box { padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.veh-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.veh-box-head strong { font-size: .88rem; }
.veh-date { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.veh-meta { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.veh-doc-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.veh-doc-bar .btn { flex: 1 1 auto; min-height: 34px; padding: 4px 10px; font-size: .8rem; }
.veh-doc-bar .btn.del { border-color: var(--danger); color: var(--danger); flex: none; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pyp-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 4px; }
.pyp-day { text-align: center; padding: 5px 2px; border-radius: 8px; font-size: .72rem; line-height: 1.25; border: 1px solid var(--line); background: var(--surface); }
.pyp-day strong { display: block; font-size: .82rem; }
.pyp-day.libre { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pyp-day.restr { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.pyp-day.hoy { outline: 2px solid currentColor; outline-offset: -1px; }
.veh-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.veh-actions .top-actions { gap: 8px; }
.veh-actions .btn { min-height: 36px; padding: 6px 12px; font-size: .84rem; }
@media (max-width: 920px) {
  .veh-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Encabezado vibrante en páginas internas */
.page-hero {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px 18px; margin-bottom: 18px; padding: 22px 24px; border-radius: 20px;
  background: var(--hero-bg); color: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 25, 22, .14);
}
.page-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 92% 14%, rgba(255, 255, 255, .24), transparent 54%);
}
.page-hero .v-art {
  position: absolute; right: 14px; bottom: -8px; width: 132px; height: 132px;
  opacity: .18; pointer-events: none;
}
.page-hero-copy { position: relative; z-index: 1; min-width: 0; flex: 1 1 280px; }
.page-hero .v-kicker { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; opacity: .9; margin-bottom: 4px; }
.page-hero h1 { font-size: 1.65rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; color: #ffffff; margin: 0; }
.page-hero .hero-sub { margin: 5px 0 0; font-size: .92rem; color: rgba(255, 255, 255, .90); line-height: 1.4; max-width: 620px; }
.page-hero .top-actions { position: relative; z-index: 1; align-items: center; }
.page-hero .btn {
  background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .36); color: #ffffff;
  backdrop-filter: blur(4px); border-radius: 10px;
}
.page-hero .btn:hover { background: rgba(255, 255, 255, .26); filter: none; }
.page-hero .btn.primary {
  background: #ffffff; border-color: #ffffff; color: var(--hero-ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
}
.page-hero .btn.primary:hover { background: #f8fafc; filter: none; }
.page-hero .pill { background: rgba(0, 0, 0, .22); color: #ffffff; backdrop-filter: blur(4px); padding: 6px 12px; font-size: .82rem; }
.page-hero .subtabs { position: relative; z-index: 1; margin: 12px 0 0; }
.page-hero .subtabs a { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .34); color: #ffffff; }
.page-hero .subtabs a[aria-current="page"] { background: #ffffff; border-color: #ffffff; color: var(--hero-ink); }

.picker { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 18px; }

/* Inicio · Bloques Vibrantes */
.home-hero { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.home-date { font-size: .84rem; font-weight: 650; color: var(--accent); text-transform: capitalize; margin-bottom: 2px; }
.home-hero h1 { font-size: 1.85rem; line-height: 1.15; letter-spacing: -.02em; }
.home-sub { margin: 4px 0 0; color: var(--muted); font-size: .94rem; }
.home-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: .86rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.home-status.alert { background: var(--danger-soft); color: var(--danger); }
.home-status .dot-pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

.vgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.vblock {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  min-height: 210px; padding: 24px 24px 22px; border-radius: 20px; color: #ffffff; text-decoration: none;
  box-shadow: 0 10px 26px rgba(15, 25, 22, .14);
  transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}
.vblock:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15, 25, 22, .22); filter: brightness(1.03); }
.vblock:active { transform: translateY(-1px); }
.vblock::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 92% 12%, rgba(255, 255, 255, .24), transparent 52%);
}
.vblock.v-servicios { background: linear-gradient(135deg, #0d6a62 0%, #14a895 100%); }
.vblock.v-estadisticas { background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%); }
.vblock.v-predial { background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); }
.vblock.v-vehiculos { background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%); }
.vblock .v-art {
  position: absolute; right: 12px; bottom: 8px; width: 146px; height: 146px;
  opacity: .22; pointer-events: none; transition: transform .3s ease, opacity .3s ease;
}
.vblock:hover .v-art { transform: scale(1.07) rotate(-2deg); opacity: .30; }
.vblock .v-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vblock .v-kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .9; }
.vblock .v-badge { padding: 4px 10px; border-radius: 999px; background: rgba(179, 38, 30, .92); color: #fff; font-size: .78rem; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.vblock .v-body { position: relative; z-index: 1; margin: 14px 0 18px; }
.vblock h2 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.015em; color: #ffffff; }
.vblock p { margin: 6px 0 0; font-size: .94rem; color: rgba(255, 255, 255, .90); max-width: 82%; line-height: 1.4; }
.vblock .v-foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.vblock .v-metric {
  display: inline-flex; align-items: center; padding: 7px 13px; border-radius: 10px;
  background: rgba(0, 0, 0, .20); backdrop-filter: blur(4px);
  font-size: .92rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.vblock .v-cta { font-size: .88rem; font-weight: 700; opacity: .94; }

@media (prefers-reduced-motion: reduce) {
  .vblock, .vblock .v-art { transition: none; }
}
@media (max-width: 720px) {
  .home-hero h1 { font-size: 1.5rem; }
  .vgrid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .vblock { min-height: 168px; padding: 20px 18px 18px; border-radius: 18px; }
  .vblock h2 { font-size: 1.32rem; }
  .vblock .v-art { width: 118px; height: 118px; right: 6px; bottom: 4px; }
}

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .usernav a[href="/"], .usernav a[href="/servicios"], .usernav a[href="/predial"], .usernav a[href="/vehiculos"], .usernav a[href="/estadisticas"], .usernav a[href="/ajustes"] { display: none; }
  .page-hero { padding: 18px 16px; border-radius: 18px; margin-bottom: 14px; }
  .page-hero h1 { font-size: 1.38rem; }
  .page-hero .v-art { width: 104px; height: 104px; right: 6px; bottom: -6px; }
  .picker { padding: 12px; border-radius: 14px; margin-bottom: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid .tile .v { font-size: 1.25rem; }
  .usernav { gap: 6px 10px; font-size: .84rem; margin-bottom: 12px; padding: 6px 10px; border-radius: 12px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { flex: none; white-space: nowrap; }
  .mobnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 12px rgba(20, 30, 25, .08);
  }
  .mobnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 48px; padding: 4px 2px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600;
  }
  .mobnav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .mobnav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
}
