/* rambla.app — encabezado de módulo (tokens + header + botón de ícono + avatar + menú).
   Se linkea en todas las páginas, siempre ANTES de rambla-app.css si la página también la usa. */

/* =========================================================================
   rambla.app — hoja de estilos compartida por todos los módulos
   Fuente: canvas "Rambla® app — Rediseño sistematizado de módulos"
   (Rambla® Design System + capa de interfaz rambla-app.css + UI kit).
   Un solo lugar para cada patrón: los módulos lo usan, no lo copian.
   Cargar DESPUÉS del CSS propio del módulo para que los tokens ganen.
   ========================================================================= */

:root {
  /* ---------- Paleta de marca ---------- */
  --ink:    #202124;
  --cream:  #F4ECE0;
  --blue:   #3282FA;
  --yellow: #FAC300;
  --orange: #FF6E3C;
  --green:  #46C89C;

  /* Neutros derivados de ink */
  --ink-90: #36373A;
  --ink-70: #5C5D5F;
  --ink-50: #8A8B8D;
  --ink-30: #B8B9BA;
  --ink-15: #D9D8D5;
  --ink-08: #E8E5DF;

  /* Rampas (s = hacia negro, t = hacia blanco). Complementos, no colores nuevos. */
  --ink-t1:#36373A; --ink-t2:#4D4D50; --ink-t3:#636466; --ink-t4:#797A7C; --ink-t5:#909092; --ink-t6:#A6A6A7; --ink-t7:#BCBCBD; --ink-t8:#D2D3D3; --ink-t9:#E9E9E9;
  --blue-s1:#2D75E1; --blue-s2:#2868C8; --blue-s3:#235BAF; --blue-s4:#1E4E96; --blue-s5:#19417D;
  --blue-t1:#478FFB; --blue-t2:#5B9BFB; --blue-t3:#70A8FC; --blue-t4:#84B4FC; --blue-t5:#99C1FD; --blue-t6:#ADCDFD; --blue-t7:#C2DAFE; --blue-t8:#D6E6FE; --blue-t9:#EBF3FF;
  --yellow-s3:#AF8900; --yellow-s5:#7D6200; --yellow-t8:#FEF3CC; --yellow-t9:#FFF9E6;
  --orange-s3:#B34D2A; --orange-s5:#80371E; --orange-t8:#FFE2D8; --orange-t9:#FFF1EC;
  --green-s3:#318C6D;  --green-s5:#23644E;  --green-t8:#DAF4EB;  --green-t9:#EDFAF5;

  /* Estados de interfaz — fuera de la paleta de marca a propósito.
     Solo errores, validaciones, banners y toasts; nunca títulos ni fondos de card. */
  --danger:  #CE1B0E;
  --success: #067544;
  --warning: #A54A00;
  --danger-soft:  color-mix(in srgb, var(--danger) 10%, transparent);
  --success-soft: color-mix(in srgb, var(--success) 10%, transparent);
  --warning-soft: color-mix(in srgb, var(--warning) 10%, transparent);

  /* ---------- Tipografía ---------- */
  --font-sans: 'Inter', system-ui, sans-serif;
  --fs-body-sm: 14px;
  --fs-caption: 12px;
  --fs-eyebrow: 10px;

  /* ---------- Espaciado, radios, movimiento ---------- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-1: 4px; --r-2: 8px; --r-3: 12px; --r-4: 16px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;

  /* ---------- Capa de interfaz (decisiones 2026-10-26) ---------- */
  --bg: #FFFFFF;
  --ui-line: var(--ink-t9);          /* separadores, bordes de card */
  --ui-line-strong: var(--ink-t8);   /* borde de card en hover, inputs */
  --ui-fill: var(--ink-t9);          /* fondo de campos y tags neutros */
  --ui-fill-hover: var(--ink-t8);
  --ui-row-hover: var(--blue-t9);    /* hover de fila */
  --ui-selected: var(--blue-t8);     /* fila/ítem seleccionado */
  --ui-text-2: var(--ink-70);        /* texto secundario (pasa 4.5:1 sobre blanco) */
  --ui-text-3: var(--ink-t3);        /* metadatos chicos */
  --ui-radius-card: var(--r-3);
  --ui-radius-control: var(--r-3);
  --ui-header-h: 64px;
  --ui-shadow-pop: 0 12px 32px rgba(32, 33, 36, .08);  /* solo menús y paneles flotantes */
}

