:root {
  --brand-dark: #0f2e20;
  --brand-dark-2: #143824;
  --brand: #1f8a4c;
  --brand-hover: #197a41;
  --brand-light: #e6f4ea;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e4e7eb;
  --border-strong: #d3d7dd;
  --text: #16181d;
  --muted: #6b7280;
  --muted-2: #9aa0a8;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, 0.05);
  --shadow-md: 0 6px 20px rgba(16, 24, 32, 0.08);
}

* { box-sizing: border-box; }
/* Nunca dejar que un display:flex/inline-flex de un componente le gane al
   atributo [hidden] (pasa con cualquier selector de clase/tag, ya que le
   gana en especificidad a la regla [hidden] del navegador). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

h1 { margin: 0 0 20px; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 0.95rem; }

/* ---------- App shell (sidebar layout) ---------- */

.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--brand-dark);
  background-image: linear-gradient(180deg, var(--brand-dark-2), var(--brand-dark));
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 8px 24px;
  border-radius: 8px; transition: background 0.15s;
}
.sidebar-brand:hover { background: rgba(255, 255, 255, 0.06); }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-fallback { color: white; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-tagline { display: flex; align-items: baseline; gap: 6px; line-height: 1.25; }
.brand-tagline-title { color: rgba(255, 255, 255, 0.85); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.02em; }
.brand-tagline-sub { color: rgba(255, 255, 255, 0.5); font-size: 0.72rem; font-weight: 500; }
.brand-tagline-sub::before { content: "·"; margin-right: 6px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.sidebar-nav a.active { background: rgba(255, 255, 255, 0.14); color: white; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px; margin-top: 14px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; color: white;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  display: block; font-size: 0.82rem; font-weight: 600; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  display: block; font-size: 0.7rem; color: rgba(255, 255, 255, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-link {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  text-decoration: none; border-radius: 8px; padding: 6px; margin: -6px;
  transition: background 0.15s;
}
.sidebar-user-link:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar-user-link.active { background: rgba(255, 255, 255, 0.14); }
.sidebar-user .link-button {
  background: none; border: none; padding: 6px; cursor: pointer;
  color: rgba(255, 255, 255, 0.55); display: flex; border-radius: 6px;
}
.sidebar-user .link-button:hover { color: white; background: rgba(255, 255, 255, 0.08); }
.sidebar-user .link-button svg { width: 17px; height: 17px; }

.main-shell { flex: 1; min-width: 0; }

.container { max-width: 1240px; margin: 0 auto; padding: 36px 40px; overflow-x: auto; }

/* ---------- Vista embebida (legajo dentro del modal de Carga) ---------- */

.embed-body { background: var(--surface); }
.container-embed { max-width: none; padding: 20px 24px; }

/* ---------- Modal de legajo ---------- */

.legajo-modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 30, 25, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 1000;
}
.legajo-modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  width: 100%; max-width: 980px; height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.legajo-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--muted);
}
.legajo-modal-cerrar {
  background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted);
  line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.legajo-modal-cerrar:hover { background: var(--bg); color: var(--text); }
.legajo-modal iframe { flex: 1; width: 100%; border: none; }

/* ---------- Login ---------- */

body:has(.login-page) { background: var(--bg); }
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 100%; max-width: 380px; margin: 0; padding: 36px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-box .login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-box .login-logo img { height: 68px; }
.login-box .login-logo .brand-fallback { color: var(--text); }
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box p.muted { text-align: center; margin-bottom: 24px; }
.login-box label { display: block; margin-bottom: 16px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.login-box input {
  width: 100%; padding: 10px 12px; margin-top: 6px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.login-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.login-box button { width: 100%; padding: 11px; font-size: 0.95rem; }

/* ---------- Buttons ---------- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
button:hover, .button:hover { background: var(--brand-hover); }
button:active, .button:active { transform: scale(0.98); }
.button.whatsapp { background: #25D366; }
.button.whatsapp:hover { background: #1ea952; }
.button.secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.button.secondary:hover { background: #f0f1f3; }
.icon-external { width: 14px; height: 14px; flex-shrink: 0; }
button:disabled, .button:disabled { opacity: 0.65; cursor: default; }

/* ---------- Inicio (dashboard) ---------- */

.subtitle { margin-top: -14px; margin-bottom: 24px; }

.hero-banner {
  position: relative;
  height: 210px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  background: var(--brand-dark);
}
.hero-banner::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    100deg,
    rgba(15, 46, 32, 0.94) 0%,
    rgba(15, 46, 32, 0.82) 30%,
    rgba(15, 46, 32, 0.35) 65%,
    rgba(15, 46, 32, 0.05) 100%
  );
}
.hero-overlay {
  position: relative; z-index: 1;
  height: 100%; max-width: 480px;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 40px;
}
.hero-eyebrow {
  margin: 0 0 6px; color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-title { margin: 0 0 6px; color: white; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }
.hero-subtitle { margin: 0; color: rgba(255, 255, 255, 0.85); font-size: 0.92rem; }
.hero-subtitle strong { color: white; font-weight: 700; }

.hero-banner--compact { height: 148px; }
.hero-banner--compact .hero-overlay { padding: 0 36px; }
.hero-banner--compact .hero-title { font-size: 1.5rem; }

/* Hero partido: fondo crema unico (mismo tono que el papel de la ilustracion)
   con texto en verde oscuro a la izquierda, y la ilustracion completa
   difuminandose desde la derecha — nada de bloques de color pesados. */
.hero-banner--split {
  display: flex; align-items: stretch;
  background: linear-gradient(100deg, #fbf8f0 0%, #f2ece0 42%, #17323a 100%);
}
.hero-banner--compact.hero-banner--split { height: 222px; }
.hero-banner--split::after { content: none; }
.hero-banner--split .hero-overlay { max-width: none; flex: 1 1 auto; }

.hero-banner--split .hero-eyebrow { color: var(--brand-hover); }
.hero-banner--split .hero-title { color: var(--brand-dark); }
.hero-banner--split .hero-subtitle { color: #4a4a3f; }
.hero-banner--split .hero-subtitle strong { color: var(--brand-dark); }

.hero-imagen {
  flex: 0 0 42%;
  min-width: 220px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px 20px;
  mask-image: linear-gradient(90deg, transparent 0%, black 22%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 22%);
}
.hero-imagen img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.card-desc { color: var(--muted); font-size: 0.78rem; margin-top: 6px; line-height: 1.4; }
.card-value { font-size: 1.05rem; font-weight: 700; color: var(--brand); margin-top: 2px; }

.card-contactados {
  margin: 8px 0 0; font-size: 0.78rem; font-weight: 600; color: var(--brand-hover);
  background: var(--brand-light); display: inline-block; padding: 2px 9px; border-radius: 999px;
  position: relative; z-index: 1;
}

.confirmar-inline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.confirmar-inline-texto { font-size: 0.78rem; color: var(--muted); }

a.card-clickable, .card-clickable-js {
  text-decoration: none; color: inherit; cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
a.card-clickable:hover, .card-clickable-js:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-clickable-js:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.card-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.button.small { padding: 6px 12px; font-size: 0.8rem; }

.card-sync { align-items: flex-start; }
.card-sync button { margin-top: 10px; }
.calendario-status { margin-top: 6px; margin-bottom: 0; }
.calendario-status .error { color: #b3261e; }
.sync-status { margin: 8px 0 0; font-size: 0.82rem; color: var(--brand); }

/* ---------- Dashboard cards: icono + estado ---------- */

.cards--dashboard .card { flex: 1 1 260px; padding: 22px 24px; gap: 4px; }
.card-top {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin-bottom: 10px;
}
.card-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.card-top .card-icon { margin-bottom: 0; }
.card-icon svg { width: 19px; height: 19px; }

.estado-badge {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
}
.estado-badge.estado-ok { background: var(--brand-light); color: var(--brand-hover); }
.estado-badge.estado-atencion { background: #fef3d6; color: #92600a; }
.estado-badge.estado-critico { background: #fbe0df; color: #a3241d; }

.card-estado-atencion { border-color: #f4d998; }
.card-estado-critico { border-color: #eeb6b3; }

.live-strip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 18px; margin-bottom: 8px;
  font-size: 0.84rem; color: var(--muted); font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0;
  animation: live-pulse 2.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(31, 138, 76, 0.35); }
  50% { opacity: 0.75; box-shadow: 0 0 0 4px rgba(31, 138, 76, 0); }
}

.section-title {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; margin: 32px 0 14px;
}

/* ---------- Accesos rapidos (cards) ---------- */

.accesos-rapidos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.acceso-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; cursor: pointer;
  font-family: inherit; text-align: left;
  transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.acceso-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.acceso-card-button { width: 100%; }
.acceso-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.acceso-icon svg { width: 18px; height: 18px; }
.acceso-texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.acceso-titulo { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.acceso-sub { font-size: 0.78rem; color: var(--muted); }

/* ---------- Actividad reciente ---------- */

.actividad-reciente {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 6px 20px; box-shadow: var(--shadow-sm);
}
.actividad-reciente > p.muted { padding: 14px 0; margin: 0; }
.actividad-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.actividad-item:last-child { border-bottom: none; }
.actividad-punto {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  margin-top: 6px; flex-shrink: 0;
}
.actividad-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.actividad-principal { font-size: 0.88rem; color: var(--text); }
.actividad-cuando { font-size: 0.76rem; color: var(--muted-2); }

@media (max-width: 700px) {
  .hero-banner { height: 170px; }
  .hero-overlay { padding: 0 20px; max-width: 100%; }
  .hero-title { font-size: 1.4rem; }
  .hero-banner--compact { height: 190px; }
  .hero-banner--compact .hero-overlay { padding: 0 20px; }
  .hero-banner--compact.hero-banner--split { height: auto; }
  .hero-imagen { display: none; }
  .accesos-rapidos { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) and (min-width: 701px) {
  .accesos-rapidos { grid-template-columns: repeat(2, 1fr); }
  .hero-imagen { flex: 0 0 32%; min-width: 160px; }
}

/* ---------- Forms / filters ---------- */

.filtros {
  display: flex; align-items: end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.filtros label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.filtros input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; margin-top: 5px;
  font-size: 0.9rem;
}
.filtros input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

/* ---------- Summary cards ---------- */

.cards { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 24px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow-sm); min-width: 140px;
}
.card-number { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.card-label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.card-selected { border-color: var(--brand); border-width: 2px; padding: 17px 23px; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 600px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; overflow-x: auto; box-shadow: var(--shadow-sm);
}
.table-wrap table { border: none; }

.celda-contactado { text-align: center; }
.contactado-wrap { display: inline-flex; align-items: center; gap: 8px; }
.contactado-toggle {
  width: 28px; height: 28px; padding: 0; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s, color 0.15s;
}
.contactado-toggle svg { width: 15px; height: 15px; }
.contactado-toggle:hover { border-color: var(--brand); }
.contactado-toggle:active { transform: scale(0.9); }
.contactado-toggle.is-contactado {
  background: var(--brand); border-color: var(--brand); color: white;
}
.contactado-toggle.is-contactado:hover { background: var(--brand-hover); }
.contactado-toggle.contactado-error { border-color: #b3261e; animation: shake 0.35s; }
@keyframes shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.contactado-fecha { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }

tr.fila-contactada { background: var(--brand-light); }
tr.fila-contactada:hover { background: var(--brand-light); }
tr.fila-contactada td { color: var(--muted); }
tr.fila-contactada td a { color: var(--brand-hover); }

.badge-contactado {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-hover);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------- Carga REPROCANN ---------- */

/* Sistema de colores de estado de carga (una sola fuente de verdad):
   gris=pendiente, verde=cargado, amarillo=problema, rojo=interconsulta,
   lila=resuelto, vencido=plazo vencido, listo=renovacion habilitada,
   espera=trámite vigente todavía no habilitado. */
tr.fila-estado-verde { background: var(--brand-light); }
tr.fila-estado-verde td { color: var(--muted); }
tr.fila-estado-verde td a { color: var(--brand-hover); }
tr.fila-estado-amarillo { background: #fef8e6; }
tr.fila-estado-amarillo:hover { background: #fef3d1; }
tr.fila-estado-rojo { background: #fdeceb; }
tr.fila-estado-rojo:hover { background: #fbe2e1; }
tr.fila-estado-lila { background: #f3edfb; }
tr.fila-estado-lila:hover { background: #ece2f9; }
tr.fila-estado-listo { background: #fde7dd; }
tr.fila-estado-listo:hover { background: #fbdcc9; }
tr.fila-estado-espera { background: #eef2f7; }
tr.fila-estado-vencido { background: #fbe2e1; }
tr.fila-estado-gris_oscuro { background: #e8eaed; }
tr.fila-estado-gris_oscuro td { color: #5f6368; }

.badge-estado-gris {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: 0.8rem; white-space: nowrap;
}
.badge-estado-verde {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand-hover);
  font-weight: 600; font-size: 0.8rem; white-space: nowrap;
}
.badge-estado-amarillo {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fef3d1; color: #92600a;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-rojo, .badge-interconsulta {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fbdad8; color: #a3231c;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-lila {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #e9ddf9; color: #6b3fa0;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-listo {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #f7d9c0; color: #9a4d16;
  font-weight: 700; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-espera {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #dde6f0; color: #3d5673;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-vencido {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fbe2e1; color: #a33a35;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-estado-gris_oscuro {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #dadce0; color: #3c4043;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
/* Alias heredados (se usan en Cobros, Vencimientos, ONGs y el legajo). */
.badge-cargado {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand-hover);
  font-weight: 600; font-size: 0.8rem; white-space: nowrap;
}
.badge-problema {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fef3d1; color: #92600a;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}

.card-critico-badge {
  display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px;
  background: #a3231c; color: #fff; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.03em; vertical-align: middle;
}
.carga-vence-wrap { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }

/* Acciones de carga al pie del modal de legajo */
.carga-acciones-modal { border-left: 3px solid var(--brand); }
.carga-modal-estado { margin-bottom: 12px; }
.carga-modal-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.carga-modal-problema {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.carga-modal-problema select, .carga-modal-problema input {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem;
}
.carga-modal-vence { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.carga-modal-problema-botones { display: flex; gap: 6px; }
.interconsulta-indicacion textarea {
  font-weight: 400; padding: 8px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 0.9rem; resize: vertical;
}
.consulta-interconsulta { white-space: pre-wrap; }

/* Importar de REPROCANN */
.reprocann-import { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.reprocann-file { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.reprocann-botones { display: flex; gap: 8px; }
.reprocann-preview { margin-top: 18px; }
.reprocann-confirmar { margin-top: 8px; }
.reprocann-resultado { margin-top: 16px; }
.badge-evaluacion {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #e4edfb; color: #2952a3;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}
.badge-ong {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted);
  font-weight: 600; font-size: 0.68rem; letter-spacing: 0.02em; vertical-align: middle; cursor: help;
}
.badge-vencido {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fbe2e1; color: #a33a35;
  font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: help;
}

.carga-acciones { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.carga-problema-form {
  display: flex; flex-direction: column; gap: 6px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-width: 220px;
}
.carga-problema-form select, .carga-problema-form input {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem;
}
.carga-problema-form-botones { display: flex; gap: 6px; }

.carga-bulk-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px;
  background: var(--brand-light); border: 1px solid var(--border); border-radius: 8px;
}
.carga-bulk-toolbar span { font-weight: 600; margin-right: auto; }

.busqueda-vacia {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 32px; text-align: center;
}
.busqueda-vacia p { margin: 0 0 6px; }
.busqueda-vacia p:last-child { margin-bottom: 0; }

/* ---------- Misc ---------- */

.muted { color: var(--muted); }
.error { color: #b3261e; }
.success { color: var(--brand); }

.paginacion { display: flex; gap: 16px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.paginacion a {
  white-space: nowrap; color: var(--text); text-decoration: none; font-size: 0.85rem;
  font-weight: 500; padding: 6px 10px; border-radius: 7px;
}
.paginacion a:hover { background: var(--surface); border: 1px solid var(--border); padding: 5px 9px; }
.ir-a-pagina { display: flex; align-items: center; gap: 8px; }
.ir-a-pagina label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.ir-a-pagina input { width: 64px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; }

.detail-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.detail-header-acciones { display: flex; gap: 8px; flex-wrap: wrap; }

.interconsulta-box { border-left: 3px solid #a3231c; margin-top: 12px; }
.interconsulta-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.interconsulta-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.interconsulta-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.interconsulta-form input[type="file"] { font-weight: 400; }
.interconsulta-form input[type="date"] { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; max-width: 200px; }
.interconsulta-form .campo-ayuda { font-weight: 400; }
.interconsulta-form-botones { display: flex; gap: 8px; }

/* ---------- Compliance ---------- */

.compliance-intro { margin-bottom: 8px; }
.compliance-leyes { margin: 12px 0 0; }
.compliance-leyes dt { font-weight: 700; color: var(--brand-hover); margin-top: 12px; }
.compliance-leyes dd { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

.compliance-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.compliance-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.compliance-item-body h3 { margin: 0 0 4px; font-size: 0.95rem; }
.compliance-item-body p { margin: 0 0 6px; font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.compliance-item-body p:last-child { margin-bottom: 0; }
.compliance-item-body code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.85em;
  background: var(--brand-light); padding: 1px 5px; border-radius: 4px;
}

.compliance-pill {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; margin-top: 2px;
}
.compliance-pill.ok { background: var(--brand-light); color: var(--brand-hover); }
.compliance-pill.warn { background: #fef3d1; color: #92600a; }
.compliance-pill.org { background: #e4edfb; color: #2952a3; }

.compliance-disclaimer { margin-top: 16px; background: var(--bg); }
.compliance-disclaimer p { margin: 0; font-size: 0.86rem; line-height: 1.55; }

.compliance-score { margin-bottom: 16px; }
.compliance-score-fila { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.compliance-score-numero {
  font-size: 2.6rem; font-weight: 700; color: var(--brand); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.compliance-score-detalle { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
.compliance-score-barra {
  height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden;
}
.compliance-score-barra span {
  display: block; height: 100%; background: var(--brand); border-radius: 999px;
}

/* ---------- Notas de paciente / seguimiento de contacto ---------- */

.contactado-nota {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.78rem; width: 130px;
}
.nota-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.nota-form textarea {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit; resize: vertical;
}
.notas-lista { display: flex; flex-direction: column; gap: 10px; }
.nota-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.nota-meta { font-size: 0.76rem; color: var(--muted); margin-bottom: 4px; }
.nota-origen { margin-left: 6px; font-size: 0.66rem; }
.nota-texto { font-size: 0.9rem; white-space: pre-wrap; }

/* ---------- ONGs ---------- */

.ong-header-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ong-header-fila h2 { margin: 0; }
.ong-crear { display: flex; gap: 8px; align-items: center; }
.ong-crear input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; min-width: 180px;
}
.ong-gestion {
  display: flex; flex-direction: column; gap: 6px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; min-width: 250px;
}
.ong-gestion-fila { display: flex; gap: 6px; align-items: center; }
.ong-gestion input, .ong-gestion select {
  flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem;
}
.ong-planilla-config { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ong-planilla-config input {
  flex: 1; min-width: 280px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.82rem;
}
.ong-busquedas-filtros { margin-bottom: 12px; }
.celda-contactado select[data-ong-contacto] {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.78rem; max-width: 150px;
}

/* ---------- Bateria de compliance en el sidebar ---------- */

.nav-compliance { display: flex; align-items: center; gap: 8px; }
/* Porcentaje de cumplimiento estilo iOS: verde claro, pildorita. */
.compliance-pct {
  margin-left: auto; padding: 2px 9px; border-radius: 999px;
  background: #d1f2d9; color: #1f8f3b;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}

/* ---------- Estadisticas ---------- */

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px; margin-top: 8px;
}
.stats-grid .panel { margin: 0; }
/* Panel de ancho completo (ej. el grafico de 12 meses arriba de todo). */
.stats-grid .panel-ancho { grid-column: 1 / -1; }
.stats-grid .panel h2 { margin-top: 0; }
.stats-nota { font-size: 0.78rem; margin: 2px 0 12px; }

/* Barras horizontales: etiqueta | barra | valor */
.stat-rows { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-row-label {
  flex: 0 0 150px; font-size: 0.82rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-row-track {
  flex: 1; height: 10px; background: var(--bg); border-radius: 4px; overflow: hidden;
}
.stat-row-fill {
  display: block; height: 100%; background: var(--brand);
  border-radius: 0 4px 4px 0; min-width: 2px; transition: filter 0.15s;
}
.stat-row-fill[style*="width: 0%"] { min-width: 0; }
.stat-row:hover .stat-row-fill { filter: brightness(1.15); }
.stat-row-valor {
  flex: 0 0 52px; text-align: right; font-size: 0.82rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}
/* Colores de estado (siempre acompañados de etiqueta y numero, nunca color solo) */
.stat-row-fill.fill-neutro { background: var(--muted-2); }
.stat-row-fill.fill-alerta { background: #d99a1f; }
.stat-row-fill.fill-lila { background: #8a5fc4; }

/* --- Usuarios / Equipo --- */
.usr-form-crear {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; align-items: end; margin-top: 8px;
}
.usr-form-crear label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.usr-form-crear input[type="text"], .usr-form-crear input[type="email"], .usr-form-crear select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: .9rem;
}
.usr-check { flex-direction: row !important; align-items: center; gap: 7px !important; }
.usr-check input { width: auto; }
.usr-form-submit { display: flex; }
.usr-nota { font-size: .78rem; margin-top: 12px; }
.usr-tabla td { vertical-align: middle; }
.usr-inactivo { opacity: .55; }
.usr-vos { font-size: .68rem; background: var(--brand-light); color: var(--brand-hover); padding: 1px 7px; border-radius: 999px; margin-left: 6px; font-weight: 700; }
.usr-col-acciones { width: 1%; }
.usr-acciones { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; white-space: nowrap; }
.usr-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.usr-reset input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; width: 130px; }
.btn-link { background: none; border: none; color: var(--brand-hover); font-weight: 600; cursor: pointer; padding: 0; font-size: .85rem; }
.btn-link:hover { text-decoration: underline; }
.pill { border: none; cursor: pointer; padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.pill-on { background: var(--brand-light); color: var(--brand-hover); }
.pill-off { background: #eceff1; color: var(--muted); }

/* Link "reconectar" en la tarjeta de Google Calendar: discreto */
.reconectar-link { font-size: .82rem; color: var(--muted); }
.reconectar-link:hover { color: var(--brand-hover); }
.resync-completa-wrap { margin: 8px 0 0; font-size: .82rem; }
.resync-completa-hint { font-size: .78rem; }

/* --- Card de Google Calendar (clickeable) + modal --- */
.gcal-card { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.gcal-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.10); transform: translateY(-1px); }
.gcal-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.gcal-auto { font-weight: 600; }
.gcal-ultima { margin-top: 2px; }
.gcal-card-hint { display: block; margin-top: 10px; font-size: .78rem; color: var(--brand-hover); font-weight: 600; }

.gcal-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 20, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000;
}
.gcal-modal-overlay[hidden] { display: none; }
.gcal-modal {
  position: relative; background: var(--surface); border-radius: 16px;
  padding: 26px 26px 22px; width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.30); max-height: 88vh; overflow-y: auto;
}
.gcal-modal-x {
  position: absolute; top: 14px; right: 14px; background: none; border: none;
  font-size: 1.1rem; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px;
}
.gcal-modal-x:hover { color: var(--text); }
.gcal-modal-tit { margin: 0 0 16px; font-size: 1.25rem; }
.gcal-modal-cal { padding: 12px 0; border-bottom: 1px solid var(--border); }
.gcal-modal-cal-head { display: flex; align-items: center; gap: 8px; }
.gcal-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.gcal-dot-on { background: #2e9e5b; box-shadow: 0 0 0 3px rgba(46,158,91,.18); }
.gcal-dot-off { background: #c0392b; }
.gcal-modal-sub { margin: 6px 0 2px; font-size: .85rem; }
.gcal-modal-auto {
  margin: 14px 0; padding: 12px 14px; background: var(--brand-light);
  color: var(--brand-hover); border-radius: 10px; font-size: .86rem; line-height: 1.4;
}
.gcal-modal-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.gcal-modal-actions .button { width: 100%; }
.gcal-modal-resync { display: flex; flex-direction: column; gap: 2px; }
.gcal-modal-hint { font-size: .76rem; line-height: 1.35; }

/* Pacientes atendidos ultimos 30 dias (numero grande + sparkline diario) */
.ult30-cuerpo { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
.ult30-num-wrap { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ult30-num { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--brand-hover); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ult30-lbl { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.ult30-spark { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.ult30-spark-bar {
  flex: 1; min-width: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--brand), #a7d8bb);
  opacity: .85; transition: opacity .15s;
}
.ult30-spark-bar:hover { opacity: 1; }

/* Comparador de periodos (Estadisticas) */
.cmp-num-base { color: var(--muted); }
.cmp-pct { font-size: 1rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.cmp-up { background: var(--brand-light); color: var(--brand-hover); }
.cmp-down { background: #fbe2e1; color: #a33a35; }
.cmp-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 10px 0 4px; }
.cmp-form-grupo { display: flex; flex-direction: column; gap: 4px; }
.cmp-form-titulo { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cmp-dot-a::before, .cmp-dot-b::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: baseline;
}
.cmp-dot-a::before { background: var(--brand); }
.cmp-dot-b::before { background: var(--muted-2); }
.cmp-form-grupo input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; margin-right: 6px; }
.cmp-barras { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.cmp-barra-fila { display: flex; align-items: center; gap: 10px; }
.cmp-barra-track { flex: 1; height: 22px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.cmp-barra-fill { display: block; height: 100%; border-radius: 7px; transition: width .5s ease; }
.cmp-fill-a { background: var(--brand); }
.cmp-fill-b { background: var(--muted-2); }
.cmp-barra-valor { min-width: 58px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-resultado { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.cmp-resultado-nota { font-size: .78rem; }
.stat-row-fill.fill-critico { background: #c4534c; }

/* Columnas mensuales: la barra se ancla abajo con posicion absoluta y el valor
   flota justo encima (bottom: <pct>%), asi el numero nunca deforma la altura
   de la barra (con flexbox, el maximo con etiqueta se "aplastaba"). */
.stat-cols {
  display: flex; align-items: stretch; gap: 6px; height: 168px; padding-top: 16px;
}
.stat-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0;
}
.stat-col-plot { position: relative; flex: 1; width: 100%; }
.stat-col-fill {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 34px; background: var(--brand);
  border-radius: 4px 4px 0 0; min-height: 2px; transition: filter 0.15s;
}
.stat-col:hover .stat-col-fill { filter: brightness(1.15); }
.stat-col-valor {
  position: absolute; left: 50%; transform: translateX(-50%);
  margin-bottom: 2px; font-size: 0.62rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1;
}
.stat-col-mes {
  font-size: 0.66rem; color: var(--muted); margin-top: 6px; line-height: 1.1;
  white-space: nowrap; text-align: center; max-width: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.stat-col-anio { font-size: 0.6rem; color: var(--muted-2); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.panel h2 { margin-top: 0; margin-bottom: 14px; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.panel .table-wrap { box-shadow: none; border-color: var(--border); }

dl { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; row-gap: 10px; column-gap: 12px; margin: 0; }
dt { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
dd { margin: 0; word-break: break-word; line-height: 1.5; }
dd.pre { white-space: pre-wrap; }

.historia-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.historia-header h3 { margin: 0; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.historia-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge-ia {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: var(--brand-light); color: var(--brand-hover);
}
.historia-ia-fecha { margin: 4px 0 0; font-size: 0.76rem; }
.historia-texto { white-space: pre-wrap; line-height: 1.5; margin-top: 10px; }

.historia-secciones { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.historia-seccion {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--bg);
}
.historia-seccion-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.historia-seccion-header strong { font-size: 0.85rem; }
.historia-seccion .historia-texto { margin-top: 6px; font-size: 0.9rem; }
[data-copiar-seccion].copiado { background: var(--brand); color: #fff; border-color: var(--brand); }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  background: var(--surface); padding: 22px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.form-grid label { display: flex; flex-direction: column; font-size: 0.82rem; color: var(--muted); font-weight: 500; gap: 5px; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; font-family: inherit;
  font-size: 0.9rem; color: var(--text);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light);
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid-1col { grid-template-columns: 1fr; }
.panel .form-grid { background: none; border: none; box-shadow: none; padding: 0; }
.panel .form-grid input:disabled { background: var(--bg); color: var(--muted); }

/* ---------- Cannela (chat IA) ---------- */

.cannela-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.cannela-avatar { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }
.cannela-header h1 { margin-bottom: 2px; }
.cannela-header .subtitle { margin: 0; }

.cannela-chat {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); height: calc(100vh - 230px); min-height: 420px; overflow: hidden;
}
.cannela-mensajes { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.cannela-mensaje { display: flex; align-items: flex-start; gap: 10px; }
.cannela-mensaje--usuario { justify-content: flex-end; }
.cannela-mensaje-avatar { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }

.cannela-burbuja {
  max-width: 68%; padding: 10px 14px; border-radius: 14px; font-size: 0.88rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.cannela-mensaje--bot .cannela-burbuja { background: var(--brand-light); color: var(--text); border-bottom-left-radius: 4px; }
.cannela-mensaje--usuario .cannela-burbuja { background: var(--brand); color: white; border-bottom-right-radius: 4px; }
.cannela-burbuja.cannela-escribiendo { color: var(--muted); font-style: italic; }

.cannela-form {
  display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface);
}
.cannela-form textarea {
  flex: 1; resize: vertical; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; min-height: 44px;
}
.cannela-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.cannela-form button { align-self: flex-end; }

.nav-avatar { width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }

/* ---------- Cannela (globo flotante, en toda la app) ---------- */

.cannela-widget { position: fixed; right: 24px; bottom: 24px; z-index: 1000; }

.cannela-globo {
  width: 60px; height: 60px; border-radius: 50%; padding: 0; border: none;
  box-shadow: 0 6px 20px rgba(15, 46, 32, 0.35); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  background: var(--brand-dark);
}
.cannela-globo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.cannela-globo:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(15, 46, 32, 0.45); }
.cannela-globo:active { transform: scale(0.97); }
.cannela-globo[hidden] { display: none; }

.cannela-panel {
  position: absolute; right: 0; bottom: 0;
  width: 340px; height: 480px; max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); display: flex; flex-direction: column; overflow: hidden;
}
.cannela-panel-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--brand-dark); background-image: linear-gradient(135deg, var(--brand-dark-2), var(--brand-dark));
  color: white; flex-shrink: 0;
}
.cannela-panel-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cannela-panel-titulo { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.cannela-panel-titulo .muted { color: rgba(255, 255, 255, 0.65); font-size: 0.74rem; }
.cannela-panel-cerrar {
  background: none; border: none; padding: 4px; color: rgba(255, 255, 255, 0.75); cursor: pointer;
  display: flex; border-radius: 6px; flex-shrink: 0;
}
.cannela-panel-cerrar:hover { color: white; background: rgba(255, 255, 255, 0.12); }
.cannela-panel-cerrar svg { width: 16px; height: 16px; }

.cannela-panel-mensajes { padding: 14px; }
.cannela-panel .cannela-form { padding: 10px 12px; }
.cannela-panel .cannela-burbuja { max-width: 78%; font-size: 0.85rem; }

@media (max-width: 420px) {
  .cannela-widget { right: 12px; bottom: 12px; }
  .cannela-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); }
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; }
  .sidebar-brand { padding: 0; margin-right: 16px; flex-direction: row; align-items: center; }
  .brand-tagline { display: none; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-user { border: none; margin: 0 0 0 auto; padding: 0; }
  .user-info { display: none; }
  .container { padding: 20px; }
}

@media (max-width: 700px) {
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  dl { grid-template-columns: 120px 1fr; }
  .cannela-chat { height: calc(100vh - 320px); }
  .cannela-burbuja { max-width: 85%; }
}

/* ---- Modulo Cobros ---- */
.card-alerta .card-number { color: #b3261e; }
.pago-importe { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pago-obs { font-size: 0.85rem; color: var(--muted, #6b7280); max-width: 260px; }
.badge-neutro {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #eef0f3; color: #4b5563; font-size: 0.8rem; white-space: nowrap;
}

/* Resolver pagos sin conciliar: menu desplegable compacto */
.pago-resolver-boton {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid #d0d5dd; border-radius: 8px;
  padding: 3px 10px 3px 4px; cursor: pointer; font-size: 0.82rem; color: #374151;
  white-space: nowrap;
}
.pago-resolver-boton:hover { border-color: var(--brand); color: var(--brand); }
.pago-resolver-menu {
  position: fixed; z-index: 60; min-width: 280px; max-width: 340px;
  background: #fff; border: 1px solid #d0d5dd; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16); padding: 10px;
  display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.pago-resolver-menu[hidden] { display: none; }
.resolver-seccion { display: flex; flex-direction: column; gap: 6px; }
.resolver-seccion + .resolver-seccion { border-top: 1px solid #eef0f3; padding-top: 10px; }
.resolver-titulo { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; }
.resolver-linea { display: flex; gap: 6px; }
.resolver-linea input, .resolver-linea select {
  flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 0.85rem;
}
.resolver-buscar { font-size: 0.8rem; text-decoration: underline; color: #4b5563; }
.resolver-opcion {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 0.87rem; color: #1f2937;
}
.resolver-opcion:hover { background: #f3f6f4; }
.resolver-opcion .muted { font-size: 0.8rem; }

.pago-resuelto { display: inline-flex; align-items: center; gap: 4px; }
.pago-quitar {
  background: none; border: none; cursor: pointer; color: #9ca3af;
  font-size: 1rem; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.pago-quitar:hover { color: #b3261e; background: #f6e7e6; }

/* Eliminar ONG erronea */
.ong-eliminar {
  background: none; border: 1px solid #e6c9c7; color: #b3261e;
  border-radius: 8px; cursor: pointer; padding: 4px 9px; font-size: 0.85rem;
  line-height: 1; vertical-align: middle;
}
.ong-eliminar:hover { background: #f6e7e6; border-color: #b3261e; }

/* Fichas de ONG */
.ong-nombre-link { font-weight: 600; color: var(--brand); text-decoration: none; }
.ong-nombre-link:hover { text-decoration: underline; }
.ficha-check { margin-left: 5px; font-size: 0.85rem; }
.fichas-sin-vincular { margin-top: 12px; }
.ficha-vincular-fila {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-top: 1px solid #eef0f3; flex-wrap: wrap;
}
.ficha-vincular-nombre { flex: 1; min-width: 180px; font-size: 0.9rem; }
.ficha-vincular-fila select { padding: 5px 8px; border: 1px solid #d0d5dd; border-radius: 6px; max-width: 220px; }

.ong-ficha-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.volver-link { color: var(--muted, #6b7280); text-decoration: none; font-size: 0.9rem; }
.volver-link:hover { text-decoration: underline; }
.ficha-seccion { margin-top: 14px; }
.ficha-seccion h3 { font-size: 0.95rem; margin: 0 0 6px; color: #374151; }
.ficha-dl { display: grid; grid-template-columns: 220px 1fr; gap: 4px 16px; margin: 0; }
.ficha-dl dt { font-weight: 600; color: #4b5563; }
.ficha-dl dd { margin: 0; white-space: pre-wrap; }
.saldo-negativo-card .card-number { color: #b3261e; }

/* Tramites a credito de las ONGs */
.saldo-negativo {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #f6e7e6; color: #b3261e; font-weight: 600; font-size: 0.8rem;
}
.creditos-panel {
  margin-top: 8px; padding: 10px; border: 1px solid #e3e8e5; border-radius: 10px;
  background: #fafbfa; max-width: 420px;
}
.creditos-form { display: flex; gap: 6px; margin-bottom: 8px; }
.creditos-form input[type="number"] { width: 70px; padding: 5px 8px; border: 1px solid #d0d5dd; border-radius: 6px; }
.creditos-form input[type="text"] { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid #d0d5dd; border-radius: 6px; }
.creditos-lista { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.credito-item { display: flex; align-items: center; gap: 8px; font-size: 0.83rem; }
.credito-delta { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.credito-mas { color: var(--brand); }
.credito-menos { color: #b3261e; }
.credito-info { color: #4b5563; }
.credito-eliminar-form { margin-left: auto; }
.creditos-vacio { font-size: 0.8rem; margin: 0; }
.credito-mas-items { font-size: 0.78rem; margin: 4px 0 0; }

/* ---------- Centro de control (hero Inicio) ---------- */
.centro-control {
  display: grid; grid-template-columns: 55% 45%; gap: 28px; align-items: center;
  background: linear-gradient(180deg, #ffffff, #fbfdfb);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 32px 36px; margin-bottom: 22px;
  animation: cc-fade-in .5s ease both;
}
@keyframes cc-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cc-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--brand); margin: 0 0 10px; }
.cc-saludo { font-size: 1.7rem; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.cc-fecha { color: var(--muted); margin: 0 0 22px; font-size: .95rem; }

.cc-metricas { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.cc-metrica { padding: 0 16px; border-left: 1px solid var(--border); }
.cc-metrica:first-child { padding-left: 0; border-left: none; }
.cc-metrica-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cc-metrica-alerta { color: #b3261e; }
.cc-metrica-lbl { display: block; font-size: .74rem; color: var(--muted); margin-top: 4px; }
.cc-metrica-sub { display: block; font-size: .66rem; color: var(--muted-2); margin-top: 2px; }

.cc-frase { color: var(--muted); font-size: .92rem; font-style: italic; margin: 0; border-top: 1px solid var(--border); padding-top: 16px; max-width: 48ch; }

/* Mapa */
.cc-mapa { display: flex; flex-direction: column; align-items: center; }
.cc-mapa-lienzo { position: relative; width: 100%; max-width: 300px; }
.mapa-arg { width: 100%; height: auto; display: block; overflow: visible; }
.prov { fill: #eef0f2; stroke: #ffffff; stroke-width: 1; transition: fill .5s ease, opacity .2s ease; cursor: pointer; outline: none; }
.prov:hover, .prov:focus { opacity: .82; }
.prov:focus-visible { stroke: var(--brand); stroke-width: 1.6; }
.prov-caba { fill: #9db4c0; stroke: #ffffff; stroke-width: 1; }
/* Marcador de CABA/GBA: el poligono real de CABA mide ~5x6 unidades (invisible
   e inapuntable), asi que se muestra como un punto -- del mismo color que el
   punto de la leyenda "CABA / GBA" de abajo. */
.prov-caba-hit { fill: #9db4c0; stroke: #ffffff; stroke-width: 2; }

.cc-mapa-skeleton { position: absolute; inset: 0; border-radius: 12px; display: none;
  background: linear-gradient(100deg, #eef0f2 30%, #f6f8f9 50%, #eef0f2 70%); background-size: 200% 100%; animation: cc-shimmer 1.2s infinite; }
.cc-mapa-lienzo[data-mapa-estado="cargando"] .cc-mapa-skeleton { display: block; }
@keyframes cc-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.cc-mapa-tooltip { position: absolute; transform: translate(-50%, -100%); background: var(--brand-dark); color: #fff;
  border-radius: 8px; padding: 7px 11px; font-size: .8rem; line-height: 1.35; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-md); z-index: 5; }
.cc-tt-prov { display: block; font-weight: 700; }
.cc-tt-metro { font-size: .6rem; background: rgba(255,255,255,.22); padding: 1px 5px; border-radius: 999px; font-weight: 600; vertical-align: middle; }
.cc-tt-num { display: block; }
.cc-tt-pct { display: block; opacity: .75; font-size: .72rem; }

.cc-mapa-alcance { margin: 16px 0 2px; font-size: .95rem; color: var(--text); }
.cc-mapa-alcance strong { font-size: 1.15rem; color: var(--brand); }
.cc-mapa-sub { margin: 0; font-size: .78rem; color: var(--muted-2); text-align: center; }

.cc-mapa-extra { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; align-items: center; text-align: center; }
.cc-metro { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cc-metro-dot { width: 9px; height: 9px; border-radius: 50%; background: #9db4c0; display: inline-block; }
.cc-metro strong { color: var(--text); }
.cc-calidad { font-size: .72rem; color: var(--muted-2); }
.cc-calidad strong { color: var(--muted); }

@media (max-width: 900px) {
  .centro-control { grid-template-columns: 1fr; }
  .cc-mapa { margin-top: 8px; }
}
@media (max-width: 560px) {
  .centro-control { padding: 24px 20px; }
  .cc-metricas { grid-template-columns: repeat(2, 1fr); gap: 16px 0; }
  .cc-metrica { padding: 0 12px; }
  .cc-metrica:nth-child(3) { border-left: none; padding-left: 0; }
}
