/* ============================================================
   Álvarez y Asociados · Intranet de procesos IA · tokens + base
   Magenta del estudio como color primario, vino para sidebar/headers.
   El oro vive SOLO como acento puntual (un detalle por vista).
   ============================================================ */

:root {
  /* Paleta Álvarez (default) */
  --bg:        #F7EEF2;
  --bg-2:      #F0E2E8;
  --surface:   #ffffff;
  --surface-2: #FBF6F8;
  --ink:       #221E20;
  --ink-2:     #443A3F;
  --muted:     #6A5C62;
  --muted-2:   #A8979F;
  --line:      #E6DCE0;
  --line-2:    #D5C6CC;

  /* Paleta Álvarez: vino y magenta */
  --navy:      #6E1B3A;
  --navy-2:    #4A1126;
  --azul:      #D41C64;
  --azul-soft: #FAE4ED;
  --azul-line: #F0C2D4;

  /* Oro: solo acentos */
  --oro:       #9a7a1e;
  --oro2:      #c2902f;
  --oro-soft:  #f6efdd;
  --oro-line:  #e3d3a6;

  /* Teal: motor Asistido (se distingue del azul de Automatizado) */
  --teal:      #0e7c86;
  --teal-soft: #e0f1f2;
  --teal-line: #b4dde0;

  /* Acción primaria / links / nav activa = magenta Álvarez */
  --primary:      #D41C64;
  --primary-2:    #4A1126;
  --primary-soft: #FAE4ED;

  /* Semáforos: verde / NARANJA / rojo */
  --ok:        #2e7d43;
  --ok-soft:   #e2f0e6;
  --warn:      #e08700;
  --warn-soft: #fdeed7;
  --err:       #c03b2e;
  --err-soft:  #f8e0dd;
  --info:      #D41C64;
  --info-soft: #FAE4ED;

  --shadow-sm: 0 1px 0 rgba(74, 17, 38, 0.04), 0 1px 2px rgba(74, 17, 38, 0.05);
  --shadow-md: 0 2px 4px rgba(74, 17, 38, 0.05), 0 8px 24px rgba(74, 17, 38, 0.08);
  --radius:    8px;
  --radius-lg: 12px;

  /* Densidad */
  --row-h:   40px;
  --pad-y:   14px;
  --pad-x:   18px;
  --gap:     16px;
  --fs-body: 13.5px;

  /* Tipografía: Mulish headings, Roboto cuerpo, IBM Plex Mono cifras/códigos */
  --font-sans:    "Roboto", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Mulish", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Paleta alternativa neutra: sin azul de marca, acento gris pizarra */
[data-palette="neutra"] {
  --bg:        #f4f5f6;
  --bg-2:      #eaecee;
  --surface:   #ffffff;
  --surface-2: #f7f8f9;
  --ink:       #1a1c1e;
  --ink-2:     #3d4145;
  --muted:     #767c82;
  --muted-2:   #adb3b9;
  --line:      #dcdfe2;
  --line-2:    #c6cacf;
  --navy:      #3d4752;
  --navy-2:    #262d34;
  --azul:      #4a5763;
  --azul-soft: #e6e9ec;
  --azul-line: #cdd2d7;
  --primary:      #3d4752;
  --primary-2:    #262d34;
  --primary-soft: #e6e9ec;
  --info:      #3d4752;
  --info-soft: #e6e9ec;
  --teal:      #4a6b6e;
  --teal-soft: #e4eaea;
  --teal-line: #cdd6d6;
}

[data-density="compact"] {
  --row-h: 34px;
  --pad-y: 10px;
  --pad-x: 14px;
  --gap:   12px;
  --fs-body: 13px;
}

[data-density="comfy"] {
  --row-h: 48px;
  --pad-y: 18px;
  --pad-x: 22px;
  --gap:   20px;
  --fs-body: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }
.mono   { font-family: var(--font-mono); font-feature-settings: "zero", "tnum"; }
.tnum   { font-variant-numeric: tabular-nums; }
.big    { font-weight: 650; letter-spacing: -0.02em; }
button  { font-family: inherit; }
a       { color: inherit; text-decoration: none; }

/* foco visible por teclado (accesibilidad): aplica a .btn, a, input, … */
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

/* ─────── Barra de marca (magenta Álvarez) ─────── */
.brandbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--azul);
  z-index: 60;
}

