/* ==========================================================================
   PLADECO UI — sistema de diseño minimalista, claro/oscuro, responsivo.
   Solo estilos: no cambia estructura de datos ni lógica de la plataforma.
   Orden: 1 tokens · 2 base · 3 header · 4 menú móvil · 5 ejecutor/notificaciones
          6 footer · 7 componentes globales · 8 login · 9 utilidades
   ========================================================================== */

/* 1 · TOKENS ------------------------------------------------------------ */
:root { color-scheme: light dark; }

/* Claro (por defecto) */
html:root,
html:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef5f3;
  --surface: #fbfefd;
  --surface-2: #e8f1ee;
  --hover: #e1eeea;
  --hover-strong: #d3e5e0;
  --line: #d9e8e4;
  --line-strong: #bdd3ce;
  --text: #0f2a26;
  --text-2: #3c5854;
  --muted: #587370;
  --subtle: #6b8683;
  --accent: #0ea394;
  --accent-text: #0b7a6e;
  --ok-text: #047857;
  --warn-text: #b45309;
  --err-text: #b91c1c;
  --info-text: #1d4ed8;
  --violet-text: #6d28d9;
  --cyan-text: #0e7490;
  --orange-text: #c2410c;
  --accent-soft: rgba(52, 216, 176, .16);
  --on-accent: #04352d;
  --ok: #059669;
  --warn: #d97706;
  --err: #dc2626;
  --info-c: #2563eb;
  --scrim: rgba(6, 22, 20, .45);
  --shadow-pop: 0 28px 64px -26px rgba(15, 60, 52, .30);
  --hdr-bg: rgba(251, 254, 253, .78);
}

/* Oscuro: elección manual */
html:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060b0b;
  --surface: #0d1716;
  --surface-2: #121f1d;
  --hover: #172725;
  --hover-strong: #1f332f;
  --line: #1c2b29;
  --line-strong: #2b403c;
  --text: #eaf7f4;
  --text-2: #a9c4bf;
  --muted: #8fa8a3;
  --subtle: #7a938e;
  --accent: #34d8b0;
  --accent-text: #7ee8d0;
  --ok-text: #34d399;
  --warn-text: #fbbf24;
  --err-text: #f87171;
  --info-text: #60a5fa;
  --violet-text: #a78bfa;
  --cyan-text: #22d3ee;
  --orange-text: #fb923c;
  --accent-soft: rgba(52, 216, 176, .14);
  --on-accent: #04352d;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --info-c: #60a5fa;
  --scrim: rgba(0, 0, 0, .66);
  --shadow-pop: 0 32px 76px -26px rgba(0, 0, 0, .7);
  --hdr-bg: rgba(13, 23, 22, .72);
}

/* Oscuro: preferencia del sistema cuando no hay elección manual */
@media (prefers-color-scheme: dark) {
  html:root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #060b0b;
    --surface: #0d1716;
    --surface-2: #121f1d;
    --hover: #172725;
    --hover-strong: #1f332f;
    --line: #1c2b29;
    --line-strong: #2b403c;
    --text: #eaf7f4;
    --text-2: #a9c4bf;
    --muted: #8fa8a3;
    --subtle: #7a938e;
    --accent: #34d8b0;
    --accent-text: #7ee8d0;
    --ok-text: #34d399;
    --warn-text: #fbbf24;
    --err-text: #f87171;
    --info-text: #60a5fa;
    --violet-text: #a78bfa;
    --cyan-text: #22d3ee;
    --orange-text: #fb923c;
    --accent-soft: rgba(52, 216, 176, .14);
    --on-accent: #04352d;
    --ok: #10b981;
    --warn: #f59e0b;
    --err: #ef4444;
    --info-c: #60a5fa;
    --scrim: rgba(0, 0, 0, .66);
    --shadow-pop: 0 32px 76px -26px rgba(0, 0, 0, .7);
    --hdr-bg: rgba(13, 23, 22, .72);
  }
}

/* Alias: los nombres que ya usan todas las páginas apuntan a los tokens nuevos,
   así cada pantalla cambia de tema sin tocar su marcado. */
html:root {
  /* Relleno sólido legacy (texto blanco en páginas antiguas): teal MiHora oscurecido para contraste */
  --primary: #0b8f82;
  --primary-dark: #0a766c;
  --brand: #34d8b0; --brand-2: #7ee8d0; --brand-strong: #0ea394;
  --primary-light: var(--accent-soft);
  --secondary: #64748b;
  --secondary-dark: #475569;
  /* Colores sólidos de estado (fondos con texto blanco: contraste >= 3:1 en ambos temas) */
  --ok-solid: #059669;
  --warn-solid: #d97706;
  --err-solid: #dc2626;
  --success: var(--ok-solid);
  --warning: var(--warn-solid);
  --danger: var(--err-solid);
  --info: var(--info-c);
  --dark: var(--surface-2);
  --darker: var(--bg);
  --light: var(--text);
  --card-bg: var(--surface);
  --border: var(--line);
  --glass: var(--accent-soft);
  --shadow: rgba(16, 24, 40, .12);
  --text-light: var(--muted);
  --text-color: var(--text);
  --bg-color: var(--bg);
  --input-bg: var(--surface);
  --info-bg: var(--surface-2);

  /* Nombres en español usados por el header/footer anteriores */
  --color-fondo: var(--bg);
  --color-fondo-header: var(--surface);
  --color-fondo-card: var(--surface);
  --color-texto: var(--text);
  --color-texto-secundario: var(--muted);
  --color-borde: var(--line);
  --color-hover: var(--hover);
  --color-primario: var(--accent);
  --color-primario-hover: var(--accent-text);
  --color-secundario: var(--ok);
  --color-peligro: var(--err);
  --color-peligro-hover: #b91c1c;
  --color-advertencia: var(--warn);
  --color-acento: var(--brand-strong);
  --color-sombra: rgba(15, 60, 52, .07);
  --color-sombra-fuerte: rgba(15, 60, 52, .20);
  --color-overlay: var(--scrim);

  /* Escalas compartidas */
  --space-xs: .5rem; --space-sm: 1rem; --space-md: 1.5rem; --space-lg: 2rem; --space-xl: 3rem;
  --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px;
  --font-xs: .75rem; --font-sm: .875rem; --font-base: 1rem; --font-lg: 1.125rem; --font-xl: 1.25rem;
  --shadow-sm: 0 2px 8px -3px rgba(15, 60, 52, .10);
  --shadow-md: 0 8px 28px -12px rgba(15, 60, 52, .22), 0 2px 8px -3px rgba(15, 60, 52, .07);
  --shadow-lg: 0 28px 64px -26px rgba(15, 60, 52, .28);
  --transition: all .18s ease;
  --header-height: 72px;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 2 · BASE -------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

html body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1100px 700px at 12% -8%, color-mix(in srgb, var(--brand-2) 30%, transparent) 0%, transparent 55%),
    radial-gradient(900px 650px at 100% 8%, color-mix(in srgb, var(--brand) 22%, transparent) 0%, transparent 52%),
    radial-gradient(1000px 800px at 50% 115%, color-mix(in srgb, var(--brand-strong) 16%, transparent) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}

