/* ============================================================
   Construbot Enterprise Suite — shell del sistema v3 (2026-10-01).
   Paleta del logo real (logo_construbot.jpg): azul acero #4197b9
   (oscuro #357792) + gris plateado #c4c6ca, sobre tinta de ingeniería
   #0e1d27. Lenguaje: software corporativo de alto valor — superficies
   blancas con profundidad suave (nunca bloques planos de color),
   tipografía Inter con micro-etiquetas JetBrains Mono como acento
   técnico, íconos lineales, estados en píldoras tintadas.
   La landing pública NO usa este archivo (static/css/landing.css).
   ============================================================ */
:root {
  /* Azul acero del logo */
  --brand-900: #0a2736;
  --brand-800: #0f3a4f;
  --brand-700: #135069;
  --brand-600: #357792;
  --brand-500: #4197b9;
  --brand-300: #8fc4db;
  --brand-100: #e2eef4;
  --brand-50: #f1f7fa;
  /* Gris plateado del logo */
  --silver: #c4c6ca;
  --silver-dark: #9cabb1;
  /* Neutrales */
  --ink: #142029;
  --ink-soft: #566a77;
  --ink-faint: #8597a3;
  --line: #e1e7ec;
  --line-strong: #cfd9e0;
  --paper: #f1f4f7;
  --canvas: #eef2f5;
  --tinta: #0b1822;          /* sidebar: azul-negro de ingeniería */
  --tinta-2: #10232f;
  --acento-cian: #7fd0e8;    /* acento claro sobre fondo tinta */
  /* Sistema */
  --sidebar-w: 268px;
  --topbar-h: 62px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(11, 24, 34, 0.05);
  --shadow: 0 1px 2px rgba(11, 24, 34, 0.04), 0 10px 28px -14px rgba(11, 24, 34, 0.18);
  --shadow-lg: 0 2px 6px rgba(11, 24, 34, 0.06), 0 24px 48px -20px rgba(11, 24, 34, 0.28);
  --ring: 0 0 0 4px rgba(65, 151, 185, 0.16);
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--canvas);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-900); }
.sys-main p a:hover,
.sys-main td a:not(.btn):hover,
.sys-main dd a:hover,
.sys-main li a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: rgba(65, 151, 185, 0.22); }

.mono { font-family: "JetBrains Mono", monospace; }
.bg-steel { background: var(--brand-600) !important; }
.fw-medium { font-weight: 500; }

/* Barra de desplazamiento discreta (Chromium/WebKit + Firefox). */
* { scrollbar-width: thin; scrollbar-color: rgba(86, 106, 119, 0.35) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(86, 106, 119, 0.32); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============ Layout ============ */

.sys-layout { display: flex; min-height: 100vh; }

.sys-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 420px at 8% -8%, rgba(65, 151, 185, 0.13), transparent 62%),
    radial-gradient(900px 360px at 100% 0%, rgba(196, 198, 202, 0.22), transparent 60%),
    var(--canvas);
}

.sys-main {
  flex: 1;
  padding: 1.75rem 2rem 2.25rem;
  position: relative;
}
/* Retícula técnica solo en la franja superior, desvanecida: identidad de
   ingeniería sin ensuciar el área de trabajo. */
.sys-main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 360px;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(53, 119, 146, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 119, 146, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
/* :not(.modal) — un modal Bootstrap (p. ej. "Nueva cotización") puede
   quedar como hijo directo de .sys-main; forzarle position:relative le
   rompe el position:fixed que Bootstrap necesita para mostrarse como
   ventana flotante (el fondo se oscurece pero el formulario no aparece). */
.sys-main > *:not(.modal) { position: relative; z-index: 1; }

@media (max-width: 767.98px) {
  .sys-main { padding: 1.1rem 1rem 1.6rem; }
}

.sys-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  padding: 0.75rem 2rem;
}
.sys-footer-tag { color: var(--brand-600); }
@media (max-width: 767.98px) { .sys-footer { padding: 0.7rem 1rem; } }

/* ============ Menú lateral izquierdo vertical ============ */

.sys-sidebar {
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(65, 151, 185, 0.20), transparent 70%),
    linear-gradient(180deg, var(--tinta-2) 0%, var(--tinta) 320px, var(--tinta) 100%);
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid rgba(143, 196, 219, 0.10);
  position: relative;
  z-index: 2;
  color: #c9d8e2;
}
@media (min-width: 992px) {
  .sys-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .sys-sidebar .offcanvas-body { overflow-y: auto; height: 100%; }
}
@media (max-width: 991.98px) {
  .sys-sidebar {
    --bs-offcanvas-width: var(--sidebar-w);
    --bs-offcanvas-bg: var(--tinta);
    /* Cajón lateral fuera del flujo: con «position: relative» (regla base) el menú oculto seguía ocupando su ancho y
       empujaba todo el contenido hacia la derecha en el celular. */
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
  }
}
.sys-sidebar .offcanvas-body {
  scrollbar-color: rgba(143, 196, 219, 0.25) transparent;
}
.sys-sidebar .offcanvas-body::-webkit-scrollbar-thumb { background: rgba(143, 196, 219, 0.22); }
.offcanvas-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #88a7ba;
}

/* Marca: baldosa blanca con el logo real + palabra. */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 1rem 0.6rem;
  padding: 0.35rem 0.25rem;
  border-radius: 12px;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 6px 18px -6px rgba(65, 151, 185, 0.65);
  transition: transform 0.15s ease;
}
.sidebar-brand:hover .brand-tile { transform: translateY(-1px); }
.brand-tile img { width: 32px; height: 32px; object-fit: contain; }
.brand-words { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: 0.14em;
  color: #fff;
}
.brand-tag {
  margin-top: 0.3rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--acento-cian);
}

.sidebar-nav {
  flex: 1;
  padding: 0.35rem 0.75rem 1rem;
}
.nav-group-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #6f8c9e;
  padding: 1.15rem 0.7rem 0.45rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #c9d8e2;
  text-decoration: none;
  padding: 0.5rem 0.7rem;
  margin: 1px 0;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  transition: background 0.14s ease, color 0.14s ease;
}
.sidebar-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #7f9cae;
  transition: color 0.14s ease;
}
.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: rgba(143, 196, 219, 0.08);
  color: #fff;
  text-decoration: none;
  outline: none;
}
.sidebar-link:hover .nav-ico,
.sidebar-link:focus-visible .nav-ico { color: var(--acento-cian); }
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(65, 151, 185, 0.34), rgba(65, 151, 185, 0.10));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(127, 208, 232, 0.16);
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--acento-cian);
  box-shadow: 0 0 12px rgba(127, 208, 232, 0.8);
}
.sidebar-link.active .nav-ico { color: var(--acento-cian); }
.nav-count {
  margin-left: auto;
  min-width: 1.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--brand-500);
  color: #fff;
  font: 600 0.66rem/1.2 "JetBrains Mono", monospace;
  text-align: center;
}
.sidebar-submenu-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #c9d8e2;
  padding: 0.5rem 0.7rem 0.2rem;
}
.sidebar-sublink {
  padding: 0.36rem 0.7rem 0.36rem 2.55rem;
  font-size: 0.83rem;
  color: #a9bfcd;
}
.sidebar-sublink::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(143, 196, 219, 0.18);
}
.sidebar-sublink.active::before { display: none; }
.sidebar-sublink.active::after { background: var(--acento-cian); width: 2px; }
.sidebar-approve { color: #dff3fa; }
.sidebar-approve .nav-ico { color: var(--acento-cian); }

/* Pie: tarjeta de usuario + acciones. */
.sidebar-foot {
  padding: 0.85rem 0.85rem 1rem;
  border-top: 1px solid rgba(143, 196, 219, 0.10);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
}
.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: 11px;
  background: rgba(143, 196, 219, 0.07);
  border: 1px solid rgba(143, 196, 219, 0.14);
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  font: 600 0.9rem/1 "Inter", sans-serif;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-800));
  box-shadow: 0 0 0 2px rgba(127, 208, 232, 0.35);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-name { font-size: 0.85rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--acento-cian);
}
.user-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.user-actions form { margin: 0; display: contents; }
.ua-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  padding: 0.45rem 0.2rem;
  border-radius: 9px;
  border: 1px solid rgba(143, 196, 219, 0.14);
  background: rgba(143, 196, 219, 0.04);
  color: #a9bfcd;
  font-size: 0.66rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.ua-btn svg { width: 17px; height: 17px; }
