/* =========================================
   ESTILOS MAESTROS - ONESYNC V4 (FUSIÓN COMPLETA)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --bg: #020617;
  --card: rgba(15,23,42,0.94);
  --accent: #22c55e;        /* Verde principal */
  --accent-alt: #38bdf8;    /* Azul claro secundario */
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #1f2937;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #fb7185;        /* Rojo suave */
}

* { box-sizing: border-box; font-family: "Roboto", sans-serif; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  font-size: 0.86rem;
}

/* FONDOS */
.bg-image {
  position: fixed; inset: 0;
  background: url("bosque-fondo.jpeg") center/cover no-repeat fixed;
  opacity: 0.5; z-index: -2;
  filter: saturate(0.95) blur(0.5px);
}
.bg-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(circle at top, rgba(15,23,42,0.35), rgba(15,23,42,0.94));
  z-index: -1;
}

.container {
  width: 100%;
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.2rem;
  padding: 0;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  padding: 1.55rem 1rem;
  background: rgba(2, 8, 23, 0.86);
  border-right: 1px solid rgba(56,189,248,0.16);
  box-shadow: 18px 0 60px rgba(0,0,0,0.34);
  backdrop-filter: blur(18px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 0.6rem;
}

.sidebar-brand img {
  width: 174px;
  max-width: 100%;
  height: auto;
  display: block;
}

.sidebar-status {
  margin-top: auto;
  display: grid;
  grid-template-columns: 36px 1fr 10px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 0.8rem;
  background: rgba(15,23,42,0.72);
}

.sidebar-status-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-alt);
  border: 1px solid rgba(56,189,248,0.18);
  background: rgba(56,189,248,0.08);
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  font-size: 0.78rem;
  color: var(--text-main);
}

.sidebar-status small {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.sidebar-status i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(34,197,94,0.1);
}

.app-main {
  min-width: 0;
  padding: 2rem 2.5rem 2.5rem 0;
}

/* HEADER */
header {
  min-height: 46px;
  padding: 0;
  margin-bottom: 1.35rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: right;
  position: relative;
}

/* Version label positioned inside the header */
.app-version {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}
.header-logo { display: none; }
h1 { margin: 0; font-size: 1.5rem; color: var(--text-main); letter-spacing: 0.05em; text-transform: uppercase; background: linear-gradient(to right, var(--text-main), var(--accent-alt)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
p.sub { display: none; }


/* =========================================
   HEADER - ESTILO SOCIAL (ROL / BD / ALERTAS)
   ========================================= */
.header-actions{
  position: relative;
  top: auto;
  right: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 1.8rem);
}

.header-pill{
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  backdrop-filter: blur(10px);
  user-select: none;
}

.header-version{
  border-color: rgba(56,189,248,0.24);
  background: rgba(56,189,248,0.10);
  color: rgba(224,242,254,0.95);
}

.header-logout{
  height: 38px;
  gap: 0.55rem;
  padding: 0 1rem;
  border-color: rgba(148,163,184,0.22);
  background: rgba(2,6,23,0.42);
  color: rgba(226,232,240,0.95);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.header-logout:hover{
  border-color: rgba(148,163,184,0.38);
  background: rgba(15,23,42,0.74);
}

.logout-icon{
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.header-dot{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  position: relative;
}

.header-dot:hover{
  border-color: rgba(148,163,184,0.38);
  background: rgba(255,255,255,0.08);
}

.header-icon{
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.92;
}

/* BD: círculo interno (🟢 / 🔴 / 🟡) */
#btn-check-db::after{
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  box-shadow: 0 0 0 2px rgba(2,6,23,0.55);
}

#btn-check-db[data-status="ok"]::after{
  background: rgba(34,197,94,0.95);
}

#btn-check-db[data-status="down"]::after{
  background: rgba(248,113,113,0.95);
}

#btn-check-db[data-status="checking"]::after{
  background: rgba(251,191,36,0.95);
  animation: pulseDot 0.9s ease-in-out infinite;
}

@keyframes pulseDot{
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.75; }
}

/* Rol activo: colores por rol */
.role-pill.muted{
  color: var(--text-muted);
  opacity: 0.92;
}

.role-pill[data-role="admin"]{
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.12);
  color: #86efac;
}

.role-pill[data-role="almacen"]{
  border-color: rgba(56,189,248,0.35);
  background: rgba(56,189,248,0.12);
  color: #7dd3fc;
}

.role-pill[data-role="diseno"]{
  border-color: rgba(234,179,8,0.35);
  background: rgba(234,179,8,0.12);
  color: #fde047;
}

.role-pill[data-role="comercial"]{
  border-color: rgba(168,85,247,0.35);
  background: rgba(168,85,247,0.12);
  color: #d8b4fe;
}


.role-pill[data-role="supervisor"]{
  border-color: rgba(244,114,182,0.35);
  background: rgba(244,114,182,0.12);
  color: #f9a8d4;
}
@media (max-width: 780px){
  .header-actions{
    justify-content: center;
  }
}
/* TABS */
.tabs { display: flex; flex-direction: column; gap: 0.42rem; margin: 0; justify-content: flex-start; }
.tab { width: 100%; min-height: 46px; border: 1px solid transparent; background: transparent; padding: 0.6rem 0.85rem; font-size: 0.86rem; cursor: pointer; border-radius: 0.8rem; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: flex-start; gap: 0.72rem; transition: all 0.2s ease; text-align: left; }
.tab::before { width: 22px; display: inline-grid; place-items: center; color: rgba(203,213,225,0.78); font-size: 1rem; line-height: 1; }
.tab[data-tab="tab-dashboard"]::before { content: "▦"; }
.tab[data-tab="tab-registro"]::before { content: "▤"; }
.tab[data-tab="tab-movimientos"]::before { content: "↔"; }
.tab[data-tab="tab-inventario"]::before { content: "□"; }
.tab[data-tab="tab-costos"]::before { content: "$"; }
.tab[data-tab="tab-destruidos"]::before { content: "⌫"; }
.tab[data-tab="tab-hoja"]::before { content: "○"; }
.tab[data-tab="tab-historial"]::before { content: "◷"; }
.tab[data-tab="tab-reportes"]::before { content: "▥"; }
.tab span.dot { display: none; }
.tab:hover { transform: translateX(2px); border-color: rgba(56,189,248,0.24); background: rgba(15,23,42,0.62); color: var(--text-main); }
.tab.active { background: linear-gradient(90deg, rgba(34,197,94,0.2), rgba(56,189,248,0.16)); border-color: rgba(56,189,248,0.36); color: var(--text-main); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent), 0 14px 28px rgba(2,6,23,0.22); }
.tab.active::before { color: var(--accent-alt); }
.tabs .tab,
.header-actions button {
  margin-top: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: relative;
    height: auto;
    padding: 1rem;
    border-right: 0;
    border-bottom: 1px solid rgba(56,189,248,0.16);
  }

  .sidebar-brand,
  .sidebar-status {
    display: none;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-main {
    padding: 1rem;
  }

  .footer {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .tabs {
    grid-template-columns: 1fr;
  }
}

/* CONTENIDO TABS */
.tab-content { display: none; border-radius: 1rem; background: rgba(15,23,42,0.95); border: 1px solid rgba(30,41,59,0.8); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 16px 36px rgba(0,0,0,0.5); backdrop-filter: blur(12px); animation: fadeIn 0.3s ease-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

h2 { margin: 0 0 0.8rem; font-size: 1.1rem; font-weight: 500; color: var(--text-main); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { margin: 1rem 0 0.5rem; font-size: 0.95rem; color: var(--text-main); font-weight: 500; }

/* GRIDS Y FORMULARIOS */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
@media (max-width: 700px) { .grid-3 { grid-template-columns: 1fr; } }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--text-muted); }
input, select, textarea { border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.1); padding: 0.45rem; font-size: 0.85rem; background: rgba(2,6,23,0.6); color: var(--text-main); outline: none; transition: border 0.2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-alt); background: rgba(2,6,23,0.9); }
input[readonly] { background: rgba(255,255,255,0.03); color: var(--text-muted); cursor: default; }
textarea { min-height: 70px; resize: vertical; }

