/*
 * VIGÍA CONCURSAL: sistema de diseño.
 *
 * Criterios: un portal de datos para áreas de riesgo (SGR, bancos, financieras). Fondo blanco, filetes finos en lugar de sombras,
 * un solo color de acento (azul oscuro) para lo que se puede accionar y colores de estado solo donde informan (quiebra, concurso,
 * vencimiento, correcto). Texto de 14 px, números tabulares y nada decorativo: lo que importa es el dato.
 * Lo único de afuera son las tipografías de Google Fonts (Plus Jakarta Sans, Lora y Roboto), enlazadas en el HTML y admitidas
 * por la política de contenido del servidor; si no cargan, se usan las del sistema.
 *
 * Orden: 1 tokens · 2 base · 3 armazón · 4 componentes · 5 alertas · 6 cartera y consulta · 7 cobertura · 8 ingreso · 9 adaptación.
 */

/* ============================== 1. Tokens (Sistema Mercury) ============================== */
:root {
  color-scheme: light;

  /* Paleta Mercury oficial */
  --bg: #FFFFFF;
  --bg-sidebar: #FAFCFE;
  --bg-muted: #EFF1F3;
  --bg-selected: #EDEFF3;
  --border: #F0F0F0;
  --border-chrome: #EDEEF0;
  --border-control: #E0E1E3;
  --border-raised: #E6E6E9;
  --text-1: #18181F;
  --text-2: #303036;
  --text-nav: #4D4E53;
  --text-3: #6B6C71;
  --accent: #5367EB;
  --accent-ink: #4E5DB7;
  --chart-line: #5D69BB;
  --up: #1F7E5B;
  --down: #C63B74;
  --avatar-bg: #CFEAEC;
  --avatar-fg: #153A44;
  --org-bg: #D3E3EE;
  --org-fg: #2B313F;

  /* Mapeo de variables existentes hacia el lenguaje visual Mercury */
  --c-ink: #18181F;
  --c-text: #303036;
  --c-text-2: #4D4E53;
  --c-text-3: #6B6C71;
  --c-bg: #FFFFFF;
  --c-surface: #FFFFFF;
  --c-surface-2: #FAFCFE;
  --c-surface-3: #EFF1F3;
  --c-line: #F0F0F0;
  --c-line-strong: #E0E1E3;

  /* Un solo acento índigo Mercury */
  --c-brand: #5367EB;
  --c-brand-hover: #4658D4;
  --c-brand-soft: #EEF0FD;
  --c-brand-text: #4E5DB7;
  --c-on-brand: #FFFFFF;
  --c-accent: #5367EB;

  --c-ok: #1F7E5B;   --c-ok-bg: #EFF8F4;   --c-ok-line: #C6E7DA;
  --c-warn: #6B6C71; --c-warn-bg: #EFF1F3; --c-warn-line: #E0E1E3;
  --c-bad: #C63B74;  --c-bad-bg: #FDF2F6;  --c-bad-line: #F4CFE0;
  --c-info: #4E5DB7; --c-info-bg: #EEF0FD; --c-info-line: #D4DAFA;

  /* Tipografía (Plus Jakarta Sans / Roboto / Lora) — peso único 400 */
  --font: "Plus Jakarta Sans", "Roboto", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --font-sans: "Plus Jakarta Sans", "Roboto", sans-serif;
  --font-serif: "Lora", Georgia, serif;
  --font-mono: "Roboto", monospace;

  --fs-hero: 32px;    --lh-hero: 40px;
  --fs-title: 28px;   --lh-title: 36px;
  --fs-section: 20px; --lh-section: 28px;
  --fs-banner: 17px;  --lh-banner: 24px;
  --fs-base: 15px;    --lh-base: 22px;
  --fs-sm: 13px;      --lh-sm: 18px;
  --fs-xs: 12px;      --lh-xs: 16px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 28px;

  /* Escala de espacio Mercury (base 4) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 40px;

  /* Formas y sombras */
  --r-card: 2px; --r-control: 2px; --r-segmented: 2px;
  --r-fab: 2px; --r-pill: 2px;
  --r-1: 2px; --r-2: 2px; --r-3: 2px; --r-4: 2px;
  --r-outer: 2px;
  --r-inner: 2px;

  --shadow-raised: 0 1px 6px rgb(16 24 40 / .07);
  --shadow-segment: 0 1px 2px rgb(16 24 40 / .08);
  --shadow-float: 0 4px 16px rgb(24 24 31 / .10);
  --shadow-pop: 0 4px 16px rgb(24 24 31 / .10);
  --shadow-modal: 0 12px 36px rgb(24 24 31 / .14);

  /* Layout Mercury */
  --sidebar-w: 220px;
  --topbar-h: 48px;
  --content-w: 1380px;
  --gutter: 24px;
  --control-h: 32px;
  --row-h: 44px;
  --ring: 0 0 0 2px rgb(83 103 235 / .18);
}

/* ============================== 2. Base (Cero negritas) ============================== */
*, *::before, *::after { box-sizing: border-box; font-weight: 400 !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, dl, dd, ul, ol, figure, strong, b, th { margin: 0; font-weight: 400; }
strong, b { color: var(--text-1); }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; font-weight: 400; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: #E3E7FC; color: var(--text-1); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

.num, .monto { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; color: var(--text-1); }
.monto .cent { font-size: .65em; line-height: 1; vertical-align: .39em; margin-left: 3px; color: var(--text-3); }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-3); top: -48px; z-index: 100; padding: var(--s-2) var(--s-4);
  background: var(--accent); color: #FFFFFF; border-radius: 2px; text-decoration: none;
}
.skip-link:focus { top: var(--s-3); }
.icon {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em;
}
.not-stated { color: var(--text-3); }

/* ============================== 3. Armazón Mercury ============================== */
.app-layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }

/* Sidebar fija 220px (#FAFCFE + borde 1px #EDEEF0) */
.app-sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); display: flex; flex-direction: column;
  padding: 14px 10px 12px; background: var(--bg-sidebar); border-right: 1px solid var(--border-chrome); color: var(--text-nav);
}
.sidebar-header {
  padding: 4px 8px 16px;
  display: flex;
  align-items: center;
}
.brand {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0; text-decoration: none; color: var(--text-1);
}
.brand:hover { color: var(--text-1); }
.brand-name {
  font-size: 16px; line-height: 22px; color: var(--text-1); letter-spacing: -0.015em;
}

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 12px; display: flex; flex-direction: column; }
.nav-group { display: grid; gap: 6px; padding: 0 2px; }
.nav-group + .nav-group {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-chrome);
}
.nav-label {
  padding: 0 8px 4px; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3);
}
.nav-link {
  display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px; border-radius: 2px;
  color: var(--text-nav); text-decoration: none; font-size: var(--fs-base); line-height: var(--lh-base);
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { background: var(--bg-selected); color: var(--text-1); }
.nav-link[aria-current="page"] { background: var(--bg-selected); color: var(--text-1); }
.nav-link[aria-current="page"] .nav-ico { stroke: var(--text-1); }
.nav-link:focus-visible { outline-offset: -2px; }
.nav-link .count, .nav-link .count-warn {
  flex: none; padding: 0 4px; background: transparent; color: var(--text-3);
  font-size: var(--fs-xs); line-height: var(--lh-xs); text-align: right; font-variant-numeric: tabular-nums;
}
.nav-link .count.is-alert { color: var(--text-1); }

.main-content-wrapper { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

/* La barra superior solo aparece en pantallas angostas para abrir el cajón */
.topbar { display: none; }
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.sidebar-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  background: var(--bg-muted); border: 0; border-radius: 2px; color: var(--text-2);
}
.topbar-context { font-size: var(--fs-base); color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Columna de contenido Mercury: fluida hasta 1440px */
.main-content {
  width: 100%; max-width: 1440px; margin: 0 auto;
  padding: 32px 32px 80px;
}
.main-content:focus { outline: none; }
.panel { display: none; }
.panel.active { display: block; }
.bands:empty { display: none; }
.bands { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); }

/* Menú de usuario al pie de la sidebar */
.user-menu { position: relative; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-chrome); }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 4px 8px; background: transparent;
  border: 0; border-radius: 2px; text-align: left; cursor: pointer; transition: background 0.12s ease;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--bg-selected); }