.ua-btn:hover,
.ua-btn:focus-visible { background: rgba(143, 196, 219, 0.12); color: #fff; border-color: rgba(143, 196, 219, 0.3); text-decoration: none; outline: none; }
.ua-logout:hover,
.ua-logout:focus-visible { background: rgba(214, 69, 69, 0.18); border-color: rgba(214, 69, 69, 0.45); color: #ffd9d9; }

/* ============ Barra superior ============ */

.sys-topbar {
  position: sticky;
  top: 0;
  /* Por debajo del cajón lateral de la ficha APU en móvil (z 30). */
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  height: var(--topbar-h);
  padding: 0 2rem;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
          backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(207, 217, 224, 0.75);
}
@media (max-width: 767.98px) { .sys-topbar { padding: 0 0.8rem; gap: 0.5rem; } }
.topbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.topbar-btn svg { width: 19px; height: 19px; }
.topbar-btn:hover,
.topbar-btn:focus-visible { background: #fff; border-color: var(--line); color: var(--brand-700); outline: none; box-shadow: var(--shadow-sm); }
.topbar-count {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font: 600 0.6rem/17px "Inter", sans-serif;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* Campana de novedades: más grande, con campaneo, ondas y un panel con lo último. */
.notif-menu { position: relative; }
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.notif-bell:hover, .notif-bell:focus-visible, .notif-menu.open .notif-bell { background: #fff; border-color: var(--line); color: var(--brand-700); box-shadow: var(--shadow-sm); outline: none; }
.notif-ico { width: 27px; height: 27px; transform-origin: 50% 8%; }
.notif-bell.has-news {
  color: #c8372d;
  border-color: #f3c9c4;
  background: linear-gradient(145deg, #fff, #fff1ef);
  box-shadow: 0 6px 18px -8px rgba(214, 69, 69, 0.55);
}
.notif-bell.has-news .notif-ico { animation: notif-ring 5s ease-in-out infinite; filter: drop-shadow(0 2px 3px rgba(214, 69, 69, 0.35)); }
.notif-wave { position: absolute; inset: 0; border-radius: 14px; border: 2px solid rgba(214, 69, 69, 0.55); animation: notif-wave 2.6s ease-out infinite; pointer-events: none; }
.notif-wave.w2 { animation-delay: 1.3s; }
.notif-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(145deg, #ff6a5c, #c8281c);
  color: #fff;
  font: 800 0.74rem/23px "Inter", sans-serif;
  text-align: center;
  letter-spacing: -0.01em;
  box-shadow: 0 0 0 2.5px #fff, 0 4px 12px rgba(200, 40, 28, 0.55);
  animation: notif-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both, notif-glow 2.6s ease-in-out 0.6s infinite;
}
@keyframes notif-ring {
  0%, 62%, 100% { transform: rotate(0); }
  66% { transform: rotate(16deg); }
  70% { transform: rotate(-14deg); }
  74% { transform: rotate(11deg); }
  78% { transform: rotate(-8deg); }
  82% { transform: rotate(4deg); }
  86% { transform: rotate(0); }
}
@keyframes notif-wave { 0% { transform: scale(0.9); opacity: 0.75; } 100% { transform: scale(1.75); opacity: 0; } }
@keyframes notif-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes notif-glow { 0%, 100% { box-shadow: 0 0 0 2.5px #fff, 0 4px 12px rgba(200, 40, 28, 0.5); } 50% { box-shadow: 0 0 0 2.5px #fff, 0 0 0 7px rgba(214, 69, 69, 0.22), 0 4px 16px rgba(200, 40, 28, 0.7); } }
@media (prefers-reduced-motion: reduce) {
  .notif-bell.has-news .notif-ico, .notif-wave, .notif-badge { animation: none; }
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1085;
  width: min(380px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0.85rem 1.1rem; background: linear-gradient(135deg, var(--brand-800), var(--brand-600)); color: #fff; }
.notif-head strong { font-size: 1rem; letter-spacing: 0.01em; }
.notif-head-count { font-size: 0.78rem; font-weight: 600; color: #d3e8f1; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 0.75rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.notif-item:hover { background: var(--brand-50); color: var(--ink); text-decoration: none; }
.notif-dot { flex: 0 0 10px; width: 10px; height: 10px; margin-top: 0.38rem; border-radius: 50%; background: #d64545; box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.15); }
.notif-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.notif-body strong { font-size: 0.88rem; line-height: 1.25; }
.notif-body span { font-size: 0.8rem; color: var(--ink-soft); }
.notif-body em { font-size: 0.72rem; font-style: normal; color: var(--ink-faint); }
.notif-empty { display: flex; align-items: center; gap: 0.6rem; padding: 1.3rem 1.1rem; color: var(--ink-soft); font-size: 0.88rem; }
.notif-empty svg { width: 22px; height: 22px; color: #1f8a5b; }
.notif-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.65rem 1.1rem; background: var(--brand-50); }
.notif-foot a, .notif-foot button { font-size: 0.8rem; font-weight: 700; color: var(--brand-700); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.notif-foot a:hover, .notif-foot button:hover { text-decoration: underline; }
.notif-foot form { margin: 0; }
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.42rem 0.8rem 0.42rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--brand-700);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.topbar-back[hidden] { display: none; }
.topbar-back svg { width: 18px; height: 18px; transition: transform 0.14s ease; }
.topbar-back:hover, .topbar-back:focus-visible { background: var(--brand-50); color: var(--brand-800); text-decoration: none; outline: none; box-shadow: var(--shadow); }
.topbar-back:hover svg { transform: translateX(-3px); }
@media (max-width: 575.98px) { .topbar-back span { display: none; } .topbar-back { padding: 0.5rem; } }
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 1.05rem;
  color: var(--ink);
}
.topbar-brand:hover { text-decoration: none; color: var(--ink); }
.topbar-brand img { width: 28px; height: 28px; object-fit: contain; }
.topbar-actions { display: flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.topbar-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-right: 0.4rem;
  text-transform: capitalize;
  white-space: nowrap;
}
.topbar-sep { width: 1px; height: 26px; background: var(--line); margin: 0 0.35rem; }
.topbar-user { display: flex; align-items: center; gap: 0.6rem; padding-left: 0.15rem; }
.topbar-user .avatar { width: 34px; height: 34px; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--brand-100); }
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.2; max-width: 190px; }
.topbar-user-meta strong { font-size: 0.82rem; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-meta small {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-600);
}
@media (max-width: 1199.98px) { .topbar-date { display: none; } }
@media (max-width: 767.98px) {
  .topbar-user-meta, .topbar-sep { display: none; }
  .topbar-brand span { display: none; }
}

/* Buscador de módulos (Ctrl K): filtra los enlaces del menú lateral. */
.quicknav {
  position: relative;
  flex: 0 1 420px;
  min-width: 0;
}
.qn-ico {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.qn-input {
  width: 100%;
  height: 40px;
  padding: 0 4.2rem 0 2.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.86rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.qn-input::placeholder { color: var(--ink-faint); }
.qn-input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); background: #fff; }
.qn-input::-webkit-search-cancel-button { display: none; }
.qn-kbd {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.18rem 0.42rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font: 500 0.62rem/1.2 "JetBrains Mono", monospace;
  pointer-events: none;
}
@media (max-width: 767.98px) { .qn-kbd { display: none; } .qn-input { padding-right: 0.8rem; } }
.qn-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
}
.qn-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.65rem;
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.86rem;
  text-decoration: none;
}
.qn-item svg { width: 18px; height: 18px; color: var(--brand-600); flex-shrink: 0; }
.qn-item small {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.qn-item:hover,
.qn-item.is-active { background: var(--brand-50); color: var(--brand-900); text-decoration: none; }
.qn-empty { padding: 0.9rem 0.8rem; font-size: 0.84rem; color: var(--ink-soft); }

/* ============ Superficies ============ */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0 !important;
  padding: 0.9rem 1.15rem 0.9rem 1.3rem;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 0.93rem;
  letter-spacing: -0.005em;
  text-transform: none;
  box-shadow: inset 3px 0 0 var(--brand-500);
}
.card-body { padding: 1.15rem 1.3rem; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--line); border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) !important; }
.card > .table-responsive > .table,
.card > .table { margin-bottom: 0; }
.card > .table-responsive:last-child > .table > tbody > tr:last-child > *,
.card > .table:last-child > tbody > tr:last-child > * { border-bottom: 0; }

/* Título de página: firme, corporativo, con filete de acento. */
.page-title {
  display: inline-block;
  position: relative;
  margin: 0;
  padding-bottom: 0.6rem;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.62rem;
  line-height: 1.2;
  letter-spacing: -0.024em;
  text-transform: none;
  color: var(--ink);
}
.page-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.6rem;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-600), var(--acento-cian));
}
@media (max-width: 575.98px) { .page-title { font-size: 1.35rem; } }

/* Fichas de indicadores (presupuesto, control tower, reportes, proyecto). */
.stat-card .card { border-top: 0; overflow: hidden; }
.stat-card .card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-600), var(--acento-cian));
}
.stat-card .stat-value {
  font-family: "Inter", sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}
