[hidden] { display: none !important; }

:root {
  --empresa: #DCE7FF;
  --pivot-font: var(--font);
  --pivot-size: 12px;
  --grid-font: var(--font);
  --grid-size: 13px;
  --canvas: #F3F5F8;
  --surface: #FFFFFF;
  --ink: #18202B;
  --muted: #5B6573;
  --line: #DCE1E8;
  --primary: #1F4FD1;
  --group: var(--primary);
  --radius: 6px;
  --font: "Public Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
}
.dx-widget, .dx-datagrid { font-family: var(--font) !important; }
.dx-datagrid .dx-row > td { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Ingreso ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 40px 36px;
}
.swatches { display: flex; gap: 6px; margin-bottom: 28px; }
.swatches span { width: 28px; height: 40px; border-radius: 3px; background: var(--c); }
.login h1 { font-size: 40px; letter-spacing: -0.02em; margin: 0 0 8px; }
.login p { color: var(--muted); margin: 0 0 28px; max-width: 34ch; }
.login-error { color: #B23A48 !important; font-weight: 500; }
.btn-ms {
  display: inline-block; background: var(--ink); color: #fff; text-decoration: none;
  padding: 11px 20px; border-radius: var(--radius); font-weight: 600;
}
.btn-ms:hover { background: #2C3747; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; height: 100vh; height: 100dvh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  min-height: 0;
}
.brand { padding: 0 8px 10px; }
.brand-nombre { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 22px; letter-spacing: -0.02em; }
.brand span { color: var(--muted); }
.field-label { font-size: 12px; color: var(--muted); padding: 0 8px 4px; }
#empresa { margin: 0 4px 18px; }

.menu { flex: 1; overflow-y: auto; min-height: 0; }
.menu-group { margin-bottom: 14px; }
.menu-group h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin: 0; padding: 6px 8px;
}
.menu-group h2::before {
  content: ""; width: 10px; height: 14px; border-radius: 2px; background: var(--c);
}
.menu-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: none; font: inherit; color: var(--ink);
  padding: 7px 8px 7px 26px; border-radius: var(--radius); cursor: pointer;
}
.menu-item:hover { background: var(--canvas); }
.menu-item[aria-current="page"] {
  background: color-mix(in srgb, var(--c) 12%, white);
  color: color-mix(in srgb, var(--c) 80%, black);
  font-weight: 600;
}

.user {
  border-top: 1px solid var(--line); padding: 14px 8px 0;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px;
}
.link-btn { border: 0; background: none; color: var(--primary); font: inherit; cursor: pointer; padding: 0; }