.user-avatar {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--avatar-bg); color: var(--avatar-fg); font-size: 11px;
}
.user-id { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.user-name { font-size: var(--fs-sm); color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { color: var(--text-3); width: 14px; height: 14px; }
.user-btn[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
.user-panel {
  position: absolute; left: 0; right: 0; width: 100%; bottom: calc(100% + 8px); z-index: 100;
  background: var(--bg); border: 1px solid var(--border-raised); border-radius: 2px;
  box-shadow: var(--shadow-float); padding: 6px;
}
.user-panel-head {
  padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.user-panel-name { font-size: 13px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-email { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-org { font-size: 12px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-org:empty { display: none; }
.role-tag {
  align-self: flex-start; margin-top: 5px; padding: 2px 8px; background: var(--bg-muted); border-radius: 2px;
  font-size: 11px; color: var(--text-2);
}
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; background: none; border: 0;
  border-radius: 2px; text-align: left; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.menu-item:hover { background: var(--bg-muted); color: var(--text-1); }
.menu-item.menu-item-danger:hover { background: var(--c-bad-bg); color: var(--down); }
.menu-item-icon {
  width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; color: var(--text-3);
}

/* Encabezado de pantalla (28px, peso 400) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head-text { min-width: 0; max-width: 960px; }
.page-title { font-size: var(--fs-title); line-height: var(--lh-title); color: var(--text-1); letter-spacing: -0.015em; }
.page-lead { margin-top: 6px; color: var(--text-3); font-size: var(--fs-base); line-height: var(--lh-base); }
.page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back-link { display: inline-block; margin-bottom: var(--s-2); font-size: var(--fs-sm); }

.section { margin-top: var(--s-10); }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); flex-wrap: wrap; }
.section-title { font-size: var(--fs-section); line-height: var(--lh-section); color: var(--text-1); letter-spacing: -0.01em; }
.section-lead { margin: -4px 0 var(--s-3); color: var(--text-3); max-width: 720px; }

.stack { display: grid; gap: var(--s-4); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }

/* ============================== 3B. Dashboard Estilo Mercury ============================== */

/* Título de página Dashboard */
.m-page-title {
  font-size: var(--fs-title); line-height: var(--lh-title); color: var(--text-1);
  letter-spacing: -0.015em; margin-bottom: 24px;
}

/* Fila de acciones (Pills de 32px) */
.m-actions-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 24px;
}
.m-actions-left {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.m-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px;
  padding: 0 16px 0 12px; border: 0; border-radius: 2px;
  font-size: var(--fs-base); line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.m-pill-primary {
  background: var(--accent); color: #FFFFFF;
}
.m-pill-primary:hover { background: var(--c-brand-hover); color: #FFFFFF; }
.m-pill-secondary {
  background: var(--bg-muted); color: var(--text-2);
}
.m-pill-secondary:hover { background: var(--bg-selected); color: var(--text-1); }
.m-pill-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: 2px; background: transparent; color: var(--text-2);
  font-size: var(--fs-base);
}
.m-pill-ghost:hover { background: var(--bg-muted); color: var(--text-1); }

/* Grilla Mercury de 2 columnas (472px c/u, gutter 24px) */
.m-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter);
}

/* Card base Mercury: blanco, borde 1px #F0F0F0, radio 12, padding 24, sin sombra */
.m-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}
.m-card-chart, .m-card-list { min-height: 340px; }
.m-card-kpi { min-height: 232px; }

.m-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px;
}
.m-card-title-wrap {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.m-card-actions {
  display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: nowrap;
}
.m-card-title {
  font-size: var(--fs-base); line-height: var(--lh-base); color: var(--text-2); white-space: nowrap;
}
.m-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 2px; background: var(--bg-muted); color: var(--text-2);
  font-size: var(--fs-xs); line-height: 1; font-variant-numeric: tabular-nums;
}
.m-circle-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: var(--bg-muted); color: var(--text-2);
  transition: background 0.12s ease;
}
.m-circle-btn:hover { background: var(--bg-selected); color: var(--text-1); }

/* Toggle gráfico/tabla (84 x 40, borde #E0E1E3, r8) */
.m-view-toggle {
  display: inline-grid; grid-template-columns: 1fr 1fr; width: 76px; height: 34px;
  border: 1px solid var(--border-control); border-radius: 2px; overflow: hidden;
  background: var(--bg-sidebar);
}
.m-toggle-btn {
  display: grid; place-items: center; padding: 0; border: 0; background: var(--bg-sidebar);
  color: var(--text-3);
}
.m-toggle-btn + .m-toggle-btn { border-left: 1px solid var(--border-control); }
.m-toggle-btn.is-active { background: var(--bg); color: var(--accent); }

/* Monto héroe (32/40, text-1) */
.m-hero-val {
  margin-top: 4px; font-size: var(--fs-hero); line-height: var(--lh-hero);
  color: var(--text-1); letter-spacing: -0.02em;
}

/* Barra de período y flechas de tendencia */
.m-period-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 8px;
}
.m-period-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 0;
  border: 0; background: transparent; color: var(--text-2); font-size: var(--fs-base);
}
.m-period-btn:hover { color: var(--text-1); }
.m-trends { display: flex; align-items: center; gap: 12px; }
.m-trend { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-base); color: var(--text-2); }
.m-trend-ico { width: 12px; height: 12px; flex: none; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.m-trend-ico.is-up { stroke: var(--up); }
.m-trend-ico.is-down { stroke: var(--down); }

/* Gráfico de área a sangre */
.m-chart-bleed, .vista {
  position: relative;
  margin: 16px -24px -12px -24px; display: flex; flex-direction: column; flex: 1; justify-content: flex-end;
  min-height: 192px;
}
.v-grafico {
  position: relative;
  width: 100%;
  height: 100%;
}
.m-area-svg, .plot {
  width: 100%; height: 170px; display: block; overflow: visible; touch-action: pan-y;
}
.m-chart-xaxis, .eje {
  position: relative; height: 22px; width: 100%; overflow: hidden;
}
.m-chart-xaxis span, .eje span {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); white-space: nowrap;
}
.m-chart-table-wrap, .v-tabla {
  position: relative; width: 100%; height: 192px; padding: 4px 24px 0;
  box-sizing: border-box; overflow-y: auto; flex: 1;
}
.m-table-view, .v-tabla table {
  width: 100%; border-collapse: collapse;
  font-size: var(--fs-sm, 13px); line-height: var(--lh-sm, 18px); font-variant-numeric: tabular-nums;
}
.m-table-view th, .v-tabla th {
  height: 24px; font-weight: 500; font-size: var(--fs-xs, 12px); line-height: var(--lh-xs, 16px);
  color: var(--text-3, #6B6C71); text-align: right; vertical-align: middle;
  border-bottom: 1px solid var(--border-control, #E0E1E3); padding: 4px 6px;
}
.m-table-view td, .v-tabla td {
  height: var(--fila, 26px); text-align: right; color: var(--text-1, #18181F);
  white-space: nowrap; padding: 4px 6px; border-bottom: 1px solid var(--border, #F0F0F0);
}
.m-table-view th:first-child, .m-table-view td:first-child,
.v-tabla th:first-child, .v-tabla td:first-child {
  text-align: left; padding-left: 0; color: var(--text-2, #303036);
}
.m-table-view th:last-child, .m-table-view td:last-child,
.v-tabla th:last-child, .v-tabla td:last-child {
  padding-right: 0;
}

/* Card de lista: filas de 44px sin divisores */
.m-list-rows { margin-top: 12px; display: flex; flex-direction: column; }
.m-row {
  display: flex; align-items: center; gap: 12px; width: 100%; height: var(--row-h);
  border: 0; background: transparent; text-align: left;
  text-decoration: none; color: var(--text-2); border-radius: 2px; padding: 0 6px;
  transition: background 0.12s ease;
}
.m-row:hover { background: var(--bg-sidebar); color: var(--text-1); }
.m-row-logo {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--bg-muted); color: var(--text-2);
  font-size: 11px; line-height: 1;
}
.m-row-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-base); color: var(--text-2);
}
.m-row-sub { color: var(--text-3); margin-left: 6px; font-size: var(--fs-sm); }
.m-row-val {
  flex: none; font-size: var(--fs-base); color: var(--text-1); font-variant-numeric: tabular-nums;
}
.m-row-val.is-urgent { color: var(--down); }
.m-empty-mini {
  padding: 28px 12px; text-align: center; color: var(--text-3); font-size: var(--fs-sm);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* Card de resumen KPIs */
.m-kpi-grid {
  margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
}
.m-kpi-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-kpi-label { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.m-kpi-val { font-size: var(--fs-base); line-height: var(--lh-base); color: var(--text-1); }
.m-card-divider {
  height: 1px; background: var(--border); margin: 16px 0 24px;
}
.m-card-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.m-foot-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-base);
  color: var(--accent-ink); text-decoration: none; white-space: nowrap;
}
.m-link:hover { color: var(--accent); }

/* Bloques de sección (distancia 40px) */
.m-section-block { margin-top: 40px; }
.m-section-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px;
}
.m-section-title { font-size: var(--fs-section); line-height: var(--lh-section); color: var(--text-1); letter-spacing: -0.01em; }
.m-period-nav-label { font-size: var(--fs-base); color: var(--text-2); }

/* Pestañas de etapa procesal (Art. 32, 35, 36, 39) */
.m-stage-tabs {
  display: inline-flex; align-items: center; gap: 2px; background: var(--bg-sidebar);
  padding: 2px; border-radius: 2px; border: 1px solid var(--border-control);
}
.m-stage-tab {
  border: 0; background: transparent; padding: 3px 6px; border-radius: 2px;
  font-size: var(--fs-xs); color: var(--text-2); cursor: pointer; transition: all 0.12s ease;
  line-height: 1.2; white-space: nowrap;
}
.m-stage-tab:hover { color: var(--text-1); }
.m-stage-tab.is-active, .m-stage-tab.activo {
  background: var(--bg); color: var(--text-1); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Tooltip flotante interactivo del gráfico Mercury */
.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: #FFFFFF; color: var(--text-1, #18181F); padding: 6px 10px; border-radius: 2px;
  border: 1px solid var(--border-raised, #E6E6E9); font-size: var(--fs-xs); line-height: 1.35;
  box-shadow: 0 4px 16px rgba(24, 24, 31, 0.10); white-space: nowrap; transition: opacity 0.1s ease;
  display: none;
}
.tooltip:not([hidden]) { display: block; }
.tooltip .t-f { font-size: 11px; color: var(--text-3, #6B6C71); margin-bottom: 2px; }
.tooltip .t-m { font-weight: 600; font-size: var(--fs-base, 15px); color: var(--text-1, #18181F); font-variant-numeric: tabular-nums; }
.tooltip .t-sub { font-size: 11px; color: var(--text-3, #6B6C71); margin-top: 2px; }

/* Menú flotante del selector de períodos Mercury */
.periodo { position: relative; display: inline-block; }
.selector { cursor: pointer; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  background: var(--bg); border: 1px solid var(--border-control); border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); padding: 4px; min-width: 180px;
  display: flex; flex-direction: column; gap: 2px;
}
.menu button {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 8px 12px; border: 0; background: transparent; font-size: var(--fs-sm);
  color: var(--text-2); border-radius: 2px; text-align: left; cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.menu button:hover { background: var(--bg-sidebar); color: var(--text-1); }
.menu button[aria-checked="true"] { color: var(--text-1); font-weight: 500; }
.menu button[aria-checked="true"]::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 8px; flex: none;
}

/* Sección inferior de Actividad reciente de cartera por mes (Mercury) */
.seccion-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 36px; margin-bottom: 12px;
}
.nav-mes {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm);
  font-weight: 500; color: var(--text-1);
}
.card-movs { padding: 0; overflow: hidden; margin-top: 0 !important; }
.movs { list-style: none; margin: 0; padding: 0; }
.movs li {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); font-size: var(--fs-sm);
}
.movs li:last-child { border-bottom: 0; }
.mov-ico {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-muted); flex: none;
}
.mov-ico .icon.up { stroke: var(--up); }
.mov-ico .icon.down { stroke: var(--down); }
.mov-nombre {
  font-weight: 500; color: var(--text-1); background: none; border: 0; padding: 0;
  text-align: left; cursor: pointer; text-decoration: none; font-size: var(--fs-sm);
}
.mov-nombre:hover { color: var(--accent); text-decoration: underline; }
.mov-c { color: var(--text-3); font-size: var(--fs-xs); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mov-f { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }

/* ============================== 4. Componentes Generales ============================== */

/* Tarjetas y cajas: outer-box, inner-box, card (2px) */
.outer-box {
  border-radius: 2px;
}

.inner-box {
  border-radius: 2px;
}

.card {
  --cpx: 24px; --cpy: 24px;
  padding: var(--cpy) var(--cpx); background: var(--bg); border: 1px solid var(--border); border-radius: 2px;
}
.card + .card { margin-top: var(--s-6); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  margin: calc(var(--cpy) * -1) calc(var(--cpx) * -1) var(--s-6); padding: 16px var(--cpx); border-bottom: 1px solid var(--border);
}
.card-body { display: grid; gap: var(--s-4); }
.card-foot {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  margin: var(--s-6) calc(var(--cpx) * -1) calc(var(--cpy) * -1); padding: 16px var(--cpx); border-top: 1px solid var(--border);
}
.card-title { font-size: var(--fs-base); color: var(--text-2); }
.card-sub { margin-left: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); }
.help, .field-hint { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }
.field-hint { margin-top: 4px; }
.help-block { max-width: 720px; margin: 4px 0 var(--s-4); }
.row-end { align-items: flex-end; }
.field-error { margin-top: 4px; font-size: var(--fs-sm); color: var(--down); }

/* Indicadores (resumen de la plataforma): una cifra por recuadro */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.kpi { min-width: 0; padding: 14px 16px 16px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px; }
.kpi-label { font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-3); }
.kpi-value { margin-top: 6px; font-size: 1.625rem; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.kpi-value-sm { font-size: 1.0625rem; line-height: 1.4; letter-spacing: -0.01em; }
.kpi-sub { margin-top: 4px; font-size: var(--fs-sm); color: var(--c-text-2); }
.kpi-sub:empty { display: none; }

/* Lista de datos: dl.kv > div > dt + dd */
.kv { display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); gap: var(--s4); padding: 10px 0; border-bottom: 1px solid var(--c-line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--c-text-3); font-size: var(--fs-sm); }
.kv dd { color: var(--c-ink); overflow-wrap: anywhere; }

/* Fila "rótulo a la izquierda, valor a la derecha" y barra fina de avance */
.row-kv { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); }
.row-kv-label { color: var(--c-text-2); }
.row-kv-value { font-weight: 600; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.row-kv-value.is-ok { color: var(--c-ok); }
.row-kv-value.is-bad { color: var(--c-bad); }
.meter { height: 6px; border-radius: 2px; background: var(--c-surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--c-brand); }
.meter.is-ok > span { background: var(--c-ok); }
.meter.is-bad > span { background: var(--c-bad); }

/* Botones (Pills de 32px Mercury) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 2px; background: var(--c-surface-3); color: var(--c-text);
  font-size: 13px; font-weight: 400; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--c-brand); color: var(--c-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--c-brand-hover); color: var(--c-on-brand); }
.btn-secondary { border-color: transparent; background: var(--c-surface-3); color: var(--c-text); }
.btn-secondary:hover:not(:disabled) { background: #E3E6EA; border-color: transparent; color: var(--c-ink); }
.btn-ghost { background: transparent; color: var(--c-brand-text); }
.btn-ghost:hover:not(:disabled) { background: var(--c-surface-3); color: var(--c-brand-hover); }
.btn-danger { background: var(--c-bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #A32D5E; color: #fff; }
.btn-danger-outline { border-color: var(--c-bad-line); background: var(--c-surface); color: var(--c-bad); }
.btn-danger-outline:hover:not(:disabled) { background: var(--c-bad-bg); color: var(--c-bad); }
.btn-danger-ghost { background: transparent; color: var(--c-bad); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--c-bad-bg); color: var(--c-bad); }
.btn.is-armed { background: var(--c-bad); border-color: var(--c-bad); color: #fff; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn-xs { min-height: 26px; padding: 0 10px; font-size: 12px; }
.btn-block { display: flex; width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; background: var(--c-surface-3); border: 0;
  border-radius: 50%; color: var(--c-text-2); font-size: 16px; transition: background-color 0.12s, color 0.12s;
}
.icon-btn:hover:not(:disabled) { background: #E3E6EA; color: var(--c-ink); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.link-btn { padding: 0; background: none; border: 0; color: var(--c-brand-text); text-decoration: none; font-size: inherit; }
.link-btn:hover { color: var(--c-brand-hover); text-decoration: underline; }
.spinner {
  width: 14px; height: 14px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: giro 0.7s linear infinite; opacity: 0.8;
}
@keyframes giro { to { transform: rotate(360deg); } }

/* Formularios */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-md); font-weight: 500; color: var(--c-ink); }
.field-inline { display: grid; gap: 6px; }
.field-inline > label { font-size: var(--fs-md); font-weight: 500; color: var(--c-ink); }
.input {
  width: 100%; min-height: 36px; padding: 6px 12px; background: var(--c-surface); border: 1px solid var(--c-line-strong);
  border-radius: 2px; color: var(--c-ink); font-size: var(--fs-md); line-height: 1.4;
}
.input::placeholder { color: #98a2b3; }
.input:hover { border-color: #b8bfca; }
.input:focus { outline: none; border-color: var(--c-brand); box-shadow: var(--ring); }
.input:disabled { background: var(--c-surface-2); color: var(--c-text-3); cursor: not-allowed; }
textarea.input { min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.55; }
select.input {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23475467' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
}
.input-date { width: auto; min-width: 160px; }
.input-select-lg { min-width: 240px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; }
.input-group-btn { padding: 0 14px; background: var(--c-surface-2); border: 1px solid var(--c-line-strong); border-left: 0; border-radius: 0 2px 2px 0; font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-2); }
.input-group-btn:hover { background: var(--c-surface-3); color: var(--c-ink); }
.check-row { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--fs-md); color: var(--c-text); line-height: 1.45; }
.check-row input[type="checkbox"], .perm-item input[type="checkbox"] { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--c-brand); }
.rules { display: grid; gap: 3px; margin: -4px 0 var(--s2); font-size: var(--fs-sm); color: var(--c-text-3); }
.rules li::before { content: "–"; display: inline-block; width: 1.1em; }
.rules li.is-ok { color: var(--c-ok); }
.rules li.is-ok::before { content: ""; width: 0.3em; height: 0.62em; margin: 0 0.42em 0.12em 0.3em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); vertical-align: middle; }