.stat-card .stat-label {
  margin-top: 0.3rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

/* Tablas */
.table {
  --bs-table-hover-bg: var(--brand-50);
  --bs-table-border-color: #e8edf1;
  --bs-table-striped-bg: #fafbfc;
  font-size: 0.875rem;
  color: var(--ink);
}
.table > :not(caption) > * > * { padding: 0.68rem 0.9rem; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: 0.42rem 0.6rem; }
.table thead th {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: #f7f9fb;
  border-bottom: 1px solid var(--line);
}
.card .table > :not(caption) > * > *:first-child { padding-left: 1.3rem; }
.card .table > :not(caption) > * > *:last-child { padding-right: 1.3rem; }
.table td { color: var(--ink); }
.table-hover > tbody > tr { transition: background-color 0.1s ease; }
.badge-status { font-family: "JetBrains Mono", monospace; font-size: 0.68rem; }

/* Avisos del sistema (mensajes de Django). */
.sys-main .alert {
  border-radius: 12px;
  border-width: 1px;
  box-shadow: var(--shadow-sm);
  font-size: 0.88rem;
  padding: 0.8rem 1rem;
}
.sys-main .alert-dismissible { padding-right: 3rem; }
.sys-main .alert-success { background: #edf8f1; border-color: #bfe3cc; color: #1a5c36; }
.sys-main .alert-danger, .sys-main .alert-error { background: #fdf0f0; border-color: #f1c4c4; color: #8a1f1f; }
.sys-main .alert-warning { background: #fff8e6; border-color: #f3dda0; color: #775a06; }
.sys-main .alert-info { background: var(--brand-50); border-color: #c7e0eb; color: var(--brand-800); }
.sys-main .badge { border-radius: 999px; font-weight: 600; }

/* Modales y menús desplegables a juego. */
.modal-content { border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--line); padding: 1rem 1.3rem; }
.modal-title { font-weight: 700; letter-spacing: -0.015em; }
.modal-footer { border-top: 1px solid var(--line); }
.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 0.35rem; }
.dropdown-item { border-radius: 8px; font-size: 0.875rem; }

/* ============ Login: página oscura de acceso ============ */
body.sys-login {
  background:
    radial-gradient(900px 520px at 15% 0%, rgba(65, 151, 185, 0.28), transparent 60%),
    radial-gradient(700px 480px at 100% 100%, rgba(127, 208, 232, 0.12), transparent 60%),
    linear-gradient(rgba(10, 39, 54, 0.9), rgba(11, 24, 34, 0.97)),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(143, 196, 219, 0.10) 27px, rgba(143, 196, 219, 0.10) 28px),
    repeating-linear-gradient(90deg, transparent, transparent 27px, rgba(143, 196, 219, 0.10) 27px, rgba(143, 196, 219, 0.10) 28px),
    var(--tinta);
  min-height: 100vh;
}
body.sys-login .sys-content { background: transparent; }
body.sys-login .sys-main::before { display: none; }
body.sys-login .sys-footer { background: transparent; border-top-color: rgba(143, 196, 219, 0.12); color: #7f9cae; }
.login-wrap {
  max-width: 430px;
  margin: 7vh auto;
  position: relative;
  z-index: 1;
}
.login-card {
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(143, 196, 219, 0.15), 0 30px 70px -20px rgba(0, 0, 0, 0.6);
}
.login-card::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-600), var(--acento-cian), var(--brand-600));
}
.login-card .card-header { border-bottom-width: 1px; }
.login-brand {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
  line-height: 1;
}
.login-brand-sub {
  margin-top: 0.35rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand-600);
}
.login-footnote {
  color: #9db5c4;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}
.login-footnote a { color: var(--acento-cian); }

/* Inputs del login: con form-control (SystemLoginForm), así el botón de
   ver contraseña queda pegado al campo en el input-group. */
.login-card .form-control {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
}
.login-card .form-control:focus { border-color: var(--brand-500); box-shadow: var(--ring); }

/* Toggle mostrar/ocultar contraseña del login. */
.login-card .btn-eye {
  border: 1px solid var(--line-strong);
  border-left: none;
  color: var(--brand-600);
  background: #fff;
}
.login-card .btn-eye:hover { background: var(--brand-50); }
.login-card .btn-eye-on { color: var(--brand-500); background: var(--brand-100); }

/* Links de recuperación/soporte/página principal bajo el form del login. */
.login-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: center;
  font-size: 0.85rem;
}
.login-links a { color: var(--brand-600); text-decoration: none; }
.login-links a:hover { color: var(--brand-500); text-decoration: underline; }

/* ============ Controles ============ */

.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-x: 0.95rem;
  --bs-btn-padding-y: 0.45rem;
  letter-spacing: -0.005em;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.btn:hover { text-decoration: none; }