/* BOTONES */
button { margin-top: 0.3rem; padding: 0.45rem 1.1rem; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600; font-size: 0.8rem; background: linear-gradient(135deg, var(--accent), var(--accent-alt)); color: #020617; transition: filter 0.2s, transform 0.1s; }
button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-small { padding: 0.3rem 0.8rem; font-size: 0.75rem; margin-top: 0; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: white; }
.btn-secondary { background: #334155; color: white; }
.btn-recibir { background: linear-gradient(135deg, var(--accent-alt), #0ea5e9); color: #020617; font-weight: bold; } /* ESTILO RECUPERADO */
.decision-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.decision-switch-btn {
  margin-top: 0;
  padding: 0.28rem 0.7rem;
  font-size: 0.68rem;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-main);
  background: transparent;
}
.decision-switch-btn:hover {
  filter: none;
  transform: none;
}
.decision-switch-btn.is-urgent {
  background: linear-gradient(135deg, #34d399, #06b6d4);
  color: #04111f;
}
.decision-switch-btn.is-next {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}

/* TABLAS ESTANDAR */
.table { margin-top: 0.5rem; border-radius: 0.75rem; border: 1px solid var(--border); background: rgba(2,6,23,0.5); overflow: hidden; }
.table-header, .table-row { display: grid; grid-template-columns: 1.2fr 1fr 1.5fr 0.8fr 1.5fr; gap: 0.5rem; padding: 0.5rem 0.8rem; align-items: center; }
.table.table-inv .table-header, .table.table-inv .table-row { grid-template-columns: 0.95fr 1.1fr 1.35fr 0.75fr 1.15fr 0.95fr 1fr 0.9fr; } /* GRID INVENTARIO + ACCION */

/* =========================================
   COSTOS (Comercial)
========================================= */
.sub-label { color: var(--text-muted); font-size: 0.85rem; }

/* Movimientos: grids compactos */
.mov-grid-2{ display:grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (max-width: 720px){ .mov-grid-2{ grid-template-columns: 1fr; } }

.costos-resumen {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 900px) {
  .costos-resumen { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 520px) {
  .costos-resumen { grid-template-columns: 1fr; }
}

.costos-card {
  background: rgba(15,23,42,0.65);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  padding: 0.75rem;
  backdrop-filter: blur(8px);
}

.costos-card-title {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.costos-card-value {
  font-weight: 800;
  margin-top: 0.25rem;
  font-size: 1.0rem;
}

.costos-card-value.big { font-size: 1.25rem; }

.costos-card-sub {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-inv-costos { width: 100%; }
.table-header { background: rgba(30,41,59,0.5); font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.table-row { font-size: 0.8rem; border-top: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: background 0.15s; }
.table-row:hover { background: rgba(56,189,248,0.1); }
.table.table-destr .table-header, .table.table-destr .table-row { grid-template-columns: 0.8fr 0.8fr 1.5fr 0.8fr 1.2fr 1.2fr 0.6fr; font-size: 0.75rem; } /* GRID DESTRUCCION RECUPERADO */

/* TABLAS HTML CLASICAS (Para Historial y Recepciones) */
.tabla-wrapper { overflow-x: auto; margin-top: 0.5rem; border-radius: 0.5rem; border: 1px solid var(--border); background: rgba(2,6,23,0.3); }
.tabla-wrapper table thead th{ position: sticky; top: 0; background: rgba(10,14,26,0.95); z-index: 2; }
.tabla-wrapper table thead th:first-child { border-top-left-radius: 8px; }
.tabla-wrapper table thead th:last-child { border-top-right-radius: 8px; }
.tabla-wrapper table tbody tr:nth-child(odd){ background: rgba(255,255,255,0.02); }
.tabla-wrapper { max-height: 65vh; overflow-y: auto; overflow-x: auto; }

/* Historial: compactar columnas */
#tabla-historial th, #tabla-historial td{
  padding: 6px 8px;
  font-size: 0.85rem;
  line-height: 1.25;
}
#tabla-historial th:nth-child(1),
#tabla-historial td:nth-child(1),
#tabla-historial th:nth-child(2),
#tabla-historial td:nth-child(2),
#tabla-historial th:nth-child(5),
#tabla-historial td:nth-child(5),
#tabla-historial th:nth-child(6),
#tabla-historial td:nth-child(6),
#tabla-historial th:nth-child(10),
#tabla-historial td:nth-child(10),
#tabla-historial th:nth-child(11),
#tabla-historial td:nth-child(11),
#tabla-historial th:nth-child(12),
#tabla-historial td:nth-child(12) {
  white-space: nowrap;
}
#tabla-historial th:nth-child(3),
#tabla-historial td:nth-child(3) {
  width: 90px;
}
#tabla-historial th:nth-child(4),
#tabla-historial td:nth-child(4) {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tabla-historial th:nth-child(7),
#tabla-historial td:nth-child(7),
#tabla-historial th:nth-child(8),
#tabla-historial td:nth-child(8),
#tabla-historial th:nth-child(9),
#tabla-historial td:nth-child(9) {
  width: 90px;
  text-align: right;
}
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; text-align: left; }
th, td { padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
th { background: rgba(30,41,59,0.6); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.7rem; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* BADGES */
.badge { padding: 0.15rem 0.5rem; border-radius: 99px; font-size: 0.7rem; font-weight: 600; border: 1px solid transparent; }
.almacen { background: rgba(34,197,94,0.15); color: #86efac; border-color: rgba(34,197,94,0.3); }
.planta { background: rgba(56,189,248,0.15); color: #7dd3fc; border-color: rgba(56,189,248,0.3); }
.mixto { background: rgba(249,115,22,0.16); color: #fdba74; border-color: rgba(249,115,22,0.34); }
.pendiente { background: rgba(234,179,8,0.15); color: #fde047; border-color: rgba(234,179,8,0.3); }
.destruido { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.transito { background: rgba(217,70,239,0.15); color: #f0abfc; }
.reposicion { background: rgba(168,85,247,0.15); color: #d8b4fe; }
.baja { background: rgba(148,163,184,0.2); color: #cbd5e1; }
.solicitado { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border-color: rgba(59, 130, 246, 0.3); }

/* CHIPS RESUMEN (RECUPERADO) */
.resumen { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1.2rem; align-items: stretch; }
.chip { position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 100px; background: linear-gradient(145deg, rgba(30,41,59,0.7), rgba(15,23,42,0.9)); backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.08); border-radius: 0.75rem; padding: 0.6rem 1rem; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: all 0.2s ease; cursor: default; overflow: hidden; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.chip:hover { transform: translateY(-2px); border-color: var(--accent-alt); background: linear-gradient(145deg, rgba(30,41,59,0.9), rgba(15,23,42,1)); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.chip strong { font-size: 1.4rem; font-weight: 700; color: var(--text-main); line-height: 1.1; margin-bottom: 0.2rem; background: linear-gradient(to right, #fff, #cbd5e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.chip::before { content: ''; position: absolute; left: 0; top: 15%; bottom: 15%; width: 3px; background: var(--border); border-radius: 0 4px 4px 0; transition: background 0.2s; }
.chip:hover::before { background: var(--accent-alt); }

/* COLORES Y MENU CONTEXTUAL */
.color-selection-container { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; margin-bottom: 0.5rem; padding: 0.5rem; background: rgba(0,0,0,0.2); border-radius: 0.5rem; }
.color-chip { padding: 0.35rem 0.75rem; border-radius: 6px; background: rgba(30, 41, 59, 0.5); border: 1px solid rgba(148, 163, 184, 0.2); color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: all 0.2s ease; user-select: none; }
.color-chip:hover { background: rgba(30, 41, 59, 0.8); border-color: var(--accent-alt); color: var(--text-main); }
.color-chip.selected { background: rgba(34, 197, 94, 0.2); border-color: var(--accent); color: #bbf7d0; font-weight: 600; box-shadow: 0 0 10px rgba(34, 197, 94, 0.1); }
.context-menu { position: fixed; z-index: 9999; width: 200px; background: #0f172a; border: 1px solid var(--border); border-radius: 0.5rem; box-shadow: 0 10px 25px rgba(0,0,0,0.7); padding: 0.3rem; display: none; }
.context-menu button { width: 100%; text-align: left; background: transparent; padding: 0.5rem; font-size: 0.8rem; font-weight: normal; color: var(--text-main); border-radius: 0.3rem; margin: 0; display: block; box-shadow: none; }
.context-menu button:hover { background: rgba(56,189,248,0.1); color: var(--accent-alt); }

.footer { text-align: center; font-size: 0.7rem; color: var(--text-muted); margin: 0 0 0 280px; padding: 0 1rem 1rem; }
.footer span { background: rgba(15,23,42,0.8); padding: 0.3rem 0.8rem; border-radius: 99px; border: 1px solid var(--border); }
.empty { text-align: center; color: var(--text-muted); padding: 1rem; font-style: italic; }
.seleccionado { font-size: 0.85rem; color: var(--accent-alt); margin-bottom: 0.5rem; padding: 0.5rem; background: rgba(56,189,248,0.1); border-radius: 0.4rem; }
.mov-form-note { margin: 0.2rem 0 0.15rem; }
#mov-fp-detalle { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); padding: 0.5rem; border-radius: 0.5rem; border: 1px solid var(--border); }
.mov-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); }
.mov-main { display:flex; flex-direction:column; gap:0.18rem; font-weight: bold; color: var(--text-main); font-size: 0.9rem; text-align: right; }
.mov-main small { font-size:0.76rem; color:var(--text-muted); font-weight:500; }
.mov-meta { display:flex; flex-direction:column; align-items:flex-end; gap:0.2rem; }
.mov-sub { font-size:0.72rem; color:var(--text-muted); text-align:right; }
.mov-open-outs { margin:0.6rem 0 0.8rem; padding:0.75rem; border:1px solid rgba(255,255,255,0.08); border-radius:0.75rem; background:rgba(15,23,42,0.45); }
.mov-open-title { font-size:0.72rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:0.55rem; }
.mov-open-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:0.55rem; }
.mov-open-card { width:100%; margin-top:0; box-shadow:none; text-align:left; border:1px solid rgba(56,189,248,0.16); background:rgba(15,23,42,0.72); border-radius:0.75rem; padding:0.7rem; display:flex; flex-direction:column; gap:0.24rem; color:var(--text-main); }
.mov-open-card:hover { filter:none; transform:none; border-color:rgba(56,189,248,0.42); background:rgba(30,41,59,0.8); }
.mov-open-card.active { border-color:rgba(34,197,94,0.45); box-shadow:0 0 0 1px rgba(34,197,94,0.18) inset; }
.mov-open-machine { font-weight:700; font-size:0.84rem; }
.mov-open-detail { font-size:0.74rem; color:var(--text-muted); }
.mov-open-pill { display:inline-flex; align-items:center; gap:0.3rem; padding:0.18rem 0.48rem; border-radius:999px; width:max-content; font-size:0.68rem; font-weight:700; background:rgba(34,197,94,0.14); color:#bbf7d0; border:1px solid rgba(34,197,94,0.18); }
.mov-devolucion-hint { margin-top:0.55rem; padding:0.65rem 0.8rem; border-radius:0.65rem; border:1px solid rgba(56,189,248,0.18); background:rgba(56,189,248,0.08); color:var(--text-main); font-size:0.78rem; }
.mov-devolucion-hint.warn { border-color:rgba(239,68,68,0.25); background:rgba(239,68,68,0.08); color:#fecaca; }
.inv-life-cell { min-width: 160px; display:flex; flex-direction:column; gap:0.28rem; }
.inv-life-top { display:flex; justify-content:space-between; align-items:center; gap:0.45rem; }
.inv-life-main { font-size:0.88rem; color:var(--text-main); line-height:1.1; }
.inv-life-sub { font-size:0.72rem; color:var(--text-muted); }
.inv-state-cell { display:flex; flex-direction:column; gap:0.24rem; }
.inv-state-badge { align-self:flex-start; font-size:0.73rem; font-weight:800; letter-spacing:0.03em; padding:0.28rem 0.7rem; }
.inv-state-line { font-size:0.76rem; color:var(--text-main); line-height:1.15; }
.inv-state-sub { font-size:0.7rem; color:var(--text-muted); line-height:1.15; }
.inv-state-sub-compact { font-size:0.75rem; color:var(--text-main); }
.inv-location-cell { display:flex; flex-direction:column; gap:0.2rem; }
.inv-location-main { font-size:0.78rem; color:var(--text-main); line-height:1.1; }
.inv-location-sub { font-size:0.72rem; color:var(--text-muted); line-height:1.1; }
.grid-6-colores { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.4rem; margin-top: 0.5rem; }
.grid-6-colores label { font-size: 0.65rem; text-align: center; color: var(--text-muted); font-weight: bold; }
.grid-6-colores input { width: 100%; padding: 0.35rem 0.2rem; text-align: center; font-size: 0.8rem; }
.table-row.active-row { background: rgba(34, 197, 94, 0.2) !important; border-left: 3px solid var(--accent); box-shadow: inset 0 0 10px rgba(0,0,0,0.3); }

@media (max-width: 720px){
  #mov-fp-detalle { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .mov-meta { align-items: flex-start; }
  .mov-main, .mov-sub { text-align: left; }
}

/* =========================================
   DASHBOARD KPI Y GRAFICOS (ESTILOS ORIGINALES)
   ========================================= */
.dash-grid-v2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: linear-gradient(145deg, rgba(30,41,59,0.7), rgba(15,23,42,0.9)); border: 1px solid rgba(255,255,255,0.05); border-radius: 1rem; padding: 1rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.kpi-card h3 { margin: 0; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-card .number { font-size: 1.8rem; font-weight: 700; color: var(--text-main); margin: 0.3rem 0; line-height: 1; }
.kpi-card .desc { font-size: 0.7rem; color: var(--text-muted); }
.kpi-icon { position: absolute; right: -10px; bottom: -10px; font-size: 4rem; opacity: 0.05; color: white; pointer-events: none; }

/* KPI/Panel clicable (Dashboard) */
.kpi-card.dash-click, .dash-panel.dash-click, .life-item.dash-click, .legend-item.dash-click, .rank-row.dash-click { cursor: pointer; }
.kpi-card.dash-click { transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.kpi-card.dash-click:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.35); }
.kpi-link { font-size: 0.65rem; color: rgba(148,163,184,0.9); margin-top: 0.25rem; }
.kpi-card.dash-click:hover .kpi-link { color: var(--accent-alt); }
.legend-item.dash-click:hover { color: var(--text-main); }
.life-item.dash-click:hover { background: rgba(56,189,248,0.06); border-radius: 0.6rem; }
.rank-row.dash-click:hover { background: rgba(56,189,248,0.06); border-radius: 0.6rem; }
.dash-panel.dash-click:hover { border-color: rgba(56,189,248,0.35); }

.dash-middle-section { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.dash-panel { background: rgba(15,23,42,0.6); border: 1px solid var(--border); border-radius: 1rem; padding: 1.2rem; backdrop-filter: blur(10px); }
.panel-head { margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5rem; }
.panel-head h4 { margin: 0; font-size: 0.95rem; color: var(--text-main); }

.gauge-wrapper { display: flex; align-items: center; justify-content: center; gap: 1.5rem; }
.gauge-chart { position: relative; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--accent) 0%, var(--bg) 0%); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 15px rgba(0,0,0,0.3); }
.gauge-chart::before { content: ''; position: absolute; width: 90px; height: 90px; background: #0f172a; border-radius: 50%; }
.gauge-value { position: relative; font-size: 1.5rem; font-weight: bold; color: var(--text-main); z-index: 2; }
.gauge-legend { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.8rem; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.dot-bad { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.life-bar-group { display: flex; flex-direction: column; gap: 1rem; }
.life-item { display: flex; flex-direction: column; gap: 0.3rem; }
.life-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
.life-track { width: 100%; height: 8px; background: rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; }
.life-fill { height: 100%; border-radius: 10px; }

.machine-rank { display: flex; flex-direction: column; gap: 0.6rem; }
.rank-row { display: grid; grid-template-columns: 20px 1fr 40px; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.rank-bar-bg { height: 6px; background: rgba(255,255,255,0.05); border-radius: 4px; grid-column: 2 / -1; margin-top: 2px; overflow: hidden; }
.rank-bar-fill { height: 100%; background: var(--accent-alt); border-radius: 4px; }

@media (max-width: 900px) { .dash-grid-v2 { grid-template-columns: 1fr 1fr; } .dash-middle-section { grid-template-columns: 1fr; } }
@media (max-width: 500px) { .dash-grid-v2 { grid-template-columns: 1fr; } .gauge-wrapper { flex-direction: column; text-align: center; } }

/* =========================================
   HOJA DE VIDA (ESTILOS ORIGINALES)
   ========================================= */
.hv-dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; }
@media (max-width: 768px) { .hv-dashboard-grid { grid-template-columns: 1fr; } }
.hv-card { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 1rem; padding: 1.5rem; box-shadow: 0 10px 30px rgba(0,0,0,0.25); backdrop-filter: blur(10px); display: flex; flex-direction: column; }
.hv-title { font-size: 1.2rem; color: var(--accent); margin: 0 0 0.2rem 0; letter-spacing: 0.02em; }
.hv-subtitle { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 1.5rem 0; font-weight: 400; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }
.hv-data-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.85rem; }
.hv-data-row strong { color: var(--text-main); }
.hv-data-row span { color: var(--text-muted); text-align: right; }
.hv-qr-section { display: flex; justify-content: center; margin-bottom: 1.5rem; padding: 1rem; background: rgba(255,255,255,0.03); border-radius: 0.5rem; }
.hv-qr-img { width: 140px; height: 140px; background: white; padding: 5px; border-radius: 5px; }
.hv-progress-container { display: flex; flex-direction: column; gap: 0.8rem; max-height: 250px; overflow-y: auto; padding-right: 5px; }
.hv-prog-item { font-size: 0.75rem; }
.hv-prog-header { display: flex; justify-content: space-between; margin-bottom: 0.2rem; }
.hv-prog-bar-bg { height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; }
.hv-prog-bar-fill { height: 100%; border-radius: 10px; transition: width 0.5s ease; }
.fill-green { background: var(--accent); box-shadow: 0 0 8px rgba(34,197,94,0.4); }
.fill-yellow { background: #facc15; box-shadow: 0 0 8px rgba(250,204,21,0.4); }
.fill-red { background: var(--danger); box-shadow: 0 0 8px rgba(251,113,133,0.4); }
.hv-timeline-card { grid-column: 1 / -1; margin-top: 1rem; max-height: 400px; overflow-y: auto; }
.timeline { position: relative; padding-left: 20px; margin-top: 0.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.t-item { position: relative; margin-bottom: 1.2rem; padding-left: 1.5rem; }
.t-dot { position: absolute; left: -20px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--text-muted); }
.t-dot.salida { border-color: var(--accent-alt); box-shadow: 0 0 5px var(--accent-alt); background: rgba(56,189,248,0.2); }
.t-dot.baja { border-color: var(--danger); box-shadow: 0 0 5px var(--danger); background: rgba(251,113,133,0.2); }
.t-content { background: rgba(255,255,255,0.03); padding: 0.6rem 1rem; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.05); }
.t-date { font-size: 0.7rem; color: var(--text-muted); opacity: 0.8; }
.t-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.2rem; }
.t-type { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: bold; color: var(--text-main); font-size: 0.85rem; }
.t-type-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.1rem; min-width: 1.1rem; font-size: 0.95rem; line-height: 1; }
.t-user { font-size: 0.75rem; color: var(--accent); }
.t-body { font-size: 0.8rem; color: var(--text-muted); }
.hv-pdf-viewer { grid-column: 1 / -1; margin-top: 1rem; height: 600px; display: flex; flex-direction: column; }
.hv-pdf-frame { flex: 1; width: 100%; border: none; background: #fff; border-radius: 0.5rem; margin-top: 0.5rem; }

/* =========================================
   NUEVO: VENTANAS PLEGADIZAS (ALERTAS)
   ========================================= */
details.dash-details {
  background: rgba(15,23,42,0.6);
  border: 1px solid var(--accent);
  border-radius: 0.8rem;
  margin-bottom: 1rem;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}
details.dash-details.repo-style { border-color: var(--accent-alt); }
details.dash-details.alert-style { border-color: var(--danger); }

details.dash-details summary {
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
  list-style: none; 
  display: flex;
  justify-content: space-between; /* Flecha a la derecha */
  align-items: center;
  font-size: 0.9rem;
}

/* El contenedor del texto y el badge juntos a la izquierda */
.summary-title {
  display: flex;
  align-items: center;
  gap: 10px; /* Separacion texto y numero */
}

.count-badge {
  background: var(--text-main);
  color: var(--bg);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  display: inline-block;
}

details.dash-details summary::after { content: '▼'; font-size: 0.8rem; color: var(--text-muted); transition: transform 0.2s; }
details.dash-details[open] summary::after { transform: rotate(180deg); }
details.dash-details[open] summary { border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.08); }
.details-content { padding: 0.5rem; max-height: 300px; overflow-y: auto; background: rgba(0,0,0,0.2); }

/* TABLA DENTRO DE ALERTAS */
.mini-table-row {
  display: grid;
  grid-template-columns: 0.8fr 1.5fr 1fr 0.8fr 0.8fr; 
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.8rem;
  align-items: center;
}
.mini-table-row:last-child { border-bottom: none; }
.mini-header { font-weight: bold; color: var(--text-muted); background: rgba(0,0,0,0.2); font-size: 0.75rem; text-transform: uppercase; }

/* LOGIN SCREEN */
#login-screen {
  /* Cambia esta ruta cuando tengas la foto final del login. */
  --login-photo-url: url("bosque-fondo.jpeg");
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 18%, rgba(56,189,248,0.18), transparent 34%),
    linear-gradient(90deg, rgba(7,18,36,0.34), rgba(7,18,36,0.88) 62%, #020617 100%),
    #061326;
  color: #fff;
}

#login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(rgba(56,189,248,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.34;
}

#login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 44% 28%, rgba(56,189,248,0.18), transparent 28%),
    linear-gradient(90deg, transparent 0 60%, rgba(2,6,23,0.62) 80%, rgba(2,6,23,0.94) 100%),
    linear-gradient(0deg, rgba(2,6,23,0.82), transparent 46%, rgba(8,20,39,0.28));
}

.login-hero,
.login-panel {
  position: relative;
  z-index: 3;
}

.login-hero {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 5rem clamp(4rem, 7vw, 8rem) 5rem clamp(5rem, 8vw, 9rem);
  isolation: isolate;
}

.login-photo {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--login-photo-url);
  background-position: center;
  background-size: cover;
  filter: saturate(0.92) contrast(1.05);
  pointer-events: none;
}

.login-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 45% 26%, rgba(56,189,248,0.14), transparent 33%),
    linear-gradient(90deg, rgba(8,20,39,0.34), rgba(8,20,39,0.38) 42%, rgba(2,6,23,0.82) 82%, rgba(2,6,23,0.96)),
    linear-gradient(0deg, rgba(2,6,23,0.84), rgba(2,6,23,0.1) 56%, rgba(8,20,39,0.52));
}

.login-copy {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  padding-bottom: 0;
  margin-top: 5vh;
  animation: fadeInDown 0.55s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-kicker,
.login-access,
.login-card label {
  display: block;
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-kicker {
  margin-bottom: 1.2rem;
}

.login-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(4.75rem, 5.6vw, 6.8rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.login-title-logo {
  display: block;
  width: min(520px, 48vw);
  height: auto;
  margin: 0;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,0.45));
}

.login-copy p {
  max-width: 720px;
  margin: 1.35rem 0 0;
  color: rgba(255,255,255,0.9);
  font-size: 1.08rem;
  line-height: 1.5;
  font-weight: 700;
}

.login-panel {
  flex: 0 0 min(560px, 40vw);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem clamp(3rem, 5vw, 5.5rem) 2rem 1rem;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 1rem;
  padding: 2.25rem;
  text-align: left;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  backdrop-filter: blur(14px);
  animation: fadeInDown 0.5s ease;
}

.login-access {
  color: rgba(255,255,255,0.62);
  margin-bottom: 1rem;
}

.login-card h2 {
  margin: 0 0 1.15rem;
  color: #fff;
  font-size: 1.95rem;
  line-height: 1.1;
  letter-spacing: 0;
  border: 0;
}

.login-card form {
  margin: 0;
}

.login-card label {
  margin: 1rem 0 0.45rem;
  color: #38bdf8;
  font-size: 0.74rem;
}

.login-card input {
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 0.95rem 1.05rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 0.85rem;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-password-row {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

.login-password-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-show-pass {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 58px;
  padding: 0 1rem;
  border: 1px solid rgba(56,189,248,0.26);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn-show-pass:hover {
  background: rgba(56,189,248,0.12);
  border-color: rgba(56,189,248,0.48);
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: auto;
  margin: 1rem 0 0;
  color: rgba(255,255,255,0.82);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}

.login-remember input {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.login-remember input:focus {
  box-shadow: 0 0 0 3px rgba(34,197,94,0.16);
}

.login-card input::placeholder {
  color: rgba(255,255,255,0.48);
}

.login-card input:focus {
  background: rgba(255,255,255,0.12);
  border-color: rgba(56,189,248,0.76);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}

.btn-login {
  width: 100%;
  min-height: 58px;
  margin-top: 1.25rem;
  padding: 0.95rem 1.05rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  color: #02111f;
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(56,189,248,0.18);
}

.btn-login:hover {
  filter: brightness(1.04);
}

.login-error {
  display: none;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(251,113,133,0.24);
  border-radius: 0.85rem;
  background: rgba(251,113,133,0.08);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  #login-screen {
    flex-direction: column;
    overflow-y: auto;
  }

  #login-screen::after {
    background:
      linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.15) 54%, rgba(0,0,0,0.48));
  }

  .login-hero {
    min-height: 54vh;
    padding: 2rem;
  }

  .login-copy {
    padding-bottom: 0;
    margin-top: 0;
  }

  .login-copy h1 {
    font-size: 3.15rem;
  }

  .login-title-logo {
    width: min(420px, 82vw);
  }

  .login-panel {
    flex: 0 0 auto;
    width: 100%;
    padding: 0 1.25rem 1.5rem;
  }

  .login-card {
    width: min(460px, 100%);
  }
}

@media (max-width: 560px) {
  .login-hero {
    min-height: 50vh;
    padding: 1.25rem;
  }

  .login-copy h1 {
    font-size: 2.55rem;
  }

  .login-title-logo {
    width: min(320px, 84vw);
  }

  .login-copy p {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .login-panel {
    padding: 0 1rem 1rem;
  }
}



/* =========================================
   MODAL (Edición Admin)
========================================= */
.modal-backdrop{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2,6,23,0.72);
  z-index: 9999;
}
.modal-backdrop.open{ display:flex; }

.modal-card{
  width: min(920px, 100%);
  border-radius: 1rem;
  background: var(--card);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  overflow: hidden;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(148,163,184,0.25);
}
.modal-header h3{
  margin:0;
  font-size: 1rem;
}

.modal-body{
  padding: 1rem;
}

.modal-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
@media (max-width: 820px){
  .modal-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px){
  .modal-grid{ grid-template-columns: 1fr; }
}

.modal-section{
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(148,163,184,0.25);
}

.modal-footer{
  display:flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 0.9rem 1rem;
  border-top: 1px solid rgba(148,163,184,0.25);
}



/* =========================================
   COSTOS/REPORTES - Avisos y Toast
   ========================================= */
.notice{
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: rgba(2,6,23,0.45);
  font-weight: 800;
}
.notice.success{
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.08);
}

.toast-container{
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast{
  min-width: 260px;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.75rem 2.2rem 0.75rem 0.9rem;
  background: rgba(2,6,23,0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  font-weight: 900;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}
.toast.success{ border-color: rgba(34,197,94,0.35); }
.toast small{
  display:block;
  margin-top: 0.25rem;
  font-weight: 700;
  opacity: 0.85;
}

.toast.sticky{ box-shadow: 0 16px 36px rgba(0,0,0,0.55); }

.toast-close{
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: inherit;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}
.toast-close:hover{ background: rgba(255,255,255,0.10); }

.pill{
  display:inline-flex;
  align-items:center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
}
.pill.ok{
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.10);
}


/* =========================================
   ALERTAS / NOTIFICACIONES (LOCAL)
   (solo este módulo funciona sin backend)
   ========================================= */

.btn-alertas{
  position: relative;
  overflow: visible;
}

.btn-alertas.has-pending{
  box-shadow: 0 0 0 1px rgba(86, 146, 255, 0.22), 0 10px 22px rgba(24, 74, 180, 0.28);
}

.badge-count{
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.24);
  background: linear-gradient(135deg, #ff8476 0%, #ff5252 100%);
  color: #fff;
  box-shadow: 0 8px 16px rgba(255, 82, 82, 0.3);
}

.hidden{ display:none !important; }

.modal-overlay{
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(46, 92, 202, 0.18), transparent 38%),
    rgba(3, 8, 20, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 18px;
  backdrop-filter: blur(14px);
}

.alertas-modal{
  width: min(980px, 96vw);
  max-height: min(84vh, 860px);
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(120, 154, 230, 0.18);
  background:
    linear-gradient(180deg, rgba(14, 25, 50, 0.98) 0%, rgba(8, 16, 34, 0.98) 100%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

.notif-shell{
  display: grid;
  gap: 18px;
  padding: 24px;
}

.notif-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.notif-head-copy{
  display: grid;
  gap: 6px;
}

.notif-eyebrow{
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 900;
  color: rgba(189, 207, 255, 0.72);
}

.notif-title{
  margin: 0;
  font-size: 1.95rem;
}

.notif-subtitle{
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  font-size: 0.92rem;
}

.notif-head-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

.notif-head-btn{
  white-space: nowrap;
}

.notif-close{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(151, 177, 237, 0.18);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.86);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.notif-close:hover{
  background: rgba(255,255,255,0.08);
}

.notif-stats{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.notif-stat-card{
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(120, 154, 230, 0.16);
  background: linear-gradient(180deg, rgba(19, 31, 61, 0.94) 0%, rgba(12, 22, 46, 0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.notif-stat-card span{
  display: block;
  color: rgba(186, 201, 236, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  font-weight: 800;
}

.notif-stat-card strong{
  display: block;
  margin-top: 0.45rem;
  font-size: 2rem;
}

.notif-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notif-filters{
  display: inline-flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(120, 154, 230, 0.16);
  background: rgba(11, 19, 40, 0.9);
}

.notif-filter{
  min-width: 132px;
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: rgba(217, 226, 245, 0.78);
  text-align: left;
  cursor: pointer;
}

.notif-filter span{
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.notif-filter strong{
  font-size: 1.15rem;
}

.notif-filter.is-active{
  background: linear-gradient(135deg, rgba(69, 127, 255, 0.92) 0%, rgba(90, 149, 255, 0.74) 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(61, 113, 221, 0.28);
}

.notif-toolbar-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notif-status-row{
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.notif-status{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #95d5b2;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.notif-status.is-offline{
  color: #facc15;
  background: rgba(250, 204, 21, 0.08);
  border-color: rgba(250, 204, 21, 0.22);
}

.alerts-list{
  min-height: 260px;
  max-height: min(46vh, 500px);
  padding: 4px;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}

.alert-card{
  border: 1px solid rgba(120, 154, 230, 0.14);
  background: linear-gradient(180deg, rgba(16, 27, 52, 0.94) 0%, rgba(10, 18, 38, 0.96) 100%);
  border-radius: 22px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.alert-card.unread{
  border-color: rgba(98, 145, 255, 0.26);
  background: linear-gradient(180deg, rgba(21, 35, 72, 0.96) 0%, rgba(10, 19, 43, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 18px 32px rgba(11, 19, 40, 0.28);
}

.alert-card.priority-critical{
  border-color: rgba(248, 113, 113, 0.3);
}

.alert-card.priority-high{
  border-color: rgba(96, 165, 250, 0.24);
}

.alert-card-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.alert-card-kicker{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.alert-kicker{
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(80, 125, 235, 0.12);
  border: 1px solid rgba(100, 140, 238, 0.18);
  color: rgba(219, 230, 255, 0.88);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.67rem;
  font-weight: 800;
}

.alert-time{
  color: rgba(186, 201, 236, 0.68);
  font-size: 0.8rem;
}

.alert-dismiss{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(151, 177, 237, 0.14);
  background: rgba(255,255,255,0.02);
  color: rgba(255,255,255,0.72);
  font-size: 1.3rem;
  cursor: pointer;
}

.alert-dismiss:hover{
  background: rgba(255,255,255,0.06);
}

.alert-top{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 14px;
}

.alert-title{
  font-weight: 900;
  font-size: 1.05rem;
  margin: 0;
}

.alert-meta{
  color: rgba(186, 201, 236, 0.72);
  font-size: 0.76rem;
  margin-top: 5px;
}

.alert-priority{
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid rgba(255,255,255,0.12);
}

.alert-priority--low{
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.alert-priority--medium{
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
}

.alert-priority--high{
  background: rgba(59, 130, 246, 0.18);
  color: #dbeafe;
}

.alert-priority--critical{
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.28);
}

.alert-msg{
  margin: 14px 0 14px;
  color: rgba(230, 237, 249, 0.9);
  line-height: 1.45rem;
  font-size: 0.92rem;
}

.alert-msg--clamp{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-chip{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(151, 177, 237, 0.14);
  background: rgba(255,255,255,0.03);
  color: rgba(216, 226, 247, 0.78);
  font-size: 0.74rem;
  font-weight: 700;
}

.alert-chip--new{
  background: rgba(69, 127, 255, 0.14);
  border-color: rgba(69, 127, 255, 0.28);
  color: #dbeafe;
}

.alert-actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-expand{
  margin: 0 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(151, 177, 237, 0.14);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}

.alert-expand-summary{
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: rgba(220, 230, 250, 0.92);
  font-size: 0.78rem;
  font-weight: 800;
}

.alert-expand-summary::-webkit-details-marker{
  display: none;
}

.alert-expand-icon{
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(220, 230, 250, 0.9);
  border-bottom: 2px solid rgba(220, 230, 250, 0.9);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
  margin-right: 4px;
}

.alert-expand[open] .alert-expand-icon{
  transform: rotate(225deg);
  margin-top: 4px;
}

.alert-expand-body{
  padding: 0 12px 12px;
}

.alert-expand-message{
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(151, 177, 237, 0.12);
  color: rgba(235, 241, 255, 0.94);
  line-height: 1.35rem;
  font-size: 0.84rem;
}

.alert-details{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.alert-detail{
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(151, 177, 237, 0.12);
}

.alert-detail span{
  display: block;
  margin-bottom: 4px;
  color: rgba(186, 201, 236, 0.7);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alert-detail strong{
  display: block;
  color: rgba(235, 241, 255, 0.96);
  font-size: 0.82rem;
  line-height: 1.2rem;
}

.alerts-list{
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.48) rgba(15, 23, 42, 0.35);
  scrollbar-gutter: stable;
}

.alerts-list::-webkit-scrollbar{
  width: 10px;
}

.alerts-list::-webkit-scrollbar-track{
  background: rgba(15, 23, 42, 0.4);
  border-radius: 999px;
}

.alerts-list::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.82), rgba(59, 130, 246, 0.62));
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.45);
}

.alerts-list::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.9), rgba(59, 130, 246, 0.8));
}

/* Popover superior para notificaciones */
#modal-alertas.modal-overlay{
  inset: auto;
  top: 88px;
  left: auto;
  right: 18px;
  bottom: auto;
  padding: 0;
  display: block;
  background: transparent;
  backdrop-filter: none;
  z-index: 10020;
}

#modal-alertas .alertas-modal{
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 24px));
  max-height: min(74vh, 760px);
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(120, 154, 230, 0.24);
  background: linear-gradient(180deg, rgba(13, 24, 49, 0.98) 0%, rgba(9, 17, 36, 0.98) 100%);
  box-shadow:
    0 24px 60px rgba(2, 6, 23, 0.48),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

#modal-alertas .alertas-modal::before{
  content: "";
  position: absolute;
  top: -8px;
  right: 28px;
  width: 16px;
  height: 16px;
  background: rgba(13, 24, 49, 0.98);
  border-top: 1px solid rgba(120, 154, 230, 0.24);
  border-left: 1px solid rgba(120, 154, 230, 0.24);
  transform: rotate(45deg);
}

#modal-alertas .notif-shell{
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  gap: 12px;
  padding: 16px 16px 18px;
}

#modal-alertas .notif-head{
  align-items: center;
  gap: 12px;
}

#modal-alertas .notif-head-copy{
  gap: 4px;
}

#modal-alertas .notif-eyebrow{
  font-size: 0.66rem;
  letter-spacing: 0.24em;
}

#modal-alertas .notif-title{
  font-size: 1.35rem;
  line-height: 1.2;
}

#modal-alertas .notif-subtitle{
  font-size: 0.82rem;
}

#modal-alertas .notif-head-actions{
  gap: 8px;
}

#modal-alertas .notif-head-btn{
  font-size: 0.72rem;
  padding: 0.28rem 0.8rem;
}

#modal-alertas .notif-close{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  font-size: 1.3rem;
}

#modal-alertas .notif-stats{
  gap: 8px;
}

#modal-alertas .notif-stat-card{
  padding: 10px 12px;
  border-radius: 16px;
}

#modal-alertas .notif-stat-card span{
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

#modal-alertas .notif-stat-card strong{
  margin-top: 0.25rem;
  font-size: 1.2rem;
}

#modal-alertas .notif-toolbar{
  gap: 10px;
}

#modal-alertas .notif-filters{
  width: 100%;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
}

#modal-alertas .notif-filter{
  min-width: 0;
  flex: 1 1 0;
  padding: 10px 12px;
  border-radius: 14px;
}

#modal-alertas .notif-filter span{
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

#modal-alertas .notif-filter strong{
  font-size: 1rem;
}

#modal-alertas .notif-toolbar-actions{
  width: 100%;
  justify-content: space-between;
}