/* ─────── App shell ─────── */
.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  padding-top: 4px;
}

/* sidebar oscuro (navy) */
.sidebar {
  background: var(--navy);
  color: #fff;
  border-right: 1px solid var(--navy-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sb-brand {
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sb-logo-mark {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(160deg, #D41C64, #4A1126);
  color: #fff; font-family: 'Mulish', sans-serif; font-weight: 800;
  font-size: 14px; letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.sb-words { display: flex; flex-direction: column; line-height: 1.18; }
.sb-brand-btn {
  border: 0; background: transparent; cursor: pointer;
  width: 100%; justify-content: flex-start;
}
.sb-brand-btn:hover .sb-logo-mark { opacity: 0.9; }

/* contexto del área actual en el sidebar (reemplaza al selector de áreas) */
.sb-ctx { padding: 14px 16px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); position: relative; }
.sb-ctx-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(255, 255, 255, 0.5); }
.sb-ctx-name { font-family: 'Mulish', sans-serif; font-weight: 700; font-size: 14px; color: #fff; margin-top: 3px; }
.sb-ctx-switch {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85); border-radius: 7px; padding: 4px 9px;
  font-size: 11.5px; cursor: pointer;
}
.sb-ctx-switch:hover { background: rgba(255, 255, 255, 0.12); }
.sb-foot-pano { margin-top: 14px; }
.sb-pano-hint { padding: 0 16px 10px; font-size: 12px; color: rgba(255, 255, 255, 0.55); line-height: 1.45; }

/* breadcrumb clickeable */
.crumb-link {
  border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer;
  color: #D41C64;
}
.crumb-link:hover { text-decoration: underline; }

/* acceso al panorama, arriba del todo */
.sb-top { padding: 10px 8px 2px; }
.sb-top .sb-item { font-weight: 600; }
.sb-name { font-weight: 800; letter-spacing: 0.04em; font-size: 12.5px; color: #fff; }
.sb-sub  { font-size: 10.5px; color: rgba(255, 255, 255, 0.62); letter-spacing: 0.02em; margin-top: 1px; }

/* selector de área */
.sb-area { padding: 12px 12px 6px; }
.sb-area-lbl {
  font-size: 10px; color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  padding: 0 4px 6px;
}
.area-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  padding: 8px 10px;
  border: 0; border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  cursor: default;
  margin-bottom: 1px;
}
.area-item .ico { width: 15px; height: 15px; flex: 0 0 15px; opacity: 0.8; }
.area-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
}
.area-item.disabled {
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}
.area-item.disabled .seal {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

.sb-section {
  padding: 14px 14px 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.sb-nav { display: flex; flex-direction: column; padding: 0 8px; gap: 1px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  cursor: default;
  border: 0; background: transparent; text-align: left; width: 100%;
  white-space: nowrap;
}
.sb-nav .sb-item > span:last-child,
.sb-foot .sb-item > span:last-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
/* Proceso/pantalla todavía en maqueta: se muestra atenuado en el menú (sin etiqueta).
   Sigue navegable; su pantalla lleva el cartel de mockup y el contenido atenuado. */
.sb-item.soon { opacity: .45; }
.sb-item.soon:hover { opacity: .7; }

/* Pantalla en maqueta: cartel claro arriba + contenido atenuado y no interactivo. */
.mockup-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: #eef2f6; border: 1px solid #d6e0ea; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 20px;
  color: #3a4a5a; font-size: 13.5px; line-height: 1.5;
}
.mockup-banner .mb-ico { color: var(--navy); flex: 0 0 auto; margin-top: 1px; }
.mockup-banner b { color: var(--navy); }
.mockup-dim { opacity: .5; pointer-events: none; user-select: none; }
/* Fila de proceso todavía en maqueta en el tablero: atenuada (sigue navegable). */
.eb-row.soon { opacity: .5; }
.sb-item.active {
  background: var(--azul);
  color: #fff;
  font-weight: 600;
}
.sb-item .ico { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: .9; }
.sb-item .badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 0;
}

.sb-foot {
  margin-top: auto;
  padding: 10px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sb-foot .sb-item { font-size: 12.5px; }
.demo-note {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 8px 10px 4px;
}

/* ─────── Login simulado ─────── */
.login-screen {
  min-height: 100vh;
  padding-top: 4px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--azul-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px 30px 22px;
  margin: 40px 20px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.login-mark {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(160deg, #D41C64, #4A1126);
  color: #fff; font-family: 'Mulish', sans-serif; font-weight: 800;
  font-size: 17px; letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.login-titles h1 {
  margin: 0; font-family: var(--font-display); font-weight: 800;
  font-size: 19px; color: var(--navy); letter-spacing: -0.01em; line-height: 1.2;
}
.login-titles .login-sub {
  font-size: 12px; color: var(--azul); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; margin-top: 3px;
}
.login-lead { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 22px; }

.login-section-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.login-areas { display: flex; flex-direction: column; gap: 8px; }
.login-area {
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  position: relative;
}
.login-area:hover { border-color: var(--azul); background: var(--azul-soft); }
.login-area-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--navy); }
.login-area-user { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-area-go {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--azul); font-weight: 600; font-size: 12.5px;
}

.login-dim {
  margin-top: 12px; font-size: 11.5px; color: var(--muted-2); line-height: 1.5;
}
.login-dim-lbl { font-weight: 600; color: var(--muted); }
.login-dim-list { display: block; margin-top: 2px; }

.login-or {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--muted-2); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.login-or::before, .login-or::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.login-sistemas {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--navy); color: #fff;
  border: 1px solid var(--navy-2); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer;
}
.login-sistemas:hover { background: var(--navy-2); }
.login-sistemas-ico {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12); color: #fff;
}
.login-sistemas-txt { display: flex; flex-direction: column; flex: 1; }
.login-sistemas-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.login-sistemas-note { font-size: 12px; color: rgba(255, 255, 255, 0.78); margin-top: 2px; }
.login-sistemas-go { color: rgba(255, 255, 255, 0.9); font-weight: 600; font-size: 12.5px; }

.login-foot {
  margin-top: 20px; text-align: center;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2);
}

/* ─────── Sidebar: usuario de la sesión + cerrar sesión ─────── */
.sb-user { padding: 4px 4px 0; }
.sb-user-line { display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.sb-user-ico { color: rgba(255, 255, 255, 0.7); flex: 0 0 auto; }
.sb-user-name { font-weight: 600; font-size: 12.5px; color: #fff; }
.sb-user-role { padding: 0 10px; font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-top: 1px; }
.sb-user-out {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85); border-radius: 7px; padding: 4px 9px;
  font-size: 11.5px; cursor: pointer;
}
.sb-user-out:hover { background: rgba(255, 255, 255, 0.12); }

/* ─────── Topbar: indicador de modo Sistemas ─────── */
.tb-mode {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  color: var(--navy); background: #e6edf3;
  border: 1px solid #c5d3e0; border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
}

/* ─────── Main area ─────── */
.main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex: 0 0 56px;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs .here { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--muted-2); }

.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  width: 280px;
  color: var(--muted);
}
.search input { all: unset; flex: 1; font-size: 13px; color: var(--ink); }
.search .kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.tb-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: default;
}
.tb-action:hover { background: var(--bg-2); }

