:root {
  color-scheme: dark;
  /* Marca segun design/BRAND.md + design/tokens.css: la app es oscura por
     defecto ('verde clinico sobre noche'). El claro queda como eleccion
     explicita via [data-theme="light"]. */
  --brand-dark: #041E10;
  --brand-dark-2: #062E17;
  --brand: #3AAA35;          /* accion (fondos de boton, con texto oscuro) */
  --brand-hover: #5CC855;
  --brand-strong: #7FE87A;   /* texto y links sobre oscuro (4.5:1) */
  --brand-light: rgba(58,170,53,.14);
  --brand-tint: rgba(58,170,53,.14);
  --brand-ink: #7FE87A;
  --brand-contrast: #07120D; /* texto SOBRE el verde de accion */
  --bg: #07120D;
  --surface: #0A1811;
  --surface-2: #0E2117;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --text: #E6EFE9;
  --muted: #A8BBAF;
  --muted-2: #8CA396;
  --ok: #7FE87A; --ok-tint: rgba(58,170,53,.14);
  --warn: #F2B33D; --warn-tint: rgba(242,179,61,.14);
  --crit: #FF8B80; --crit-tint: rgba(224,84,74,.14);
  /* Graficos en escala cielo: celeste = datos, el verde queda para la accion. */
  --chart-fact: #A9DAE6;
  --chart-ventas: #3B93AD;
  --ring: rgba(127,232,122,.34);
  /* Jerarquia con superficie y borde; sombra solo para flotantes. */
  --shadow-sm: none;
  --shadow-md: 0 24px 60px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --sans: "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Sora", "DM Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --side-bg: #0A1811; --side-text: #C9DAD0; --side-muted: #8CA396;
}

/* ---------- Tema CLARO (eleccion explicita del usuario) ----------
   Redefine SOLO tokens; misma marca, en piezas claras (verde profundo
   sobre blanco, tintes de la escala verde 100). */
:root[data-theme="light"] {
  color-scheme: light;
  --brand-dark: #062E17; --brand-dark-2: #094924;
  --brand: #157A3C; --brand-hover: #0F6231; --brand-strong: #0F6231;
  --brand-light: #EDF7EE; --brand-tint: #EDF7EE; --brand-ink: #094924;
  --brand-contrast: #ffffff;
  --bg: #F2F5F1; --surface: #ffffff; --surface-2: #F5F8F5;
  --border: #E2E8E4; --border-strong: #CFDAD3;
  --text: #14201A; --muted: #5C6B63; --muted-2: #8A988F;
  --ok: #157A3C; --ok-tint: #EDF7EE;
  --warn: #B57D16; --warn-tint: #FBF1D8;
  --crit: #C23B32; --crit-tint: #FBE6E4;
  --chart-fact: #226C82; --chart-ventas: #3B93AD;
  --ring: rgba(21,122,60,.28);
  --shadow-sm: 0 1px 2px rgba(19,32,25,.06);
  --shadow-md: 0 4px 14px rgba(19,32,25,.07), 0 1px 3px rgba(19,32,25,.05);
  --shadow-lg: 0 18px 44px rgba(19,32,25,.13), 0 4px 12px rgba(19,32,25,.07);
  --side-bg: #ffffff; --side-text: #094924; --side-muted: #5B6B62;
}

* { 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: var(--sans);
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
}