#modal-alertas .notif-status{
  font-size: 0.72rem;
  padding: 6px 10px;
}

#modal-alertas .alerts-list{
  min-height: 0;
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 10px;
  padding: 2px 10px 26px 2px;
  scroll-padding-block-end: 26px;
  overscroll-behavior: contain;
}

#modal-alertas .alerts-list > .alert-card:last-child{
  margin-bottom: 10px;
}

#modal-alertas .alert-card{
  scroll-margin-block-end: 26px;
}

#modal-alertas .alert-card{
  border-radius: 18px;
  padding: 14px;
}

#modal-alertas .alert-card-top{
  margin-bottom: 10px;
}

#modal-alertas .alert-kicker{
  font-size: 0.62rem;
}

#modal-alertas .alert-time{
  font-size: 0.74rem;
}

#modal-alertas .alert-dismiss{
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

#modal-alertas .alert-title{
  font-size: 0.98rem;
}

#modal-alertas .alert-meta{
  font-size: 0.72rem;
}

#modal-alertas .alert-priority{
  padding: 6px 10px;
  font-size: 0.68rem;
}

#modal-alertas .alert-msg{
  margin: 10px 0;
  font-size: 0.84rem;
  line-height: 1.3rem;
}

#modal-alertas .alert-expand{
  margin-bottom: 12px;
}