html body ::selection { background: var(--accent-soft); color: var(--text); }
html body :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html body a { text-underline-offset: 3px; }
html body img { max-width: 100%; }

/* Scrollbars discretas */
html * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
html ::-webkit-scrollbar { width: 10px; height: 10px; }
html ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
html ::-webkit-scrollbar-thumb:hover { background: var(--subtle); background-clip: content-box; border: 2px solid transparent; }
html ::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  html *, html *::before, html *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 3 · HEADER (estructura MiHora: logos arriba · navegación abajo) ------- */
html:root { --header-height: 108px; }
html body .pd-header {
  position: sticky; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--surface);
  background: var(--hdr-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 0; margin: 0; height: auto; min-height: 0;
  transition: box-shadow .3s ease, background-color .2s ease;
}
html body .pd-header:hover { box-shadow: var(--shadow-lg); }
html body.pd-fixed-header { padding-top: var(--header-height); }
html body.pd-fixed-header .pd-header { position: fixed; }

/* Fila 1: LM · título · PCG (+ campana). Fila 2: navegación · usuario · salir.
   .pd-actions usa display:contents para que sus hijos se ordenen en las dos filas sin tocar el HTML de cada header. */
.pd-header__inner {
  max-width: 1400px; margin: 0 auto; padding: .6rem 2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem;
}
.pd-header__inner::after { content: ""; order: 5; flex: 0 0 100%; height: 0; border-top: 1px solid var(--line); margin-top: .1rem; }
.pd-actions { display: contents; }

html body .pd-brand { order: 1; display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; color: var(--text); }
.pd-brand__lm { height: 45px; width: auto; display: block; object-fit: contain; transition: filter .3s ease; }
/* LM.png es blanco: en claro se oscurece, en oscuro queda original (igual que MiHora) */
html:root:not([data-theme="dark"]) .pd-brand__lm { filter: brightness(0); }
@media (prefers-color-scheme: dark) { html:root:not([data-theme="light"]) .pd-brand__lm { filter: none; } }
html:root[data-theme="dark"] .pd-brand__lm { filter: none; }
html body .pd-brand .pd-brand__fallback {
  display: none; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--text); white-space: nowrap;
}
.pd-brand__fallback i { color: var(--accent); }

.pd-title { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; }
.pd-title__main {
  font-size: 1.05rem; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(135deg, var(--accent-text), var(--brand-strong));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html:root[data-theme="dark"] .pd-title__main { background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; }
@media (prefers-color-scheme: dark) { html:root:not([data-theme="light"]) .pd-title__main { background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; } }
.pd-title__sub { font-size: .7rem; color: var(--muted); margin-top: .1rem; }

/* PCG = interruptor de tema, con brillo dorado como en MiHora */
html body .pd-pcg {
  order: 4; position: relative; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: transparent; cursor: pointer; box-shadow: none; transform: none; border-radius: 10px;
}
.pd-pcg__img { height: 45px; width: auto; display: block; transition: transform .3s ease, filter .3s ease;
  filter: brightness(2.5) contrast(1.4) sepia(1) saturate(4) hue-rotate(-10deg); }
.pd-pcg:hover .pd-pcg__img { transform: scale(1.05); }
.pd-pcg::before {
  content: ''; position: absolute; top: 15%; left: 50%; transform: translate(-50%, -50%); width: 130%; height: 55%;
  background: radial-gradient(ellipse at center, rgba(255, 215, 0, .4) 0%, rgba(255, 215, 0, 0) 70%); filter: blur(8px); pointer-events: none;
}
.pd-pcg::after {
  content: ''; position: absolute; top: 23%; left: 35%; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 180, 1) 0%, rgba(255, 230, 100, .8) 40%, transparent 70%);
}
html:root[data-theme="dark"] .pd-pcg__img { filter: brightness(3.2) contrast(1.1) sepia(.8) saturate(3) hue-rotate(-8deg); }
html:root[data-theme="dark"] .pd-pcg::after { opacity: 0; }
@media (prefers-color-scheme: dark) {
  html:root:not([data-theme="light"]) .pd-pcg__img { filter: brightness(3.2) contrast(1.1) sepia(.8) saturate(3) hue-rotate(-8deg); }
  html:root:not([data-theme="light"]) .pd-pcg::after { opacity: 0; }
}
.pd-pcg__fallback { display: none; width: 38px; height: 38px; place-items: center; color: var(--muted); }
.pd-pcg__tip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--brand-strong); color: #fff; font: 600 .65rem/1 var(--font-ui); padding: 5px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; visibility: hidden; transition: opacity .2s ease; pointer-events: none;
}
.pd-pcg:hover .pd-pcg__tip, .pd-pcg:focus-visible .pd-pcg__tip { opacity: 1; visibility: visible; }

/* Navegación (fila 2) */
.pd-nav {
  order: 6; display: flex; align-items: center; justify-content: center; gap: .15rem 2px; flex-wrap: wrap;
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; list-style: none;
}
.pd-nav > li { list-style: none; display: flex; }

html body .pd-header .pd-link {
  position: relative; display: inline-flex; align-items: center; gap: .4rem;
  padding: .32rem .7rem; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--accent-text); font: 500 .8rem/1.2 var(--font-ui);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: all .2s cubic-bezier(.25, .46, .45, .94); transform: none; box-shadow: none;
}
html body .pd-header .pd-link i { font-size: .72rem; width: 14px; text-align: center; color: inherit; }
html body .pd-header .pd-link:hover,
html body .pd-header .pd-link.active,
html body .pd-header .pd-link[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-accent); transform: none; box-shadow: none; }

/* Contador de pendientes (jefe) */
html body .badge-pendientes {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--err-solid); color: #fff;
  font: 700 10.5px/18px var(--font-ui); letter-spacing: 0; text-align: center;
}
html body .badge-pendientes.pulsando { animation: pd-pulse 1.8s ease-in-out infinite; }
html body .badge-pendientes.nuevo-cambio { animation: pd-pop .6s ease; }
@keyframes slideInItems { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes pd-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); } 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); } }
@keyframes pd-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }

