/* Cobros · Tesorería — colores del "Panel de Tesorería v3"; tipografía, botones,
   formas y ritmo tomados del sistema de ClickUp: títulos pesados y apretados
   (Plus Jakarta Sans), texto en Inter, rótulos en mono, todo lo que se toca en
   píldora, tarjetas planas con filete y un solo borde cónico animado por pantalla. */
@property --giro { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
:root {
  --bg: #F7F8F6;
  --card: #FFFFFF;
  --ink: #111A14;
  --ink-2: #3D4B43;
  --muted: #5C6A61;
  --line: #E8EBE7;
  --line-soft: #F1F4F1;
  --line-strong: #CBD4CD;
  --head: #FBFCFB;
  --hover: #FCFDFC;
  --chip: #F2F4F1;
  --brand: #17754A;
  --brand-dark: #0F5334;
  --brand-soft: #E7F4EC;
  --accent: #3CD07A;
  --warn: #C8922C;
  --danger: #C0392B;
  --side: #0D1F16;
  --side-hover: #16301F;
  --side-active: #1C3728;
  --side-ink: #B7CDBF;
  --side-muted: #7FA891;
  --side-label: #5E8571;
  --side-line: #23402F;
  --surface: var(--card);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --mono: 'Sometype Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --r-pill: 9999px;
  --r-input: 9px;
  --r-card: 12px;
  --r-card-lg: 20px;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  /* Degradado cónico de la marca, con nuestros verdes. */
  --conic: conic-gradient(from var(--giro), var(--brand-dark) 0%, var(--brand) 20%, var(--accent) 40%, #B9F2CF 55%,
    var(--accent) 70%, var(--brand) 85%, var(--brand-dark) 100%);
  --grad-text: linear-gradient(83deg, var(--accent) -5%, var(--brand) 60%, var(--brand-dark) 125%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { font-family: var(--font); font-feature-settings: "calt" 0, "liga" 0; color: var(--ink); font-size: 14px; line-height: 1.5;
  letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; text-wrap: pretty; }
a { color: var(--brand); text-decoration: none; cursor: pointer; transition: color .15s; }
a:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }
a.btn:hover { text-decoration: none; }
::selection { background: #CDEBD9; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; margin: 0; }
/* En montos el espaciado no se cierra: los separadores de miles tienen que verse. */
.num { font-family: var(--display); font-weight: 700; letter-spacing: 0; word-spacing: .08em; }
.muted { color: var(--muted); }
.ok { color: var(--brand); }
.warn { color: var(--warn); }
.error { color: var(--danger); }
.small { font-size: 12px; }
.right { text-align: right; justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- botones */
/* Todo botón es píldora. El principal va relleno oscuro; los demás, con filete. */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; cursor: pointer;
  border-radius: var(--r-pill); padding: 0 20px; min-height: 40px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--ink); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover { background: var(--chip); border-color: var(--ink-2); }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
button:disabled:hover { background: #fff; border-color: var(--line-strong); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); padding: 0 24px; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled:hover { background: var(--ink); border-color: var(--ink); }
.btn-ghost { background: transparent; }
/* Variante con filete de color: acción secundaria que sí debe notarse. */
.btn-soft { color: var(--brand); border-color: var(--brand); background: #fff; font-size: 13px; min-height: 30px; padding: 0 14px; }
.btn-soft:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn-danger { color: var(--danger); border-color: #EBC2BC; }
.btn-danger:hover { background: #FBEBE8; border-color: var(--danger); }
.btn-danger.btn-primary, .btn-primary.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { font-size: 13px; min-height: 30px; padding: 0 14px; }
.linkish { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); font-weight: 600; border-radius: 0; }
.linkish:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- campos */
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--r-input); padding: 8px 12px; width: 100%; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
select { appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235C6A61' stroke-width='1.5'/%3E%3C/svg%3E"); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px #CDEBD9; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
label.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field > input, label.field > select, label.field > textarea { font-weight: 400; color: var(--ink); font-size: 14px; }
label.field .small { font-weight: 400; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.check { width: 18px; height: 18px; min-height: 0; border-radius: 5px; flex: none; border: 1.5px solid var(--line-strong);
  background: #fff; cursor: pointer; display: inline-grid; place-items: center; color: #fff; font-size: 11px; padding: 0; }
.check.on { background: var(--brand); border-color: var(--brand); }
.check.on::after { content: "✓"; }

/* ---------------------------------------------------------------- rótulos mono */
.micro, table.t th, .fact-label, .section-label, .nav-label, .modal-kicker, .project-label, .brand-sub, .crumb, .kpi-title, .nav-soon {
  font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }

/* ---------------------------------------------------------------- píldoras */
.pill { font-size: 12px; font-weight: 600; letter-spacing: 0; padding: 3px 10px; border-radius: var(--r-pill); width: fit-content;
  white-space: nowrap; display: inline-block; background: var(--chip); color: #4A574E; line-height: 1.4; }
.pill-ok { background: var(--brand-soft); color: var(--brand-dark); }
.pill-warn { background: #FDF3E3; color: #8A5B07; }
.pill-danger { background: #FBEBE8; color: #94281B; }
.pill-info { background: #EEF1FA; color: #39479B; }
.pill-purple { background: #EEE9FA; color: #4A2E86; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Etiquetas de filtro: la activa va en el color de marca, como la etiqueta resaltada. */
.chip { font-size: 13px; font-weight: 700; background: #fff; padding: 0 16px; min-height: 34px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--line); color: var(--ink); }
.chip:hover { background: var(--head); border-color: var(--line-strong); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.chip.danger { color: #94281B; }
.chip.danger.on { background: #FBEBE8; border-color: var(--danger); color: #94281B; }
.seg { display: flex; gap: 4px; background: var(--chip); border-radius: var(--r-pill); padding: 4px; width: fit-content; flex-wrap: wrap; }
.seg button { font-size: 13px; min-height: 30px; padding: 0 14px; border: 0; background: none; color: var(--muted); }
.seg button:hover { color: var(--ink); background: rgba(17,26,20,.04); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(17,26,20,.1), 0 1px 2px -1px rgba(17,26,20,.1); }

/* ---------------------------------------------------------------- estructura */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.sidebar { background: var(--side); display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 14px 24px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 17px; line-height: 1; color: var(--side); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .04em; line-height: 1; color: #fff; }
.brand-sub { color: var(--side-muted); line-height: 2; }
.project-box { position: relative; margin-bottom: 20px; }
.project-btn { width: 100%; border: 1px solid var(--side-line); border-radius: var(--r-card); padding: 8px 12px 8px 8px; min-height: 0;
  display: flex; align-items: center; gap: 8px; background: none; color: inherit; text-align: left; font-weight: 400; }
.project-btn:hover { background: var(--side-hover); border-color: var(--side-line); }
.project-count { width: 26px; height: 26px; border-radius: var(--r-pill); background: var(--side-active); display: grid;
  place-items: center; font-size: 11px; font-weight: 700; color: var(--accent); flex: none; }
.project-label { color: var(--side-muted); }
.project-name { font-size: 13px; font-weight: 600; color: #EAF3ED; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border-radius: var(--r-card);
  border: 1px solid var(--line); box-shadow: 0 1px 1px -.5px rgba(13,31,22,.06), 0 6px 6px -3px rgba(13,31,22,.06), 0 12px 12px -6px rgba(13,31,22,.06);
  padding: 4px; z-index: 30; max-height: 320px; overflow-y: auto; }
.project-menu button { width: 100%; border: 0; justify-content: space-between; min-height: 34px; font-weight: 500; border-radius: 8px; padding: 0 12px; }
.project-menu button.on { color: var(--brand); font-weight: 700; }
.nav-label { color: var(--side-label); padding: 0 12px 8px; }
.nav-label.gap { padding-top: 24px; }
/* Grupo desplegable del menú («Gestión»): un botón como los demás (Planos, Comercial)
   que se abre y cierra con un clic; sus opciones van con sangría debajo. */
.nav-group .nav-group-txt { flex: 1; }
.nav-group:hover .nav-caret { color: #fff; }
/* Cerrado y con la página actual adentro: se marca para saber dónde se está. */
.nav-group.tiene-activo { background: rgba(255,255,255,.10); color: #fff; font-weight: 700; }
.nav-group:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#nav-general { margin: 2px 0 4px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.12); margin-left: 14px; }
.nav-caret { font-size: 18px; line-height: 1; color: var(--side-muted); transition: transform .15s ease; }
.nav-group[aria-expanded="true"] .nav-caret { transform: rotate(90deg); }
#nav-general-sum .nav-badge { margin-left: 0; }
@media (prefers-reduced-motion: reduce) { .nav-caret { transition: none; } }
/* Ítems de menú en píldora; el activo, píldora clara sobre el panel oscuro. */
.nav-item { display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 36px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--side-ink); border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.on { background: #fff; color: var(--side); font-weight: 700; }
.nav-count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--side-muted); }
.nav-item.on .nav-count { color: var(--muted); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--side);
  border-radius: var(--r-pill); padding: 0 8px; line-height: 20px; }
.nav-badge.danger { background: #E0574A; color: #fff; }
.nav-soon { margin-left: auto; font-size: 9px; color: var(--side-label); border: 1px solid var(--side-line);
  border-radius: var(--r-pill); padding: 0 8px; line-height: 18px; }
.side-user { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--side-line); display: flex; align-items: center;
  gap: 8px; position: relative; }
.avatar { width: 32px; height: 32px; border-radius: var(--r-pill); background: var(--side-active); color: var(--accent);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; box-shadow: 0 0 0 2px var(--side); }
.side-user-name { font-size: 13px; font-weight: 600; color: #EAF3ED; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-role { font-size: 12px; color: var(--side-muted); }
.side-user-more { margin-left: auto; color: var(--side-muted); background: none; border: 0; padding: 0 10px; min-height: 28px; font-size: 14px; }
.side-user-more:hover { background: rgba(255,255,255,.06); color: #fff; }
.user-menu { position: absolute; bottom: calc(100% + 8px); right: 0; background: #fff; border-radius: var(--r-card);
  border: 1px solid var(--line); box-shadow: 0 6px 6px -3px rgba(13,31,22,.06), 0 12px 12px -6px rgba(13,31,22,.06);
  padding: 4px; min-width: 200px; z-index: 30; }
.user-menu button { width: 100%; border: 0; min-height: 34px; font-weight: 500; border-radius: 8px; padding: 0 12px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.crumb { color: var(--muted); line-height: 2; }
.page-title { font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 0 8px 0 16px; min-width: 280px; background: var(--head); transition: border-color .15s, box-shadow .15s; }
.search:hover { border-color: var(--line-strong); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px #CDEBD9; background: #fff; }
.search input { border: 0; padding: 8px 0; min-height: 38px; outline: none; font-size: 14px; border-radius: 0; background: transparent; }
.search input:focus { box-shadow: none; }
.search .kbd { font-family: var(--mono); font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: #fff; }
.icon-btn { position: relative; width: 40px; height: 40px; min-height: 0; padding: 0; justify-content: center; border-radius: var(--r-pill);
  border-color: var(--line); }
.icon-btn .alert-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  box-shadow: 0 0 0 2px #fff; }
.me { width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand); display: grid;
  place-items: center; font-size: 12px; font-weight: 700; }
.menu-toggle { display: none; }
.popover { position: absolute; top: calc(100% + 8px); right: 0; width: min(380px, 90vw); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: 0 6px 6px -3px rgba(13,31,22,.06), 0 12px 12px -6px rgba(13,31,22,.06); padding: 4px; z-index: 40; }
.popover .item { display: flex; gap: 12px; padding: 12px; border-radius: 8px; cursor: pointer; align-items: flex-start; }
.popover .item:hover { background: var(--chip); }
.content { padding: 28px 28px 64px; display: flex; flex-direction: column; gap: 24px; }
.back { font-size: 14px; font-weight: 600; color: var(--brand); cursor: pointer; width: fit-content; background: none; border: 0; padding: 0; min-height: 0; border-radius: 0; }
.back:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.flash { background: var(--brand-soft); color: var(--brand-dark); border-radius: var(--r-card); padding: 12px 16px; font-weight: 600; }
.flash.error { background: #FBEBE8; color: #94281B; }

/* ---------------------------------------------------------------- tarjetas */
/* Planas: filete de 1 px, sin sombra. */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-pad { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 24px 28px 16px; flex-wrap: wrap; }
.card-title { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.3; }
.card-sub { font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* Cifras grandes tipo "stat callout": pesadas y con el espaciado muy cerrado. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-card-lg); overflow: hidden; }
.kpi { background: #fff; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.kpi-title { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-value { font-family: var(--display); font-size: 38px; font-weight: 800; letter-spacing: -0.02em; word-spacing: .1em; line-height: 1.05; }
.kpi-value.sm { font-size: 30px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(340px, 1.7fr) minmax(280px, 1fr); gap: 24px; align-items: stretch; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(265px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-card-lg); overflow: hidden; }
.tile { background: #fff; padding: 28px; display: flex; flex-direction: column; gap: 8px; min-height: 136px; }
.tile-title { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -0.025em; }

/* ---------------------------------------------------------------- tablas */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { color: var(--muted); text-align: left; padding: 10px 16px; background: var(--head); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t th:first-child, table.t td:first-child { padding-left: 28px; }
table.t th:last-child, table.t td:last-child { padding-right: 28px; }
table.t tr.click { cursor: pointer; }
table.t tbody tr:hover td { background: var(--head); }
table.t th.r, table.t td.r { text-align: right; }
.cell-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; display: block; }
.cell-sub { font-size: 12px; color: var(--muted); }
.lv-mark { width: 3px; height: 30px; border-radius: 3px; display: inline-block; flex: none; }
.pager { display: flex; align-items: center; gap: 12px; padding: 16px 28px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .pages { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.pager button { font-size: 13px; min-height: 32px; min-width: 32px; padding: 0 10px; justify-content: center; border-color: var(--line); }
.pager button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.empty { padding: 28px; color: var(--muted); }

/* ---------------------------------------------------------------- gráficos */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.legend { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--muted); }
.legend .ln { width: 16px; height: 2px; border-radius: 2px; display: inline-block; margin-right: 8px; vertical-align: middle; }
.stackbar { display: flex; height: 8px; border-radius: var(--r-pill); overflow: hidden; gap: 2px; }
.bar-track { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); }
.tip { position: fixed; pointer-events: none; z-index: 60; background: var(--side); color: #fff; font-size: 12px;
  padding: 8px 12px; border-radius: 10px; line-height: 1.5; box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1); }
.tip b { font-weight: 700; }

/* ---------------------------------------------------------------- ficha */
.big-avatar { width: 48px; height: 48px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand); display: grid;
  place-items: center; font-family: var(--display); font-weight: 800; font-size: 16px; flex: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 16px; padding-top: 16px;
  border-top: 1px solid var(--line-soft); }
.fact-label { color: var(--muted); }
.fact-value { font-size: 15px; font-weight: 700; letter-spacing: -0.015em; }
.timeline-item { display: flex; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.timeline-item .dot { width: 8px; height: 8px; margin-top: 6px; }
.note-box { font-size: 13px; color: var(--muted); background: var(--head); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 16px; }
.policy { background: #FFFBEB; border-color: #F3E3B5; }
.policy ul { margin: 8px 0 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); }
.policy li { margin: 4px 0; }
.inline-edit { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-edit input { width: 11rem; padding: 4px 10px; min-height: 32px; }
.tpl-text { white-space: pre-wrap; font-size: 12px; color: var(--muted); max-width: 420px; }
.preview { white-space: pre-wrap; background: #E7FBE6; border: 1px solid #CDECCB; border-radius: var(--r-card); padding: 12px 16px; }
.preview mark { background: #FFF3B0; border-radius: 3px; padding: 0 2px; }

/* ---------------------------------------------------------------- ventanas */
dialog.modal { border: 1px solid var(--line); border-radius: var(--r-card-lg); padding: 28px; width: min(560px, 96vw); max-height: 92vh;
  box-shadow: 0 1px 1px -.5px rgba(13,31,22,.06), 0 6px 6px -3px rgba(13,31,22,.06), 0 12px 12px -6px rgba(13,31,22,.06), 0 24px 48px -12px rgba(13,31,22,.12);
  color: var(--ink); }
dialog.modal.wide { width: min(760px, 96vw); }
dialog.modal::backdrop { background: rgba(13,31,22,.42); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.modal-kicker { color: var(--brand); }
.modal-title { font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
.modal-x { margin-left: auto; border: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 0;
  width: 34px; height: 34px; min-height: 0; justify-content: center; }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.section-label { color: var(--muted); }
.opt-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 16px;
  min-height: 0; font-size: 14px; font-weight: 400; cursor: pointer; background: #fff; width: 100%; text-align: left; white-space: normal; }
.opt-row:hover { background: var(--head); border-color: var(--line-strong); }
.opt-row.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.money-input { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: 0; border-color: var(--brand); }
fieldset.group { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px 20px; margin: 0; display: flex;
  flex-direction: column; gap: 16px; }
fieldset.group legend { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; padding: 0 8px; }
details.group { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px; }

/* ---------------------------------------------------------------- ingreso */
/* Dos columnas: titular enorme con lista de beneficios a la izquierda; la tarjeta
   de ingreso a la derecha con el único borde cónico animado del sistema. */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center;
  gap: 64px; padding: 48px max(24px, 7vw); background: #fff; }
.login-hero { display: flex; flex-direction: column; gap: 24px; max-width: 640px; }
.login-hero .brand { padding: 0 0 8px; }
.login-hero .brand-name { color: var(--ink); }
.login-hero .brand-sub { color: var(--muted); }
.login-title { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5.2vw, 72px); line-height: 1.05;
  letter-spacing: -0.045em; margin: 0; color: var(--ink); font-feature-settings: normal; }
/* La coma y el punto de Plus Jakarta traen mucho aire a la izquierda a este tamaño. */
.login-title .pt { margin-left: -.14em; }
.login-title em { font-style: normal; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-lead { font-size: 18px; line-height: 1.5; color: var(--muted); margin: 0; max-width: 500px; letter-spacing: -0.014em; }
.login-lead b { color: var(--ink); font-weight: 600; }
.login-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--muted); }
.login-checks li { display: flex; gap: 8px; align-items: baseline; }
.login-checks li::before { content: "✓"; color: var(--brand); font-weight: 800; }
.login-checks b { color: var(--ink); font-weight: 700; }
.login-card { width: min(400px, 100%); justify-self: center; background: #fff; border-radius: var(--r-card-lg);
  padding: 28px; display: flex; flex-direction: column; gap: 16px; position: relative; isolation: isolate; }
.login-card::before { content: ""; position: absolute; inset: -2px; border-radius: calc(var(--r-card-lg) + 2px); background: var(--conic);
  z-index: -1; animation: girar 4s linear infinite; }
.login-card::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card-lg); background: #fff; z-index: -1; }
@keyframes girar { to { --giro: 360deg; } }
@media (prefers-reduced-motion: reduce) { .login-card::before { animation: none; } }
.login-card .btn-primary { min-height: 44px; justify-content: center; }

/* ---------------------------------------------------------------- celular */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 50; transform: translateX(-100%);
    transition: transform .45s var(--ease); }
  .layout.menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(13,31,22,.42); }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .page-title { font-size: 22px; }
  .content { padding: 20px 16px 48px; }
  .search { min-width: 0; flex: 1; }
  .top-tools { width: 100%; }
  .two-col { grid-template-columns: 1fr; }
  .card-head, .card-pad { padding-left: 16px; padding-right: 16px; }
  table.t th:first-child, table.t td:first-child { padding-left: 16px; }
  .kpi-value { font-size: 34px; }
  .login { grid-template-columns: 1fr; padding: 32px 16px; gap: 32px; align-content: center; }
  .login-lead { font-size: 16px; }
  dialog.modal { padding: 24px 16px; }
  .modal-title { font-size: 24px; }
}

/* Historial de cobranza: barras por día/semana/mes/año con la línea del promedio. */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars-plot { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 24px; }
.bar-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center;
  cursor: default; outline: 0; }
.bar-fill { position: relative; width: 100%; max-width: 48px; min-height: 2px; background: var(--brand);
  border-radius: 6px 6px 0 0; transition: filter .15s; }
.bar-col:hover .bar-fill, .bar-col:focus-visible .bar-fill { filter: brightness(1.25); }
/* El periodo en curso va rayado: todavía no termina, no se compara de igual a igual. */
.bar-fill.open { background: repeating-linear-gradient(135deg, var(--brand) 0 5px, var(--brand-dark) 5px 10px); opacity: .6; }
.bar-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.bar-avg { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line-strong); pointer-events: none; }
.bars-axis { display: flex; gap: 6px; }
/* Las etiquetas se rotulan salteadas: la que va, se deja desbordar sobre los
   huecos vacíos de al lado en vez de recortarse a una letra. */
.bars-axis span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: visible; }
@media (max-width: 720px) { .bars-plot { gap: 3px; height: 170px; } .bars-axis { gap: 3px; }
  .bars-axis span, .bar-val { font-size: 9.5px; } }

/* Tarjetas para elegir etapa: son botones, así que hay que quitarles el aspecto
   de botón del navegador y darles la reacción al pasar el ratón. */
.stage-card { border: 1px solid var(--line); background: var(--surface); font: inherit; border-radius: var(--r-card-lg);
  color: inherit; white-space: normal; min-height: 0; transition: border-color .15s, transform .45s var(--ease); }
.stage-card:hover { border-color: var(--brand); background: var(--surface); transform: translateY(-2px); }
.stage-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stage-card .facts { border-top: 1px solid var(--line); }

/* Lotes del cliente: una pestaña por lote y el detalle del elegido debajo. */
.lote-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.lote-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  min-width: 200px; min-height: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--surface); font: inherit; color: inherit; cursor: pointer; text-align: left; white-space: normal;
  transition: border-color .15s; }
.lote-tab:hover { border-color: var(--line-strong); background: var(--surface); }
.lote-tab.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--surface); }
.lote-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.lote-tab-name { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: -0.02em; }
.lote-tab-meta { display: flex; gap: 8px; align-items: center; }

/* Barra de avance de pago del lote. */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin-bottom: 4px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }

/* Cuota vencida y sin pagar, para que salte a la vista en el cronograma. */
.row-overdue td { background: color-mix(in srgb, var(--danger) 7%, transparent); }

@media (max-width: 640px) { .lote-tab { min-width: 0; flex: 1 1 100%; } }

/* Dónde está el lote (proyecto · etapa), bajo su título en la ficha. */
.lote-ubic { font-size: 13px; color: var(--muted); }

/* Columna del lote en las tablas: ancho propio para que no se estire ni parta el
   "Mz A Lt 1" en dos líneas, y el proyecto · etapa debajo sin romper la fila. */
.col-lote { white-space: nowrap; }
.col-lote .cell-main { max-width: 160px; }
.col-lote .cell-sub { display: block; overflow: hidden; text-overflow: ellipsis;
  max-width: 190px; white-space: nowrap; }

/* ================================================================ orden y jerarquía */
/* Franja de aviso: una línea con el estado; el detalle se despliega si hace falta. */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: var(--r-card);
  border: 1px solid var(--line); background: #fff; font-size: 14px; }
.banner-icon { width: 24px; height: 24px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 800; }
.banner-ok .banner-icon { background: var(--brand-soft); color: var(--brand); }
.banner-danger { border-color: #EBC2BC; background: #FFFBFA; }
.banner-danger .banner-icon { background: var(--danger); color: #fff; }
.banner-danger b { color: #94281B; }
.banner-sub { color: var(--muted); }
.banner-more { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--brand); white-space: nowrap; }
details.banner { display: block; padding: 0; }
details.banner > summary { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.banner > summary .banner-more::after, .card-fold > summary .banner-more::after { content: " ↓"; }
details[open].banner > summary .banner-more::after, .card-fold[open] > summary .banner-more::after { content: " ↑"; }
details[open].banner > summary { border-bottom: 1px solid #F3DCD8; margin-bottom: 12px; }
details.banner .table-wrap { max-height: 420px; overflow-y: auto; border-top: 1px solid var(--line-soft); }
.card-fold > summary { cursor: pointer; list-style: none; }
.card-fold:not([open]) > summary { padding-bottom: 24px; }

/* Ficha: cabecera de perfil a lo ancho (quién es, cuánto debe, qué hacer). */
.profile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; padding: 24px 28px; align-items: center; }
.profile-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.profile-id .big-avatar { width: 56px; height: 56px; font-size: 18px; }
.profile-name { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.profile-money { display: flex; gap: 32px; align-items: flex-start; padding-left: 32px; border-left: 1px solid var(--line); }
.profile-money .kpi-value.sm { font-size: 28px; }
.profile-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--line-soft); }

/* Dos columnas: el lote (lo que se consulta) y, al costado, lo que se gestiona del cliente. */
.ficha-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.ficha-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ficha-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ficha-side .card-pad { padding: 20px 24px; }
.ficha-main .section-title .card-title { font-size: 16px; }
.grid-side { grid-template-columns: 1fr; gap: 12px; }

/* Datos del lote: primero lo que importa hoy, en grande; lo contable, debajo y en pequeño. */
.facts-key { grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 16px 24px; border-top: 0; padding-top: 8px; }
.facts-key .kpi-value.sm { font-size: 26px; white-space: nowrap; }
.facts-sec { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 16px; }
.facts-sec .fact-value { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.crono-toggle { display: flex; align-items: center; gap: 12px; padding: 12px 28px 20px; }

/* Documentos en la columna: lista compacta, un archivo por fila. */
.doc-list { width: 100%; border-collapse: collapse; }
.doc-list td { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.doc-list .cell-main { max-width: 100%; }
.doc-upload { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-upload input[type=file] { grid-column: 1 / -1; font-size: 13px; padding: 8px; }
.doc-upload #doc-up { grid-column: 1 / -1; justify-content: center; }

@media (max-width: 1180px) {
  .ficha-grid { grid-template-columns: 1fr; }
  .ficha-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
@media (max-width: 900px) {
  .profile { grid-template-columns: 1fr; padding: 20px 16px; }
  .profile-money { padding-left: 0; border-left: 0; }
  .facts-key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px; gap: 8px; }
  .kpi .kpi-value { font-size: 24px; }
  .kpi-foot .pill { white-space: normal; border-radius: 12px; }
  .banner-sub { display: none; }
  .crono-toggle { padding: 12px 16px 16px; }
}

/* Contenido de cada pestaña: tarjetas separadas, nunca pegadas. */
#gest, #pay-section, #rep { display: flex; flex-direction: column; gap: 16px; }
#gest > .kpis, #pay-section > .kpis { margin: 0; }

/* Estado vacío: ícono, qué pasa y qué hacer. */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 24px 44px; }
.empty-state b { font-family: var(--display); font-size: 16px; letter-spacing: -0.02em; }
.empty-icon { width: 40px; height: 40px; border-radius: var(--r-pill); display: grid; place-items: center; margin-bottom: 6px;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 16px; }

/* Barra de filtros dentro de la cabecera de una tarjeta. */
.filter-bar { margin-left: auto; gap: 8px; }
.filter-bar input, .filter-bar select { width: auto; }

/* Cierre de caja. */
.week-nav { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.week-nav .icon-btn { width: 36px; height: 36px; }
.cc-action { padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* Motor de cobranza: los pasos en orden, de izquierda a derecha. */
.rule-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 0 28px 20px; }
.rule-step { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--head); position: relative; }
.rule-step.on { background: #fff; border-color: var(--line-strong); }
.rule-step:not(.on) { opacity: .7; }
.rule-step .pill { margin-top: auto; }
.rule-n { width: 24px; height: 24px; border-radius: var(--r-pill); display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--chip); color: var(--muted); }
.rule-step.on .rule-n { background: var(--ink); color: #fff; }
.rule-when { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; line-height: 1.25; }

/* Redactar + vista previa: el formulario a la izquierda y cómo le llega, a la derecha. */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.wa-phone { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 96px; }
.wa-screen { background: #E9EFE9; border-radius: var(--r-card-lg); padding: 20px 16px; min-height: 220px;
  background-image: radial-gradient(rgba(17,26,20,.05) 1px, transparent 1px); background-size: 14px 14px; }
.wa-bubble { background: #D9FDD3; border-radius: 12px 12px 12px 4px; padding: 10px 12px 12px; font-size: 14px; line-height: 1.45;
  white-space: pre-wrap; color: var(--ink); max-width: 100%; box-shadow: 0 1px 1px rgba(17,26,20,.08); }
.wa-bubble mark { background: #FFF3B0; border-radius: 3px; padding: 0 2px; }
/* La invitación en la vista previa: el video o la foto arriba y los botones abajo, como en WhatsApp. */
.wa-bubble .inv-flyer { width: calc(100% + 24px); margin: -10px -12px 8px; }
.wa-bubble .inv-botones { margin: 10px -12px -12px; white-space: normal; border-radius: 0 0 12px 4px; overflow: hidden; }
.wa-inline { font-size: 13px; }
.compose > .policy { align-self: stretch; }

@media (max-width: 1100px) { .compose { grid-template-columns: minmax(0, 1fr); } .wa-phone { position: static; } }
@media (max-width: 900px) {
  .rule-steps { padding: 0 16px 16px; }
  .filter-bar { margin-left: 0; width: 100%; }
  .week-nav { margin-left: 0; }
}
.empty-icon.danger { background: #FBEBE8; color: var(--danger); }
@media (max-width: 900px) {
  /* Pestañas en una sola fila deslizable, no partidas en dos líneas. */
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; }
}

/* ------------------------------------------------------------- comercial */
.com-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 50%;
  background: var(--brand) center / cover no-repeat; color: #fff; font-weight: 700; font-size: 13px; }
.com-big { font-family: var(--display); font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.com-anulada td { color: var(--muted); }
.com-anulada td b { text-decoration: line-through; }
.com-file { display: inline-flex; align-items: center; cursor: pointer; border-radius: var(--r-pill); border: 1px solid var(--brand); }
.com-link { width: 100%; font-family: var(--mono); font-size: 12.5px; padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: var(--r-input); background: var(--head); color: var(--ink-2); }
.com-pasos { margin: 0; padding-left: 1.2rem; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.com-dir { font-family: var(--mono); font-size: 13px; background: var(--chip); padding: 1px 8px; border-radius: 6px; }
.com-code { width: 170px; font-family: var(--mono); font-size: 24px; letter-spacing: .12em; text-align: center; padding: 6px 10px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-input); }
.com-code:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.com-qr { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; flex: 0 0 auto; }
.crop-area { position: relative; width: min(420px, 100%); aspect-ratio: 1; margin: 0 auto; border-radius: 14px; overflow: hidden;
  cursor: grab; touch-action: none; background: #16301F; }
.crop-area:active { cursor: grabbing; }
.crop-area canvas { width: 100%; height: 100%; display: block; }
/* Fuera del círculo, oscurecido: es lo que la TV no muestra. */
.crop-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(13, 31, 22, .6); outline: 3px solid var(--accent); outline-offset: -3px; }
.com-lado { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.com-app { width: 280px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.com-app .com-qr { width: 180px; height: 180px; align-self: center; }
@media (max-width: 900px) { .com-app { width: 100%; } }
.com-wa { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
#inv-card .field select { width: 100%; }
/* Tabla «Invitaciones» (Enviar mensaje): la hora, el último día y las acciones, discretos en la fila. */
#inv-campanas td select, #inv-campanas td input { width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px; }
#inv-campanas td select { padding-right: 28px; background-position: right 8px center; }
.inv-acciones { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.com-oro { background: #FFF0B8; color: #6B4E00; }
/* ------------------------------------------------------------- marca */
.crop-area.logo .crop-mask { border-radius: 18%; box-shadow: 0 0 0 999px rgba(13, 31, 22, .35); }
.marca-fila { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; }
.marca-preview { display: flex; flex-direction: column; gap: 14px; align-items: center; width: 240px; }
.marca-tab { display: flex; align-items: center; gap: 8px; width: 100%; background: #E8EBE7; border-radius: 10px 10px 0 0;
  padding: 8px 12px; font-size: 12.5px; color: var(--ink-2); overflow: hidden; white-space: nowrap; }
.marca-tab img { width: 16px; height: 16px; border-radius: 3px; flex: 0 0 auto; }
.marca-tab span { overflow: hidden; text-overflow: ellipsis; }
.marca-cel { display: flex; flex-direction: column; align-items: center; gap: 6px; background: linear-gradient(160deg, #1C3728, #0D1F16);
  border-radius: 22px; padding: 22px 34px 16px; }
.marca-cel img { width: 64px; height: 64px; border-radius: 16px; background: #fff; }
.marca-cel span { color: #fff; font-size: 12px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-primary.com-file { display: inline-flex; align-items: center; min-height: 40px; padding: 0 22px; cursor: pointer; border-radius: var(--r-pill); }
.update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; background: var(--side);
  color: #fff; border-radius: var(--r-pill); padding: 8px 10px 8px 18px; font-size: 13.5px; display: flex; gap: 10px;
  align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); flex-wrap: wrap; }
.update-bar button { background: var(--accent); color: var(--side); border: 0; border-radius: var(--r-pill); font-weight: 700;
  padding: 6px 14px; cursor: pointer; }
.update-bar span { color: var(--side-muted); font-size: 12px; }
/* Oculto a la vista pero no «display:none»: así Safari (iPhone/iPad) sí lo abre. */
.archivo-oculto { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.com-file { position: relative; }
.token-estado { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: var(--r-input); padding: 10px 14px;
  border: 1px solid var(--line); background: var(--head); }
.token-estado.ok { background: var(--brand-soft); border-color: #CFE8D9; }
.token-estado.warn { background: #FDF3E3; border-color: #F2DDB4; }
.token-estado.danger { background: #FBEBE8; border-color: #EBC2BC; }

/* ------------------------------------------------------- entrada con fondo
   Imagen de fondo (volteada: los objetos a la izquierda) y todo el contenido a la
   derecha, sobre el espacio azul libre, en claro. Un velo oscuro a la derecha
   asegura el contraste del texto. */
.login { background: #0f2a44 url("fondo-login.jpg") center / cover no-repeat;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 500px); grid-auto-rows: auto; align-content: center;
  column-gap: 48px; row-gap: 28px; position: relative; isolation: isolate; }
.login::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 22, 38, 0) 35%, rgba(8, 22, 38, .55) 62%, rgba(8, 22, 38, .72) 100%); }
.login-hero { grid-column: 2; gap: 16px; max-width: 500px; }
.login-card { grid-column: 2; justify-self: stretch; width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(4, 14, 26, .45); }
.login-hero .brand-name { color: #fff; }
.login-hero .brand-sub { color: rgba(255, 255, 255, .7); }
.login-title { color: #fff; font-size: clamp(34px, 3.4vw, 50px); text-shadow: 0 2px 18px rgba(4, 14, 26, .35); }
.login-title em { background: linear-gradient(83deg, #7CF0AE, #3CD07A 55%, #9FF5C6); -webkit-background-clip: text;
  background-clip: text; color: transparent; text-shadow: none; }
.login-lead { color: rgba(255, 255, 255, .82); font-size: 16.5px; }
.login-lead b { color: #fff; }
.login-checks { display: none; }        /* con la imagen, el mensaje ya se entiende */
@media (max-width: 900px) {
  /* En vertical se ve una franja de la imagen: la de los gráficos y el celular. */
  .login { background-position: 18% center; grid-template-columns: 1fr; padding: 28px 16px; }
  .login::before { background: linear-gradient(180deg, rgba(8, 22, 38, .82) 0%, rgba(8, 22, 38, .66) 38%, rgba(8, 22, 38, .4) 60%, rgba(8, 22, 38, .7) 100%); }
  .login-hero, .login-card { grid-column: 1; }
  .login-card { justify-self: center; }
}
.sidebar .brand-sub { line-height: 1.6; margin-top: 4px; display: block; }
/* La marca, más grande (pedido del usuario: se veía en letra chica). */
.sidebar .brand-name { font-size: 30px; letter-spacing: .06em; }
.sidebar .brand-sub { font-size: 10.5px; letter-spacing: .08em; margin-top: 8px; }
.login-hero .brand-name { font-size: clamp(40px, 4vw, 56px); letter-spacing: .07em; text-shadow: 0 2px 18px rgba(4, 14, 26, .35); }
.login-hero .brand-sub { font-size: 13px; letter-spacing: .12em; margin-top: 10px; display: block; color: #9FF5C6; }
.login-hero .brand { padding-bottom: 14px; }
/* «COBRANZA» arriba y «DIGITAL» en verde debajo: en una sola línea no entra grande. */
.brand-name-2 { display: flex; flex-direction: column; line-height: .95; }
.brand-accent { color: var(--accent); }
.sidebar .brand-name-2 { font-size: 26px; letter-spacing: .05em; }
.login-hero .brand-name-2 { font-size: clamp(36px, 3.6vw, 50px); }
.login-hero .brand-accent { color: #7CF0AE; }
/* Isotipo (la «C» con el check) junto al nombre. */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-iso { width: 40px; height: 40px; flex: 0 0 auto; display: block; }
.sidebar .brand-name-2 { font-size: 21px; }
.sidebar .brand-sub { font-size: 9.5px; letter-spacing: .06em; margin-top: 6px; }
.login-hero .brand { gap: 18px; }
.login-hero .brand-iso { width: clamp(70px, 6.5vw, 96px); height: auto; filter: drop-shadow(0 4px 18px rgba(4, 14, 26, .45)); }
@media (max-width: 900px) { .login-hero .brand-iso { width: 62px; } }

/* ---------------------------------------------------------------- WhatsApp */
.wa { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; height: calc(100vh - 170px); min-height: 460px; }
.wa .card { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.wa-gratis { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--surface-2, transparent); }
.wa-gratis.on { background: color-mix(in srgb, #25d366 12%, transparent); }
.wa-gratis-txt { flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.wa-gratis-txt > span { color: var(--muted); font-size: 12px; }
.wa-mes { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; }
.wa-mes-txt { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.wa-mes-txt > span { color: var(--muted); font-size: 12px; }
.wa-mes-barra { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.wa-mes-barra i { display: block; height: 100%; background: #25d366; border-radius: 3px; }
.wa-mes.alto .wa-mes-barra i { background: #e0a100; }
.wa-mes.lleno .wa-mes-barra i { background: var(--danger); }
.wa-mes.lleno .wa-mes-txt > span { color: var(--danger); }
.wa-chat-gratis { display: block; font-size: 11px; color: #128c4a; margin-top: 2px; }
.wa-buscar { padding: 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.wa-buscar input { flex: 1 1 160px; }
.wa-filtros { flex: 1 1 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.wa-filtros .chip { min-height: 28px; padding: 0 12px; font-size: 12px; }
#wa-chats { overflow-y: auto; flex: 1; }
.wa-chat { display: flex; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.wa-chat:hover { background: var(--hover); }
.wa-chat.on { background: var(--brand-soft); }
.wa-chat .avatar { flex: none; width: 38px; height: 38px; }
.wa-chat-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wa-chat-top { display: flex; justify-content: space-between; gap: 8px; }
.wa-chat-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.wa-chat-top small { color: var(--muted); flex: none; font-size: 11.5px; }
.wa-chat-top small.wa-nuevo { color: var(--brand); font-weight: 600; }
.wa-chat-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.wa-chat-ult { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.wa-sin-leer { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: #25D366;
  color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.wa-vacio { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 6px; color: var(--muted); padding: 24px; }
.wa-vacio b { color: var(--ink); font-size: 16px; }
.wa-cab { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.wa-cab .stack { flex: 1; min-width: 0; }
.wa-cab .avatar { width: 36px; height: 36px; }
.wa-volver { display: none; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 16px 5%; display: flex; flex-direction: column; gap: 6px;
  background: #EFEAE2; }
.wa-dia { text-align: center; margin: 8px 0; }
.wa-dia span { background: #fff; color: var(--muted); font-size: 11.5px; padding: 4px 10px; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-msg { max-width: min(560px, 80%); padding: 7px 10px 5px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.1);
  font-size: 13.5px; line-height: 1.45; }
.wa-msg.out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 2px; }
.wa-msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-msg.fallo { background: #FDECEA; }
.wa-etq { font-size: 11px; font-weight: 600; color: var(--brand-dark); margin-bottom: 2px; }
.wa-texto { white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.wa-meta { text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.wa-tick { color: #8696A0; letter-spacing: -2px; margin-right: 3px; }
.wa-meta .wa-tick { margin: 0 0 0 3px; }
.wa-tick.read { color: #53BDEB; }
.wa-tick.fail { color: var(--danger); letter-spacing: 0; }
.wa-pie { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; }
@media (max-width: 760px) {
  .wa { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); }
  .wa.abierto .wa-lista, .wa:not(.abierto) .wa-conv { display: none; }
  .wa-volver { display: inline-flex; }
  .wa-msgs { padding: 12px; }
  .wa-msg { max-width: 88%; }
}

.wa-responder { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--head); }
.wa-nota { font-size: 12px; color: var(--muted); }
.wa-form { display: flex; gap: 8px; align-items: flex-end; }
.wa-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 9px 12px; border-radius: 20px;
  border: 1px solid var(--line-strong); font: inherit; line-height: 1.4; }
.wa-form .btn-primary { border-radius: 20px; }

/* ------------------------------------------------------------- Facturación */
.fac-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.fac-total { display: flex; flex-direction: column; gap: 6px; justify-content: center; background: var(--brand-soft); }
.fac-monto { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--brand-dark); }
.fac-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line-soft); }
.fac-fila b { white-space: nowrap; }
.fac-fila.fac-sub { border-bottom: 0; border-top: 1px solid var(--line-strong); margin-top: 4px; }

/* ------------------------------------------------------------- Sugerencias */
.sug-grid { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 14px; align-items: start; }
.sug-grid .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; }
.sug-grid textarea { resize: vertical; font: inherit; padding: 10px 12px; border-radius: var(--r-input); border: 1px solid var(--line-strong); }
.sug-lista { display: flex; flex-direction: column; }
.sug-item { padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.sug-texto { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sug-resp { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); }
.sug-resp p { margin: 4px 0 0; white-space: pre-wrap; }
@media (max-width: 860px) { .sug-grid { grid-template-columns: 1fr; } }
#fac-mes { width: auto; min-width: 200px; }
.wa-msgs.cambiando { opacity: .35; transition: opacity .15s; }
.wa-cerrada { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px 14px;
  background: #FFF8E6; color: var(--ink-2); font-size: 13px; }
.wa-cerrada b { color: var(--ink); }
.wa-candado { font-size: 18px; line-height: 1.2; }

/* Fotos, audios y documentos que manda el cliente (sección WhatsApp) */
.wa-foto { display: block; padding: 0; margin: -3px -6px 4px; border: 0; background: none; border-radius: 6px;
  overflow: hidden; cursor: zoom-in; }
.wa-foto img { display: block; max-width: min(330px, 100%); max-height: 330px; width: auto; height: auto; }
.wa-foto img:not([src]) { width: 220px; height: 160px; background: #D1D7DB; }
.wa-foto.sticker img { max-width: 140px; max-height: 140px; }
/* Nota de voz como en WhatsApp: ▶, onda que se pinta al avanzar, duración y velocidad */
.wa-voz { display: flex; align-items: center; gap: 8px; width: min(320px, 72vw); padding: 4px 0 2px; }
.wa-voz-play { flex: none; width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: #54656F; justify-content: center; }
.wa-voz-play:hover { background: rgba(0,0,0,.06); border: 0; }
.wa-voz-cuerpo { flex: 1; min-width: 0; }
.wa-voz-onda { position: relative; display: flex; align-items: center; gap: 2px; height: 30px; }
.wa-voz-onda i { flex: 1; height: 30%; min-height: 3px; border-radius: 2px; background: #B4BEC5; transition: background-color .1s; }
.wa-voz-onda i.on { background: #00A884; }
.wa-voz-barra { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0;
  -webkit-appearance: none; appearance: none; background: none; opacity: 0; cursor: pointer; }
.wa-voz-barra:focus-visible { opacity: .25; }
.wa-voz-pie { display: flex; align-items: center; justify-content: space-between; height: 18px; margin-top: 1px;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wa-voz-vel { min-height: 0; height: 18px; padding: 0 7px; border: 0; border-radius: 9px; background: #8696A0;
  color: #fff; font-size: 11px; font-weight: 700; }
.wa-voz-vel:hover { background: #667781; border: 0; }
.wa-voz-mic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #DFE5E7; font-size: 17px; }
.wa-msg.out .wa-voz-mic { background: #C6EBC0; }
.wa-voz + .wa-bajar { margin-top: 2px; }
.wa-bajar { display: inline-block; min-height: 0; background: none; border: 0; padding: 0 0 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.wa-bajar:hover { background: none; color: var(--ink); text-decoration: underline; }
.wa-video { display: block; max-width: min(330px, 100%); max-height: 330px; border-radius: 6px; margin: -3px -6px 4px; background: #000; }
.wa-doc { display: flex; align-items: center; gap: 10px; width: min(300px, 100%); text-align: left; padding: 8px 10px;
  margin-bottom: 4px; border: 0; border-radius: 6px; background: rgba(0,0,0,.05); cursor: pointer; font: inherit; color: inherit; }
.wa-doc:hover { background: rgba(0,0,0,.09); }
.wa-doc .stack { min-width: 0; }
.wa-doc b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wa-doc small { color: var(--muted); font-size: 11.5px; }
.wa-doc-ico { font-size: 24px; }
.wa-medio-error { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 2px; }
dialog.wa-visor { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
dialog.wa-visor::backdrop { background: rgba(11,20,26,.88); }
.wa-visor img { display: block; max-width: 92vw; max-height: 86vh; border-radius: 4px; min-width: 120px; min-height: 80px; }
.wa-visor-barra { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }

/* Invitación a un evento (Gestiones → Resumen) */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; }
.inv-grid .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.inv-seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.inv-op { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); font-size: 13px; cursor: pointer; }
.inv-op:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.inv-previa { max-width: 520px; background: #fff; border: 1px solid var(--line); margin-top: 4px; }
.inv-previa:empty { display: none; }
.inv-botones { display: grid; gap: 1px; margin: 8px -10px -5px; border-top: 1px solid var(--line); background: var(--line); }
.inv-botones span { background: #fff; text-align: center; padding: 8px; color: #027EB5; font-size: 13px; font-weight: 600; }
.inv-flyer { display: block; width: calc(100% + 20px); height: auto; margin: -7px -10px 8px; border-radius: 8px 8px 0 0; }
.inv-flyer.vacio { height: 140px; display: grid; place-items: center; background: #E9EDEF; color: var(--muted); font-size: 13px; }
video.inv-flyer { background: #000; max-height: 480px; }

/* ================================================================ llamadas y visitas */
.banner-warn { border-color: #EBD9B4; background: #FFFCF5; }
.banner-warn .banner-icon { background: #FDF3E3; color: #8A5B07; }
.ll-fila { display: flex; gap: 16px; align-items: flex-start; padding: 14px 22px; border-top: 1px solid var(--line-soft); }
.ll-acciones { flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 46%; }
a.btn-primary { display: inline-flex; align-items: center; text-decoration: none; }
.ges-opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 6px 0 14px; }
.ges-op { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; font-size: 13.5px; }
.ges-op:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); font-weight: 700; }
@media (max-width: 720px) {
  .ll-fila { flex-direction: column; padding: 14px 16px; }
  .ll-acciones { max-width: none; justify-content: flex-start; }
  .ges-opciones { grid-template-columns: 1fr; }
}