#modal-alertas .alert-expand-summary{
  padding: 9px 10px;
  font-size: 0.72rem;
}

#modal-alertas .alert-expand-body{
  padding: 0 10px 10px;
}

#modal-alertas .alert-expand-message{
  font-size: 0.78rem;
  line-height: 1.25rem;
}

#modal-alertas .alert-chip{
  font-size: 0.68rem;
  padding: 5px 9px;
}

#modal-alertas .alert-actions .btn-small{
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
}

#modal-alertas .notif-empty{
  min-height: 150px;
  padding: 18px;
  border-radius: 18px;
}

@media (max-width: 720px){
  #modal-alertas.modal-overlay{
    right: auto;
    left: 12px;
    top: 72px;
  }

  #modal-alertas .alertas-modal{
    width: calc(100vw - 24px);
    max-height: min(78vh, 760px);
  }

  #modal-alertas .alertas-modal::before{
    right: 18px;
  }

  #modal-alertas .notif-head{
    align-items: flex-start;
  }

  #modal-alertas .notif-stats{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #modal-alertas .alert-details{
    grid-template-columns: 1fr;
  }
}

.notif-empty{
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 28px;
  border-radius: 24px;
  border: 1px dashed rgba(151, 177, 237, 0.16);
  background: rgba(11, 19, 40, 0.8);
}