/* Números alineados en tablas/datos: legibilidad de producto. */
table, .card-value, .card-number, .stat-value, [class*="tabular"] { font-variant-numeric: tabular-nums; }
/* Utilidad: números/IDs con la monoespaciada (look técnico). */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Gráfico de evolución (Pagos) ---------- */
.chart-wrap { position: relative; width: 100%; margin-top: 10px; }
.chart-svg { display: block; width: 100%; height: 300px; overflow: visible; touch-action: none; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-base { stroke: var(--border-strong); stroke-width: 1; }
.chart-axis-lbl { fill: var(--muted-2); font-size: 11px; font-family: var(--mono); }
.chart-xlbl { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.chart-area-fact { fill: var(--chart-fact); opacity: .12; }
.chart-line-fact { fill: none; stroke: var(--chart-fact); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot-fact { fill: var(--chart-fact); }
.chart-line-ventas { fill: none; stroke: var(--chart-ventas); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot-ventas { fill: var(--chart-ventas); }
.chart-guide { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-leyenda { display: flex; gap: 16px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.chart-leyenda i.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-fact { background: var(--chart-fact); }
.lg-ventas { background: var(--chart-ventas); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; transform: translate(-50%, -100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow-md); padding: 8px 11px; font-size: .76rem; white-space: nowrap; line-height: 1.5;
}
.chart-tip b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart-tip .tip-fecha { font-weight: 700; margin-bottom: 3px; }
.chart-tip .tip-sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ---------- Donut (tortas con %) ---------- */
.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.donut-svg { width: 152px; height: 152px; flex-shrink: 0; }
.donut-track { fill: none; stroke: var(--border); stroke-width: 20; }
.donut-seg { transition: opacity .15s; }
.donut-wrap:hover .donut-seg { opacity: .45; }
.donut-seg:hover { opacity: 1 !important; }
.donut-total { fill: var(--text); font-size: 23px; font-weight: 800; font-family: var(--sans); }
.donut-sub { fill: var(--muted-2); font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.donut-leg { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 190px; }
.donut-leg-row { display: flex; align-items: center; gap: 9px; font-size: .84rem; }
.donut-sw { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.donut-leg-lbl { flex: 1; color: var(--text); min-width: 0; }
.donut-leg-val { color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.donut-leg-val b { color: var(--text); font-weight: 700; }

/* Los campos toman fondo y texto del tema (si no, en oscuro quedarían con el
   blanco nativo del navegador y el texto claro sería ilegible). Las reglas
   específicas con su propio fondo siguen ganando. */
input, textarea, select { background-color: var(--surface); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }

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

h1 { margin: 0 0 20px; font-family: var(--display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-family: var(--display); font-size: 0.95rem; letter-spacing: -0.01em; }

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

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

/* Barra lateral BLANCA (pedido del titular, 19/8): letras en el verde oscuro
   de la marca, con tintes suaves de verde para hover y activo. */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--border);
  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: var(--brand-light); }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-fallback { color: var(--side-text); 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: var(--side-text); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.02em; }
.brand-tagline-sub { color: var(--side-muted); 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: var(--side-text);
  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: var(--brand-light); color: var(--brand-ink); }
.sidebar-nav a.active { background: var(--brand-light); color: var(--brand-ink); font-weight: 700; }

/* Grupos plegables del menu (19/8): el summary se ve como un link mas, los
   subitems van sangrados. La flechita rota al abrir. */
.nav-grupo summary {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--side-text);
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  list-style: none;
}
.nav-grupo summary::-webkit-details-marker { display: none; }
.nav-grupo summary svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-grupo summary:hover { background: var(--brand-light); color: var(--brand-ink); }
.nav-flecha { margin-left: auto; font-size: 1rem; opacity: .5; transition: transform 0.15s; }
.nav-grupo[open] > summary .nav-flecha { transform: rotate(90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px; }
.sidebar-nav .nav-sub a { padding: 7px 12px 7px 40px; font-size: 0.86rem; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  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: var(--brand-contrast);
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  display: block; font-size: 0.82rem; font-weight: 600; color: var(--side-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  display: block; font-size: 0.7rem; color: var(--side-muted);
  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: var(--brand-light); }
.sidebar-user-link.active { background: var(--brand-light); }
.sidebar-user .link-button {
  background: none; border: none; padding: 6px; cursor: pointer;
  color: var(--side-muted); display: flex; border-radius: 6px;
}
.sidebar-user .link-button:hover { color: var(--brand-ink); background: var(--brand-light); }
.sidebar-user .link-button svg { width: 17px; height: 17px; }
/* Toggle de tema: se muestra el icono del tema al que se cambia. */
.theme-toggle .ico-sun { display: block; }
.theme-toggle .ico-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ico-moon { display: block; }

.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 select {
  width: 100%; padding: 10px 12px; margin-top: 6px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; background: var(--surface); color: var(--text);
}
.boton-registro {
  display: block; text-align: center; margin-top: 14px; padding: 11px 16px;
  border: 1.5px solid var(--brand); border-radius: var(--radius-sm);
  color: var(--brand-strong); font-weight: 700; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.boton-registro:hover { background: var(--brand-light); }
.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-strong); box-shadow: 0 0 0 3px var(--brand-light); }
.login-box button { width: 100%; padding: 11px; font-size: 0.95rem; }

/* Ver la contraseña. El boton va DENTRO del campo, asi que se saca de la regla
   de arriba (que estira todos los botones del login al ancho completo). */
.campo-clave { position: relative; display: block; margin-top: 6px; }
.campo-clave input { margin-top: 0; padding-right: 44px; }
.login-box .ver-clave {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 40px; padding: 0; background: none; border: none; box-shadow: none;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 8px 8px 0;
}
.login-box .ver-clave:hover { color: var(--text); background: none; }
/* El foco se marca aunque el boton no tenga fondo propio: se llega con Tab. */
.login-box .ver-clave:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px; color: var(--text);
}

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

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand);
  color: var(--brand-contrast);
  border: 1px solid transparent;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s, border-color 0.15s;
}
button:hover, .button:hover { background: var(--brand-hover); }
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.button.whatsapp { background: #25D366; }
.button.whatsapp:hover { background: #1ea952; }
.button.secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.button.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.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-strong); 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-strong); }

/* ---------- 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-strong);
  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-strong);
  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-strong); 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-strong); 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.05em; font-weight: 700; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
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-strong); }
.contactado-toggle:active { transform: scale(0.9); }
.contactado-toggle.is-contactado {
  background: var(--brand); border-color: var(--brand-strong); 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; }
/* Entrevista de control: verde mas intenso que el "cargado" comun */
tr.fila-estado-control { background: #c4ecd4; }
tr.fila-estado-control td a { color: #0d6b39; }
.card-control .card-number { color: #14884a; }
.card-control.card-selected { border-color: #14884a; }
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-control {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--brand); color: var(--brand-contrast);
  font-weight: 700; font-size: 0.8rem; white-space: nowrap;
}
.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;
}

/* Acciones en UNA linea (el detalle vive en el menu "⋯"); el form de problema,
   al abrirse, baja a su propia linea (flex-basis 100%). */
.carga-acciones { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.carga-problema-form {
  flex-basis: 100%;
  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-strong); }

.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-strong); 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 ---------- */

/* Semaforo de contacto en la card "con problema" (19/8). */
.card-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.01em;
  vertical-align: 4px; white-space: nowrap;
}
.card-pill-ok { background: #d1f2d9; color: #1d7a46; }
.card-pill-atencion { background: #fdeeca; color: #8a6100; }
.card-pill-critico { background: #fadbd8; color: #b3261e; }

/* Registro de contacto en las filas de Carga: mismo widget que Renovaciones
   (logo de WhatsApp + nota opcional + circulo), compacto. */
.contacto-carga .contactado-nota { max-width: 170px; font-size: 0.74rem; padding: 4px 8px; }
.contacto-wa-logo { width: 18px; height: 18px; flex-shrink: 0; color: #25d366; }

.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; }
.stat-row-fill.fill-control { background: #14884a; }

/* --- 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-error-detalle {
  font-family: ui-monospace, Consolas, monospace; font-size: .74rem;
  background: var(--bg); border-radius: 6px; padding: 6px 10px; word-break: break-word;
}
.gcal-modal-hint { font-size: .76rem; line-height: 1.35; }
.planilla-auto-hint { font-size: .82rem; margin: 4px 0 0; }

/* --- Prioridad de carga (módulo Carga) --- */
/* Próximo a cargar: la fila a la que la página scrollea al entrar a Carga */
.fila-proximo td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.badge-proximo {
  display: inline-block; background: var(--brand-light); color: var(--brand-hover);
  font-weight: 700; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
  margin-right: 6px; white-space: nowrap;
}

.badge-prioridad {
  display: inline-block; background: #fdecc8; color: #8a5a00;
  font-weight: 700; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
  margin-right: 6px; white-space: nowrap;
}
.fila-prioridad { background: #fffaf0 !important; }
.fila-prioridad td:first-child { box-shadow: inset 3px 0 0 #e6a817; }
.card-prioridad .card-number { color: #b8860b; }
.card-prioridad.card-selected { border-color: #e6a817; }
.btn-prioridad { white-space: nowrap; }

/* --- Tabla de resultados de una consulta de Cannela a la base --- */
.cannela-tabla-wrap { margin-top: 10px; max-width: 100%; overflow-x: auto; }
.cannela-tabla { width: 100%; border-collapse: collapse; font-size: .78rem; min-width: 0; background: transparent; }
.cannela-tabla th, .cannela-tabla td {
  text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.cannela-tabla th { font-weight: 700; color: var(--muted); }
.cannela-tabla-aviso { font-size: .72rem; color: var(--muted); margin: 6px 0 0; white-space: normal; }
.cannela-tabla-acciones { display: flex; gap: 6px; margin-top: 8px; }

/* --- Acciones compactas del listado de Carga --- */
.btn-icono { padding-left: 9px; padding-right: 9px; line-height: 1.1; }
.menu-acciones {
  position: fixed; z-index: 1200; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 6px;
  display: flex; flex-direction: column;
}
.menu-acciones[hidden] { display: none; }
.menu-acciones button {
  background: none; border: none; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: 7px; font-size: .86rem; color: var(--text);
  white-space: nowrap;
}
.menu-acciones button:hover { background: var(--bg); }

/* --- Medio de contacto (Vencimientos): WhatsApp / Mail --- */
.contacto-medios { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.badge-medio {
  display: inline-block; font-size: .68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; white-space: nowrap; background: #eceff1; color: var(--muted);
}
.badge-medio-wa { background: #d8f3e3; color: #1b7a45; }
.badge-medio-mail { background: #dce8fb; color: #2456a6; }

/* --- Página de carga en REPROCANN (copiar y pegar campo por campo) --- */
.rp-campo { margin-bottom: 14px; }
.rp-campo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rp-campo-nombre { font-weight: 700; font-size: 1rem; }
/* Historia que no pasa el doble chequeo: el error mas grave (un resumen que
   arranca por el tratamiento) se lee como texto normal, asi que el aviso tiene
   que ser imposible de pasar por alto. */
.rp-historia-mala { border: 1px solid #eab5b0; border-left: 4px solid #c0392b; background: #fff5f4; }
.rp-historia-mala-tit { margin: 0 0 6px; font-size: 1.05rem; color: #a3231c; }
.rp-historia-mala-obs { margin: 0 0 8px; font-weight: 600; color: #8a1f11; }
/* Que texto recibe Cannela: plegado, para no gritar en la pagina, pero a un
   click cuando regenerar no alcanza. */
.rp-que-recibe { margin: 10px 0 0; font-size: .84rem; }
.rp-que-recibe summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.rp-que-recibe-texto {
  white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; max-height: 320px;
  overflow: auto; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: .82rem; line-height: 1.45;
}

/* Problema que SI se ve leyendo la pagina (el genero): avisa, no alarma. */
.rp-historia-revisar { border-color: #eccf98; border-left-color: #d99100; background: #fdf3e3; }
.rp-historia-revisar .rp-historia-mala-tit,
.rp-historia-revisar .rp-historia-mala-obs { color: #8a5a00; }

/* Con que cuenta de REPROCANN hay que cargar: si se usa la sesion equivocada,
   el tramite queda a nombre de otro profesional. Va arriba de todo. */
.rp-medico {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
  margin: 0 0 18px; padding: 12px 16px; border-radius: 10px;
  background: #e8f4ec; border: 1px solid #b9ddc8; border-left: 4px solid #2f9e5f;
}
.rp-medico-lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #2b6b47; }
.rp-medico-nombre { font-size: 1.15rem; color: #1d5637; }
.rp-medico-falta { background: #fdf3e3; border-color: #eccf98; border-left-color: #d99100; }
.rp-medico-falta .rp-medico-lbl { color: #8a5a00; }
.rp-medico-falta .rp-medico-nombre { color: #8a5a00; }
.rp-medico-aviso { font-size: .84rem; color: #8a5a00; }
.rp-cambio-medico {
  margin: 10px 0 0; font-size: .86rem; color: #8a5a00;
  background: #fdf3e3; border: 1px solid #eccf98; border-radius: 8px; padding: 8px 12px;
}

.rp-campo-acciones { display: inline-flex; align-items: center; gap: 10px; }
.rp-oblig { color: #c0392b; font-weight: 700; }
/* Medidor de ocupacion del recuadro de REPROCANN: el numero y, debajo, una
   barra que muestra de un vistazo cuanto margen queda antes del limite. */
.rp-medidor { display: inline-flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 82px; }
.rp-contador {
  font-size: .74rem; font-weight: 600; color: var(--muted);
  background: var(--bg); padding: 2px 8px; border-radius: 999px;
  font-variant-numeric: tabular-nums; text-align: center;
}
.rp-barra { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.rp-barra-llena { display: block; height: 100%; background: #2f9e5f; border-radius: 999px; }
/* Cerca del limite: avisa antes de que sea un problema. */
.rp-medidor-justo .rp-barra-llena { background: #d99100; }
.rp-medidor-justo .rp-contador { color: #8a5a00; }
.rp-medidor-excede .rp-barra-llena { background: #c0392b; }
.rp-medidor-excede .rp-contador { background: #fbdad8; color: #a3231c; }
.rp-excede { background: #fbdad8; color: #a3231c; }
/* Los recuadros de la revision previa se pueden corregir antes de enviar: lo
   que se manda es lo que quedo escrito aca. */
.rp-auto-campo.editable { display: block; margin: 10px 0 14px; }
.rp-auto-campo.editable > b { display: block; margin-bottom: 4px; font-size: .85rem; }
.rp-auto-campo.editable textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: .9rem; line-height: 1.45; resize: vertical;
}
.rp-auto-campo.editable textarea:focus {
  outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 3px var(--brand-light);
}
.rp-auto-campo.editable .rp-medidor { margin-top: 5px; }
.rp-auto-editar { font-size: .85rem; margin: 14px 0 2px; }
.rp-auto-menos { color: #8a5a00; }
/* Cada diagnostico con su desarrollo completo, como se presenta en el tramite. */
.rp-auto-dx { margin: 6px 0 10px; padding-left: 12px; border-left: 3px solid var(--border); }
.rp-auto-dx-prio {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: #1d5637; background: #e8f4ec; border-radius: 999px; padding: 2px 8px;
  vertical-align: middle;
}
.rp-auto-dx-texto { margin: 4px 0 0; font-size: .88rem; line-height: 1.5; white-space: pre-wrap; }
.rp-auto-menos-fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rp-ayuda { font-size: .8rem; margin: 4px 0 10px; line-height: 1.4; }
.rp-contenido {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; font-size: .9rem; line-height: 1.5;
}
.rp-vacio, .rp-aviso { font-size: .82rem; margin: 6px 0 0; }
.rp-copiado { background: var(--brand-light) !important; color: var(--brand-hover) !important; }
/* Barras del grafico "No aplicó por mes": tono neutro oscuro (metrica
   negativa), distinto del verde institucional de las demas series. */
.stat-col-fill.stat-col-fill-na { background: #6b7a86; }

.rp-dx { padding: 12px 0; border-top: 1px solid var(--border); }
.rp-dx:first-of-type { border-top: none; }
.rp-dx-nombre { font-weight: 700; font-size: .95rem; }
.rp-dx-prio {
  display: inline-block; background: #fdecc8; color: #8a5a00; font-size: .68rem;
  font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: middle;
}
.rp-dx-des-top { margin-top: 8px; }
.rp-dx-des-lbl { font-size: .76rem; }

/* Estado del tramite arriba de la pagina de carga: sin esto no se veia en
   ningun lado si el paciente ya estaba cargado o marcado con problema. */
.rp-estado {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
  margin: 0 0 18px; padding: 10px 16px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--muted);
}
.rp-estado-lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rp-estado-motivo { font-weight: 700; }
.rp-estado-detalle { font-size: .88rem; }
.rp-estado-cuando { font-size: .8rem; margin-left: auto; }
.rp-estado-verde { background: #e8f4ec; border-color: #b9ddc8; border-left-color: #2f9e5f; }
.rp-estado-amarillo { background: #fdf3e3; border-color: #eccf98; border-left-color: #d99100; }
.rp-estado-rojo { background: #fff5f4; border-color: #eab5b0; border-left-color: #c0392b; }
.rp-estado-vencido { background: #fff5f4; border-color: #eab5b0; border-left-color: #c0392b; }
.rp-estado-lila { background: #f2eefb; border-color: #cdbde8; border-left-color: #6b4fa8; }

/* Marcar el problema desde la misma pagina de carga. */
.rp-problema {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin: 12px 0 0; padding: 12px 14px;
  background: #fdf3e3; border: 1px solid #eccf98; border-radius: 8px;
}
.rp-problema select { min-width: 220px; }
.rp-problema input[type="text"] { flex: 1 1 260px; min-width: 200px; }
.rp-problema-vence { font-size: .84rem; display: inline-flex; gap: 6px; align-items: center; }

.rp-final { text-align: left; }
.rp-final-fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.rp-final-nota { font-size: .82rem; margin: 10px 0 0; }
.rp-final-volver { margin: 12px 0 0; font-size: .84rem; }

.rp-paciente-tit { margin: 0 0 12px; font-size: 1.05rem; }
.rp-paciente-datos {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px; margin: 0; padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.rp-paciente-datos dt { font-size: .74rem; color: var(--muted); }
.rp-paciente-datos dd { margin: 2px 0 0; font-weight: 700; font-size: .95rem; }
.rp-codigo-linea { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.rp-paciente-nota { font-size: .76rem; margin: 10px 0 0; }
.rp-codigo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rp-copiar-fila { display: inline-flex; align-items: center; gap: 10px; }
.rp-codigo-valor { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; }
.rp-antecedentes { list-style: none; padding: 0; margin: 10px 0 0; }
.rp-antecedentes li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rp-antecedentes li:last-child { border-bottom: none; }
.rp-ant-fila { display: flex; align-items: flex-start; gap: 12px; }
.rp-ant-texto { min-width: 0; }
.rp-resp {
  flex-shrink: 0; min-width: 42px; text-align: center; font-weight: 800;
  font-size: .88rem; padding: 4px 10px; border-radius: 8px; margin-top: 1px;
}
.rp-resp-no { background: var(--brand-light); color: var(--brand-hover); }
.rp-resp-si { background: #fbdad8; color: #a3231c; }
.rp-pregunta { display: block; font-weight: 600; font-size: .88rem; }
.rp-pista { display: block; font-size: .82rem; color: var(--muted); margin-top: 3px; }
.rp-manual { margin: 8px 0 0; padding-left: 20px; font-size: .88rem; line-height: 1.7; }
.rp-sincampo { font-size: .78rem; margin-top: 12px; }

/* 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: var(--brand-contrast); border-color: var(--brand-strong); }

.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-strong); 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: var(--brand-contrast); 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-strong); 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: var(--border); color: var(--muted); 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 var(--border-strong); border-radius: 8px;
  padding: 3px 10px 3px 4px; cursor: pointer; font-size: 0.82rem; color: var(--text);
  white-space: nowrap;
}
.pago-resolver-boton:hover { border-color: var(--brand-strong); color: var(--brand-strong); }
.pago-resolver-menu {
  position: fixed; z-index: 60; min-width: 280px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border-strong); 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 var(--border); padding-top: 10px; }
.resolver-titulo { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.resolver-linea { display: flex; gap: 6px; }
.resolver-linea input, .resolver-linea select {
  flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 0.85rem;
}
.resolver-buscar { font-size: 0.8rem; text-decoration: underline; color: var(--muted); }
.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: var(--text);
}
.resolver-opcion:hover { background: var(--surface-2); }
.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: var(--muted-2);
  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-strong); 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 var(--border); 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 var(--border-strong); 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: var(--text); }
.ficha-dl { display: grid; grid-template-columns: 220px 1fr; gap: 4px 16px; margin: 0; }
.ficha-dl dt { font-weight: 600; color: var(--muted); }
.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: var(--surface); 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 var(--border-strong); border-radius: 6px; }
.creditos-form input[type="text"] { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; }
.creditos-lista { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
/* La pastilla del numero de creditos es un boton: abre la ventana de codigos. */
.pastilla-creditos { border: none; font: inherit; cursor: pointer; }
.pastilla-creditos:hover { filter: brightness(0.94); }

/* Ventana de codigos de credito de una ONG. */
.dlg-codigos { border: none; border-radius: 14px; padding: 0; width: min(92vw, 440px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.dlg-codigos::backdrop { background: rgba(15, 32, 24, .45); }
.dlg-codigos-cuerpo { padding: 18px 20px; }
.dlg-codigos-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dlg-codigos-cabecera h3 { margin: 0; font-size: 1rem; }
.dlg-codigos-lista { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0;
  max-height: 260px; overflow-y: auto; }
.codigo-chip {
  background: #eef6f1; border: 1px solid #cfe5d8; border-radius: 6px;
  padding: 3px 9px; font-size: 0.85rem; color: var(--brand-dark, #0d6b39);
  font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace;
  cursor: pointer;
}
.codigo-chip:hover { background: #dff0e6; }
.codigo-chip.codigo-usado {
  background: #f2f3f2; border-color: #e0e3e1; color: #8a978f;
  text-decoration: line-through; cursor: default;
}
.dlg-codigos-acciones { display: flex; gap: 8px; margin-bottom: 8px; }
.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-strong); }
.credito-menos { color: #b3261e; }
.credito-info { color: var(--muted); }
.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, var(--surface), var(--surface-2));
  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-strong); 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: var(--crit); }
/* Variación contra el período anterior: verde sube, rojo baja. */
.cc-var { font-size: .78rem; font-weight: 700; vertical-align: 3px; margin-left: 2px; }
.cc-var-sube { color: var(--ok); }
.cc-var-baja { color: var(--crit); }
.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-strong); }
.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; }
}

/* Indicador de resincronizacion en curso (card de Google Calendar).
   Una resincronizacion completa tarda horas y corre en segundo plano: sin
   esta senal la pantalla no muestra nada y parece que el boton no hizo nada. */
.gcal-corriendo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1d7a4c;
}

.gcal-spin {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid rgba(29, 122, 76, 0.25);
  border-top-color: #1d7a4c;
  border-radius: 50%;
  animation: gcal-spin 0.9s linear infinite;
}

@keyframes gcal-spin {
  to { transform: rotate(360deg); }
}

/* Respeta a quien pidio menos animacion: el punto queda fijo, no parpadea. */
@media (prefers-reduced-motion: reduce) {
  .gcal-spin { animation: none; }
}

/* Anulado (devolucion de dinero): fuera de la carga, sin ser un error.
   Gris apagado y texto atenuado: cerrado administrativamente, no una alarma. */
tr.fila-estado-anulado { background: #ececec; }
tr.fila-estado-anulado td { color: #8a8a8a; }
tr.fila-estado-anulado td a { color: #6f6f6f; }
.card-anulado .card-number { color: #7a7a7a; }
.card-anulado.card-selected { border-color: #7a7a7a; }

/* Filtro fino por motivo dentro de "con problema" (pildoras con conteo). */
.motivo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.motivo-pill {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #d8d8d8);
  background: var(--surface);
  font-size: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.motivo-pill:hover { border-color: #b9b9b9; }

.motivo-pill-activa {
  background: #1f2937;
  border-color: var(--text);
  color: #fff;
}

/* Cabeceras de tabla clickeables (agrupar por medico / estado). */
th a.th-orden { text-decoration: none; color: inherit; }
th a.th-orden:hover { text-decoration: underline; }
th a.th-orden-activo { font-weight: 700; }

/* Novedades del sistema (Inicio): registro de cambios para el equipo.
   Mismo lenguaje visual que "Actividad reciente", con fecha + modulo. */
.novedades {
  background: var(--surface);
  border: 1px solid var(--border, #e3e6e4);
  border-radius: 12px;
  padding: 6px 18px;
  margin-bottom: 26px;
}

.novedad {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f1;
}

.novedad:last-child { border-bottom: none; }

.novedad-meta {
  flex: none;
  width: 150px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}

.novedad-fecha { font-size: 0.8rem; color: var(--muted, #7a857e); }

.novedad-modulo {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #14884a;
  background: #e7f5ec;
  border-radius: 999px;
  padding: 1px 9px;
}

.novedad-nueva {
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: #e0a100;
  border-radius: 999px;
  padding: 1px 8px;
}

.novedad-cuerpo { display: flex; flex-direction: column; gap: 2px; }
.novedad-titulo { font-weight: 700; }
.novedad-detalle { font-size: 0.88rem; color: var(--muted, #6b756f); line-height: 1.45; }

.novedades-mas summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 0.86rem;
  color: var(--muted, #6b756f);
}

@media (max-width: 640px) {
  .novedad { flex-direction: column; gap: 4px; }
  .novedad-meta { flex-direction: row; width: auto; align-items: center; gap: 8px; }
}

/* Pago sin conciliar: tramite en curso sin pago vinculado tras 2 dias habiles.
   Ambar fuerte: es una alarma de plata, tiene que verse. */
.badge-sin-pago {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #7a4d00;
  background: #ffe2ad;
  border: 1px solid #e8b95c;
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}
.card-sin-pago .card-number { color: #b96b00; }
.card-sin-pago.card-selected { border-color: #b96b00; }

/* Historia preparada que no pasa el control: no es una categoria del trabajo
   diario sino un defecto a corregir, por eso rojo y no ambar. */
.badge-historia-mala {
  display: inline-block; margin-left: 6px; font-size: .72rem; font-weight: 800;
  color: #a3231c; background: #fbdad8; border-radius: 999px; padding: 2px 8px;
}
/* Carga automatica (fase de prueba): de a un paciente y en dos pasos. */
.rp-auto { border-left: 4px solid #2f9e5f; }
.rp-auto-tit { margin: 0 0 4px; font-size: 1.05rem; }
.rp-auto-prueba {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: #8a5a00; background: #fdf3e3; border-radius: 999px; padding: 2px 8px; vertical-align: middle;
}
.rp-auto-fila { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 0; }
.rp-auto-sesion {
  margin: 12px 0 0; padding: 10px 14px; font-size: .9rem;
  background: #e8f4ec; border: 1px solid #b9ddc8; border-radius: 8px; color: #1d5637;
}
/* De quien es la sesion: el tramite se presenta a nombre de quien la tiene
   abierta, asi que ese nombre se destaca tanto como el del medico asignado. */
.rp-auto-quien { text-decoration: underline; text-underline-offset: 3px; }
/* Avisarle al paciente al terminar la carga: el número a la vista para
   copiarlo, y el acceso directo a su conversación. */
.rp-aviso-paciente {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin: 0 0 16px; padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.rp-aviso-lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.rp-aviso-tel {
  font-size: 1.05rem; font-weight: 700; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; user-select: all;
}
.rp-aviso-nota { font-size: .85rem; }

/* Control contra el extracto (cierre de mes). */
.extracto-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.extracto-form label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem;
  font-weight: 600; color: var(--muted); }
.extracto-form input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.extracto-archivos { flex: 1; min-width: 260px; }
.extracto-kpis { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 20px; }
.extracto-kpis .stat-card { border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 18px; background: var(--surface); min-width: 150px; }
.extracto-kpis .stat-card b { display: block; font-size: 1.4rem; }
.extracto-kpis .stat-card span { font-size: .78rem; color: var(--muted); }
.extracto-kpis .stat-ok b { color: #1d5637; }
.extracto-kpis .stat-mal { border-color: #e8a19a; background: #fdf2f1; }
.extracto-kpis .stat-mal b { color: #a3231c; }
.extracto-tit-mal { color: #a3231c; }

/* Carga manual de pagos en Comprobantes: la valvula de escape cuando la
   lectura automatica no sirve. */
.carga-manual { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.carga-manual summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--muted); }
.carga-manual[open] summary { color: var(--text); margin-bottom: 10px; }
.carga-manual-campos {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px; margin: 10px 0;
}
.carga-manual-campos label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .78rem; font-weight: 600; color: var(--muted);
}
.carga-manual-campos input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.carga-manual-archivo input { padding: 5px; }
.carga-manual-fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 8px 0 0; }

/* ---------- Activar el token de REPROCANN ---------- */

.activar-aviso {
  margin: 0 0 14px; padding: 12px 16px; border-radius: 8px; font-size: .92rem;
  background: #fdf3e3; border: 1px solid #e8c98a; color: #8a5a00;
}
.activar-estado {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; font-size: .9rem;
  background: #e8f4ec; border: 1px solid #b9ddc8; color: #1d5637;
}
.activar-pasos { margin: 0; padding-left: 22px; }
.activar-pasos > li { margin-bottom: 16px; line-height: 1.55; }
.activar-marcador-fila {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px;
}
.activar-nota { margin: 6px 0 0; font-size: .82rem; }
.activar-manual { margin-top: 6px; }
.activar-manual summary { cursor: pointer; font-size: .88rem; color: var(--muted); }
.activar-manual p { margin: 10px 0 0; font-size: .86rem; }
.activar-fila { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.activar-fila input { flex: 1; min-width: 240px; }
.activar-acceso {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed #d5e0d9;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.activar-panel { max-width: 720px; }

/* La ventana emergente reusa el bloque de arriba tal cual. */
.activar-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 32, 24, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.activar-overlay[hidden] { display: none; }
.activar-ventana {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column;
}
.activar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.activar-cuerpo { padding: 18px; overflow-y: auto; }

.verificar-catalogo {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed #d5e0d9;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.rp-auto-sinquien { margin: 6px 0 0; font-size: .85rem; }
.rp-auto-aviso {
  margin: 0 0 10px; padding: 10px 14px; font-size: .9rem; font-weight: 600;
  background: #fdf3e3; border: 1px solid #e8c98a; border-radius: 8px; color: #8a5a00;
}
/* El marcador se ARRASTRA a favoritos, no se hace clic: se ve como una pastilla
   agarrable y no como un boton de la pagina. */
.rp-auto-marcador {
  display: inline-block; padding: 8px 14px; border-radius: 8px; cursor: grab;
  background: #1d5637; color: #fff; font-weight: 700; font-size: .88rem;
  text-decoration: none; border: 2px dashed #7fbf9b;
}
.rp-auto-ayuda { font-size: .82rem; }
.rp-auto-fila input { flex: 1 1 320px; min-width: 220px; }
.rp-auto-resumen {
  margin: 12px 0 0; padding: 12px 14px; font-size: .86rem; line-height: 1.5;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.rp-auto-campo { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.rp-auto-campo b { flex: 0 0 200px; font-size: .78rem; color: var(--muted); }

.aviso-historias {
  margin: 0 0 14px; padding: 10px 14px; font-size: .86rem; line-height: 1.5;
  background: var(--bg); border: 1px solid var(--border);
  border-left: 4px solid #d99100; border-radius: 8px;
}

/* Historia que quedo vieja porque el paciente saco un turno nuevo: se sigue
   mostrando (es informacion clinica real) pero avisando que esta archivada. */
/* El legajo dice un medico y la historia la escribio otro: el tramite iria a
   nombre de quien no atendio. Rojo, como el resto de los defectos a corregir. */
.aviso-medico-distinto {
  margin: 0 0 12px; padding: 10px 14px; font-size: .86rem; line-height: 1.5;
  background: #fbdad8; border: 1px solid #f3cfcc;
  border-left: 4px solid #a3231c; border-radius: 8px; color: #8f231d;
}

.aviso-historia-vieja {
  margin: 0 0 12px; padding: 10px 14px; font-size: .86rem; line-height: 1.5;
  background: #fdf3e3; border: 1px solid #eccf98;
  border-left: 4px solid #d99100; border-radius: 8px; color: #7d4a00;
}
.card-historia-mala .card-number { color: #a3231c; }
.card-historia-mala.card-selected { border-color: #a3231c; }

/* Modulo de Comprobantes: revision de pagos leidos por IA. */
.comprobante { margin-bottom: 14px; }
.comprobante-cols { display: flex; gap: 18px; align-items: flex-start; }
.comprobante-preview {
  flex: none;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  font-size: 0.78rem;
  word-break: break-all;
}
.comprobante-preview img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border, #e3e6e4);
}
.comprobante-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  border: 1px solid var(--border, #e3e6e4);
  border-radius: 8px;
  font-size: 1.1rem;
  background: var(--surface);
}
.comprobante-datos { flex: 1; }
.comprobante-campos { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.comprobante-campos label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted, #6b756f); gap: 2px; }
.comprobante-acciones { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .comprobante-cols { flex-direction: column; }
  .comprobante-preview { width: 100%; }
}

/* Tabla de revision de comprobantes (espejo de la planilla que reemplaza). */
.tabla-comprobantes input { padding: 4px 6px; font-size: 0.85rem; }
.fila-comprobante-error { background: #fff3f0; }
.celda-archivo { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
/* X para eliminar una lectura mal leida, en la primera columna (la tabla
   scrollea a lo ancho y las acciones del final pueden quedar fuera de vista). */
.boton-eliminar-lectura {
  border: 1px solid transparent; background: none; color: #c0392b; cursor: pointer;
  font-size: .95rem; line-height: 1; padding: 3px 6px; border-radius: 6px;
}
.boton-eliminar-lectura:hover { background: #fbdad8; border-color: #eab5b0; }
.comprobante-acciones-celda { white-space: nowrap; }
.badge-turno {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.badge-turno-si { color: #0d6b39; background: #dff3e7; }
.badge-turno-no { color: #8a1f11; background: #fde3de; }

/* Verificacion previa de una tanda contra REPROCANN. */
.verificar-tanda {
  margin: 0 0 16px; padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.verificar-ayuda { display: block; margin-top: 6px; font-size: .82rem; line-height: 1.45; }
.verificar-resultado { margin-top: 10px; font-size: .86rem; line-height: 1.5; }
.verificar-resultado ul { margin: 4px 0 10px; padding-left: 20px; }
.verificar-resultado li { margin-bottom: 4px; }
.verificar-resultado code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* Seguimientos: contacto con el paciente entre consultas. */
.seg-cab { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.seg-cuando { margin-left: auto; font-size: .8rem; }
.seg-mensaje {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; font-size: .88rem; line-height: 1.5; margin: 0 0 10px;
}
.seg-resumen { margin: 0 0 8px; font-size: .95rem; line-height: 1.5; }
.seg-textual { font-size: .84rem; margin-bottom: 10px; }
.seg-textual summary { cursor: pointer; color: var(--muted); }
.seg-textual pre { white-space: pre-wrap; margin: 6px 0 0; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: .84rem; }
.seg-respuesta textarea { width: 100%; }
.seg-respuesta-acciones { display: flex; gap: 8px; margin-top: 8px; }
.badge-clasif { font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.badge-bien { color: #1d5637; background: #dff3e7; }
.badge-revisar { color: #8a5a00; background: #fdf3e3; }
.badge-urgente { color: #a3231c; background: #fbdad8; }
.seg-alerta { border-left: 4px solid #d99100; }
.seg-urgente { border-left-color: #c0392b; }
.badge-ong { font-size: .72rem; color: #2b6b47; background: #e8f4ec; border-radius: 999px; padding: 2px 8px; }

/* Configuracion del seguimiento en el legajo y en las ONGs. */
.seg-config { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg-config select { min-width: 150px; }

/* Panel de seguimientos por ONG: elegir que socios y cada cuanto. */
.seg-panel {
  margin-top: 8px; padding: 12px 14px; min-width: 460px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.seg-panel-barra { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg-panel-ayuda { font-size: .8rem; margin: 8px 0; line-height: 1.45; }
.seg-panel-lista { max-height: 320px; overflow: auto; }
.seg-fila {
  display: flex; gap: 10px; align-items: baseline; padding: 6px 0;
  border-top: 1px solid var(--border); font-size: .86rem; cursor: pointer;
}
.seg-nombre { font-weight: 600; min-width: 160px; }
.seg-medico { font-size: .78rem; min-width: 150px; }
.seg-on { color: #1d5637; font-weight: 600; }
.seg-baja { color: #a3231c; font-size: .78rem; }
.seg-sin-dm { display: inline-block; min-width: 90px; }
.seg-ongs-tit { margin-top: 0; }

/* Ventana de configuracion del seguimiento. Se abre sobre el legajo para no
   perder de vista la historia del paciente, que es con lo que se decide. */
.modal-fondo {
  position: fixed; inset: 0; z-index: 1000; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 35, 28, .45); backdrop-filter: blur(2px);
}
.modal-caja {
  background: var(--surface); border-radius: 16px; padding: 26px 28px; width: 100%;
  max-width: 520px; max-height: 90vh; overflow: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  animation: modal-entra .16s ease-out;
}
@keyframes modal-entra { from { opacity: 0; transform: translateY(10px); } }
.modal-tit { margin: 0 0 6px; font-size: 1.15rem; }

/* Tags de estado en la fila de ONGs (1/9). */
.ong-tags { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.ong-tag {
  display: inline-block; font-size: .66rem; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap; letter-spacing: .02em;
}
.ong-tag-seg { background: var(--ok-tint); color: var(--ok); }
.ong-tag-boton { background: var(--brand-light); color: var(--brand-hover); }

/* La ventana de seguimientos de la ONG (antes era un panel inline). */
.seg-modal { max-width: 720px; }
.seg-modal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.seg-modal .seg-panel-lista { max-height: 55vh; overflow-y: auto; }
.modal-bajada { margin: 0 0 18px; font-size: .88rem; line-height: 1.5; }
.modal-campo { display: block; margin-bottom: 16px; }
.modal-campo > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.modal-campo select, .modal-campo textarea { width: 100%; }
.modal-campo small { display: block; margin-top: 6px; font-size: .8rem; line-height: 1.4; }
.modal-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.modal-nota { margin: 12px 0 0; font-size: .8rem; line-height: 1.45; }

.seg-consulta-actual { font-size: .86rem; margin: 4px 0 10px; }
.seg-apagar-form { display: inline-block; }
.seg-historial { margin-top: 14px; border-top: 1px solid var(--border); }
.seg-historial-item {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .86rem;
}
.seg-historial-texto { flex: 1 1 100%; line-height: 1.5; }

/* Editor grafico de horarios de agenda (28/8). */
.dlg-horarios { border: none; border-radius: 16px; padding: 0; max-width: 640px; width: 94%;
  box-shadow: 0 24px 60px rgba(0,0,0,.28); background: var(--surface); color: var(--text); }
.dlg-horarios::backdrop { background: rgba(20,30,25,.45); }
.dlg-horarios-cuerpo { padding: 20px 22px 22px; max-height: 88vh; overflow-y: auto; }
.hz-dia { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0;
  border-top: 1px solid var(--border, #e3e6e4); }
.hz-dia-cab { display: flex; align-items: center; gap: 6px; flex: 0 0 130px; }
.hz-franjas { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
/* Fondos por token (1/9, reporte de Daniel): con el claro hardcodeado, en modo
   oscuro las excepciones agregadas quedaban texto claro sobre fondo claro. */
.hz-franja { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
  color: var(--text); border-radius: 8px; padding: 3px 6px; font-size: .85rem; }
.hz-franja input[type=time] { border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 4px; }
.hz-exc-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
  color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; margin: 0 6px 6px 0; font-size: .85rem; }
.hz-preview { margin-top: 6px; }
.hz-cal { display: flex; flex-direction: column; gap: 4px; }
.hz-cal-sem { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hz-cal-dia { aspect-ratio: 1 / 1; border-radius: 7px; display: flex; align-items: flex-start;
  justify-content: flex-end; padding: 3px 5px; font-size: .72rem; color: #33413a; }
.hz-cal-num { opacity: .75; }
.hz-abre { background: #cdeedd; }
.hz-cerrado-semana { background: #ececec; color: #a9b1ac; }
.hz-exc-cerrado { background: #f6d6d3; color: #7a1f18; }
.hz-exc-especial { background: #f7e4c2; color: #7a5410; }
.hz-pasado { opacity: .4; }

/* ============================================================
   MODO OSCURO — colores de estado (aditivo: no toca el claro).
   Variantes oscuras de los tintes de estado hardcodeados. Se
   repite para el toggle explícito y para el sistema. Un macro
   selector-list no puede mezclar [data-theme] y @media, por eso
   van los dos bloques.
   ============================================================ */
:root:not([data-theme="light"]) .estado-badge.estado-atencion { background: #2c2413; color: var(--warn); }
:root:not([data-theme="light"]) .estado-badge.estado-critico { background: #2c1917; color: var(--crit); }
:root:not([data-theme="light"]) .card-estado-atencion { border-color: #5a4a1e; }
:root:not([data-theme="light"]) .card-estado-critico { border-color: #5e2a26; }
:root:not([data-theme="light"]) .card-pill-ok { background: rgba(58,170,53,.14); color: #7FE87A; }
:root:not([data-theme="light"]) .card-pill-atencion { background: #2c2413; color: var(--warn); }
:root:not([data-theme="light"]) .card-pill-critico { background: #2c1917; color: var(--crit); }
:root:not([data-theme="light"]) tr.fila-estado-amarillo { background: #241f10; }
:root:not([data-theme="light"]) tr.fila-estado-amarillo:hover { background: #2c2614; }
:root:not([data-theme="light"]) tr.fila-estado-rojo { background: #241413; }
:root:not([data-theme="light"]) tr.fila-estado-rojo:hover { background: #2c1917; }
:root:not([data-theme="light"]) tr.fila-estado-lila { background: #1e1a2b; }
:root:not([data-theme="light"]) tr.fila-estado-lila:hover { background: #262036; }
:root:not([data-theme="light"]) tr.fila-estado-listo { background: #241a12; }
:root:not([data-theme="light"]) tr.fila-estado-listo:hover { background: #2c1f16; }
:root:not([data-theme="light"]) tr.fila-estado-espera { background: #171e22; }
:root:not([data-theme="light"]) tr.fila-estado-vencido { background: #2c1917; }
:root:not([data-theme="light"]) tr.fila-estado-control { background: #16281e; }
:root:not([data-theme="light"]) tr.fila-estado-control td a { color: #7FE87A; }
:root:not([data-theme="light"]) tr.fila-estado-gris_oscuro { background: #1c242a; }
:root:not([data-theme="light"]) tr.fila-estado-gris_oscuro td { color: #9aa8b0; }
:root:not([data-theme="light"]) tr.fila-estado-anulado { background: #1a1a1a; }
:root:not([data-theme="light"]) tr.fila-estado-anulado td { color: #8a8a8a; }
:root:not([data-theme="light"]) .card-alerta .card-number { color: var(--crit); }
:root:not([data-theme="light"]) .error, :root:not([data-theme="light"]) .calendario-status .error { color: var(--crit); }


/* Filas con fondo pálido hardcodeado (evitan texto de token ilegible en oscuro). */
:root:not([data-theme="light"]) .fila-prioridad { background: #241f10 !important; }
:root:not([data-theme="light"]) .fila-comprobante-error { background: #241413; }