.btn-sm {
  --bs-btn-font-size: 0.8rem;
  --bs-btn-padding-x: 0.7rem;
  --bs-btn-padding-y: 0.28rem;
  --bs-btn-border-radius: 8px;
}
.btn-lg { --bs-btn-border-radius: 12px; }

.btn-steel {
  --bs-btn-color: #fff;
  background: linear-gradient(180deg, #4ba3c5 0%, var(--brand-600) 100%);
  border: 1px solid #2d6984;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(11, 24, 34, 0.14), 0 6px 14px -8px rgba(53, 119, 146, 0.7);
}
.btn-steel:hover,
.btn-steel:focus {
  background: linear-gradient(180deg, var(--brand-500) 0%, #2f6c86 100%);
  border-color: #275d73;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 4px rgba(11, 24, 34, 0.14), 0 10px 20px -10px rgba(53, 119, 146, 0.8);
}
.btn-steel:active {
  background: var(--brand-700);
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18);
  color: #fff;
}
.btn-steel:focus-visible {
  outline: none;
  box-shadow: var(--ring), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-steel:disabled, .btn-steel.disabled { color: #fff; opacity: 0.55; }

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--brand-800);
  --bs-btn-hover-bg: var(--brand-50);
  --bs-btn-hover-border-color: #b2cbd8;
  --bs-btn-active-color: var(--brand-900);
  --bs-btn-active-bg: var(--brand-100);
  --bs-btn-active-border-color: var(--brand-300);
  --bs-btn-disabled-color: var(--ink-faint);
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-outline-secondary:focus-visible { box-shadow: var(--ring); }
.btn-outline-danger { --bs-btn-border-radius: var(--radius-sm); }

.form-control, .form-select {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.form-control::placeholder { color: var(--ink-faint); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}
.form-control-sm, .form-select-sm { border-radius: 8px; }
.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.form-label {
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-bottom: 0.32rem;
}
.sys-main form p > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.sys-main form p { margin-bottom: 0.8rem; }

/* ============ Utilidades de dominio ============ */

.money { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; }
.internal-note { background: #fff4f4; border: 1px dashed #b13; color: #7a1020; font-size: 0.75rem; padding: 0.35rem 0.5rem; border-radius: 6px; }

/* Ficha APU: formato real de la empresa (secciones + subtotales). */
.apu-sheet .apu-section td {
  background: var(--brand-100);
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--brand-700);
  border-top: 2px solid var(--brand-300);
}
.apu-sheet .apu-subtotal td { font-size: 0.78rem; }
.apu-sheet .apu-total td {
  background: var(--brand-700);
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.apu-sheet .apu-total-sale td { background: var(--brand-900); }
/* Totales que definen la propuesta: costo directo y precio sugerido, bien legibles para el cliente. */
.apu-sheet .apu-total td {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  vertical-align: middle;
}
.apu-sheet .apu-total td.money {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}
.apu-sheet .apu-total-sale td { padding-top: 0.8rem; padding-bottom: 0.8rem; font-size: 1.3rem; }
.apu-sheet .apu-total-sale td.money { font-size: 2.15rem; }
@media (max-width: 575.98px) {
  .apu-sheet .apu-total td { font-size: 0.95rem; }
  .apu-sheet .apu-total td.money { font-size: 1.35rem; }
  .apu-sheet .apu-total-sale td { font-size: 1.05rem; }
  .apu-sheet .apu-total-sale td.money { font-size: 1.6rem; }
}

/* ============ Paginación destacada (pedido 2026-09-24) ============
   Barra visible arriba y abajo de la tabla: contador, botones de
   página grandes y selector de registros por página (20/50/100). */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  margin: 0 0 1rem;
  box-shadow: var(--shadow);
}
/* Barra final de la página: sin margen inferior y algo separada de la tabla. */
main .pagination-bar:last-of-type { margin: 1rem 0 0; }
.pagination-info {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pagination-bar .pagination {
  --bs-pagination-color: var(--brand-700);
  --bs-pagination-border-color: var(--line);
  --bs-pagination-border-radius: 8px;
  --bs-pagination-hover-color: var(--brand-900);
  --bs-pagination-hover-bg: var(--brand-50);
  --bs-pagination-hover-border-color: var(--brand-300);
  --bs-pagination-active-bg: var(--brand-600);
  --bs-pagination-active-border-color: var(--brand-700);
  --bs-pagination-disabled-bg: #f6f8fa;
  --bs-pagination-disabled-color: #a5b4be;
  --bs-pagination-disabled-border-color: var(--line);
  --bs-pagination-focus-box-shadow: var(--ring);
  margin: 0;
  flex-wrap: wrap;
}
.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pagination-size select {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0.18rem 0.4rem;
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
}

/* ============ Buscador de listas desplegables (select-search) ============ */
.select-search-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.4rem;
}
.select-search-input { font-size: 0.9rem; }
.select-search-hint {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Aviso de acceso restringido (guardián de la Administración Django). */
.admin-denied-card { border-top: 4px solid var(--brand-600); }
.admin-denied-icon { color: var(--brand-600); }
.admin-denied-card .page-title { font-size: 1.5rem; }
/* ============ Ficha APU: control del cálculo HH/U (nota 3) ============ */
.labor-calc {
  background: #f4f8fa;
  border: 1px solid #d9e4ea;
  border-left: 3px solid var(--brand-600, #357792);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  display: grid;
  gap: 0.25rem;
}
.labor-help { margin-top: 0.75rem; }
.labor-help summary { cursor: pointer; }
.labor-help ul { padding-left: 1.2rem; margin-top: 0.4rem; }

/* ============ Ayuda de campos tras «?» (2026-09-25) ============
   La información adicional de cada campo no compite con el formulario:
   un botón pequeño junto a la etiqueta la despliega compacta. */
.help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 0.35rem;
  padding: 0;
  border: 1px solid var(--brand-300);
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  font: 700 0.66rem/1 "Inter", system-ui, sans-serif;
  vertical-align: 1px;
  cursor: pointer;
}
.help-toggle:hover,
.help-toggle.is-open { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.help-toggle:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
form .helptext {
  display: block;
  margin-top: 0.3rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-soft);
  background: #f4f8fa;
  border-left: 2px solid var(--brand-500);
  border-radius: 0 6px 6px 0;
}
form .helptext[hidden] { display: none; }

/* ============ Estados: píldoras tintadas con punto de color ============
   Cada .status-X solo fija --st; el componente deriva fondo, borde y
   texto con color-mix para mantener contraste AA sobre fondo claro.
   Código de color (pedido del usuario 2026-09-25): negro = borrador,
   rojo = inactivo/rechazado, verde = activo/cumplido, ámbar = en
   revisión/pendiente de acción, acero = aprobado/cerrado, gris = obsoleto. */
.status-badge {
  --st: #6c757d;
  display: inline-flex;
  align-items: center;
  gap: 0.42em;
  padding: 0.34em 0.68em 0.34em 0.58em;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: color-mix(in srgb, var(--st) 60%, #0b1620);
  background: color-mix(in srgb, var(--st) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--st) 26%, #fff);
}
.status-badge::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--st);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--st) 20%, transparent);
}
.status-BORRADOR { --st: #2b3a46; }
/* Estados de la cotización: gris = borrador, azul = en preparación/aprobada interna, ámbar = espera de aprobación, violeta = lista para enviar,
   azul vivo = enviada al cliente, verde = aprobada por el cliente, rojo = rechazada/cancelada, naranja = vencida, gris claro = reemplazada/archivada */
.status-EN_PREPARACION { --st: #4197b9; }
.status-PENDIENTE_APROBACION_INTERNA { --st: #d98200; }
.status-APROBADA_INTERNAMENTE { --st: #357792; }
.status-LISTA_PARA_ENVIAR { --st: #6b4fb3; }
.status-ENVIADA { --st: #2f6fb5; }
.status-APROBADA_POR_CLIENTE { --st: #1e7d45; }
.status-RECHAZADA { --st: #b3261e; }
.status-VENCIDA { --st: #c2570c; }
.status-REEMPLAZADA, .status-ARCHIVADA { --st: #6c757d; }
.status-EN_REVISION { --st: #e0a800; }
.status-APROBADO { --st: #357792; }
.status-ACTIVO { --st: #1e7d45; }
.status-INACTIVO { --st: #b3261e; }
.status-OBSOLETO { --st: #6c757d; }
/* Centros de costo (doc Centros de Costos §5). */
.status-PLANIFICADO { --st: #4197b9; }
.status-SUSPENDIDO { --st: #e0a800; }
.status-FINALIZADO { --st: #357792; }
/* Proveedores (doc Proveedores §5) e incidencias/conteos abiertos. */
.status-EN_HOMOLOGACION { --st: #4197b9; }
.status-PROVISIONAL { --st: #e0a800; }
.status-EVENTUAL { --st: #6c757d; }
.status-BLOQUEADO { --st: #b3261e; }
.status-ABIERTA { --st: #e0a800; }
.status-CERRADA { --st: #357792; }
.status-RESUELTA { --st: #1e7d45; }
.status-VIGENTE { --st: #1e7d45; }
.status-POR_VENCER { --st: #e0a800; }
.status-VENCIDO { --st: #b3261e; }
/* Aceptación de cliente en órdenes de trabajo (doc Órdenes de Servicio §38). */
.status-ACCEPTED { --st: #1e7d45; }
.status-ACCEPTED_WITH_OBSERVATIONS { --st: #e0a800; }
.status-REJECTED { --st: #b3261e; }
/* Contratos (FASE 6) y Proyectos (FASE 7): mismo código de color. */
.status-FIRMADO { --st: #1e7d45; }
.status-ANULADO { --st: #b3261e; }
.status-PLANEACION { --st: #2b3a46; }
.status-EJECUCION { --st: #1e7d45; }
.status-CERRADO { --st: #357792; }
.status-CANCELADO { --st: #b3261e; }
/* Elementos de la EDT/actividades (FASE 7). */
.status-PENDIENTE { --st: #2b3a46; }
.status-EN_PROGRESO { --st: #e0a800; }
.status-COMPLETADA { --st: #1e7d45; }
.status-CUMPLIDA { --st: #1e7d45; }
.status-RESUELTO { --st: #1e7d45; }
.status-CANCELADA { --st: #b3261e; }
.status-ALCANZADO { --st: #1e7d45; }
/* Control de cambios (FASE 7). */
.status-ENVIADO { --st: #e0a800; }
.status-RECHAZADO { --st: #b3261e; }
/* Órdenes de trabajo (FASE 8). */
.status-PROGRAMADA { --st: #e0a800; }
.status-EN_EJECUCION { --st: #1e7d45; }
/* Compras (FASE 9). */
.status-CONVERTIDA { --st: #357792; }
.status-APROBADA { --st: #357792; }
.status-RECHAZADA { --st: #b3261e; }
.status-RECIBIDA_PARCIAL { --st: #e0a800; }
.status-RECIBIDA_TOTAL { --st: #1e7d45; }
/* Control operativo (FASE 10). */
.status-IDENTIFICADO { --st: #2b3a46; }
.status-MITIGADO { --st: #1e7d45; }
.status-MATERIALIZADO { --st: #b3261e; }
.status-ABIERTO { --st: #b3261e; }
.status-EN_TRATAMIENTO { --st: #e0a800; }
.status-VENCIDA { --st: #6c757d; }
.status-RECLAMADA { --st: #e0a800; }
/* Finanzas (FASE 11) y facturas de proveedor (FASE 9). */
.status-PAGADA { --st: #1e7d45; }
.status-PARCIAL { --st: #e0a800; }
/* Activos, equipos y flota propios (apps.assets). */
.status-DISPONIBLE { --st: #1e7d45; }
.status-ASIGNADO { --st: #357792; }
.status-EN_MANTENIMIENTO { --st: #e0a800; }
.status-DADO_DE_BAJA { --st: #6c757d; }
.status-PERDIDO_ROBADO { --st: #b3261e; }
.status-legend { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.status-legend .status-badge { font-size: 0.62rem; }

/* ============ Calculadora de rendimiento M.O. en vivo (2026-09-25) ============ */
.labor-calculator .lc-perf-cell input { max-width: 8rem; margin-left: auto; }
.labor-calculator .lc-changed { color: #9a6b00; font-weight: 700; }
.labor-calculator input.lc-changed { border-color: #d9a400; background: #fffaf0; }
.lc-impact {
  background: #f4f8fa;
  border: 1px solid #d9e4ea;
  border-top: 3px solid var(--brand-600, #357792);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}
.lc-impact-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0;
  font-size: 0.875rem;
}
.lc-impact-row + .lc-impact-row { border-top: 1px dashed #d9e4ea; }
.lc-impact-row .money { font-family: "JetBrains Mono", monospace; text-align: right; }
.lc-impact-sale { font-weight: 700; }

/* REND. con doble clic: rendimiento = horas necesarias ÷ cantidad a ejecutar. */
.apu-sheet td.apu-rend-cell {
  cursor: pointer;
  text-decoration: underline dotted var(--brand-500);
  text-underline-offset: 3px;
}
.apu-sheet td.apu-rend-cell:hover,
.apu-sheet td.apu-rend-cell:focus-visible {
  background: var(--brand-100);
  outline: 1px solid var(--brand-300);
}
.rend-dialog {
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand-600);
  border-radius: 12px;
  padding: 1rem;
  width: min(26rem, calc(100vw - 2rem));
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.rend-dialog::backdrop { background: rgba(11, 24, 34, 0.45); }

/* Productividad de actividad: cadena de lo que el sistema deriva. */
.prod-chain .prod-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  padding: 0.15rem 0;
}
.prod-chain .prod-row + .prod-row { border-top: 1px dashed #d9e4ea; }
.prod-chain .prod-row strong { text-align: right; }
.prod-chain .lc-changed { color: #9a6b00; }

/* ============ Edición de línea: vista previa del total en vivo (nota 4) ============ */
.line-preview {
  background: #f4f8fa;
  border: 1px solid #d9e4ea;
  border-top: 3px solid var(--brand-600, #357792);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.4rem;
}
.line-preview-total {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.line-preview-total.changed { color: #9a6b00; }

/* ============ Búsqueda en vivo de listados (nota 5) ============ */
input.live-searching {
  background-image: linear-gradient(45deg, transparent 48%, var(--brand-600, #357792) 48%, var(--brand-600, #357792) 52%, transparent 52%);
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.9rem 0.9rem;
}

/* ============ Formularios compactos de la columna lateral (2026-09-26) ============
   Estructura de costos, agregar recurso y productividad: dos columnas,
   controles bajos y márgenes cortos para no ocupar tanto alto/ancho en
   pantallas pequeñas. Desplegables, textos largos y botones a ancho completo. */
.side-card > .card-body { padding: 0.75rem 0.9rem 0.9rem; }
.side-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.6rem;
}
.side-form > p { margin: 0; min-width: 0; }
.side-form > p:has(select),
.side-form > p:has(.select-search-wrap),
.side-form > p:has(textarea),
.side-form > p:has(.bg-light),
.side-form > p:has(.helptext:not([hidden])) { grid-column: 1 / -1; }
.side-form > button { grid-column: 1 / -1; margin-top: 0.2rem !important; }
.side-form .form-control,
.side-form .form-select {
  padding: 0.28rem 0.5rem;
  font-size: 0.86rem;
  min-height: 0;
  height: auto;
}
.side-form .btn { padding: 0.35rem 0.6rem; font-size: 0.86rem; }
@media (max-width: 340px) {
  .side-form { grid-template-columns: minmax(0, 1fr); }
}

/* ============ Tarjetas plegables de la ficha del APU (2026-09-26) ============
   Los paneles adicionales se ocultan/muestran para dejar solo las líneas
   del APU en edición. El estado se recuerda por navegador. */
.collapsible-card > .card-header {
  position: relative;
  cursor: pointer;
  padding-right: 2.4rem;
  user-select: none;
}
.card-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-700);
  line-height: 1;
  cursor: pointer;
}
.card-toggle:hover,
.card-toggle:focus-visible { background: var(--brand-100); outline: none; }
.card-toggle::before {
  content: "";
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease;
}
.collapsible-card.is-collapsed > .card-header .card-toggle::before { transform: translateY(1px) rotate(-45deg); }
.collapsible-card.is-collapsed > :not(.card-header) { display: none !important; }
.collapsible-card.is-collapsed > .card-header { border-bottom-color: transparent; border-radius: calc(var(--radius) - 1px) !important; }

/* ============ Panel lateral horizontal de la ficha del APU (2026-09-26) ============
   Escritorio: la columna se oculta hacia el costado y las líneas del APU
   ocupan todo el ancho. Pantallas pequeñas: cajón deslizante a la derecha. */
.apu-side-tab,
.apu-side-backdrop,
.apu-side-head { display: none; }
@media (min-width: 992px) {
  .apu-layout.side-hidden > .apu-side { display: none; }
  .apu-layout.side-hidden > .apu-main { width: 100%; }
}
@media (max-width: 991.98px) {
  .sys-main > .apu-layout { z-index: 30; }
  .apu-layout > .apu-side {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 440px);
    max-width: none;
    overflow-y: auto;
    padding: 0.75rem;
    background: #eef3f6;
    box-shadow: -8px 0 24px rgba(11, 24, 34, 0.28);
    transform: translateX(105%);
    transition: transform 0.25s ease;
    z-index: 2;
  }
  .apu-layout.side-open > .apu-side { transform: none; }
  .apu-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
  }
  .apu-side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 24, 34, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1;
  }
  .apu-layout.side-open > .apu-side-backdrop { opacity: 1; pointer-events: auto; }
  .apu-side-tab {
    display: block;
    position: fixed;
    right: 0;
    top: 45%;
    z-index: 1;
    padding: 0.7rem 0.4rem;
    border: 0;
    border-radius: 8px 0 0 8px;
    background: var(--brand-600, #357792);
    color: #fff;
    font: 600 0.72rem/1 "Barlow Condensed", sans-serif;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    box-shadow: -2px 2px 8px rgba(11, 24, 34, 0.25);
  }
  .apu-layout.side-open > .apu-side-tab { display: none; }
}

/* ============ Ventanas de contraseña / acceso (2026-09-26) ============
   Tarjeta con cabecera de marca, icono, ayuda de contraseña en vivo. */
.auth-wrap { max-width: 470px; margin-top: 6vh; }
.auth-card { border-top: 0; overflow: hidden; border-radius: 18px; }
.auth-hero {
  position: relative;
  padding: 1.7rem 1.6rem 1.4rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #0a2230 0%, #12475e 62%, #1c6280 100%);
  border-bottom: 3px solid var(--brand-500);
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
}
.auth-hero > * { position: relative; }
.auth-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-bottom: 0.7rem;
  border-radius: 50%;
  color: #c6e9f5;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(198, 233, 245, 0.45);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05);
}
.auth-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8fc4db;
}
.auth-title {
  margin: 0.25rem 0 0.45rem;
  font-family: "Inter", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.auth-lead { margin: 0; font-size: 0.87rem; line-height: 1.5; color: #d3e6ee; }
.auth-body { padding: 1.5rem 1.6rem 1.4rem; background: #fff; }
.auth-sep { margin: 0.2rem 0 1rem; border-color: var(--line); opacity: 1; }
.auth-field .form-label { font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.auth-input .form-control { border-right: 0; }
.auth-input .btn-eye {
  border: 1px solid var(--line-strong);
  border-left: none;
  color: var(--brand-600);
  background: #fff;
}
.auth-input .btn-eye:hover { background: var(--brand-50); }
.auth-input .btn-eye-on { color: var(--brand-500); background: var(--brand-100); }
.auth-error { margin-top: 0.3rem; font-size: 0.8rem; color: #b3261e; }
.pw-help[hidden], .pw-match[hidden] { display: none; }
.pw-meter { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.55rem; }
.pw-bar { flex: 1; height: 6px; border-radius: 3px; background: #dfe7ec; overflow: hidden; }
.pw-bar i { display: block; height: 100%; width: 0; background: #c0392b; transition: width 0.25s ease, background 0.25s ease; }
.pw-level { min-width: 6.5rem; text-align: right; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.pw-rules { margin: 0.45rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.15rem; font-size: 0.78rem; color: var(--ink-soft); }
.pw-rules li::before { content: "\25CB"; margin-right: 0.45rem; color: #9fb1bc; }
.pw-rules li.ok { color: #1d6b46; }
.pw-rules li.ok::before { content: "\25CF"; color: #1d8a5a; }
.pw-match { margin-top: 0.3rem; font-size: 0.78rem; font-weight: 600; }
.pw-match.ok { color: #1d6b46; }
.pw-match.bad { color: #b3261e; }

/* ============ Tablero ejecutivo (v3, 2026-10-01) ============ */

/* Marca de agua del logo (pedido 2026-09-26), más discreta. */
.sys-main > .dash-watermark {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 3vw 4vh 0;
  pointer-events: none;
}
@media (min-width: 992px) {
  .sys-main > .dash-watermark { left: var(--sidebar-w); }
}
.dash-watermark img {
  width: min(46vmin, 480px);
  height: auto;
  opacity: 0.05;
  mix-blend-mode: multiply;
}

/* Encabezado: banda de tinta con retícula, brillo acero y datos de sesión. */
.dash-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.6fr);
  gap: 1.25rem 2rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1.6rem 1.8rem;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(520px 260px at 92% 0%, rgba(127, 208, 232, 0.22), transparent 65%),
    radial-gradient(560px 320px at 0% 120%, rgba(65, 151, 185, 0.35), transparent 60%),
    linear-gradient(120deg, #0b1822 0%, #0f3145 55%, #164f69 100%);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.dash-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(143, 196, 219, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 196, 219, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 55%);
}
.dash-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--acento-cian), transparent);
}
.hero-identity { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.session-avatar {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 1.6rem/1 "Inter", sans-serif;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-800));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 10px 24px -8px rgba(65, 151, 185, 0.8);
}
.hero-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acento-cian);
}
.hero-title {
  margin: 0.3rem 0 0.3rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.15;
  color: #fff;
}
.hero-sub { font-size: 0.82rem; color: #b5cbd8; word-break: break-word; }
.hero-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
}
.hero-meta > div {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(143, 196, 219, 0.16);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
.hero-meta dt {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8fb3c6;
}
.hero-meta dd { margin: 0.3rem 0 0; font-weight: 600; font-size: 0.92rem; color: #fff; word-break: break-word; }
.hero-meta small { display: block; margin-top: 0.2rem; font-weight: 400; font-size: 0.7rem; color: #a6bfcd; }
.perm-badge {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand-800);
  background: var(--brand-100);
  border: 1px solid var(--brand-300);
}
.dash-hero .perm-badge { color: #fff; background: rgba(127, 208, 232, 0.16); border-color: rgba(127, 208, 232, 0.45); }
.perm-badge.perm-super { color: #fff; background: var(--brand-900); border-color: var(--brand-900); }
.dash-hero .perm-badge.perm-super { background: linear-gradient(90deg, #b8860b, #e0a800); border-color: transparent; color: #1b1300; }
.session-timer { font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.dash-hero .session-timer { color: var(--acento-cian); }
@media (max-width: 1199.98px) {
  .dash-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
  .dash-hero { padding: 1.25rem 1.1rem; border-radius: 16px; }
  .hero-title { font-size: 1.35rem; }
  .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
  .hero-meta { grid-template-columns: minmax(0, 1fr); }
}

/* Indicadores: cada uno es un acceso directo a su listado. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.05rem 1.15rem 0.95rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-600), var(--acento-cian));
  opacity: 0;
  transition: opacity 0.16s ease;
}
.kpi:hover,
.kpi:focus-visible {
  transform: translateY(-2px);
  border-color: #c7dde8;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  text-decoration: none;
  outline: none;
}
.kpi:hover::after,
.kpi:focus-visible::after { opacity: 1; }
.kpi-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 0.85rem;
  border-radius: 11px;
  color: var(--brand-600);
  background: linear-gradient(140deg, var(--brand-50), var(--brand-100));
  box-shadow: inset 0 0 0 1px rgba(65, 151, 185, 0.18);
}
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-value {
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.kpi-value { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; }
.kpi-label { margin-top: 0.4rem; font-size: 0.82rem; font-weight: 500; color: var(--ink-soft); }
.kpi-go {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--brand-600);
}
.kpi-go svg { width: 14px; height: 14px; transition: transform 0.16s ease; }
.kpi:hover .kpi-go svg { transform: translateX(3px); }
.kpi-accent {
  color: #fff;
  border-color: transparent;
  background:
    radial-gradient(240px 140px at 100% 0%, rgba(127, 208, 232, 0.35), transparent 70%),
    linear-gradient(140deg, var(--brand-600), var(--brand-800));
}
.kpi-accent:hover, .kpi-accent:focus-visible { color: #fff; border-color: transparent; }
.kpi-accent .kpi-ico { color: #fff; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.kpi-accent .kpi-label { color: #d3e8f1; }
.kpi-accent .kpi-go { color: var(--acento-cian); border-top-color: rgba(255, 255, 255, 0.16); }
.kpi-accent::after { display: none; }

/* Tarjetas informativas: tono corporativo según su significado (aprobado, pendiente, en proceso, borrador, dinero). */
.kpi { --tone: #357792; --tone-ink: #0f3a4f; --tone-bg: #dcebf3; --tone-bg2: #f3f8fb; }
.kpi:has(use[href="#i-check-circle"]),
.kpi:has(use[href="#i-file-check"]),
.kpi:has(use[href="#i-shield"]) { --tone: #1f8a5b; --tone-ink: #0d5a3a; --tone-bg: #d8f1e5; --tone-bg2: #f1faf5; }
.kpi:has(use[href="#i-clock"]),
.kpi:has(use[href="#i-timer"]),
.kpi:has(use[href="#i-bell"]) { --tone: #d98200; --tone-ink: #8a4f00; --tone-bg: #fdebc8; --tone-bg2: #fff8ea; }
.kpi:has(use[href="#i-inbox"]),
.kpi:has(use[href="#i-truck"]),
.kpi:has(use[href="#i-cart"]),
.kpi:has(use[href="#i-receipt"]),
.kpi:has(use[href="#i-file-text"]) { --tone: #2f6fb5; --tone-ink: #17406f; --tone-bg: #d9e7f7; --tone-bg2: #f1f6fc; }
.kpi:has(use[href="#i-clipboard"]),
.kpi:has(use[href="#i-box"]),
.kpi:has(use[href="#i-warehouse"]),
.kpi:has(use[href="#i-wrench"]),
.kpi:has(use[href="#i-ruler"]) { --tone: #5b6b7a; --tone-ink: #2c3a47; --tone-bg: #e4e9ee; --tone-bg2: #f4f6f8; }
.kpi:has(use[href="#i-target"]),
.kpi:has(use[href="#i-pie"]),
.kpi:has(use[href="#i-trending"]),
.kpi:has(use[href="#i-year"]) { --tone: #6b4fb3; --tone-ink: #3f2b78; --tone-bg: #e7e0f6; --tone-bg2: #f6f3fc; }
.kpi:has(use[href="#i-coins"]),
.kpi:has(use[href="#i-calc"]),
.kpi:has(use[href="#i-landmark"]),
.kpi:has(use[href="#i-briefcase"]) { --tone: #0f8a8a; --tone-ink: #0a5757; --tone-bg: #d3f0ef; --tone-bg2: #eefaf9; }
.kpi:has(use[href="#i-alert"]),
.kpi:has(use[href="#i-x-circle"]),
.kpi:has(use[href="#i-ban"]) { --tone: #c0392b; --tone-ink: #7d1f15; --tone-bg: #fbdcd8; --tone-bg2: #fef4f2; }
.kpi:not(.kpi-accent) {
  border-left: 5px solid var(--tone);
  background: linear-gradient(135deg, #fff 55%, var(--tone-bg2));
  padding: 1.15rem 1.25rem 1.05rem;
}
.kpi:not(.kpi-accent)::after { background: linear-gradient(90deg, var(--tone), transparent); }
.kpi:not(.kpi-accent) .kpi-ico { width: 44px; height: 44px; color: var(--tone); background: var(--tone-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent); }
.kpi:not(.kpi-accent) .kpi-ico svg { width: 23px; height: 23px; }
.kpi:not(.kpi-accent) .kpi-value { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.045em; color: var(--tone-ink); }
.kpi:not(.kpi-accent) .kpi-label { margin-top: 0.5rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em; color: var(--ink-soft); }
.kpi:not(.kpi-accent) > .small { margin-top: 0.4rem; font-size: 0.98rem; font-weight: 700; color: var(--tone) !important; }
.kpi-value { white-space: nowrap; }

/* Tonos corporativos para tarjetas sin ícono (centros de costo, presupuesto, proyecto, torre de control). */
.kpi.tone-green, .stat-card.tone-green .card, .stat-card.tone-green { --tone: #1f8a5b; --tone-ink: #0d5a3a; --tone-bg: #d8f1e5; --tone-bg2: #f1faf5; }
.kpi.tone-amber, .stat-card.tone-amber .card, .stat-card.tone-amber { --tone: #d98200; --tone-ink: #8a4f00; --tone-bg: #fdebc8; --tone-bg2: #fff8ea; }
.kpi.tone-blue, .stat-card.tone-blue .card, .stat-card.tone-blue { --tone: #2f6fb5; --tone-ink: #17406f; --tone-bg: #d9e7f7; --tone-bg2: #f1f6fc; }
.kpi.tone-slate, .stat-card.tone-slate .card, .stat-card.tone-slate { --tone: #5b6b7a; --tone-ink: #2c3a47; --tone-bg: #e4e9ee; --tone-bg2: #f4f6f8; }
.kpi.tone-violet, .stat-card.tone-violet .card, .stat-card.tone-violet { --tone: #6b4fb3; --tone-ink: #3f2b78; --tone-bg: #e7e0f6; --tone-bg2: #f6f3fc; }
.kpi.tone-teal, .stat-card.tone-teal .card, .stat-card.tone-teal { --tone: #0f8a8a; --tone-ink: #0a5757; --tone-bg: #d3f0ef; --tone-bg2: #eefaf9; }
.kpi.tone-red, .stat-card.tone-red .card, .stat-card.tone-red { --tone: #c0392b; --tone-ink: #7d1f15; --tone-bg: #fbdcd8; --tone-bg2: #fef4f2; }
.stat-card { --tone: #357792; --tone-ink: #0f3a4f; --tone-bg: #dcebf3; --tone-bg2: #f3f8fb; }
.stat-card .card, .card.stat-card {
  position: relative;
  border-left: 5px solid var(--tone);
  background: linear-gradient(135deg, #fff 55%, var(--tone-bg2));
}
.card.stat-card { overflow: hidden; }
.card.stat-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.stat-card .card::before, .card.stat-card::before { background: linear-gradient(90deg, var(--tone), transparent); }
.stat-card .stat-value { font-size: 2.45rem; font-weight: 800; letter-spacing: -0.045em; color: var(--tone-ink); white-space: nowrap; }
.stat-card .stat-label { margin-top: 0.5rem; font-size: 0.7rem; font-weight: 600; color: var(--ink-soft); }

/* Accesos rápidos en mosaico. */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.qa-grid-wide { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.qa-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.qa-tile:hover,
.qa-tile:focus-visible {
  background: #fff;
  border-color: #bcd6e2;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  color: var(--ink);
  text-decoration: none;
  outline: none;
}
.qa-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 6px 14px -8px rgba(53, 119, 146, 0.9);
}
.qa-ico svg { width: 18px; height: 18px; }
.qa-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.qa-text strong { font-size: 0.86rem; font-weight: 600; }
.qa-text small {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
@media (max-width: 400px) { .qa-grid { grid-template-columns: minmax(0, 1fr); } }

.empty-state {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.empty-state svg { width: 34px; height: 34px; flex-shrink: 0; color: #1e7d45; }
.empty-state strong { color: var(--ink); }


/* Centros de costos: gráficas SVG del servidor y barras de avance */
.cc-chart { width: 100%; height: auto; max-width: 100%; display: block; }
.cc-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.cc-donut svg { width: 190px; flex: 0 0 190px; }
.cc-legend { list-style: none; margin: 0; padding: 0; font-size: .85rem; flex: 1 1 200px; }
.cc-legend li { margin-bottom: .3rem; }
.cc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; vertical-align: baseline; }
.cc-progress { height: 8px; background: #e3e9ef; border-radius: 4px; overflow: hidden; min-width: 90px; }
.cc-progress > div { height: 100%; border-radius: 4px; }
.cc-kpi small { color: #6b7a8c; display: block; }
.cc-kpi strong { font-size: 1.15rem; }
.cc-pos { color: #1e7d45; }
.cc-neg { color: #b3261e; }

/* Ventanas emergentes con formulario: el cuerpo se desplaza con barra vertical y el encabezado y los botones quedan fijos
   (el <form> envuelve modal-header/body/footer, por eso Bootstrap no limitaba la altura). */
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 3.5rem);
  min-height: 0;
}
.modal-dialog-scrollable .modal-content > form > .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
}

/* Foto tipo carnet 3x4 del empleado */
.carnet-wrap { flex: 0 0 auto; }
.carnet-photo {
  display: block; width: 84px; aspect-ratio: 3 / 4; padding: 0; border: 2px solid var(--brand-600, #357792);
  border-radius: 6px; background: #eef3f6; overflow: hidden; cursor: pointer; color: #6b7a8c;
}
.carnet-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carnet-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; font-size: .7rem; font-weight: 600; }
.carnet-preview { width: 120px; aspect-ratio: 3 / 4; flex: 0 0 auto; border: 2px dashed #98a8c0; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #98a8c0; background: #f6f8fa; }
.carnet-preview img { width: 100%; height: 100%; object-fit: cover; }
.carnet-mini { width: 22px; height: 29px; object-fit: cover; border-radius: 3px; margin-right: 8px; vertical-align: middle; border: 1px solid #c4c6ca; }

/* ============ Celular (Android / app Campo): el shell completo no debe desbordar la pantalla ============
   Sin esto, un solo elemento más ancho que el teléfono ensancha la página y el navegador la muestra reducida y corrida. */
@media (max-width: 767.98px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .sys-topbar { overflow: hidden; }
  .quicknav { display: none; }
  .sys-main { min-width: 0; overflow-x: hidden; }
  .sys-main > .d-flex, .sys-main .d-flex.justify-content-between, .sys-main .d-flex.gap-2, .sys-main .d-flex.gap-3 { flex-wrap: wrap; gap: 0.5rem; }
  .page-title { overflow-wrap: anywhere; }
  .sys-main .card > table, .sys-main .card-body > table, .sys-main > table, .sys-main form > table {
    display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .table-responsive { max-width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qa-tile { min-width: 0; }
  .btn { white-space: normal; }
  .modal-dialog { margin: 0.6rem; }
  img, svg, video, canvas { max-width: 100%; }
}

/* Botón flotante «‹ Campo»: regreso rápido a la app móvil desde la versión completa (solo celular y tableta). */
.campo-fab { display: none; }
@media (max-width: 991.98px) {
  .campo-fab {
    display: inline-flex; align-items: center; gap: 6px; position: fixed; left: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 1030; padding: 9px 14px 9px 11px; border-radius: 999px;
    background: #203764; color: #fff; font: 700 0.82rem/1 Inter, system-ui, sans-serif; text-decoration: none;
    box-shadow: 0 4px 14px rgba(11, 24, 34, 0.35); border: 1px solid rgba(143, 196, 219, 0.35);
  }
  .campo-fab svg { width: 17px; height: 17px; }
  .campo-fab:hover, .campo-fab:focus-visible { color: #fff; background: #357792; text-decoration: none; }
  .sys-main { padding-bottom: 4.5rem; }
}


/* Visor de fotos de perfil: foto grande para apreciar a la persona (clic en la foto o en «Ver foto»). */
.carnet-wrap { text-align: center; }
.carnet-view { display: block; margin: 0.4rem auto 0; padding: 0.15rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--brand-700); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.carnet-view:hover { background: var(--brand-50); }
.photo-zoomable { cursor: zoom-in; }
.photo-lightbox { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem; padding: 1.5rem; background: rgba(8, 20, 30, 0.88); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: lb-in 0.18s ease; }
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img { max-width: min(92vw, 760px); max-height: 80vh; object-fit: contain; border-radius: 14px; background: #fff; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
.photo-lightbox .lb-caption { color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; text-align: center; }
.photo-lightbox .lb-close { position: absolute; top: 14px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.photo-lightbox .lb-close:hover { background: rgba(255, 255, 255, 0.3); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