/* Interruptor (casilla de activar o desactivar con texto explicativo al lado) */
input[type="checkbox"].switch {
  appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 2px; background: #98a2b3;
  cursor: pointer; transition: background-color 0.15s;
}
input[type="checkbox"].switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3); transition: transform 0.15s;
}
input[type="checkbox"].switch:checked { background: var(--c-brand); }
input[type="checkbox"].switch:checked::after { transform: translateX(16px); }
input[type="checkbox"].switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s4); border: 1px solid var(--c-line); border-radius: 2px; }
.switch-row-title { font-weight: 600; color: var(--c-ink); }
.switch-row-text { margin-top: 2px; font-size: var(--fs-sm); color: var(--c-text-2); line-height: 1.5; }

/* Segmentados */
.pill-group { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--c-surface-3); border-radius: 2px; }
.pill { min-height: 30px; padding: 0 12px; background: transparent; border: 0; border-radius: 2px; color: var(--c-text-2); font-size: var(--fs-sm); font-weight: 500; }
.pill:hover { color: var(--c-ink); }
.pill.is-active, .pill.active { background: var(--c-surface); color: var(--c-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.pill:focus-visible { outline-offset: 1px; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px; }
.table, .list, .cov-table, .extract-preview-table, .data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th, .cov-table th, .extract-preview-table th, .data-table th {
  padding: 10px 16px; background: var(--c-surface-2); border-bottom: 1px solid var(--c-line); text-align: left;
  font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-3); white-space: nowrap;
}
.table td, .list td, .cov-table td, .extract-preview-table td, .data-table td { padding: 12px 16px; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.table tbody tr:last-child td, .list tbody tr:last-child td, .cov-table tbody tr:last-child td, .extract-preview-table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover, .list tbody tr:hover, .data-table tbody tr:hover { background: var(--c-surface-2); }
.table td.num, .table th.num { text-align: right; }
.table .cell-actions, .list .cell-actions, .data-table .cell-actions { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 600; color: var(--c-ink); }
.cell-sub { display: block; margin-top: 2px; font-size: var(--fs-sm); font-weight: 400; color: var(--c-text-3); }

/* Etiquetas de estado */
.tag, .chip, .cov-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 0; border-radius: 2px;
  background: var(--c-surface-2); color: var(--c-text-2); font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.tag-ok, .cov-ok { background: var(--c-ok-bg); color: var(--c-ok); }
.tag-warn, .cov-warn { background: var(--c-warn-bg); color: var(--c-warn); }
.tag-bad, .cov-bad { background: var(--c-bad-bg); color: var(--c-bad); }
.tag-info, .cov-info { background: var(--c-info-bg); color: var(--c-info); }
.tag-muted, .cov-neutral { background: var(--c-surface-2); color: var(--c-text-3); }
.badge-valid { color: var(--c-ok); font-size: var(--fs-sm); font-weight: 600; }
.badge-invalid, .status-bad { color: var(--c-bad); font-size: var(--fs-sm); font-weight: 600; }

/* Estados vacíos y avisos */
.state { padding: var(--s6) var(--s5); text-align: center; color: var(--c-text-2); display: grid; gap: var(--s2); justify-items: center; }
.state-title { font-size: var(--fs-lg); font-weight: 600; color: var(--c-ink); }
.state p { max-width: 760px; }
.state .btn { margin-top: var(--s2); }
.state-box { border: 1px solid var(--c-line); border-radius: 2px; }
.card > .state, .table-wrap > .state { padding-top: var(--s5); padding-bottom: var(--s5); }

.band, .result-box {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: 12px 16px;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px;
}
.band-body, .result-box-body { min-width: 0; display: grid; gap: 4px; flex: 1; }
.band-title, .result-box-title { font-weight: 600; color: var(--c-ink); }
.band-text, .result-box-text { color: var(--c-text); }
.result-box-extra { color: var(--c-text-2); font-size: var(--fs-sm); }
.band-actions, .result-box-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.result-box-actions { margin-top: var(--s2); }
.band-info, .result-box.is-neutral { background: var(--c-info-bg); border-color: var(--c-info-line); }
.band-info .band-title { color: var(--c-info); }
.band-warn { background: var(--c-warn-bg); border-color: var(--c-warn-line); }
.band-warn .band-title { color: var(--c-warn); }
.band-bad, .result-box.is-error { background: var(--c-bad-bg); border-color: var(--c-bad-line); }
.band-bad .band-title, .result-box.is-error .result-box-title { color: var(--c-bad); }
.band-ok, .result-box.is-ok { background: var(--c-ok-bg); border-color: var(--c-ok-line); }
.band-ok .band-title, .result-box.is-ok .result-box-title { color: var(--c-ok); }
.result-box.is-alert { background: var(--c-warn-bg); border-color: var(--c-warn-line); }
.result-box.is-alert .result-box-title { color: var(--c-warn); }
.result-box {
  margin-bottom: var(--s5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.result-box.is-fading {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.result-close { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; background: transparent; border: 0; border-radius: 2px; color: var(--c-text-3); }
.result-close:hover { background: rgba(16, 24, 40, 0.06); color: var(--c-ink); }
.progress { width: 100%; height: 6px; margin-top: var(--s2); appearance: none; border: 0; border-radius: 2px; background: rgba(16, 24, 40, 0.1); overflow: hidden; }
.progress::-webkit-progress-bar { background: rgba(16, 24, 40, 0.1); }
.progress::-webkit-progress-value { background: var(--c-brand); border-radius: 2px; }
.progress::-moz-progress-bar { background: var(--c-brand); border-radius: 2px; }

.form-alert { padding: 10px 14px; border: 1px solid; border-radius: 2px; font-size: var(--fs-md); margin-bottom: var(--s3); }
.form-alert-error { background: var(--c-bad-bg); border-color: var(--c-bad-line); color: #7a271a; }
.form-alert-info { background: var(--c-info-bg); border-color: var(--c-info-line); color: #194185; }

/* Contraseña temporal (se muestra una sola vez) */
.secret-box { padding: var(--s4); background: var(--c-warn-bg); border: 1px solid var(--c-warn-line); border-radius: 2px; display: grid; gap: var(--s2); }
.secret-title { font-weight: 600; color: var(--c-ink); }
.secret-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.secret-value { padding: 6px 12px; background: var(--c-surface); border: 1px solid var(--c-warn-line); border-radius: 2px; font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.04em; color: var(--c-ink); user-select: all; overflow-wrap: anywhere; }
.secret-note { font-size: var(--fs-sm); color: var(--c-text-2); }

/* Permisos */
.perm-group + .perm-group { margin-top: var(--s4); }
.perm-group-title { margin-bottom: var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-3); }
.perm-group > ul, .perm-list { display: grid; border: 1px solid var(--c-line); border-radius: 2px; overflow: hidden; }
.perm-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--c-line); }
.perm-item:first-child { border-top: 0; }
.perm-item:hover { background: var(--c-surface-2); }
.perm-name { display: block; font-weight: 500; color: var(--c-ink); }
.perm-detail { display: block; font-size: var(--fs-sm); color: var(--c-text-3); }

/* Diálogos y avisos pasajeros */
.dialog {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: var(--s5); overflow: auto;
  background: var(--c-surface); color: var(--c-text); border: 0; border-radius: 2px; box-shadow: var(--shadow-modal);
}
.dialog.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(16, 24, 40, 0.4); }
.dialog-title {
  margin: calc(var(--s5) * -1) calc(var(--s5) * -1) var(--s4); padding: 16px var(--s5); border-bottom: 1px solid var(--c-line);
  font-weight: 600; font-size: var(--fs-lg); color: var(--c-ink);
}
.dialog-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.dialog-title-row .dialog-title { flex: 1; }
.dialog-text { margin-bottom: var(--s4); color: var(--c-text-2); line-height: 1.55; }
.dialog-actions {
  display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap;
  margin: var(--s5) calc(var(--s5) * -1) calc(var(--s5) * -1); padding: 12px var(--s5); border-top: 1px solid var(--c-line);
}
.dialog form > .field + .field { margin-top: var(--s3); }

.notice {
  position: fixed; right: var(--s5); bottom: var(--s5); z-index: 60; display: flex; align-items: flex-start; gap: var(--s3);
  width: min(400px, calc(100vw - 32px)); padding: 12px 8px 12px 16px; background: var(--c-ink); border-radius: 2px;
  box-shadow: var(--shadow-pop); color: #fff;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.notice.is-fading {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.notice::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: #84adff; }
.notice > span { flex: 1; line-height: 1.45; }
.notice-success::before { background: #47cd89; }
.notice-error::before { background: #f97066; }
.notice-alert::before { background: #fdb022; }
.notice-close { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; background: transparent; border: 0; border-radius: 2px; color: #d0d5dd; }
.notice-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ============================== 5. Alertas ============================== */
/* Barra de búsqueda y filtros: una sola línea */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.toolbar .search { flex: 1 1 240px; max-width: 420px; }
.toolbar .toolbar-count { margin-left: auto; font-size: var(--fs-sm); color: var(--c-text-3); }
.search {
  padding-left: 34px;
  background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 16px;
}
.toolbar select.input { width: auto; min-width: 150px; }
input[type="search"].input { -webkit-appearance: none; appearance: none; }
input[type="search"].input::-webkit-search-cancel-button { cursor: pointer; }

/* Custom UI Dropdown (controles UI diseñados sin selects nativos) */
.ui-dropdown {
  position: relative;
  display: inline-block;
}
.ui-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: #FFFFFF;
  border: 1px solid var(--c-line, #E4E4E7);
  border-radius: 2px;
  color: var(--c-ink, #18181B);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ui-dropdown-trigger:hover {
  background: #FAFAFA;
  border-color: #D4D4D8;
}
.ui-dropdown.is-open .ui-dropdown-trigger,
.ui-dropdown-trigger:focus-visible {
  outline: none;
  border-color: var(--c-brand, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.ui-dropdown-chevron {
  width: 15px;
  height: 15px;
  color: #71717A;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
  flex: none;
}
.ui-dropdown.is-open .ui-dropdown-chevron {
  transform: rotate(180deg);
}
.ui-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  background: #FFFFFF;
  border: 1px solid var(--c-line, #E4E4E7);
  border-radius: 2px;
  padding: 5px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ui-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #27272A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.ui-dropdown-item:hover {
  background: #F4F4F5;
  color: #09090B;
}
.ui-dropdown-item.is-selected {
  background: #F0F4FF;
  color: #1D4ED8;
  font-weight: 600;
}
.ui-dropdown-check {
  width: 14px;
  height: 14px;
  stroke: #2563EB;
  stroke-width: 2.2;
  fill: none;
  opacity: 0;
  flex: none;
}
.ui-dropdown-item.is-selected .ui-dropdown-check {
  opacity: 1;
}

/* Lista de alertas: una fila por alerta; el detalle se despliega debajo de la fila */
.alerts-table tbody tr.al-row { cursor: pointer; scroll-margin-top: 72px; }
.alerts-table td { vertical-align: middle; }
.al-name { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 0; background: none; border: 0; text-align: left; font-weight: 600; color: var(--c-ink); overflow-wrap: anywhere; }
.al-chev { display: inline-flex; flex: none; color: var(--c-text-3); transition: transform 0.15s ease; }
.al-chev .icon { width: 16px; height: 16px; }
.al-row.is-open .al-chev { transform: rotate(90deg); }
.al-row.is-open td { background: var(--c-surface-2); border-bottom-color: transparent; }
.al-name:hover { color: var(--c-brand-hover); text-decoration: underline; text-underline-offset: 2px; }
.al-doc { display: block; margin-top: 1px; padding-left: 24px; font-size: var(--fs-sm); color: var(--c-text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.al-new { display: none !important; }
.al-deadline { display: block; font-variant-numeric: tabular-nums; color: var(--c-ink); }
.al-deadline-sub { display: block; font-size: var(--fs-sm); color: var(--c-text-3); }
.dl-urgent .al-deadline-sub, .dl-urgent.dl-text { color: var(--c-bad); font-weight: 600; }
.dl-warning .al-deadline-sub, .dl-warning.dl-text { color: var(--c-warn); font-weight: 600; }
.dl-active .al-deadline-sub, .dl-active.dl-text { color: var(--c-ok); }
.dl-expired .al-deadline-sub, .dl-pending .al-deadline-sub, .dl-expired.dl-text, .dl-pending.dl-text { color: var(--c-text-3); }

.chip, .tag, .cov-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 0 !important; border-radius: 2px;
  background: var(--c-surface-2); color: var(--c-text-2); font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.chip-quiebra, .tag-bad { background: var(--c-bad-bg) !important; color: var(--c-bad) !important; border: 0 !important; }
.chip-concurso, .chip-concurso_preventivo, .tag-warn { background: var(--c-warn-bg) !important; color: var(--c-warn) !important; border: 0 !important; }
.chip-ape, .tag-info { background: var(--c-info-bg) !important; color: var(--c-info) !important; border: 0 !important; }
.chip-desconocido, .chip-nacion, .chip-provincia, .tag-muted { background: var(--c-surface-2) !important; color: var(--c-text-2) !important; border: 0 !important; }

/* Detalle desplegado de una alerta */
.alerts-table tbody tr.al-detail, .alerts-table tbody tr.al-detail:hover { cursor: default; background: var(--c-surface-2); }
.al-detail > td { padding: 0; }
.ad { display: grid; gap: var(--s5); padding: 4px var(--s5) var(--s5) 40px; }
.ad-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-3); }
.ad-note { padding: 10px 14px; background: var(--c-warn-bg); border: 1px solid var(--c-warn-line); border-radius: 2px; font-size: var(--fs-sm); color: #6e3410; line-height: 1.5; }
.ad-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.ad-discard { margin-left: auto; }
.ad .plazos, .ad .facts, .ad .alert-summary, .ad .edict-text { background: var(--c-surface); }

/* Plazos del proceso y datos del expediente */
.plazos, .facts { display: grid; border: 1px solid var(--c-line); border-radius: 2px; overflow: hidden; }
.plazos > div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--s2) var(--s4); padding: 9px 14px; border-top: 1px solid var(--c-line); }
.facts > div { display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr); gap: var(--s3); padding: 9px 14px; border-top: 1px solid var(--c-line); }
.plazos > div:first-child, .facts > div:first-child { border-top: 0; }
.plazos dt { color: var(--c-text-3); font-size: var(--fs-sm); white-space: nowrap; flex: 1 0 auto; }
.plazos dd { color: var(--c-ink); text-align: right; white-space: nowrap; }
.facts dt { color: var(--c-text-3); font-size: var(--fs-sm); }
.facts dd { color: var(--c-ink); overflow-wrap: anywhere; }
.plazos dd .dl-text { margin-left: 8px; font-size: var(--fs-sm); }
.facts a { overflow-wrap: anywhere; }
.alert-summary { padding: 12px 14px; background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: 2px; color: var(--c-text); line-height: 1.55; }
.alert-summary-label { display: block; margin-bottom: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-3); }
.alert-ia-note { margin: var(--s2) 0 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--c-text-2); }
.edict-text, .extract-box-text {
  max-height: 420px; overflow: auto; padding: 14px 16px; white-space: pre-wrap; background: var(--c-surface-2); border: 1px solid var(--c-line);
  border-radius: 2px; font-family: var(--font-serif); font-size: 15px; line-height: 1.65; color: var(--c-ink); overflow-wrap: anywhere;
}
.extract-box { margin-top: var(--s3); }
.extract-box-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.extract-cut { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--c-text-2); }
.alert-full-text-title { font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-3); }

/* Resultados de la consulta del archivo: cada edicto en un recuadro con los mismos bloques del detalle */
.alerts { display: grid; gap: var(--s4); }
.result-card { display: grid; gap: var(--s4); padding: var(--s5); border: 1px solid var(--c-line); border-radius: 2px; background: var(--c-surface); }
.result-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.result-card-name { font-size: var(--fs-xl); font-weight: 600; line-height: 1.3; color: var(--c-ink); overflow-wrap: anywhere; }
.result-card-sub { margin-top: 2px; font-size: var(--fs-sm); color: var(--c-text-2); }
.result-card-foot { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ============================== 6. Cartera y consulta ============================== */
.cartera-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.cartera-bar .search { flex: 1 1 240px; max-width: 360px; }
.load-section { margin-top: var(--s4); }
.dialog > .pill-group { margin-top: 2px; }
.file-dropzone {
  display: grid; justify-items: center; gap: 4px; padding: var(--s5); text-align: center; cursor: pointer;
  background: var(--c-surface-2); border: 1px dashed var(--c-line-strong); border-radius: 2px;
}
.file-dropzone:hover, .file-dropzone.is-dragover { background: var(--c-brand-soft); border-color: var(--c-brand); }
.file-dropzone.is-busy { opacity: 0.6; cursor: progress; }
.dropzone-icon { color: var(--c-text-3); margin-bottom: 2px; }
.dropzone-title { font-weight: 600; color: var(--c-ink); }
.dropzone-subtitle { max-width: 480px; font-size: var(--fs-sm); color: var(--c-text-2); }
.ia-option { margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: 2px; }
.ia-warning { margin-top: 6px; font-size: var(--fs-sm); color: var(--c-text-2); }
.extract-progress { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); color: var(--c-text-2); }
.extract-preview { margin-top: var(--s4); border: 1px solid var(--c-line); border-radius: 2px; overflow: hidden; }
.extract-preview-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s4); background: var(--c-surface-2); border-bottom: 1px solid var(--c-line); flex-wrap: wrap; }
.extract-preview-title { font-size: var(--fs-lg); font-weight: 600; color: var(--c-ink); }
.extract-preview-desc { font-size: var(--fs-sm); color: var(--c-text-2); }
.extract-preview-head-actions { display: flex; gap: var(--s2); }
.extract-preview-table-wrap { max-height: 320px; overflow: auto; }
.extract-preview-foot { display: flex; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--c-line); background: var(--c-surface-2); }
.th-chk { width: 44px; text-align: center; }
.input-preview-name { width: 100%; min-height: 32px; padding: 4px 10px; border: 1px solid var(--c-line-strong); border-radius: 2px; background: var(--c-surface); }
.input-preview-name:focus { outline: none; border-color: var(--c-brand); box-shadow: var(--ring); }
.load-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s3); }
.load-count { font-size: var(--fs-sm); color: var(--c-text-2); }
.load-count .warn { color: var(--c-warn); font-weight: 600; }