/* Acciones: campana (ejecutor) · usuario · salir (el PCG se define arriba) */
.pd-user { order: 7; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; min-width: 0; text-align: right; }
html body .pd-header .pd-user__name { font-weight: 600; font-size: .75rem; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .pd-header .pd-user__unit { font-size: .65rem; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .pd-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
  padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  font: 600 10.5px/1.6 var(--font-ui); letter-spacing: .04em; text-transform: uppercase;
}

html body .pd-iconbtn {
  width: 38px; height: 38px; flex-shrink: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0; position: relative;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease; transform: none; box-shadow: none;
}
html body .pd-iconbtn:hover { background: var(--hover); color: var(--text); border-color: var(--line-strong); transform: none; }
html body .pd-header .menu-toggle, html body .pd-header .notifications-wrapper { order: 3; }

/* Fila de tema del menú móvil: luna en claro, sol en oscuro */
.pd-theme .pd-ico-sun { display: none; }
html[data-theme="dark"] .pd-theme .pd-ico-sun { display: block; }
html[data-theme="dark"] .pd-theme .pd-ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .pd-theme .pd-ico-sun { display: block; }
  html:not([data-theme="light"]) .pd-theme .pd-ico-moon { display: none; }
}
.pd-theme svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

html body .pd-header .pd-logout {
  order: 8; display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  font: 500 .8rem/1.2 var(--font-ui); text-decoration: none; white-space: nowrap;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease; transform: none; box-shadow: none;
}
html body .pd-header .pd-logout:hover { color: var(--err-text); border-color: var(--err); background: transparent; transform: none; }

/* Botón hamburguesa (solo en pantallas que usan el panel) */
html body .pd-header .menu-toggle { display: none; }

/* Aviso de cambio de tema */
.pd-toast {
  position: fixed; top: 84px; right: 20px; z-index: 9999; padding: 10px 16px; border-radius: 12px;
  background: var(--brand-strong); color: #fff; font: 600 .8rem/1.2 var(--font-ui);
  box-shadow: var(--shadow-md); animation: pd-toast-in .3s ease; transition: opacity .3s ease;
}
.pd-toast.out { opacity: 0; }
@keyframes pd-toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Colapso a menú móvil: una sola fila (LM · título · PCG · menú) */
@media (max-width: 1100px) {
  html:root { --header-height: 66px; }
  .pd-header__inner::after { display: none; }
  html body .pd-header .pd-nav--drawer, html body .pd-header .pd-user, html body .pd-header .pd-logout { display: none; }
  html body .pd-header .menu-toggle { display: inline-grid; }
}
@media (max-width: 640px) {
  .pd-header__inner { padding: .5rem 1rem; gap: .5rem; }
  .pd-brand__lm { height: 32px; }
  .pd-pcg__img { height: 32px; }
  .pd-title__main { font-size: .9rem; }
  .pd-title__sub { display: none; }
  html:root { --header-height: 56px; }
}

/* 4 · MENÚ MÓVIL (panel lateral) ----------------------------------------- */
html body .pd-scrim {
  position: fixed; inset: 0; z-index: 1900; background: var(--scrim);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
html body .pd-scrim.active { opacity: 1; visibility: visible; }

html body .pd-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 2000;
  width: min(320px, 88vw); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: var(--shadow-pop); transform: translateX(-104%); visibility: hidden;
  transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility .26s; overflow: hidden;
}
html body .pd-drawer.active { transform: none; visibility: visible; }

.pd-drawer__head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; position: relative; }
html body .pd-drawer .btn-close-menu { align-self: flex-end; }
.pd-drawer__user { display: flex; align-items: center; gap: 12px; min-width: 0; }
html body .pd-drawer .mobile-user-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font: 700 15px/1 var(--font-ui); letter-spacing: .02em;
}
.pd-drawer__who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
html body .pd-drawer .mobile-user-name { font-weight: 600; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
html body .pd-drawer .mobile-user-unit { font-size: 12px; color: var(--muted); }

.pd-drawer__nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
html body .pd-drawer .pd-dlink {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font: 500 14.5px/1.2 var(--font-ui);
  background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer;
  transition: background-color .15s ease, color .15s ease; transform: none; box-shadow: none; animation: none; opacity: 1;
}
html body .pd-drawer .pd-dlink i { width: 20px; text-align: center; color: var(--muted); font-size: 15px; }
html body .pd-drawer .pd-dlink:hover { background: var(--hover); color: var(--text); transform: none; }
html body .pd-drawer .pd-dlink.active { background: var(--accent-soft); color: var(--accent-text); }
html body .pd-drawer .pd-dlink.active i { color: var(--accent-text); }
html body .pd-drawer .pd-dlink .badge-pendientes { margin-left: auto; }

html body .pd-drawer .pd-dlink svg { width: 20px; height: 20px; flex-shrink: 0; }
.pd-drawer__foot { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
html body .pd-drawer .btn-logout-mobile {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--err);
  font: 600 14px/1 var(--font-ui); text-decoration: none; transition: background-color .15s ease; transform: none; box-shadow: none;
}
html body .pd-drawer .btn-logout-mobile:hover { background: color-mix(in srgb, var(--err) 10%, transparent); transform: none; }

/* 5 · EJECUTOR: menú desplegable + notificaciones ------------------------- */
html body .pd-header--exec .pd-nav-wrap { display: flex; flex: 1 1 auto; min-width: 0; }
html body .pd-header--exec .pd-nav { flex: 1 1 auto; }
html body .pd-header--exec .nav-link.hitos-link:not(.active)::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pd-pulse 2.4s ease-in-out infinite;
}
.pd-header--exec .pd-actions { gap: 8px; }
html body .pd-header--exec .pd-nav-wrap { order: 6; }
/* Ejecutor: el header es fijo y su altura depende de 1 o 2 filas */
html body.pd-fixed-header { --header-height: 108px; }
@media (min-width: 769px) and (max-width: 1100px) { html body .pd-header--exec .pd-header__inner::after { display: block; } }
@media (max-width: 768px) { html body.pd-fixed-header { --header-height: 66px; } }
@media (max-width: 640px) { html body.pd-fixed-header { --header-height: 56px; } }
html body .pd-header--exec .menu-toggle { display: none; }
html body .pd-header--exec .menu-toggle.active { background: var(--hover); color: var(--text); }
html body .pd-only-mobile { display: none; }
@media (max-width: 1100px) {
  html body .pd-header--exec .pd-user, html body .pd-header--exec .pd-logout { display: flex; }
}
@media (max-width: 900px) {
  html body .pd-header--exec .pd-user { display: none; }
  html body .pd-header--exec .pd-link { padding: 8px 9px; }
}