.content {
  flex: 1 1 auto;
  overflow: auto;
  padding: 28px 32px 60px;
  min-height: 0;
}

/* ─────── Headings ─────── */
.page-h {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-h h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--navy);
}
.page-h .eyebrow {
  font-size: 11px;
  color: var(--azul);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-h .sub { color: var(--muted); font-size: 13.5px; max-width: 72ch; }

/* ─────── Cards ─────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--pad-y) var(--pad-x); }
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.card-h h3 { margin: 0; font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: -0.005em; color: var(--navy); }
.card-h .h-sub { font-size: 12px; color: var(--muted); }

/* ─────── Stat tiles (KPIs) ─────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-bottom: 24px;
}
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.five { grid-template-columns: repeat(5, 1fr); }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tile .label, .tile .value, .tile .delta { position: relative; z-index: 1; }
/* KPI tintado por tono de estado + ícono ghost gigante difuminado al costado */
.tile.tone-warn { background: #fdf4e4; border-color: #f3ddb6; }
.tile.tone-warn .label { color: #a96a06; }
.tile.tone-warn .delta { color: #a96a06; }
.tile.tone-warn .tile-ghost { color: var(--warn); }
.tile.tone-info { background: #ebf1fb; border-color: #c8d6ee; }
.tile.tone-info .label { color: var(--azul); }
.tile.tone-info .delta { color: #3a5a99; }
.tile.tone-info .tile-ghost { color: var(--azul); }
.tile.tone-ok { background: #e8f2ec; border-color: #c2ddcc; }
.tile.tone-ok .label { color: var(--ok); }
.tile.tone-ok .delta { color: #3f7a54; }
.tile.tone-ok .tile-ghost { color: var(--ok); }
.tile .label {
  font-family: var(--font-display);
  font-size: 11.5px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700;
}
.tile .value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 7px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 7px;
}
.tile .value .unit { font-family: var(--font-sans); font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.tile .delta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.tile .delta strong { color: var(--ink-2); font-weight: 600; }
.tile .delta.up { color: var(--ok); }
.tile .delta.dn { color: var(--err); }
.tile .tile-ghost {
  position: absolute; right: -22px; bottom: -26px;
  opacity: 0.13; pointer-events: none; z-index: 0;
}

/* ─────── Tarjetas-proceso del dashboard ─────── */
.proc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.proc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  cursor: default;
  box-shadow: var(--shadow-sm);
}
.proc-card.linkable { cursor: pointer; }
.proc-card.linkable:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
.proc-card .proc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.proc-card h3 { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.proc-card .proc-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; flex: 1; }
.proc-card .proc-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.proc-card .proc-foot .estado { color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.proc-card .proc-foot .estado.muted { color: var(--muted-2); }
/* link chico "Ver detalle": navega a la página del proceso (aparte del botón
   de acción). No hace clickeable toda la tarjeta a propósito. */
.proc-card .proc-foot .ver-detalle {
  margin-left: auto;
  border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer;
  color: var(--azul); font-weight: 600; font-size: 12px; white-space: nowrap;
}
.proc-card .proc-foot .ver-detalle:hover { text-decoration: underline; }
/* pie de acción: el botón que depende del motor (lanzar vs navegar) */
.proc-card .proc-act { display: flex; align-items: center; margin-top: 2px; }
.proc-card .proc-rel {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-2);
}
/* "Abrir en Cowork": botón de lanzar (no navegar). Acento sutil para que se
   note que abre Claude Cowork con el instructivo del proceso. */
.btn.cowork {
  background: var(--azul-soft);
  color: var(--azul);
  border-color: var(--azul-line);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.cowork:hover { background: #dbe6f6; border-color: var(--azul); }
.btn.cowork .corner, .btn.cowork svg { color: var(--azul); }

/* ─────── Panorama de áreas (home) ─────── */
.area-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.area-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  cursor: default;
  box-shadow: var(--shadow-sm);
}
.area-card.linkable { cursor: pointer; }
.area-card.linkable:hover { border-color: var(--azul-line); box-shadow: var(--shadow-md); }
.area-card.dim { background: var(--surface-2); cursor: not-allowed; }
.area-card .area-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.area-card h3 {
  margin: 0; font-size: 15px; font-weight: 800;
  color: var(--navy); line-height: 1.2;
}
.area-card.dim h3 { color: var(--muted); }
.area-card .area-desc { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.area-card .seal-rel {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 4px;
  padding: 2px 7px; white-space: nowrap; flex: 0 0 auto;
}
.area-card .area-empty {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto;
  font-size: 12.5px; color: var(--muted-2);
}

/* spotlight de un área poblada */
.spotlight { margin-top: 2px; display: flex; flex-direction: column; gap: 10px; }
.spotlight .spot-head { display: flex; align-items: baseline; gap: 7px; }
.spotlight .spot-total {
  font-family: var(--font-mono); font-weight: 600;
  font-size: 26px; line-height: 1; letter-spacing: -0.02em; color: var(--ink);
}
.spotlight .spot-total-lbl {
  font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  font-family: var(--font-display);
}
.spotlight .spot-bar {
  display: flex; gap: 3px; height: 7px; width: 100%;
}
.spotlight .spot-seg { border-radius: 3px; min-width: 8px; }
.spotlight .spot-seg.auto     { background: var(--azul); }
.spotlight .spot-seg.asistido { background: var(--teal); }
.spotlight .spot-seg.relevar  { background: var(--line-2); }
.spotlight .spot-legend { display: flex; flex-wrap: nowrap; gap: 10px; }
.spotlight .spot-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: var(--ink-2); font-weight: 600;
}
.spotlight .spot-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.spotlight .spot-dot.auto { background: var(--azul); }
.spotlight .spot-dot.asistido { background: var(--teal); }
.spotlight .spot-dot.relevar { background: var(--line-2); }
.spotlight .spot-now {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--warn);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 6px; padding: 5px 10px; align-self: flex-start;
}
.spotlight .spot-now b { font-weight: 700; }

/* ─────── Etiqueta de motor (sistema global) ─────── */
.motor {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.motor::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.motor.auto     { background: var(--azul-soft); color: var(--azul); border-color: var(--azul-line); }
.motor.asistido { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.motor.relevar  { background: var(--bg-2); color: var(--muted); border-color: var(--line-2); }

/* leyenda de etiquetas al pie */
.leyenda {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.leyenda h4 {
  margin: 0 0 12px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
}
.leyenda .ley-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.leyenda .ley-row .motor { flex: 0 0 auto; }
.leyenda .ley-row b { color: var(--ink-2); font-weight: 500; }

/* ─────── Badges & pills ─────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.dot::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge.green { background: var(--ok-soft);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.badge.warn  { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.red   { background: var(--err-soft);  color: var(--err);  border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.badge.blue  { background: var(--azul-soft); color: var(--azul); border-color: var(--azul-line); }
.badge.navy  { background: #e6edf3; color: var(--navy); border-color: #c5d3e0; }

/* punto de semáforo */
.sem-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.sem-dot.ok   { background: var(--ok); }
.sem-dot.warn { background: var(--warn); }
.sem-dot.err  { background: var(--err); }
.sem-dot.wait { background: var(--azul); }

/* ─────── Buttons ─────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: default;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-2); }
/* Botón primario: magenta Álvarez con texto blanco */
.btn.primary {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
  font-weight: 600;
}
.btn.primary:hover { background: var(--navy); border-color: var(--navy); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* ─────── Tables ─────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  padding: 11px 14px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th {
  font-weight: 600;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  position: sticky; top: 0;
  z-index: 1;
}
.tbl tbody tr:hover { background: var(--bg); cursor: default; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }
.tbl td.right, .tbl th.right { text-align: right; }
.tbl.dense th, .tbl.dense td { padding: 8px 12px; font-size: 12.5px; }

/* ─────── Stub ─────── */
.stub {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}
.stub .stub-flag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--oro);
  background: var(--oro-soft);
  border: 1px solid var(--oro-line);
  border-radius: 5px;
  padding: 4px 10px;
  margin-top: 16px;
}
.stub p { color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 64ch; margin: 14px 0 0; }

/* ─────── Página-tipo de proceso: marca (última ejecución) + historial ─────── */
/* Resultado de una marca: punto de semáforo + texto, mismo lenguaje para todos. */
.marca-res {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600;
}
.marca-res.ok   { color: var(--ok); }
.marca-res.warn { color: var(--warn); }
.marca-res.err  { color: var(--err); }

.marca-card .card-pad { padding: 16px 18px 18px; }
.marca-grid {
  display: flex; gap: 32px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.marca-kv { display: flex; flex-direction: column; gap: 3px; }
.marca-kv .k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700;
}
.marca-kv b { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.marca-kv b.mono { font-family: var(--font-mono); }

.marca-resumen { font-size: 14px; color: var(--ink); line-height: 1.5; }
.marca-pend {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 12px; font-size: 13px; color: var(--ink-2); line-height: 1.45;
}
.marca-pend b { color: var(--warn); font-weight: 700; }
.marca-pend .sem-dot { position: relative; top: 1px; }
.marca-limpio { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.marca-nota {
  margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45;
  font-style: italic;
}
.marca-acts { display: flex; gap: 8px; margin-top: 16px; }

/* ─────── Misc ─────── */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.row { display: flex; gap: 8px; align-items: center; }
.row.gap-lg { gap: 16px; }
.spread { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); }
.dim   { color: var(--muted-2); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }

/* aviso de tope de página (guardado / error / info) */
.aviso {
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 14px;
}
.aviso.ok   { background: var(--ok-soft);   color: var(--ok); }
.aviso.err  { background: var(--err-soft);  color: var(--err); }
.aviso.info { background: var(--azul-soft);  color: var(--azul); }

/* ── Toast global: feedback flotante de acciones (guardar, agregar…). Lo dispara
      ?flash=<código> vía _shell; app.js lo autocierra a los ~4.5s y limpia el query. ── */
.nota-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(92vw, 420px);
}
.nota {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 32, 45, 0.16);
  font-size: 13.5px; color: var(--ink);
  animation: nota-in .22s ease-out;
}
.nota::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--ink-2);
}
.nota.ok::before   { background: var(--ok); }
.nota.err::before  { background: var(--err); }
.nota.info::before { background: var(--azul); }
.nota .nota-txt { flex: 1; }
.nota .nota-x {
  flex: none; display: inline-flex; align-items: center;
  background: none; border: 0; cursor: pointer; color: var(--ink-2);
  padding: 3px; border-radius: 5px;
}
.nota .nota-x:hover { background: var(--bg-2); color: var(--ink); }
.nota.saliendo { animation: nota-out .25s ease-in forwards; }
@keyframes nota-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nota-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(12px); } }

/* ── Servicio en Configuración: cada servicio como una tarjeta con aire propio,
      para que sus campos, estado y botones se lean como una unidad. ── */
.entidad {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.entidad:last-of-type { margin-bottom: 0; }
.entidad-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.entidad-h > b { font-size: 14.5px; }
.entidad-h .badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entidad-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.entidad-foot .ult-prueba { margin-left: auto; font-size: 12px; color: var(--ink-2); }

/* banner solo lectura / demo */
.banner-ro {
  background: var(--azul-soft);
  color: var(--azul);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 8px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--azul-line);
}

/* ─────── Modal ─────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(74, 17, 38, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 40px;
}
/* <dialog> nativo: el fondo lo oscurece ::backdrop (no el viejo .modal-bg). */
dialog::backdrop { background: rgba(74, 17, 38, 0.4); backdrop-filter: blur(2px); }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-h {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-h h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--navy); }
.modal-body { padding: 22px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-f {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-2);
}

/* ─────── Toasts ─────── */
.nota-host {
  position: fixed;
  right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300;
  pointer-events: none;
}
.nota {
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nota.in { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════════════════════════════════
   Topbar derecha + menú de usuario
   ════════════════════════════════════════════════════════════ */
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tb-demo {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px;
}

.user-menu { position: relative; }
.um-btn {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 5px 9px 5px 6px; cursor: pointer;
}
.um-btn:hover { background: var(--bg-2); }
.um-av {
  width: 30px; height: 30px; border-radius: 7px; flex: 0 0 30px;
  background: linear-gradient(160deg, #D41C64, #4A1126); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.um-av.lg { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; border-radius: 9px; }
.um-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.um-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.um-role { font-size: 11px; color: var(--muted); }
.um-caret { color: var(--muted-2); }

.um-overlay { position: fixed; inset: 0; z-index: 199; }
.um-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 244px; z-index: 200;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 8px;
}
.um-head {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 8px 12px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.um-head-txt .um-name { font-size: 13.5px; }
.um-head-txt .um-role { font-size: 11.5px; line-height: 1.3; }
.um-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
}
.um-item:hover { background: var(--bg-2); }
.um-item svg { color: var(--muted); }
.um-item.danger { color: var(--err); }
.um-item.danger svg { color: var(--err); }
.um-item.danger:hover { background: var(--err-soft); }
.um-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.um-foot {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2);
  text-align: center; padding: 8px 0 4px;
}

/* ════════════════════════════════════════════════════════════
   Dashboard: gráficos + tablero de estados
   ════════════════════════════════════════════════════════════ */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.panel { display: flex; flex-direction: column; }

/* barra horizontal (gráfico simple) */
.barrow { margin-bottom: 14px; }
.barrow:last-child { margin-bottom: 0; }
.barrow-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.barrow-lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.barrow-val {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.barrow-track { height: 9px; background: var(--bg-2); border-radius: 5px; overflow: hidden; }
.barrow-fill { display: block; height: 100%; border-radius: 5px; transition: width 0.5s ease; }
.barrow-fill.auto     { background: var(--azul); }
.barrow-fill.asistido { background: var(--teal); }
.barrow-fill.relevar  { background: var(--line-2); }
.barrow-fill.ok       { background: var(--ok); }
.barrow-fill.wait     { background: var(--azul); opacity: 0.4; }

/* donut: procesos por motor */
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; flex: 0 0 132px; }
.donut circle { transition: stroke-dasharray 0.6s ease; }
.donut-num { font-family: var(--font-mono); font-weight: 600; font-size: 30px; fill: var(--ink); }
.donut-lbl { font-family: var(--font-display); font-size: 10px; fill: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dl-row { display: flex; align-items: center; gap: 10px; }
.dl-dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 11px; }
.dl-name { font-size: 13px; color: var(--ink-2); flex: 1; }
.dl-val { font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--ink); }

/* tablero semáforo de procesos */
.estado-board { display: flex; flex-direction: column; }
.eb-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: default;
  padding: 11px 18px; border-bottom: 1px solid var(--line); font: inherit;
}
.eb-row:last-child { border-bottom: 0; }
.eb-row:hover { background: var(--bg); }
.eb-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.eb-dot.ok { background: var(--ok); }
.eb-dot.warn { background: var(--warn); }
.eb-dot.err { background: var(--err); }
.eb-dot.none { background: var(--line-2); }
.eb-name { font-size: 13px; font-weight: 600; color: var(--navy); flex: 0 0 210px; }
.eb-row .motor { flex: 0 0 auto; }
.eb-estado { font-size: 12.5px; color: var(--muted); flex: 1; }
.eb-go { color: var(--muted-2); flex: 0 0 auto; }

/* ════════════════════════════════════════════════════════════
   Panel de impacto (antes / ahora / ROI) en la página de proceso
   ════════════════════════════════════════════════════════════ */
.impacto {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--gap);
}
.impacto-col { padding: 16px 20px; }
.impacto-col.ahora { border-left: 1px solid var(--line); background: var(--azul-soft); }
.impacto-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 6px;
}
.impacto-col.ahora .impacto-lbl { color: var(--azul); }
.impacto-col p { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.45; }
.impacto-roi {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px 22px; background: var(--navy); color: #fff; text-align: center;
  min-width: 116px;
}
.impacto-roi-num {
  font-family: var(--font-mono); font-weight: 600; font-size: 30px; line-height: 1;
  letter-spacing: -0.02em;
}
.impacto-roi-lbl { font-size: 10.5px; color: rgba(255,255,255,0.8); margin-top: 5px; line-height: 1.25; }

/* ════════════════════════════════════════════════════════════
   Historial del área (línea de tiempo)
   ════════════════════════════════════════════════════════════ */
.hist-filtros { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip-f {
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--muted); border-radius: 999px; padding: 5px 13px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.chip-f:hover { border-color: var(--azul-line); color: var(--ink-2); }
.chip-f.on { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }

.timeline { padding: 6px 4px; }
.tl-row {
  display: flex; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); position: relative;
}
.tl-row:last-child { border-bottom: 0; }
/* riel vertical que une los puntos */
.tl-row::before {
  content: ""; position: absolute; left: 25px; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}
.tl-row:first-child::before { top: 18px; }
.tl-row:last-child::before { bottom: auto; height: 18px; }
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px;
  margin-top: 4px; position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--surface);
}
.tl-dot.ok { background: var(--ok); }
.tl-dot.warn { background: var(--warn); }
.tl-dot.err { background: var(--err); }
.tl-dot.none { background: var(--line-2); }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tl-proc {
  border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit;
  font-weight: 700; font-size: 13.5px; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.tl-proc:hover { color: var(--azul); text-decoration: underline; }
.tl-fecha {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted-2);
  white-space: nowrap; flex: 0 0 auto;
}
.tl-resumen { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 3px; }
.tl-quien { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tl-pend { color: var(--warn); }

/* nota al pie de la leyenda de motores */
.ley-nota {
  margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); line-height: 1.5;
}