/* ---------- Encabezado de módulo ---------- */
.mh { background: #FFFFFF; border-bottom: 1px solid var(--ui-line); font-family: var(--font-sans); color: var(--ink); }
.mh-inner { max-width: 1440px; margin: 0 auto; box-sizing: border-box; height: var(--ui-header-h); padding: 0 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mh-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mh-home { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--r-pill); margin-left: -8px; text-decoration: none; }
.mh-home:hover { background: var(--ui-fill); }
.mh-home:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mh-home img { height: 26px; width: auto; display: block; }
.mh-sep { width: 1px; height: 22px; background: var(--ink-t8); flex: none; }
.mh-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-right { display: flex; align-items: center; gap: 6px; flex: none; }
.mh-role { font-size: 12px; font-weight: 500; color: var(--ink-70); padding: 0 10px; height: 24px; display: inline-flex; align-items: center; border-radius: var(--r-pill); background: var(--ui-fill); margin-right: 6px; }
.mh-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: var(--r-pill); background: var(--danger); color: #FFFFFF; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }

/* Menú desplegable (cuenta, notificaciones, acciones de card) */
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 200; min-width: 200px; background: #FFFFFF; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-card); box-shadow: var(--ui-shadow-pop); padding: 4px; font-family: var(--font-sans); }
.menu-pop-head { padding: 10px 12px; border-bottom: 1px solid var(--ui-line); margin: -4px -4px 4px; }
.menu-pop-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.menu-pop-sub { font-size: 12px; color: var(--ui-text-2); margin-top: 2px; }
.menu-item { appearance: none; border: none; background: transparent; width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-2); font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--ui-fill); }
.menu-item:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.menu-item svg { flex: none; color: var(--ui-text-2); }
.menu-item.is-danger, .menu-item.is-danger svg { color: var(--danger); }


/* Botón de ícono */
.icon-btn { appearance: none; border: none; background: transparent; cursor: pointer; width: 40px; height: 40px; flex: none; padding: 0; position: relative;
  border-radius: var(--r-pill); color: var(--ui-text-2); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { background: var(--ui-fill); color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.icon-btn.is-on { color: var(--ink); }

/* Persona: círculo amarillo con iniciales + nombre */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-sans); font-size: 12px; font-weight: 700; flex: none; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* Íconos de lucide dentro del header: mismo trazo fino que el kit */
.mh .icon-btn svg { stroke-width: 1.6; }
@media (max-width: 760px) { .mh-inner { padding: 0 16px; } }

/* ---------- Navegación de submódulos ---------- */
.subnav { background: #FFFFFF; border-bottom: 1px solid var(--ui-line); }
.subnav-inner { max-width: 1440px; margin: 0 auto; box-sizing: border-box; padding: 0 40px; display: flex; gap: 28px; }
.submodule-tab { display: inline-flex; align-items: center; padding: 14px 2px; font-family: var(--font-sans); font-size: 16px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; transition: color var(--dur-fast) var(--ease); }
.submodule-tab:hover { color: var(--blue); }
.submodule-tab.is-active { color: var(--blue); }
.submodule-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.submodule-tab svg, .submodule-tab i { width: 16px; height: 16px; flex: none; }
@media (max-width: 760px) { .subnav-inner { padding: 0 16px; overflow-x: auto; } }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* Densidad de herramienta — idéntica a NOPROT (noprot/ui-rambla.css).
   Se activa con .mh-compact en el header y en la barra de navegación.
   El ancho y el padding horizontal los iguala cada módulo al de su contenido
   (por defecto 1800 px y 24 px). */
.mh-compact .mh-inner { height: 52px; max-width: 1800px; padding: 0 24px; }
.mh-compact .mh-name { font-size: 16px; }
.mh-compact .mh-home { width: 36px; height: 36px; margin-left: -6px; }
.mh-compact .mh-home img { height: 22px; }
.mh-compact .mh-right { gap: 4px; }
.mh-compact .icon-btn { width: 34px; height: 34px; }
.mh-compact .icon-btn svg { width: 18px; height: 18px; }
.mh-compact .icon-btn.mh-user { width: 36px; height: 36px; }
.mh-compact .avatar { width: 28px; height: 28px; font-size: 11px; }
.mh-compact .mh-badge { top: 2px; right: 2px; }
.mh-compact .menu-pop .avatar { width: 32px; height: 32px; font-size: 12px; }
.subnav.mh-compact .subnav-inner { max-width: 1800px; padding: 0 24px; gap: 22px; }
.subnav.mh-compact .submodule-tab { padding: 10px 2px; font-size: 14px; }
@media (max-width: 760px) { .mh-compact .mh-inner, .subnav.mh-compact .subnav-inner { padding: 0 16px; } }

/* Tab de vista (vistas internas de un registro). El activo va en naranja. */
.op-view-tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 2px; font-family: var(--font-sans); font-size: 10px; line-height: 1; font-weight: 600; color: var(--ui-text-2); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
.op-view-tab svg { flex: none; }
.op-view-tab:hover { color: var(--ink); }
.op-view-tab.is-active { color: var(--orange); }
.op-view-tab { appearance: none; border: none; background: transparent; cursor: pointer; }
/* Densidad NOPROT para la fila de vistas */
.subnav.mh-compact .op-view-tab { font-size: 13px; padding: 10px 2px; }