.list-card { padding: 0; overflow: hidden; }
.list-wrap { overflow-x: auto; }
.list th { padding: 10px 16px; background: var(--c-surface-2); border-bottom: 1px solid var(--c-line); text-align: left; font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-3); }
.list td { padding: 11px 16px; }
.cuit { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--c-ink); letter-spacing: 0.01em; }
.cell-name { color: var(--c-text); }
.list-note { padding: var(--s3) var(--s4); border-top: 1px solid var(--c-line); font-size: var(--fs-sm); color: var(--c-text-2); }

.query-form-row { display: flex; align-items: center; gap: var(--s2); position: relative; }
.query-input-wrap { display: flex; align-items: center; gap: var(--s2); position: relative; }
.query-icon-slot { position: absolute; left: 12px; color: var(--c-text-3); pointer-events: none; display: grid; }
.query-input { padding-left: 38px; padding-right: 36px; min-height: 40px; font-size: var(--fs-lg); }
.query-clear-btn { position: absolute; right: 118px; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; background: none; border: 0; border-radius: 2px; color: var(--c-text-3); }
.query-clear-btn:hover { background: var(--c-surface-3); color: var(--c-ink); }
.query-submit-btn { min-height: 40px; min-width: 104px; }
.query-card { margin-bottom: var(--s5); }
.query-results-area { display: grid; gap: var(--s4); }
.query-summary-banner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s3) var(--s4); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px; }
.query-summary-banner.is-hit { background: var(--c-brand-soft); border-color: #c7d4f3; }
.query-summary-banner-content { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.query-badge-hit { padding: 1px 9px; background: var(--c-ink); color: #fff; border-radius: 2px; font-weight: 600; font-size: 12.5px; }
.query-scope-box { display: grid; gap: 6px; padding: var(--s3) var(--s4); background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: 2px; font-size: var(--fs-sm); color: var(--c-text-2); }
.query-note { font-size: var(--fs-sm); color: var(--c-text-2); }
.query-empty-state { display: grid; gap: var(--s2); padding: var(--s5); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px; justify-items: start; }
.query-empty-title { font-weight: 600; font-size: var(--fs-lg); color: var(--c-ink); }
.query-empty-desc { max-width: 640px; }
.query-empty-more { max-width: 640px; font-size: var(--fs-sm); color: var(--c-text-2); }
.query-empty-action { margin-top: var(--s2); }

/* ============================== 7. Cobertura (solo el dueño del sistema) ============================== */
.cov-summary { color: var(--c-text); }
.cov-summary strong { color: var(--c-ink); }
.cov-alert { margin-top: 2px; color: var(--c-text-2); font-size: var(--fs-sm); }
.cov-summary + .table-wrap, .cov-alert + .table-wrap { margin-top: var(--s4); }
.cov-table td.cov-name strong { color: var(--c-ink); }
.cov-detail { max-width: 520px; }
.cov-note { display: block; font-size: var(--fs-sm); color: var(--c-text-2); }
.cov-days { margin-top: 6px; }
.cov-days ul { margin-top: 6px; display: grid; gap: 4px; }
.cov-days li { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: var(--fs-sm); }
.cov-day-date { min-width: 76px; color: var(--c-ink); }
.cov-day-count, .cov-day-ms { color: var(--c-text-3); }
.cov-day-detail { color: var(--c-text-2); }

/* ============================== 8. Ingreso ============================== */
.login-body { background: var(--c-surface-2); }
.login-split { display: grid; place-items: center; min-height: 100vh; padding: var(--s5) var(--s4); }
.login-main { width: 100%; display: grid; justify-items: center; }
.login-wrap { width: min(400px, 100%); }
.login-brand { display: flex; justify-content: center; margin-bottom: var(--s5); }
.login-card { padding: var(--s6); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 2px; }
.login-title { font-weight: 600; font-size: var(--fs-2xl); letter-spacing: -0.015em; color: var(--c-ink); }
.login-sub { margin: 4px 0 var(--s5); color: var(--c-text-2); }
.login-card .field + .field { margin-top: var(--s4); }
.login-card .btn-block { margin-top: var(--s5); min-height: 40px; }
.login-foot { margin-top: var(--s5); font-size: var(--fs-sm); color: var(--c-text-3); }

/* ============================== 9. Adaptación ============================== */
@media (max-width: 1100px) {
  .main-content { padding: 28px var(--s5) 56px; }
}
@media (max-width: 900px) {
  .app-layout { display: block; }
  .app-sidebar {
    position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(260px, 86vw); height: 100vh; transform: translateX(-102%);
    transition: transform 0.18s ease; box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0);
  }
  .app-sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0.4); }
  .sidebar-toggle-btn { display: inline-flex; }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; min-height: 48px; padding: 0 var(--s4); background: var(--c-surface); border-bottom: 1px solid var(--c-line); }
  .grid-2, .form-grid, .m-grid, .m-split-card { grid-template-columns: minmax(0, 1fr); }
  .m-split-card > .m-card + .m-card { border-left: 0; border-top: 1px solid var(--c-line); }
  .kv > div, .plazos > div, .facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 720px) {
  /* La lista de alertas pasa a una tarjeta por fila */
  .alerts-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .alerts-table, .alerts-table tbody, .alerts-table tr, .alerts-table td { display: block; width: 100%; }
  .alerts-table tr { padding: 12px 0; border-bottom: 1px solid var(--c-line); }
  .alerts-table tr:last-child { border-bottom: 0; }
  .alerts-table tr.al-detail { padding: 0; }
  .alerts-table .al-detail td { padding: 0; }
  .ad { padding: var(--s2) var(--s4) var(--s4); }
  .alerts-table td { padding: 3px 16px; border: 0; }
  .alerts-table td[data-label]::before { content: attr(data-label) ": "; color: var(--c-text-3); font-size: var(--fs-sm); }
  .alerts-table .al-col-name::before { content: none !important; }
}
@media (max-width: 640px) {
  .main-content { padding: var(--s4) var(--s4) 48px; }
  .page-title { font-size: 22px; }
  .kpis, .m-kpis { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .m-kpi-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar select.input { flex: 1 1 140px; }
  .cartera-bar .search { max-width: none; flex-basis: 100%; }
  .query-input-wrap { flex-wrap: wrap; }
  .query-input { flex: 1 1 100%; }
  .query-clear-btn { right: 12px; top: 6px; }
  .query-submit-btn { flex: 1 1 100%; }
  .list td, .list th { padding-left: var(--s3); padding-right: var(--s3); }
  .result-card { padding: var(--s4); }
  .cov-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .cov-table, .cov-table tbody, .cov-table tr, .cov-table td { display: block; width: 100%; }
  .cov-table tr { padding: 10px 0; border-bottom: 1px solid var(--c-line); }
  .cov-table td { padding: 4px 16px; border: 0; }
  .cov-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 400; letter-spacing: 0.02em; color: var(--c-text-3); }
  .notice { right: var(--s3); bottom: var(--s3); }
  .dialog { padding: var(--s4); }
  .dialog-title, .dialog-title-row { margin: calc(var(--s4) * -1) calc(var(--s4) * -1) var(--s4); padding: 14px var(--s4); }
  .dialog-actions { justify-content: stretch; margin: var(--s4) calc(var(--s4) * -1) calc(var(--s4) * -1); padding: 12px var(--s4); }
  .dialog-actions .btn { flex: 1 1 auto; }
  .m-fab { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media print {
  .app-sidebar, .topbar, .toolbar, .notice, .page-actions, .m-fab { display: none !important; }
  .app-layout { display: block; }
  body { background: #fff; }
  .result-card { break-inside: avoid; }
}

/* --- Terminal de Riesgo Financiero BCRA & Cartera ---------------------------------------------------- */
.watchlist-table { width: 100%; table-layout: fixed; }
.watchlist-table th:nth-child(1), .watchlist-table td:nth-child(1),
.watchlist-table th.cell-check, .watchlist-table td.cell-check { width: 44px; max-width: 44px; padding: 11px 8px; text-align: center; }
.watchlist-table th:nth-child(2), .watchlist-table td:nth-child(2) { width: 34%; }
.watchlist-table th:nth-child(3), .watchlist-table td:nth-child(3) { width: 16%; }
.watchlist-table th:nth-child(4), .watchlist-table td:nth-child(4) { width: 20%; }
.watchlist-table th:nth-child(5), .watchlist-table td:nth-child(5) { width: 18%; }
.watchlist-table th:nth-child(6), .watchlist-table td:nth-child(6) { width: 70px; text-align: right; }

@media (min-width: 720.02px) {
  .alerts-table { width: 100%; }
  .alerts-table th:nth-child(1), .alerts-table tr.al-row td:nth-child(1) { width: 32%; }
  .alerts-table th:nth-child(2), .alerts-table tr.al-row td:nth-child(2) { width: 14%; }
  .alerts-table th:nth-child(3), .alerts-table tr.al-row td:nth-child(3) { width: 13%; }
  .alerts-table th:nth-child(4), .alerts-table tr.al-row td:nth-child(4) { width: 11%; }
  .alerts-table th:nth-child(5), .alerts-table tr.al-row td:nth-child(5) { width: 14%; }
  .alerts-table th:nth-child(6), .alerts-table tr.al-row td:nth-child(6) { width: 16%; }
}

.empresa-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.empresa-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.empresa-nombre { font-size: 13.5px; font-weight: 600; color: var(--c-text, #18181B); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.empresa-cuit { font-size: 12px; color: var(--c-text-3, #71717A); font-variant-numeric: tabular-nums; }

.tag-bcra { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 2px; border: 0 !important; line-height: 1.4; white-space: nowrap; }
.tag-bcra-1 { background: #E8F5E9; color: #1B5E20; border: 0 !important; }
.tag-bcra-2 { background: #FFF8E1; color: #B78103; border: 0 !important; }
.tag-bcra-3 { background: #FFF3E0; color: #E65100; border: 0 !important; }
.tag-bcra-4 { background: #FFEBEE; color: #C62828; border: 0 !important; font-weight: 600; }
.tag-bcra-5, .tag-bcra-6 { background: #FBE9E7; color: #BF360C; border: 0 !important; font-weight: 600; }
.tag-bcra-sd { background: #F4F4F6; color: #71717A; border: 0 !important; }

.tag-chq-bad { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 2px; background: #FFEBEE; color: #C62828; border: 0 !important; white-space: nowrap; }
.tag-chq-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 2px; background: #F4F4F6; color: #71717A; border: 0 !important; white-space: nowrap; }

.deuda-subtext { font-size: 11px; color: var(--c-text-3, #71717A); margin-top: 2px; }
.bcra-inline-cell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; vertical-align: middle; }
.bcra-monto { font-size: 12px; font-weight: 500; color: var(--c-text-2, #52525B); font-variant-numeric: tabular-nums; line-height: 1; }

/* Dossier Dialog */
.bcra-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.bcra-kpi-card { background: var(--c-surface-sunken, #FAFAFB); border: 1px solid var(--c-line, #E4E4E7); border-radius: 2px; padding: 12px 14px; }
.bcra-kpi-title { font-size: 11.5px; color: var(--c-text-3, #71717A); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; font-weight: 500; }
.bcra-kpi-value { font-size: 18px; font-weight: 600; color: var(--c-text, #18181B); font-variant-numeric: tabular-nums; }
.bcra-kpi-sub { font-size: 11px; color: var(--c-text-3, #71717A); margin-top: 2px; }

.bcra-section-title { font-size: 13.5px; font-weight: 600; color: var(--c-text, #18181B); margin: 18px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.bcra-table-wrap { border: 1px solid var(--c-line, #E4E4E7); border-radius: 2px; overflow: hidden; background: #fff; margin-bottom: 16px; }
.bcra-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bcra-table th { text-align: left; padding: 9px 12px; background: #F4F4F6; color: #52525B; font-weight: 500; font-size: 11.5px; border-bottom: 1px solid var(--c-line, #E4E4E7); }
.bcra-table td { padding: 9px 12px; border-bottom: 1px solid #F4F4F6; vertical-align: middle; }
.bcra-table tr:last-child td { border-bottom: 0; }
.bcra-table tr:hover td { background: #FAFAFB; }
.bcra-table-empty { padding: 16px; text-align: center; color: var(--c-text-3, #71717A); font-size: 12.5px; }

/* Indicador de Cupo y Capacidad de Monitoreo Simultáneo */
.cupo-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-2, #52525B);
  background: var(--c-surface-2, #F4F4F6);
  border: 0 !important;
  border-radius: 2px;
  white-space: nowrap;
}
.cupo-indicator .cupo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16A34A;
}
.cupo-indicator.cupo-casi-lleno .cupo-dot {
  background: #D97706;
}
.cupo-indicator.cupo-lleno .cupo-dot {
  background: #DC2626;
}

/* Barra de Acciones por Lote (Bulk) */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 2px;
}
.bulk-actions-bar .bulk-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #1E3A8A;
}
.bulk-actions-bar .bulk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: #1D4ED8;
  border-radius: 2px;
}
.bulk-actions-bar .bulk-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell-check {
  width: 38px;
  text-align: center;
  vertical-align: middle;
}
.cell-check input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: #1D4ED8;
}

/* Banner de sincronización continua de BCRA */
.bcra-sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 10px 0 14px;
  border-radius: 2px;
  font-size: 12.5px;
  line-height: 1.4;
  transition: all 0.25s ease;
}
.bcra-sync-active {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}
.bcra-sync-done {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(30, 64, 175, 0.2);
  border-top-color: #1E40AF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.pill-ok {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  background: #E8F5E9;
  color: #1B5E20;
  font-size: 11px;
  font-weight: 600;
}

/* ===========================================================
 * Seguimiento Judicial y Monitoreo Concursal Ley 24.522
 * =========================================================== */
.seg-card {
  background: #fff;
  border: 1px solid var(--border, #F0F0F0);
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.seg-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}
.seg-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.seg-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1, #0F172A);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.seg-cuit-badge {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  padding: 2px 8px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 2px;
}
.badge-novedad {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 2px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #FCD34D;
}
.seg-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 2px;
  border: 1px solid #e2e8f0;
}
@media (max-width: 768px) {
  .seg-timeline {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.seg-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.seg-step-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.seg-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  flex: none;
}
.seg-step.is-done .seg-step-dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.seg-step.is-pending .seg-step-dot {
  background: #f59e0b;
}
.seg-step-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.seg-step-sub {
  font-size: 11px;
  color: #64748b;
  margin-left: 16px;
}
.seg-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #e2e8f0;
  font-size: 13px;
}
.seg-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.seg-info-label {
  font-size: 11.5px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}
.seg-info-val {
  color: #1e293b;
  font-weight: 500;
}
.seg-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn-star-judicial {
  transition: transform 0.15s ease, color 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}
.btn-star-judicial:hover {
  transform: scale(1.18);
}
.btn-star-judicial:active {
  transform: scale(0.9);
}
.btn-star-judicial:disabled {
  opacity: 0.6;
  cursor: wait !important;
  transform: none !important;
}