/* responsive angosto: gráficos y panel de impacto apilados */
@media (max-width: 1080px) {
  .dash-cols { grid-template-columns: 1fr; }
  .impacto { grid-template-columns: 1fr; }
  .impacto-col.ahora { border-left: 0; border-top: 1px solid var(--line); }
  .impacto-roi { flex-direction: row; gap: 10px; }
}

/* ════════════════════════════════════════════════════════════
   Ayuda a demanda: modal de etiquetas + modal por proceso
   ════════════════════════════════════════════════════════════ */
.ayuda-motores { display: flex; flex-direction: column; gap: 14px; }
.ayuda-row { display: flex; align-items: baseline; gap: 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ayuda-row .motor { flex: 0 0 auto; position: relative; top: 1px; }
.ayuda-nota {
  margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
}

.ayuda-proc { display: flex; flex-direction: column; gap: 14px; }
.ayuda-proc-desc { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.5; }
.ayuda-proc-imp {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.ayuda-proc-imp > div { padding: 13px 16px; }
.ayuda-proc-imp > div:last-child { border-left: 1px solid var(--line); background: var(--azul-soft); }
.ayuda-proc-imp .k, .ayuda-proc-como .k {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.ayuda-proc-imp > div:last-child .k { color: var(--azul); }
.ayuda-proc-imp p { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.45; }
.ayuda-proc-como p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ayuda-proc-nota { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; font-style: italic; }

/* tablero de estados: nombre clickeable + ayuda (?) + ir */
.eb-name-btn {
  border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--navy); flex: 0 0 200px; padding: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eb-name-btn:hover { color: var(--azul); text-decoration: underline; }
.eb-help {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  font-family: var(--font-display); font-size: 12px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.eb-help:hover { border-color: var(--azul); color: var(--azul); background: var(--azul-soft); }
.eb-go-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--muted-2);
  padding: 0; display: inline-flex; align-items: center; flex: 0 0 auto;
}
.eb-go-btn:hover { color: var(--azul); }

/* ════════════════════════════════════════════════════════════
   Selector de área (popover en el sidebar, perfil Sistemas)
   ════════════════════════════════════════════════════════════ */
.sb-area-ctrl {
  margin-top: 7px; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 8px 11px; cursor: pointer; color: #fff;
}
.sb-area-ctrl:hover { background: rgba(255,255,255,.13); }
.sb-area-ctrl-name { font-family: var(--font-display); font-weight: 700; font-size: 13px; text-align: left; }
.sb-area-ctrl svg { color: rgba(255,255,255,.7); flex: 0 0 auto; }
.sb-area-overlay { position: fixed; inset: 0; z-index: 40; }
.sb-area-pop {
  position: absolute; left: 16px; right: 16px; top: calc(100% - 6px); z-index: 50;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 28px rgba(74,17,38,.3); padding: 6px;
}
.sb-area-pop-lbl {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-2); font-weight: 700; padding: 6px 8px 5px;
}
.sb-area-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 7px; padding: 8px 9px; font: inherit; cursor: pointer;
}
.sb-area-opt.active { background: var(--azul-soft); }
.sb-area-opt.disabled { cursor: not-allowed; }
.sb-area-opt:not(.disabled):hover { background: var(--azul-soft); }
.sb-area-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: 0 0 7px; }
.sb-area-dot.on { background: var(--azul); }
.sb-area-opt-name { font-size: 12.5px; color: var(--muted-2); flex: 1; }
.sb-area-opt.active .sb-area-opt-name { color: var(--navy); font-weight: 700; }
.sb-area-check { color: var(--azul); flex: 0 0 auto; }
.sb-area-pop .seal-l {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-2); border: 1px solid var(--line-2); border-radius: 3px; padding: 1px 5px; white-space: nowrap;
}