.notif-empty__icon{
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-size: 1.8rem;
  background: rgba(80, 125, 235, 0.12);
  color: rgba(219, 230, 255, 0.82);
}

.notif-empty p{
  margin: 0;
  max-width: 360px;
  color: rgba(186, 201, 236, 0.72);
}

.notif-skeleton{
  height: 138px;
  border-radius: 22px;
  border: 1px solid rgba(151, 177, 237, 0.12);
  background:
    linear-gradient(90deg, rgba(16, 27, 52, 0.96) 0%, rgba(33, 48, 86, 0.96) 50%, rgba(16, 27, 52, 0.96) 100%);
  background-size: 220% 100%;
  animation: notifPulse 1.5s ease-in-out infinite;
}

@keyframes notifPulse{
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 860px){
  .alertas-modal{
    width: min(100vw - 18px, 100%);
    max-height: min(92vh, 920px);
  }

  .notif-shell{
    padding: 18px;
  }

  .notif-head{
    flex-direction: column;
  }

  .notif-head-actions{
    width: 100%;
    justify-content: space-between;
  }

  .notif-stats{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .notif-toolbar{
    align-items: stretch;
  }

  .notif-filters{
    width: 100%;
    overflow-x: auto;
  }

  .notif-filter{
    min-width: 112px;
  }

  .notif-toolbar-actions{
    width: 100%;
    justify-content: space-between;
  }

  .alerts-list{
    max-height: min(50vh, 480px);
  }
}

@media (max-width: 560px){
  .notif-stats{
    grid-template-columns: 1fr;
  }

  .notif-head-btn{
    max-width: calc(100vw - 140px);
  }

  .alert-top{
    flex-direction: column;
  }
}

/* =========================================
   Hoja de vida: Resumen por color (tarjetas)
   ========================================= */
.color-cards{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.color-card{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px 10px;
}

.color-card .cc-title{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.cc-pill{
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  color: var(--text-muted);
}

.cc-rows{ display:grid; gap: 4px; }
.cc-row{ display:flex; justify-content: space-between; gap: 10px; font-size: 0.78rem; }
.cc-row span{ color: var(--text-muted); }
.cc-row strong{ color: var(--text-main); }


/* Barra de progreso dentro de la tarjeta de color */
.cc-bar{
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
}
.cc-bar-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width .25s ease;
  background: rgba(34,197,94,0.85);
}
.color-card.ok .cc-bar-fill{ background: rgba(34,197,94,0.85); }
.color-card.warn .cc-bar-fill{ background: rgba(250,204,21,0.90); }
.color-card.crit .cc-bar-fill{ background: rgba(239,68,68,0.90); }
.cc-bar-fill.ok{ background: rgba(34,197,94,0.85); }
.cc-bar-fill.warn{ background: rgba(250,204,21,0.90); }
.cc-bar-fill.crit{ background: rgba(239,68,68,0.90); }

.cc-pill.ok{
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.12);
  color: #4ade80;
}
.cc-pill.warn{
  border-color: rgba(250,204,21,0.35);
  background: rgba(250,204,21,0.12);
  color: #facc15;
}
.cc-pill.crit{
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}
.inv-vida{ margin-top: 2px; }

.color-card.ok{ border-color: rgba(34,197,94,0.22); background: rgba(34,197,94,0.06); }
.color-card.warn{ border-color: rgba(250,204,21,0.25); background: rgba(250,204,21,0.06); }
.color-card.crit{ border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.06); }

/* Historial: Delta plan vs real */
.delta-pos{ color: #fca5a5; font-weight: 900; }
.delta-neg{ color: #86efac; font-weight: 900; }
.delta-zero{ color: var(--text-muted); font-weight: 900; }