html body .notifications-wrapper { position: relative; }
html body .notifications-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; position: relative; cursor: pointer; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 15px;
  transition: background-color .15s ease, border-color .15s ease; transform: none; box-shadow: none;
}
html body .notifications-btn:hover { background: var(--hover); border-color: var(--line-strong); transform: none; }
html body .notifications-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: var(--err); color: #fff; font: 700 10.5px/1 var(--font-ui);
  border: 2px solid var(--surface);
}
html body .notifications-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 1001;
  width: 380px; max-width: calc(100vw - 24px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
html body .notifications-panel.active { opacity: 1; visibility: visible; transform: none; }
html body .notifications-header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
html body .notifications-title-container { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
html body .notifications-title { font: 600 14px/1.2 var(--font-ui); color: var(--text); margin: 0; }
html body .mark-all-read-btn, html body .clear-all-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  font: 500 12px/1.2 var(--font-ui); cursor: pointer; box-shadow: none; transform: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
html body .mark-all-read-btn { color: var(--accent-text); border-color: transparent; background: var(--accent-soft); }
html body .mark-all-read-btn:hover:not(:disabled), html body .clear-all-btn:hover:not(:disabled) { background: var(--hover); transform: none; box-shadow: none; }
html body .mark-all-read-btn:disabled, html body .clear-all-btn:disabled { opacity: .45; cursor: not-allowed; }
html body .mark-all-read-btn::before, html body .clear-all-btn::before { content: none; }
html body .notifications-close { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
html body .notifications-close:hover { background: var(--hover); color: var(--text); }
html body .notifications-list { max-height: min(420px, 60vh); overflow-y: auto; padding: 8px; }
html body .notification-item {
  padding: 12px; border-radius: 10px; margin-bottom: 6px; cursor: pointer;
  border: 1px solid transparent; border-left: 3px solid transparent; background: transparent; transition: background-color .15s ease;
}
html body .notification-item.unread { background: var(--accent-soft); border-left-color: var(--accent); opacity: 1; }
html body .notification-item.read { opacity: .72; background: transparent; }
html body .notification-item:hover { background: var(--hover); }
html body .notification-item.reenvio { border-left: 3px solid var(--warn) !important; }
html body .notification-item.reenvio .notification-title { color: var(--warn); }
html body .notification-title { font: 600 13.5px/1.35 var(--font-ui); color: var(--text); margin-bottom: 4px; display: flex; gap: 6px; align-items: flex-start; }
html body .notification-message { color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 6px; }
html body .notification-time { color: var(--subtle); font-size: 11.5px; }
html body .no-notifications { padding: 32px 16px; text-align: center; color: var(--muted); }
html body .no-notifications h4 { color: var(--text); font-size: 14px; margin-bottom: 4px; }

/* Ejecutor: en pantallas angostas el menú baja como panel bajo el header */
@media (max-width: 768px) {
  html body .pd-header--exec .menu-toggle { display: inline-grid; }
  html body .pd-header--exec .pd-user, html body .pd-header--exec .pd-logout { display: none; }
  html body .pd-header--exec .pd-actions { margin-left: auto; }
  html body .pd-header--exec .pd-nav-wrap {
    position: fixed; top: var(--header-height); left: 0; right: 0; z-index: 1500;
    padding: 10px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-pop);
    max-height: calc(100vh - var(--header-height)); overflow-y: auto;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
  }
  html body .pd-header--exec .pd-nav-wrap.active { transform: none; opacity: 1; visibility: visible; }
  html body .pd-header--exec .pd-nav { flex-direction: column; align-items: stretch; overflow: visible; gap: 2px; justify-content: flex-start; }
  html body .pd-header--exec .pd-nav > li { display: block; }
  html body .pd-header--exec .pd-link { width: 100%; padding: 12px; font-size: 14.5px; }
  html body .pd-only-mobile { display: block; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  html body .pd-header--exec .notifications-panel { position: fixed; top: calc(var(--header-height) + 8px); left: 10px; right: 10px; width: auto; max-width: none; }
}
html body .mobile-overlay {
  position: fixed; inset: 0; z-index: 1400; background: var(--scrim); opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
html body .mobile-overlay.active { opacity: 1; visibility: visible; }

/* Jefe: aviso de actualización + estado de conexión (colores los fija el JS) */
html body .update-notification {
  position: fixed; top: calc(var(--header-height) + 14px); right: 16px; z-index: 9999;
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  color: #fff; font: 500 13px/1.2 var(--font-ui); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-12px); transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
html body .update-notification.show { opacity: 1; transform: none; }
html body .update-notification.hide { opacity: 0; transform: translateY(-12px); }
html body .connection-status {
  position: fixed; bottom: 12px; right: 12px; z-index: 9998; width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface); transition: background-color .3s ease;
}
html body .connection-status.connected { background: var(--ok); color: var(--ok); }
html body .connection-status.disconnected { background: var(--err); color: var(--err); animation: pd-pulse 2s infinite; }
html body .connection-status.connecting { background: var(--warn); color: var(--warn); animation: pd-pulse 1s infinite; }

/* 6 · FOOTER (minimalista, centrado, como MiHora) ----------------------- */
html body footer.pd-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; width: 100%; height: var(--pd-footer-h); margin: 0; padding: 0 1rem; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 0;
  background: var(--hdr-bg); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .68rem; line-height: 1.45;
}
/* Pie pegado al borde inferior de la pantalla en toda la plataforma (si el contenido es corto) o al final de la página */
html { --pd-footer-h: 2.8rem; }
html body:not(.pd-auth) { padding-bottom: var(--pd-footer-h); box-sizing: border-box; }
html body.pd-auth footer.pd-footer { position: relative; height: auto; padding: .6rem 1rem; }
@media (max-width: 640px) { html { --pd-footer-h: 4.6rem; } html body footer.pd-footer { font-size: .64rem; } }
html body footer.pd-footer p { margin: 0; }
.pd-k4r { position: relative; display: inline-block; vertical-align: middle; margin: 0 2px; cursor: zoom-in; outline: none; }
.pd-k4r:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
html body .pd-footer .pd-k4r__img { height: 15px; width: auto; display: block; }
html body .pd-footer .pd-k4r__big {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  height: 100px; width: auto; max-width: 80vw; z-index: 2000; pointer-events: none; filter: drop-shadow(0 8px 16px rgba(15, 42, 38, .35));
}
html body .pd-footer .pd-k4r--dark { display: none; }
html body .pd-footer .pd-k4r:is(:hover, :focus) .pd-k4r__big.pd-k4r--light { display: block; }
html[data-theme="dark"] body .pd-footer .pd-k4r--light { display: none !important; }
html[data-theme="dark"] body .pd-footer .pd-k4r__img.pd-k4r--dark { display: block; }
html[data-theme="dark"] body .pd-footer .pd-k4r:is(:hover, :focus) .pd-k4r__big.pd-k4r--dark { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body .pd-footer .pd-k4r--light { display: none !important; }
  html:not([data-theme="light"]) body .pd-footer .pd-k4r__img.pd-k4r--dark { display: block; }
  html:not([data-theme="light"]) body .pd-footer .pd-k4r:is(:hover, :focus) .pd-k4r__big.pd-k4r--dark { display: block; }
}
@media print { .pd-header, footer.pd-footer, .pd-drawer, .pd-scrim { display: none !important; } }

/* 7 · COMPONENTES GLOBALES ----------------------------------------------- */
/* Solo capa visual (color, borde, radio, sombra). Layout y tamaños de cada
   pantalla se conservan. Prefijo "html body" para imponerse a los estilos
   embebidos de cada página. */

/* Títulos */
html body h1, html body h2, html body h3, html body h4 { letter-spacing: -.015em; }
html body h1 { font-weight: 700; }
html body h2, html body h3 { font-weight: 650; }

/* Superficies */
html body .card,
html body .stat-card,
html body .dashboard-card,
html body .hito-card,
html body .info-box,
html body .modal-content,
html body .filter-modal-content,
html body .evidencia-item,
html body .objetivo-item,
html body .accion-item,
html body .item-validacion,
html body .hito-acordeon-item,
html body .tarea-detail,
html body .resumen-item,
html body .empty-state {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  box-shadow: none;
}
html body .card, html body .stat-card, html body .dashboard-card, html body .hito-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
html body .card:hover, html body .stat-card:hover, html body .hito-card:hover { transform: none; box-shadow: none; }
html body .dashboard-card:hover { transform: none; border-color: var(--line-strong); box-shadow: none; }
html body .card h2, html body .card h3, html body .dashboard-card h3 { color: var(--text); }
html body .modal-content, html body .filter-modal-content { box-shadow: var(--shadow-pop); border-radius: var(--radius-lg); }
html body .welcome-box { background: var(--accent-soft); border: 1px solid transparent; border-radius: 12px; }
html body .welcome-box h3 { color: var(--accent-text); }
html body .quick-stat, html body .action-btn { background: var(--surface-2); border-color: var(--line); color: var(--text); }
html body .action-btn:hover { background: var(--hover); color: var(--text); transform: none; }

/* Botones */
html body .btn { border-radius: 11px; font-weight: 600; letter-spacing: -.005em; box-shadow: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
html body .btn:hover { transform: none; box-shadow: none; }
html body .btn:disabled, html body .btn[disabled] { opacity: .5; cursor: not-allowed; }
html body .btn-primary { background: linear-gradient(145deg, var(--brand), var(--brand-strong)); color: #04352d; font-weight: 700; border: 1px solid rgba(255,255,255,.38); box-shadow: 0 8px 20px -8px rgba(14,163,148,.5), 0 1px 0 rgba(255,255,255,.4) inset; }
html body .btn-primary:hover { filter: brightness(1.04); transform: translateY(-2px); color: #04352d; box-shadow: 0 12px 26px -8px rgba(14,163,148,.55), 0 1px 0 rgba(255,255,255,.5) inset; }
html body .btn-primary:active { transform: translateY(1px); }
html body .btn-secondary { background: transparent; color: var(--text-2); border: 1px solid var(--line-strong); }
html body .btn-secondary:hover { background: var(--hover); color: var(--text); }
html body .btn-success { background: var(--ok-solid); color: #fff; border: 1px solid transparent; }
html body .btn-success:hover { background: color-mix(in srgb, var(--ok-solid) 86%, #000); color: #fff; }
html body .btn-danger { background: var(--err-solid); color: #fff; border: 1px solid transparent; }
html body .btn-danger:hover { background: color-mix(in srgb, var(--err-solid) 86%, #000); color: #fff; }
html body .btn-warning { background: var(--warn-solid); color: #fff; border: 1px solid transparent; }
html body .btn-warning:hover { background: color-mix(in srgb, var(--warn-solid) 86%, #000); color: #fff; }

/* Formularios */
html body label { color: var(--text-2); }
html body :is(input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"],
  input[type="datetime-local"], input[type="time"], input[type="search"], input[type="tel"], input[type="url"],
  input:not([type]), select, textarea) {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 11px; font-family: var(--font-ui); box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
html body :is(input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"],
  input[type="datetime-local"], input[type="time"], input[type="search"], input[type="tel"], input[type="url"],
  input:not([type]), select, textarea):focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface);
}
html body :is(input, select, textarea)::placeholder { color: var(--subtle); opacity: 1; }
html body :is(input, select, textarea):disabled, html body .disabled-field { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
html body select option { background: var(--surface); color: var(--text); }
html body input[type="checkbox"], html body input[type="radio"], html body input[type="range"] { accent-color: var(--accent); }
html body input[type="file"] { color: var(--text-2); }
html body input[type="date"], html body input[type="datetime-local"], html body input[type="time"] { color-scheme: inherit; }

/* Tablas */
html body table { border-collapse: collapse; color: var(--text); }
html body th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; border-color: var(--line); }
html body td { border-color: var(--line); color: var(--text); }
html body tbody tr:hover { background: var(--hover); }

/* Mensajes */
html body .success { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok-text); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); border-radius: 10px; }
html body .error, html body .error-container { background: color-mix(in srgb, var(--err) 10%, var(--surface)); color: var(--err-text); border: 1px solid color-mix(in srgb, var(--err) 28%, transparent); border-radius: 10px; }
html body .warning-box, html body .warning { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent); border-radius: 10px; }

/* Pestañas y chips */
html body .tabs { border-bottom: 1px solid var(--line); }
html body .tab { color: var(--muted); }
html body .tab:hover { background: var(--hover); color: var(--text); }
html body .tab.active { color: var(--accent-text); border-bottom-color: var(--accent); background: transparent; }
html body .badge, html body [class^="badge-"]:not(.badge-pendientes) { border-radius: 999px; }
html body .breadcrumbs, html body .breadcrumbs a { color: var(--muted); }
html body .dropdown-item { color: var(--text-2); }
html body .dropdown-item:hover { background: var(--hover); color: var(--text); }
html body hr { border: 0; border-top: 1px solid var(--line); }
html body code, html body pre { background: var(--surface-2); color: var(--text); border-radius: 8px; }

/* Enlaces de contenido */
html body main a:not([class]) { color: var(--accent-text); }

/* 8 · FILTROS Y BUSCADORES (lenguaje MiHora: contenedor de vidrio, campos de 11px, foco teal) ---- */
html body :is(.filtros-container, .search-historial, .search-form, .filtros-activos) {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
html body :is(.filtro-select, .filtro-input, .search-input, .search-input-unidades, .search-historial input) {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: 11px;
  font-family: var(--font-ui); box-shadow: none; transition: border-color .24s ease, box-shadow .24s ease, background-color .24s ease;
}
html body :is(.filtro-select, .filtro-input, .search-input, .search-input-unidades, .search-historial input):hover { border-color: var(--brand); }
html body :is(.filtro-select, .filtro-input, .search-input, .search-input-unidades, .search-historial input):focus {
  outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft);
}
html body :is(.filtro-label, .filtro-group label) { color: var(--text-2); font-weight: 600; }
html body .btn-clear-filters {
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: none;
}
html body .btn-clear-filters:hover { background: var(--hover); color: var(--text); border-color: var(--brand); transform: none; }
html body .filtro-activo { background: var(--accent-soft); color: var(--accent-text); border: 1px solid transparent; border-radius: 999px; }
html body .remove-filter { color: inherit; }

/* 10 · DENSIDAD MINIMALISTA: tipografía, cifras y tarjetas más compactas -------------- */
html body { font-size: 13px; line-height: 1.5; }
html body :is(main, .main-content) h1 { font-size: 1.25rem; line-height: 1.3; }
html body :is(main, .main-content) h2 { font-size: 1.05rem; line-height: 1.35; }
html body :is(main, .main-content) h3 { font-size: .95rem; line-height: 1.35; }
html body :is(main, .main-content) h4 { font-size: .88rem; }
html body .main-content { padding: .75rem 1rem; }
/* Cifras grandes -> discretas */
html body :is(.hito-total, .stat-number, .stat-value, .stat-valor, .stat-num, .porcentaje-central, .big-number) { font-size: 1.5rem; line-height: 1.1; margin: .25rem 0; }
html body .hito-icon { font-size: 1.5rem; }
html body :is(.hito-anio) { font-size: .85rem; padding: .15rem .7rem; margin-bottom: .25rem; }
html body :is(.hito-label, .stat-label, .stat-action, .info-label) { font-size: .7rem; letter-spacing: .04em; }
/* Tarjetas: menos aire, sin elevación al pasar el cursor */
html body :is(.hito-card, .stat-card) { padding: .75rem; border-radius: var(--radius-md); box-shadow: none; }
html body :is(.hito-card, .stat-card, .dashboard-card, .card):hover { transform: none; box-shadow: none; border-color: var(--line-strong); }
html body .card { padding: 1rem; margin-bottom: .75rem; }
html body .dashboard-card { padding: .85rem; }
html body :is(.card, .dashboard-card) :is(p, li, td, th, label, span) { font-size: inherit; }
/* Tablas, botones y campos */
html body th { font-size: .7rem; padding: .5rem .65rem; }
html body td { padding: .5rem .65rem; font-size: .82rem; }
html body .dashboard-grid:has(> .hito-card) { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
html body .btn { padding: .45rem .9rem; font-size: .8rem; }
html body :is(input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea) { padding: .45rem .7rem; font-size: .82rem; }
html body .login-container .btn { padding: 0; }
html body .login-container input { padding: 0 44px 0 14px; }

/* 11 · COMPACTO v2: header al ras, menos contenedores, tarjetas pequeñas, listas con scroll --- */
html, html body { margin: 0; padding-top: 0; }
html body .pd-header { margin: 0; width: 100%; max-width: none; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; top: 0; left: 0; right: 0; }
html body .pd-header__inner { max-width: none; width: 100%; margin: 0; padding-left: 1rem; padding-right: 1rem; }
/* Ancho útil: todo el ancho de pantalla */
html body :is(main, .main-content, .contenido-principal, .container) { max-width: none; width: 100%; margin-left: 0; margin-right: 0; box-sizing: border-box; padding: .6rem 1rem; }
/* Contenedores envoltorio planos: solo quedan las tarjetas informativas */
html body :is(.card, .estadisticas-container, .filtros-container, .welcome-box, .historial-container, .navigation):not(:has(> .card)) { box-shadow: none; }
html body :is(.estadisticas-container, .welcome-box, .historial-container, .navigation) { background: transparent; border: 0; padding: 0; margin: 0 0 .5rem; box-shadow: none; }
html body .card:has(> .dashboard-grid:only-of-type), html body .card:has(> .dashboard-grid) { background: transparent; border: 0; padding: .25rem 0; box-shadow: none; }
html body .card:has(> .dashboard-grid) > h2 { margin: 0 0 .4rem; }
html body .card { padding: .75rem; margin-bottom: .6rem; }
/* Tarjetas de estadística: tamaño de su contenido, repartidas en toda la fila */
html body :is(.stats-grid, .estadisticas-grid, .dashboard-grid) { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
html body .stats-grid:has(> .stat-card) { grid-template-columns: repeat(auto-fit, minmax(190px, 260px)); justify-content: start; }
html body :is(.stat-card, .estadistica-item, .dashboard-card) { padding: .6rem .75rem; min-height: 0; border-radius: var(--radius-md); box-shadow: none; }
html body .estadistica-item { text-align: center; }
html body .estadistica-valor { font-size: 1.3rem; margin: 0; line-height: 1.1; }
html body :is(.estadistica-etiqueta, .estadistica-porcentaje) { font-size: .7rem; margin: 0; }
html body :is(.estadisticas-header) { margin: 0 0 .4rem; padding: 0; gap: .4rem; }
html body :is(.estadisticas-titulo) { font-size: .85rem; }
html body .action-buttons, html body .acciones-filtros, html body .filtros-acciones, html body .acciones-container { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
html body :is(.btn, .btn-accion, .nav-btn, button.btn-etapa) + :is(.btn, .btn-accion, .nav-btn, button.btn-etapa) { margin-left: 0; }
html body .filtros-container { padding: .6rem .75rem; margin-bottom: .6rem; }
html body .filtros-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem .75rem; }
/* ver_hitos_jefe: acordeón compacto */
html body .hito-acordeon-item { margin-bottom: .35rem; border-radius: 12px; }
html body .hito-acordeon-header { padding: .5rem .75rem; gap: .5rem; }
html body .hito-acordeon-titulo { font-size: .85rem; gap: .5rem; }
html body .hito-info-cerrado { gap: .4rem; font-size: .72rem; }
html body .hito-contenido { padding: .6rem .75rem; }
html body .info-tabla { display: block; }
html body .info-tabla tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); column-gap: 1rem; }
html body .info-tabla td { padding: .25rem .4rem; font-size: .78rem; }
html body .hito-metadata { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; margin: .4rem 0; padding: 0; }
html body .metadata-item { padding: .3rem .5rem; gap: .4rem; }
html body .metadata-icon { width: 24px; height: 24px; font-size: .75rem; }
html body .hito-acordeon-header { padding: .4rem .75rem; }
html body .hito-info-cerrado { flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: .75rem; }
html body .hito-nombre { font-size: .85rem; margin: 0; }
html body .hito-unidad { font-size: .72rem; }
html body .hito-estado-badge { padding: .15rem .55rem; font-size: .65rem; margin-left: .5rem; }
html body .hito-acordeon-header .hito-icon { font-size: 1rem; }
html body .estadistica-item { padding: .4rem .6rem; }
html body .estadisticas-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 170px)); justify-content: start; }
html body .estadistica-badge { font-size: .6rem; padding: .05rem .4rem; }
html body .estadistica-porcentaje { padding: .05rem .4rem; }
html body :is(.etapa-header, .role-banner) { padding: .5rem .85rem; margin-bottom: .5rem; }
html body .etapa-header :is(h2, h3) { font-size: .95rem; margin: 0; }
html body .etapa-badge-large { padding: .3rem .8rem; font-size: .8rem; }
html body .nav-btn { padding: .35rem .8rem; font-size: .78rem; }
html body .titulo-seccion { font-size: 1.1rem; margin: .2rem 0 .5rem; padding-bottom: .3rem; }
html body .filtros-container .filtros-acciones { margin-top: .4rem; }
html body .unidad-header > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; }
html body .unidad-title { font-size: .9rem; gap: .5rem; }
html body .unidad-stats { gap: .4rem; }
html body .unidad-stats .stat-badge { padding: .1rem .55rem; font-size: .7rem; gap: .3rem; }
html body #unidadesList { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: .5rem; align-content: start; }
html body #unidadesList > .unidad-card { margin: 0; align-self: start; }
html body :is(.search-container-unidades, .acciones-container) { margin-bottom: .5rem; gap: .5rem; }
html body .unidad-card { min-height: 0; padding: 0; overflow: hidden; }
html body .unidad-header { align-items: center; min-height: 0; }
/* Listas con scroll interno (la página deja de crecer sin control) */
html body :is(#hitosAcordeon, .hitos-acordeon, #unidadesList, #listaEvidenciasPendientes, #historialRecientes, #historialCompleto, .lista-scroll) {
  max-height: calc(100vh - var(--header-height, 108px) - 190px); min-height: 220px; overflow-y: auto; overflow-x: hidden;
  padding-right: .35rem; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain;
}
html body :is(#hitosAcordeon, #unidadesList, #listaEvidenciasPendientes, #historialRecientes, #historialCompleto)::-webkit-scrollbar { width: 8px; }
html body :is(#hitosAcordeon, #unidadesList, #listaEvidenciasPendientes, #historialRecientes, #historialCompleto)::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
html body :is(.unidad-card, .evidencia-pendiente) { margin-bottom: .4rem; padding: .6rem .75rem; }
html body .unidad-header { padding: .4rem .6rem; }
html body :is(#listaEvidenciasPendientes, #historialRecientes):has(> :only-child:not(.evidencia-pendiente)) { min-height: 0; }
html body :is(#hitosAcordeon, #unidadesList, #listaEvidenciasPendientes, #historialRecientes, #historialCompleto) > * { flex-shrink: 0; }
html body .dashboard-grid:has(> .dashboard-card) { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; }
html body .single-access-container { max-width: none; margin: 0; }
html body .single-access-container > .hito-card { max-width: 420px; margin: .5rem 0 0; animation: none; transform: none; padding: .75rem; }
html body .single-access-container .access-info-box { padding: .5rem .75rem; }
html body .user-header { padding: .6rem .85rem; margin-bottom: .6rem; min-height: 0; }
html body .user-header h1, html body .user-header h2 { font-size: 1rem; margin: 0; }
/* Mensajes pequeños */
html body :is(.success-message, .error-message, .warning-message, .info-message, .alert, .alert-success, .alert-error, .warning-box, .info-box, .mensaje, .sin-resultados, .estadisticas-sin-resultados) {
  padding: .5rem .75rem; margin: .4rem 0; font-size: .8rem; border-radius: 10px; line-height: 1.4;
}
html body :is(.warning-box, .info-box) :is(h3, h4) { font-size: .85rem; margin: 0 0 .25rem; }
html body :is(.sin-resultados, .estadisticas-sin-resultados) :is(i, span) { font-size: 1.3rem; }
html body :is(.modal-content, .filter-modal-content) { padding: 1rem; max-width: 520px; border-radius: 14px; }
/* Botones con aire entre sí */
html body :is(.btn, button.btn, .btn-accion, .nav-btn) { margin: .15rem .25rem .15rem 0; }
html body :is(form .btn + .btn, td .btn + .btn, .btn + a.btn) { margin-left: .35rem; }

/* 12 · MINIMAL v3: formularios, tablas, buscador y tarjetas pequeños en toda la plataforma ---- */
/* Tarjetas de panel (superadmin y similares) */
html body .dashboard-grid:has(> .dashboard-card) { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
html body .dashboard-card { padding: .5rem .65rem; }
html body .dashboard-card h3 { font-size: .8rem; margin: 0 0 .15rem; }
html body .dashboard-card p { font-size: .72rem; margin: 0 0 .35rem; line-height: 1.35; }
html body :is(.quick-stats) { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; margin: .25rem 0; }
html body .quick-stat { padding: .25rem .35rem; border-radius: 8px; }
html body :is(.quick-stat-number) { font-size: .95rem; margin: 0; line-height: 1.1; }
html body :is(.quick-stat-label) { font-size: .62rem; }
html body .action-buttons { display: flex; flex-wrap: wrap; gap: .3rem; }
html body .action-btn { padding: .25rem .55rem; font-size: .7rem; gap: .3rem; border-radius: 8px; min-height: 0; }
html body .stats-grid:has(> .stat-card) { grid-template-columns: repeat(auto-fit, minmax(110px, 150px)); gap: .4rem; }
html body .stat-card { padding: .35rem .5rem; }
html body .stat-card .stat-number { font-size: 1.05rem; margin: 0; }
html body :is(.stat-card .stat-label, .stat-card p, .stat-card span:not(.stat-number)) { font-size: .66rem; }
html body .tabs { gap: .25rem; margin-bottom: .5rem; }
html body .tab { padding: .3rem .65rem; font-size: .75rem; }
/* Buscador compacto y en una sola línea */
html body .contenedor-busqueda { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: 0; margin: 0 0 .5rem; background: none; border: 0; box-shadow: none; }
html body .contenedor-busqueda .search-input, html body .search-input { flex: 1 1 260px; min-width: 0; width: auto; height: 32px; padding: 0 .7rem; font-size: .78rem; border-radius: 9px; margin: 0; }
html body .botones-container { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; width: auto; margin: 0; flex: 0 0 auto; }
html body .botones-container .btn, html body .contenedor-busqueda .btn { width: auto; height: 32px; padding: 0 .75rem; font-size: .74rem; border-radius: 9px; margin: 0; }
html body .filtros-activos { padding: .25rem .5rem; margin: 0 0 .4rem; gap: .3rem; font-size: .72rem; }
/* Tablas minimalistas con scroll interno */
html body .tabla-contenedor { max-height: calc(100vh - var(--header-height, 108px) - 150px); overflow: auto; border-radius: 12px; }
html body :is(.tabla, .table) { font-size: .76rem; }
html body :is(.tabla, .table) th { padding: .35rem .55rem; font-size: .64rem; position: sticky; top: 0; z-index: 2; }
html body :is(.tabla, .table) td { padding: .3rem .55rem; font-size: .76rem; }
html body :is(.tabla, .table) td .btn, html body :is(.tabla, .table) .btn-sm, html body :is(.tabla, .table) td button { padding: .2rem .5rem; font-size: .68rem; min-height: 0; border-radius: 8px; margin: 0 .1rem; }
html body :is(.tabla, .table) :is(.badge, .rol-badge, .estado-badge, .status-badge, .prioridad-badge) { padding: .1rem .45rem; font-size: .64rem; }
html body .id-small { font-size: .62rem; }
html body .filter-icon { font-size: .7rem; }
/* Formularios: más columnas, controles bajos */
html body .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .4rem .75rem; }
html body .form-group { margin: 0 0 .35rem; }
html body .form-group.full-width, html body .form-grid > .full-width { grid-column: 1 / -1; }
html body .form-group label, html body .form-group > .font-semibold { font-size: .72rem; margin-bottom: .15rem; }
html body .form-group :is(input, select, textarea), html body .form-group .w-full { height: auto; padding: .3rem .6rem; font-size: .8rem; border-radius: 9px; min-height: 30px; }
html body .form-group textarea { min-height: 60px; }
html body .form-group :is(small, .text-muted, .form-text, .form-help, .help-text, .rut-hint) { font-size: .64rem; margin-top: .1rem; line-height: 1.3; }
html body .form-group.password-toggle { margin: 0; }
html body .form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
html body .form-actions .btn, html body .btn-hito { padding: .35rem .9rem; font-size: .78rem; }
html body :is(.info-box, .warning-box) { padding: .35rem .6rem; margin: 0 0 .4rem; font-size: .72rem; line-height: 1.35; }
html body :is(.info-box, .warning-box) :is(h3, h4) { font-size: .78rem; margin: 0 0 .15rem; }
html body :is(.info-box, .warning-box) :is(ul, ol) { margin: .15rem 0; padding-left: 1.1rem; }
html body :is(.info-box, .warning-box) li { margin: 0; }
html body :is(.sistema-option, .sistema-header) { padding: .35rem .6rem; }
html body .sistema-title { font-size: .8rem; }
html body :is(.sistema-desc, .puntaje-label) { font-size: .68rem; }
html body .main-content .card > h2:first-child, html body .main-content .card > .card-title { font-size: .95rem; margin: 0 0 .4rem; }
html body .main-content :is(.header-actions, .header-buttons) { gap: .4rem; }
html body .modal-content { padding: .75rem; }
html body .modal-header h2, html body .modal-header h3 { font-size: .95rem; }

html body .contenedor-busqueda { flex-direction: row; }
html body .form-group small { font-size: .64rem !important; margin-top: .1rem !important; }
html body .form-actions { margin-top: .5rem; padding-top: .5rem; gap: .5rem; }
html body .form-actions .btn { flex: 0 0 auto; width: auto; min-width: 0; height: 32px; padding: 0 1rem; font-size: .76rem; }
html body .form-group.password-toggle button, html body .form-group .toggle-password, html body .password-toggle { font-size: .8rem; }
html body .sistema-option { padding: .45rem .65rem; min-height: 0; gap: .2rem; }
html body :is(.sistema-icon) { font-size: .95rem; }
html body .puntaje-stat { font-size: 1.15rem; line-height: 1.1; }
html body :is(.sistema-option, .sistema-header) :is(input[type="radio"], input[type="checkbox"]) { width: 14px; height: 14px; min-height: 0; }
/* Crear/editar hito: cuadrícula ordenada de 4 columnas y avisos de responsable compactos */
html body .form-grid:has(#unidadTarea) { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: .5rem .9rem; }
@media (max-width: 1100px) { html body .form-grid:has(#unidadTarea) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { html body .form-grid:has(#unidadTarea) { grid-template-columns: 1fr; } }
html body :is(.responsable-info, .sin-responsable, .todas-direcciones-info) { padding: .3rem .55rem; margin: .3rem 0 0; border-radius: 8px; font-size: .68rem; line-height: 1.35; }
html body :is(.responsable-info, .sin-responsable, .todas-direcciones-info) h5 { font-size: .7rem; margin: 0 0 .1rem; gap: .3rem; }
html body :is(.responsable-info, .sin-responsable, .todas-direcciones-info) :is(p, .text-sm) { font-size: .68rem; margin: 0; line-height: 1.35; }
html body :is(.responsable-info, .sin-responsable, .todas-direcciones-info) small { font-size: .62rem !important; }
html body .form-group.full-width.mt-4 { margin-top: .4rem; }
html body .main-content :is(.info-box, .warning-box) { margin: .4rem 0 .7rem; border-width: 1px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 10px; }
html body .form-group.full-width.mt-4 { margin-top: .7rem; }
html body .form-group.full-width.mt-4 > label { display: block; margin-bottom: .25rem; }
html body .form-group textarea { min-height: 54px; resize: vertical; }
html body .form-grid + :is(.info-box, .sistema-container, [class*="puntaje"]), html body .form-grid + div { margin-top: .7rem; }
html body :is(.hito-info-box, .hito-puntaje-estimado) { padding: .45rem .7rem; margin: .4rem 0 .7rem; border-width: 1px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 10px; font-size: .76rem; line-height: 1.4; }
html body .puntaje-info { padding: .6rem .8rem; margin: .4rem 0; border-radius: 12px; }
html body :is(.hito-info-box, .hito-puntaje-estimado) :is(h4, h5) { font-size: .8rem; margin: 0 0 .2rem; gap: .35rem; }
html body :is(.hito-info-box, .hito-puntaje-estimado) :is(p, .text-sm, .text-base) { font-size: .74rem; margin: 0 0 .2rem; }
html body .hito-puntaje-estimado { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .3rem 1.2rem; }
html body .hito-puntaje-estimado > :is(h4, p) { grid-column: 1 / -1; }
/* 9 · UTILIDADES RESPONSIVAS --------------------------------------------- */
html body .table-responsive, html body .tabla-container, html body .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
  html body { font-size: 14px; }
  html body .modal-content, html body .filter-modal-content { max-width: calc(100vw - 24px); }
}