/* pulso del día + botón entrar (card del panorama, área poblada) */
.area-pulse {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px;
}
.area-pulse b { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.area-enter {
  margin-top: auto; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  background: var(--azul); color: #fff; border: 0; border-radius: 8px;
  padding: 10px; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px;
}
.area-enter:hover { background: var(--navy); }

/* ── Dropdown de usuario con <details> (server-rendered; reemplaza el de React) ── */
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::marker { content: ""; }
.user-menu[open] > summary .um-caret { transform: rotate(180deg); }

/* ── Prueba de conexión: detalle en la tarjeta + modal de progreso ─────────── */
.bank-detalle { margin: 4px 0 0; font-size: 12px; color: #b23b3b; line-height: 1.35; }

.pasos { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.paso { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--navy); }
.paso.hecho { color: var(--ok); }
.paso.hecho::before { content: "✓"; display: inline-flex; width: 18px; justify-content: center; color: var(--ok); font-weight: 700; }
.paso.activo { font-weight: 600; }
.paso.hecho .paso-spin { display: none; }   /* al pasar a "hecho", se apaga el spinner */
.paso-spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15); border-top-color: var(--azul);
  display: inline-block; animation: mp-spin .7s linear infinite; flex: 0 0 auto;
}
@keyframes mp-spin { to { transform: rotate(360deg); } }

.mp-resultado { margin-top: 16px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; }
.mp-resultado.ok  { background: var(--ok-soft);  color: var(--ok);  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.mp-resultado.err { background: var(--err-soft); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 25%, transparent); }