/* ---------- Contenido ---------- */
.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 20px 24px 16px; }
.content-head { display: grid; grid-template-columns: auto minmax(0, max-content) minmax(0, 1fr); gap: 14px; align-items: center; }
#toolbar { min-width: 0; }
.pigment { width: 10px; height: 44px; border-radius: 3px; background: var(--group); transition: background .2s; }
.titles h1 { font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.titles p { margin: 2px 0 0; color: var(--muted); }
.subbar { display: flex; align-items: center; gap: 18px; margin: 10px 0 10px 24px; min-height: 34px; flex-wrap: wrap; }
.periodo { display: flex; align-items: center; gap: 8px; }
.periodo .field-label { padding: 0; }
#mes { width: 150px; }
#ano { width: 100px; }
.estado { color: var(--muted); font-size: 12px; }
.area { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.grid {
  flex: 1; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Formato aplicado al grid ---------- */
#grid .dx-widget, #grid .dx-datagrid .dx-row > td, #grid .dx-datagrid .dx-header-row > td {
  font-family: var(--grid-font) !important;
  font-size: var(--grid-size) !important;
}
#grid[data-densidad="compacta"] .dx-datagrid .dx-row > td { padding-top: 3px !important; padding-bottom: 3px !important; }
#grid[data-densidad="compacta"] .dx-datagrid .dx-header-row > td { padding-top: 6px !important; padding-bottom: 6px !important; }
#grid[data-densidad="amplia"] .dx-datagrid .dx-row > td { padding-top: 13px !important; padding-bottom: 13px !important; }

/* ---------- Panel de formato ---------- */
.fmt-tab { padding: 16px 4px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; height: 100%; }
.fmt-row { display: grid; gap: 4px; }
.fmt-row > label { font-size: 12px; color: var(--muted); }
.fmt-row > label:empty { display: none; }
.fmt-nota { color: var(--muted); font-size: 12px; margin: 0; }
.fmt-lista h3 { font-size: 13px; margin: 14px 0 6px; }
.fmt-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.fmt-item > span:nth-child(2) { flex: 1; }
.fmt-muestra { width: 32px; text-align: center; border: 1px solid var(--line); border-radius: 4px; font-weight: 600; }

/* ---------- Vistas ---------- */
.vista-item { display: flex; align-items: center; gap: 8px; }
.vista-nombre { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.vista-vacia { color: var(--muted); }
.vista-badge { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--canvas); color: var(--muted); }
.vista-badge.std { background: color-mix(in srgb, var(--group) 14%, white); color: color-mix(in srgb, var(--group) 80%, black); }
.vista-borrar { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.vista-borrar:hover { background: #F6E3E6; color: #B23A48; }

/* ---------- Dinámica y gráfica ---------- */
.nota-filtros { margin: -4px 0 8px 24px; font-size: 12px; color: var(--muted); }
.chart-wrap { display: flex; flex-direction: column; padding: 12px 16px; }
.chart-cfg { display: flex; flex-wrap: wrap; gap: 10px 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cfg-item { display: grid; gap: 3px; }
.cfg-item .field-label { padding: 0; }
.chart { flex: 1; min-height: 320px; padding-top: 12px; }
.chart-vacio { display: grid; place-items: center; color: var(--muted); }

/* ---------- Pestañas estándar (cada una con su pastel) ---------- */
.pestanas { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.pestanas[hidden] { display: none !important; }
.pestanas-rotulo { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pestanas-tabs { flex: 1; min-width: 0; }
.pestanas .dx-tabs, .pestanas .dx-tabs-wrapper { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.pestanas .dx-tabs-wrapper { display: flex !important; justify-content: flex-start; }
.pestanas .dx-tab { flex: 0 0 auto !important; width: auto !important; }
.pestanas .dx-tab { padding: 2px 3px !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.pestanas .dx-tab::after, .pestanas .dx-tab-selected::after, .pestanas .dx-tab::before,
.pestanas .dx-tab-content::after, .pestanas .dx-tab-content::before { display: none !important; }
.pestana {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: var(--p); color: #2A3240; font-weight: 500; border: 1px solid transparent;
  transition: box-shadow .15s, transform .15s;
}
.dx-tab:hover .pestana { box-shadow: 0 1px 4px rgba(24, 32, 43, .12); }
.dx-tab-selected .pestana {
  font-weight: 700; color: #141A23;
  border-color: color-mix(in srgb, var(--p) 45%, #18202B);
  box-shadow: 0 2px 6px rgba(24, 32, 43, .14);
}

/* ---------- Administración ---------- */
.admin { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 14px; }
.admin .grid { padding: 4px; }
.admin-nota { color: var(--muted); font-size: 12px; margin: 0 0 10px; max-width: 80ch; }

/* ---------- Formato aplicado a la dinámica ---------- */
#pivot .dx-pivotgrid, #pivot .dx-pivotgrid td, #pivot .dx-pivotgrid .dx-area-description-cell {
  font-family: var(--pivot-font) !important;
  font-size: var(--pivot-size) !important;
}
#pivot[data-densidad="compacta"] .dx-pivotgrid .dx-pivotgrid-area td { padding: 3px 8px !important; }
#pivot[data-densidad="amplia"] .dx-pivotgrid .dx-pivotgrid-area td { padding: 12px 12px !important; }
#pivot[data-totales="si"] .dx-pivotgrid .dx-total { background: color-mix(in srgb, var(--group) 7%, white) !important; font-weight: 600; }
#pivot[data-totales="si"] .dx-pivotgrid .dx-grandtotal { background: color-mix(in srgb, var(--group) 14%, white) !important; font-weight: 700; }
.fmt-h { font-size: 13px; margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.fmt-h:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Administración de pestañas ---------- */
.admin { overflow-y: auto; }
.adm-barra { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.adm-titulo { font-size: 14px; margin: 16px 0 6px; }
.adm-grid { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }

/* =====================================================================
   PWA, tableta y móvil
   ===================================================================== */
.topbar, .velo { display: none; }

.btn-instalar {
  margin: 8px 4px 10px; padding: 8px 10px; border-radius: var(--radius);
  border: 1px dashed var(--line); background: var(--canvas); color: var(--ink);
  font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.btn-instalar:hover { border-color: var(--primary); color: var(--primary); }

.aviso-version, .aviso-red {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 3000;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: #fff; padding: 10px 14px 10px 18px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(24, 32, 43, .25); font-size: 14px; max-width: calc(100vw - 24px);
}
.aviso-red { background: #8A2D3A; bottom: calc(72px + env(safe-area-inset-bottom)); }
.aviso-version[hidden], .aviso-red[hidden] { display: none; }
.aviso-version button {
  border: 0; border-radius: 6px; padding: 7px 12px; font: inherit; font-weight: 600;
  background: #fff; color: var(--ink); cursor: pointer;
}

/* Ventana instalada en escritorio con controles superpuestos */
@media (display-mode: window-controls-overlay) {
  .content { padding-top: max(20px, env(titlebar-area-height, 0px)); }
}

/* ---------- Tableta horizontal: barra lateral más angosta ---------- */
@media (max-width: 1280px) and (min-width: 1024px) {
  .shell { grid-template-columns: 220px 1fr; }
  .content { padding: 16px 18px 12px; }
}

/* ---------- Tableta vertical y móvil: menú deslizable ---------- */
@media (max-width: 1023px) {
  .shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

  .topbar {
    display: flex; align-items: center; gap: 12px; flex: none;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px calc(10px + env(safe-area-inset-left));
    background: var(--ink); color: #fff;
  }
  .topbar-marca { font-size: 18px; letter-spacing: -0.02em; }
  .topbar-titulo { color: #C9D1DC; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-btn {
    width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
    display: grid; align-content: center; justify-items: center; gap: 5px; border-radius: 8px;
  }
  .menu-btn span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }
  .menu-btn:focus-visible { outline: 2px solid #fff; }

  .sidebar {
    position: fixed; z-index: 2000; top: 0; bottom: 0; left: 0;
    width: min(310px, 86vw); border-right: 1px solid var(--line);
    padding: calc(20px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
    transform: translateX(-102%); transition: transform .22s ease-out;
    box-shadow: 0 0 40px rgba(24, 32, 43, .25);
  }
  .shell.menu-abierto .sidebar { transform: none; }
  .velo { display: block; position: fixed; inset: 0; z-index: 1999; background: rgba(24, 32, 43, .38); }
  .velo[hidden] { display: none; }

  .menu-item { padding: 11px 8px 11px 26px; }          /* objetivos táctiles de 44 px */
  .menu-group h2 { padding: 8px; }

  .content { flex: 1; min-height: 0; padding: 12px 12px calc(8px + env(safe-area-inset-bottom)); }
  .content-head { grid-template-columns: auto 1fr; gap: 10px 12px; }
  .content-head .pigment { height: 36px; }
  .titles h1 { font-size: 19px; }
  #toolbar { grid-column: 1 / -1; }
  .subbar { margin: 8px 0 8px 0; }
  .nota-filtros { margin-left: 0; }
  .pestanas { margin-bottom: 8px; }
}

/* ---------- Móvil ---------- */
@media (max-width: 700px) {
  .titles p { display: none; }                            /* la descripción ya está en el menú */
  .content-head .pigment { height: 26px; width: 8px; }
  .pestanas-rotulo { display: none; }
  .pestana { padding: 6px 12px; }
  .periodo { width: 100%; }
  #mes { flex: 1; width: auto; }
  .estado { font-size: 11px; }
  /* Botones de modo: solo íconos para que quepan */
  #toolbar .modos .dx-button-text { display: none; }
  #toolbar .modos .dx-button-content { padding-left: 10px; padding-right: 10px; }
  .grid { border-radius: 6px; padding: 0; }
  .chart-wrap { padding: 10px; }
  .chart-cfg { gap: 8px; }
  .cfg-item { flex: 1 1 calc(50% - 8px); min-width: 130px; }
  .cfg-item > div { width: 100% !important; }
  .chart { min-height: 300px; }
  .login-card { padding: 32px 24px; }
}

/* Pantallas táctiles: celdas un poco más altas aunque la densidad sea compacta */
@media (pointer: coarse) {
  #grid[data-densidad="compacta"] .dx-datagrid .dx-row > td { padding-top: 7px !important; padding-bottom: 7px !important; }
}

/* ---------- Fotos (snapshots) ---------- */
.foto-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 0; padding: 9px 12px; border-radius: 8px;
  background: #FFF4DC; border: 1px solid #F0D9A6; color: #5A4512; font-size: 13px;
}
.foto-banner[hidden] { display: none; }
.foto-banner svg { width: 18px; height: 18px; fill: #B9821B; flex: none; }
.foto-banner span { flex: 1; min-width: 200px; }
.foto-banner button {
  border: 1px solid #D9B86A; background: #fff; color: #5A4512; border-radius: 6px;
  padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.foto-banner button:hover { background: #FFFBF1; }
.content.en-foto .grid { border-color: #E9C877; box-shadow: 0 0 0 2px #FFF4DC; }

.fotos-panel { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 20px; overflow-y: auto; height: 100%; }
.fotos-panel h3 { font-size: 14px; margin: 10px 0 2px; }
.foto-nueva { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.foto-item { padding: 6px 0; white-space: normal; }
.foto-nombre { font-weight: 600; }
.foto-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.foto-nota { font-size: 12px; margin-top: 4px; font-style: italic; color: #3B4656; }
.foto-acciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.comparar { display: flex; flex-direction: column; height: 100%; gap: 8px; }
.comparar-grid { flex: 1; min-height: 0; }

/* ---------- Preguntas en lenguaje natural ---------- */
.pregunta-bar {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 0;
  padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--group) 28%, var(--line));
}
.pregunta-bar[hidden] { display: none; }
.pregunta-bar svg { width: 18px; height: 18px; fill: var(--group); flex: none; }
.pregunta-input { flex: 1; min-width: 0; }
.pregunta-input.dx-editor-outlined { border-color: transparent; box-shadow: none; }

.respuesta { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.resp-pregunta { font-size: 16px; font-weight: 600; margin: 0; }
.resp-entendi { margin: 0; color: var(--muted); }
.resp-no { margin: 6px 0; padding: 10px 12px; border-radius: 8px; background: #FBE9EC; color: #7A2230; }
.resp-resumen {
  margin: 4px 0; padding: 10px 12px; border-radius: 8px; font-weight: 600;
  background: color-mix(in srgb, var(--group) 9%, white); border-left: 4px solid var(--group);
}
.resp-grafica { height: 280px; flex: none; }
.resp-grid { flex: 1; min-height: 160px; }
.resp-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
@media (max-width: 700px) {
  .pregunta-bar #pregunta-btn .dx-button-text { font-size: 13px; }
  .resp-grafica { height: 220px; }
}

.chip-costo {
  border: 1px solid var(--line); background: var(--canvas); color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: help;
}
.chip-costo:hover { color: var(--ink); border-color: var(--muted); }
.tip-costo { text-align: left; font-size: 12px; line-height: 1.6; padding: 2px 4px; }
.resp-aviso { margin: 0; padding: 8px 12px; border-radius: 8px; background: #FFF4DC; border: 1px solid #F0D9A6; color: #5A4512; font-size: 13px; }

/* ---------- Empresa seleccionada (pastel) ---------- */
#empresa.dx-editor-outlined {
  background: var(--empresa) !important;
  border-color: color-mix(in srgb, var(--empresa) 55%, #18202B 25%) !important;
}
#empresa .dx-texteditor-input { font-weight: 700; color: #18202B; }
.emp-dropdown .dx-list-item { padding: 0 !important; }
.emp-dropdown .dx-list-item-content { padding: 3px 6px !important; }
.emp-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
}
.emp-chip { width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none;
  box-shadow: inset 0 0 0 1px rgba(24, 32, 43, .18); }
.emp-dropdown .dx-list-item-selected { background: transparent !important; }
.emp-dropdown .dx-list-item-selected .emp-item {
  background: var(--c) !important; font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, #18202B 30%);
}
.emp-dropdown .dx-state-hover:not(.dx-list-item-selected) .emp-item { background: color-mix(in srgb, var(--c) 45%, white); }
.emp-dropdown .dx-list-item-selected .emp-item::after { content: "✓"; margin-left: auto; font-weight: 700; }
.topbar-empresa {
  margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--empresa); color: #18202B; white-space: nowrap;
}
.topbar-empresa:empty { display: none; }
.emp-color { display: inline-block; width: 18px; height: 18px; border-radius: 5px; vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(24, 32, 43, .2); }
.prueba-ok { color: #0E7A5C; font-weight: 600; }
.prueba-mal { color: #B23A48; font-weight: 600; }
.aviso-campos { font-size: 12px; color: #7A5A12; background: #FFF4DC; border-radius: 999px; padding: 2px 10px; }
.aviso-campos[hidden] { display: none; }

/* ---------- Consolidado ---------- */
.emp-consolidado { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }
.emp-consolidado .emp-chip { display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #5A4A1E;
  width: 16px; height: 16px; background: var(--c); }
.modo-consolidado .menu-item:not([data-consolidable]) { opacity: .45; }
.modo-consolidado .menu-item[data-consolidable]::after { content: " Σ"; font-weight: 700; color: #8A6D1F; }

/* ---------- Código de la consulta (administradores) ---------- */
.titles h1 { display: flex; align-items: center; gap: 8px; }
.btn-codigo {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  font: 600 11px/1 Consolas, "Courier New", monospace; padding: 4px 6px; border-radius: 6px;
}
.btn-codigo:hover { color: var(--ink); border-color: var(--muted); }
.btn-codigo[hidden] { display: none; }
.codigo { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.codigo-modelos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.codigo-modelos span.m { font: 12px Consolas, monospace; background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }
.codigo-bloques { flex: 1; min-height: 0; overflow: auto; }
.codigo h3 { font-size: 13px; margin: 12px 0 6px; }
.codigo pre {
  margin: 0; padding: 12px; border-radius: 8px; background: #18202B; color: #E6EBF2;
  font: 12px/1.5 Consolas, "Courier New", monospace; overflow: auto; tab-size: 4; white-space: pre;
}

/* ---------- Historial de preguntas ---------- */
.hist-lista { max-height: 340px; overflow-y: auto; min-width: 280px; }
.hist-item { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--ink);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.hist-item:hover, .hist-item:focus-visible { background: color-mix(in srgb, var(--group) 10%, white); }
.hist-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.hist-vacio { color: var(--muted); font-size: 13px; padding: 8px 10px; }

/* ---------- Rol del usuario ---------- */
.rol-pill {
  align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px; background: #DCE7FF; color: #1D3F9E;
}
.rol-pill.admin { background: #E6DEFA; color: #4F3696; }
.rol-pill:empty { display: none; }

/* ---------- Menú lateral contraíble ---------- */
.menu-acciones { display: flex; justify-content: flex-end; padding: 0 6px 4px; }
.menu-acciones .link-btn { font-size: 12px; }
.menu-group h2 { padding: 0; }
.grupo-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); padding: 6px 8px; border-radius: var(--radius); text-align: left;
}
.grupo-btn:hover { background: var(--canvas); }
.grupo-btn::before { content: ""; width: 10px; height: 14px; border-radius: 2px; background: var(--c); flex: none; }
.grupo-btn .chev { margin-left: auto; color: var(--muted); font-size: 11px; transition: transform .15s; }
.menu-group.cerrado .chev { transform: rotate(-90deg); }
.menu-group.cerrado .menu-items { display: none; }
.menu-group h2::before { display: none; }
.menu-group .cuenta { font-weight: 500; color: var(--muted); font-size: 11px; }

/* Pigmentos bajo la marca: ocupan el espacio que antes era margen (no agregan alto) */
.brand-pigmentos { display: flex; gap: 3px; margin-top: 4px; height: 6px; }
.brand-pigmentos span { width: 14px; height: 6px; border-radius: 2px; background: var(--c); }

/* Cerrar sesión */
.btn-salir {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 11px 5px 9px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-salir svg { width: 15px; height: 15px; fill: currentColor; }
.btn-salir:hover, .btn-salir:focus-visible { color: #B23A48; border-color: #E8B9C1; background: #FDF1F3; }
/* Zona del usuario: nombre, rol y "Cerrar sesión" a lo ancho. Siempre igual, sin importar el rol ni el ancho. */
.user { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 14px; }
.user-nombre { color: var(--ink); font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-fila { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
/* Rol y botón con la misma forma y tamaño: todo el bloque se ve parejo */
.user-fila .rol-pill, .user-fila .btn-salir {
  box-sizing: border-box; width: 100%; min-height: 33px; padding: 7px 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 999px; font-size: 12px; line-height: 1.2;
}
.user-fila .rol-pill { align-self: stretch; white-space: nowrap; font-weight: 700; letter-spacing: .02em; }
.user-fila .btn-salir { border-color: var(--line); }
.celda-corta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Empresas de pruebas / evaluación */
.emp-pruebas { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: #8A5A00; background: #FFF1CC; border: 1px dashed #E0B252; border-radius: 999px; padding: 1px 7px; }
.emp-dropdown .dx-list-item-selected .emp-item .emp-pruebas { margin-left: auto; }
.emp-dropdown .dx-list-item-selected .emp-item:has(.emp-pruebas)::after { margin-left: 6px; }
#empresa.es-pruebas.dx-editor-outlined { border-style: dashed !important; border-color: #D9A33A !important; }
.empresa-nota { margin: 6px 4px 14px; font-size: 11px; line-height: 1.35; color: #8A5A00; }
.empresa-nota[hidden] { display: none; }

/* Versión de la app, al pie de la barra lateral */
.version-app {
  align-self: center; border: 0; background: none; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  font: inherit; font-size: 11px; color: #8A93A1; letter-spacing: .02em;
}
.version-app:hover, .version-app:focus-visible { color: var(--ink); background: var(--canvas); }
.pasos-instalar { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; }

/* =====================================================================
   Diagramas · Colorquímica (sobre la base visual de BIP)
   ===================================================================== */
.menu-group h2 { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 8px 4px; letter-spacing: .02em; }
.menu-item { display: flex; align-items: center; gap: 8px; padding-left: 12px; }
.menu-chip { width: 10px; height: 14px; border-radius: 2px; background: var(--c); flex: none; }
.menu-item[aria-current="page"] { background: color-mix(in srgb, var(--c) 12%, white); color: color-mix(in srgb, var(--c) 80%, black); }

.vista { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 12px; }
.vista[hidden] { display: none !important; }

/* Chips de tipo y estado */
.chip-tipo { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 6px; border-radius: 999px;
  background: var(--p); color: color-mix(in srgb, var(--c) 78%, black); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-tipo::before { content: ""; width: 8px; height: 12px; border-radius: 2px; background: var(--c); }
.chip-estado { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.item-tipo { display: flex; align-items: center; gap: 8px; }
.item-tipo .chip-tipo { padding: 2px 4px; }
.celda-nombre { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.badge-comp { font-size: 10px; font-weight: 700; color: #1D3F9E; background: #DCE7FF; border-radius: 999px; padding: 1px 7px; }

/* Ícono de IA (destellos, igual que la barra de preguntas de BIP) */
.dx-icon-fa-ia { background: currentColor; -webkit-mask: var(--ia) center / 16px no-repeat; mask: var(--ia) center / 16px no-repeat;
  --ia: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l1.8 5.2L19 9l-5.2 1.8L12 16l-1.8-5.2L5 9l5.2-1.8L12 2zm7 11l.9 2.6 2.6.9-2.6.9L19 20l-.9-2.6-2.6-.9 2.6-.9L19 13zM5 15l.7 1.8L7.5 17.5l-1.8.7L5 20l-.7-1.8L2.5 17.5l1.8-.7L5 15z'/%3E%3C/svg%3E"); }
.btn-ia.dx-button, .btn-ia .dx-button { border-color: color-mix(in srgb, #6B4FBB 45%, var(--line)) !important; color: #4F3696 !important; }

/* ---------- Editor ---------- */
.modo-editor .content { padding-bottom: 10px; }
.estado-guardado { font-size: 12px; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--canvas); white-space: nowrap; }
.estado-guardado.sucio { color: #8A5A00; background: #FFF1CC; }
.estado-guardado.ok { color: #0E7A5C; background: #D3F0E3; }
.aviso-lectura { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: #EEF1F5; color: #3B4656; font-size: 13px; }
.aviso-lectura[hidden] { display: none; }
.editor-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; }
.panel-oculto .editor-layout { grid-template-columns: minmax(0, 1fr) 0; }
.panel-oculto .panel { display: none; }
.lienzo { position: relative; min-height: 0; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lienzo:focus { outline: none; }
.lienzo-bpmn { background-image: radial-gradient(circle, #DCE1E8 1px, transparent 1px); background-size: 20px 20px; }
.lienzo-bpmn .djs-palette { left: 12px; top: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 2px 8px rgba(24,32,43,.08); }
.lienzo-bpmn .djs-palette .entry, .lienzo-bpmn .djs-context-pad .entry { color: var(--ink); }
.lienzo-bpmn .djs-palette .entry:hover { color: var(--primary); }
.lienzo-bpmn text, .lienzo-bpmn .djs-direct-editing-parent { font-family: var(--font) !important; }
.lienzo-bpmn .bjs-powered-by { opacity: .35; transform: scale(.7); transform-origin: bottom right; }
.lienzo-bpmn .djs-minimap { top: 12px; right: 12px; }
.lienzo-dx .dx-diagram { border: 0; }
#editor:fullscreen { background: var(--canvas); padding: 12px; display: flex; flex-direction: column; }

.panel { min-height: 0; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.panel h3 { font-size: 13px; margin: 0; }
.panel-seccion { display: flex; flex-direction: column; gap: 8px; }
.panel-seccion + .panel-seccion { border-top: 1px solid var(--line); padding-top: 12px; }
.panel-vacio, .rev-ayuda { color: var(--muted); font-size: 12px; margin: 0; }
.rev-resumen { margin: 0; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, #6B4FBB 8%, white); border-left: 4px solid #6B4FBB; font-size: 13px; }
.rev-supuestos { padding: 10px 12px; border-radius: 8px; background: #FFF4DC; border: 1px solid #F0D9A6; color: #5A4512; font-size: 12px; }
.rev-supuestos[hidden], .rev-resumen[hidden] { display: none; }
.rev-supuestos ul { margin: 6px 0; padding-left: 18px; }
.rev-supuestos p { margin: 0; font-weight: 600; }
.rev-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hallazgo { border: 1px solid var(--line); border-left: 4px solid var(--s, #5B6573); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.hallazgo.error { --s: #B23A48; } .hallazgo.advertencia { --s: #C98A0B; } .hallazgo.sugerencia { --s: #1F4FD1; } .hallazgo.ok { --s: #0E8A6A; color: #0E7A5C; }
.hallazgo.con-elemento { cursor: pointer; }
.hallazgo.con-elemento:hover, .hallazgo.con-elemento:focus-visible { background: var(--canvas); }
.hallazgo-cab { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.hallazgo .sev { font-weight: 700; color: var(--s); }
.hallazgo .regla { color: var(--muted); text-align: right; }
.hallazgo p { margin: 4px 0 0; }
.hallazgo .sug { color: var(--muted); }

/* ---------- Diálogos ---------- */
.dialogo-ia { display: flex; flex-direction: column; gap: 8px; }
.dialogo-ia .field-label { padding: 6px 0 0; }
.ejemplos-ia { display: flex; flex-direction: column; gap: 6px; }
.ejemplo-ia { text-align: left; border: 1px solid var(--line); background: var(--canvas); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
.ejemplo-ia:hover, .ejemplo-ia:focus-visible { border-color: #6B4FBB; background: #F4F0FD; }
.nota-ia { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.nota-dialogo { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.cargando-ia { padding: 10px 12px; border-radius: 8px; background: #F4F0FD; color: #4F3696; font-weight: 600; font-size: 13px; }
.cargando-ia[hidden] { display: none; }

@media (max-width: 1023px) {
  .editor-layout { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 1fr) auto; }
  .panel { max-height: 40vh; }
}

.titles h1 .estado-guardado { font-size: 11px; font-weight: 600; letter-spacing: 0; }
.estado-guardado[hidden] { display: none; }
.lienzo-bpmn .djs-minimap .toggle { display: none; }
.lienzo-bpmn .djs-minimap:not(.open) { display: none; }
