/* =========================================================================
   Plan de Producción de Promoción y Mantenimiento de la Salud · Multihospital
   Hoja de estilos principal: paleta institucional verde azulado, superficies
   claras y semáforo (verde = cumple, ámbar = en riesgo, rojo = crítico).
   ========================================================================= */
:root {
  --primario: #0369a1;
  --primario-2: #075985;
  --primario-claro: #e0f2fe;
  --primario-suave: #f0f9ff;
  --acento: #0284c7;
  --fondo: #f3f6f9;
  --superficie: #ffffff;
  --borde: #e3e8ef;
  --borde-2: #cfd8e3;
  --texto: #0f172a;
  --texto-2: #475569;
  --texto-3: #8a97a8;
  --ok: #15803d;     --ok-bg: #dcfce7;   --ok-2: #22c55e;
  --warn: #b45309;   --warn-bg: #fef3c7; --warn-2: #f59e0b;
  --mal: #b91c1c;    --mal-bg: #fee2e2;  --mal-2: #ef4444;
  --info: #1d4ed8;   --info-bg: #dbeafe;
  --gris-bg: #f1f5f9;
  --p: #2563eb; --h: #16a34a; --v: #d97706; --a: #9333ea;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 6px rgba(15, 23, 42, .05);
  --sombra-2: 0 10px 30px rgba(15, 23, 42, .12);
  --sidebar: 268px;
  font-size: 14.5px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fondo); color: var(--texto); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primario); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .6rem; }
small, .muted { color: var(--texto-2); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }

/* ------------------------------ Layout ------------------------------ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: linear-gradient(180deg, #082f49 0%, #0c3d5e 100%); color: #d1fae5; flex-shrink: 0;
  position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 40; transition: transform .22s ease;
  display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #1e4e70 transparent;
}
.sidebar .marca { padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; gap: 11px; align-items: center; }
.sidebar .marca .logo { width: 40px; height: 40px; border-radius: 11px; background: #0ea5e9; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 4px 12px rgba(14,165,233,.35); }
.sidebar .marca .logo svg { width: 22px; height: 22px; color: #082f49; }
.sidebar .marca b { display: block; color: #fff; font-size: 1rem; letter-spacing: .2px; line-height: 1.2; }
.sidebar .marca span { font-size: .72rem; color: #bae6fd; line-height: 1.3; display: block; margin-top: 2px; }
.sidebar nav { padding: 6px 10px 20px; flex: 1; }
.sidebar .grupo { margin: 16px 10px 5px; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #7dd3fc; display: flex; align-items: center; gap: 7px; }
.sidebar .grupo i { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; font-style: normal; color: #fff; font-size: .66rem; }
.sidebar .grupo small { color: #93c5e8; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .7rem; }
.sidebar a.item { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 9px; color: #e0f2fe; font-size: .92rem; font-weight: 500; margin: 1px 0; }
.sidebar a.item:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.sidebar a.item.activo { background: #0ea5e9; color: #082f49; font-weight: 650; box-shadow: 0 4px 12px rgba(14,165,233,.25); }
.sidebar a.item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar .pie { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .72rem; color: #93c5e8; line-height: 1.4; }
.velo { display: none; }

.principal { margin-left: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .hospital { display: flex; flex-direction: column; min-width: 0; }
.topbar .hospital b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .98rem; }
.topbar .hospital small { font-size: .75rem; }
.topbar .espacio { flex: 1; }
.topbar select { min-width: 0; }
.vigencia { display: flex; align-items: center; gap: 6px; background: var(--primario-suave); border: 1px solid #bae6fd; border-radius: 99px; padding: 3px 4px 3px 12px; }
.vigencia label { margin: 0; color: var(--primario-2); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.vigencia select { border: 0; background: #fff; border-radius: 99px; padding: 4px 10px; font-weight: 700; color: var(--primario-2); width: auto !important; box-shadow: none; }
.btn-ayuda { background: #fff; border: 1px solid var(--borde-2); border-radius: 99px; height: 34px; padding: 0 12px; cursor: pointer; color: var(--texto-2); font: inherit; font-weight: 600; font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; }
.btn-ayuda b { width: 20px; height: 20px; border-radius: 50%; background: var(--primario-suave); color: var(--primario); display: inline-grid; place-items: center; font-size: .8rem; }
.btn-ayuda:hover, .btn-ayuda.activo { background: var(--primario-suave); color: var(--primario-2); border-color: #bae6fd; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.45rem; cursor: pointer; color: var(--texto); padding: 4px 6px; }
.usuario { display: flex; align-items: center; gap: 8px; position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; display: grid; place-items: center; font-weight: 700; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--borde); font-size: .95rem; }
.dropdown { position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra-2); min-width: 250px; padding: 6px; display: none; }
.dropdown.abierto { display: block; animation: entra .12s ease-out; }
.dropdown .cab { padding: 10px 12px; border-bottom: 1px solid var(--borde); margin-bottom: 4px; }
.dropdown button, .dropdown a { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--texto); font: inherit; }
.dropdown button:hover, .dropdown a:hover { background: var(--gris-bg); text-decoration: none; }

.contenido { padding: 22px 26px 40px; max-width: 1520px; width: 100%; }

/* Encabezado de página */
.encabezado {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 20px 16px 24px; box-shadow: var(--sombra);
  position: relative; overflow: hidden;
}
.encabezado::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: linear-gradient(180deg, #0ea5e9, #0369a1); }
.encabezado > div:first-child { display: flex; gap: 14px; align-items: center; min-width: 0; flex: 1 1 420px; }
.encabezado .ico-pag { width: 48px; height: 48px; border-radius: 12px; background: var(--primario-suave); color: var(--primario); display: grid; place-items: center; flex-shrink: 0; border: 1px solid #e0f2fe; }
.encabezado .ico-pag svg { width: 24px; height: 24px; }
.encabezado h1 { margin: 2px 0 2px; }
.encabezado p { margin: 0; color: var(--texto-2); font-size: .92rem; max-width: 900px; }
.migas { font-size: .72rem; color: var(--primario); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.encabezado > div + div, .encabezado > form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Ayuda contextual */
.ayuda-pagina { background: linear-gradient(135deg, #f0f9ff, #eff6ff); border: 1px solid #bae6fd; border-radius: var(--radio); padding: 14px 18px; margin-bottom: 18px; display: none; }
.ayuda-pagina.abierta { display: block; animation: entra .15s ease-out; }
.ayuda-pagina h3 { color: #0c4a6e; margin-bottom: 8px; }
.ayuda-pagina ol { margin: 0; padding-left: 20px; color: #1e3a5f; }
.ayuda-pagina li { margin: 4px 0; }
.ayuda-pagina .cerrar-ayuda { float: right; background: none; border: 0; cursor: pointer; color: #0c4a6e; font-size: 1.3rem; line-height: 1; }

/* ------------------------------ Tarjetas ------------------------------ */
.card { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--borde); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card .card-h h2, .card .card-h h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card .card-h h3::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: var(--primario); display: inline-block; }
.card .card-b { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.chart-box canvas { max-width: 100%; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.kpi:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15,23,42,.08); }
.kpi .t { font-size: .73rem; color: var(--texto-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 1.85rem; font-weight: 750; margin: 6px 0 2px; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .82rem; color: var(--texto-2); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--primario); }
.kpi.ok::before { background: var(--ok-2); } .kpi.warn::before { background: var(--warn-2); }
.kpi.mal::before { background: var(--mal-2); } .kpi.info::before { background: #3b82f6; }
.kpi.ok .v { color: var(--ok); } .kpi.warn .v { color: var(--warn); } .kpi.mal .v { color: var(--mal); }

.barra { height: 8px; background: #e8edf3; border-radius: 99px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--primario); border-radius: 99px; transition: width .4s ease; }
.barra.ok > span { background: var(--ok-2); } .barra.warn > span { background: var(--warn-2); } .barra.mal > span { background: var(--mal-2); }
.prog { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.prog .barra { flex: 1; }
.prog b { font-size: .8rem; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------ Badges ------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 650; white-space: nowrap; background: var(--gris-bg); color: var(--texto-2); border: 1px solid #e2e8f0; }
.b-ok { background: var(--ok-bg); color: #166534; border-color: #bbf7d0; } .b-warn { background: var(--warn-bg); color: #92400e; border-color: #fde68a; }
.b-mal { background: var(--mal-bg); color: #991b1b; border-color: #fecaca; } .b-info { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }

/* ------------------------------ Botones / formularios ------------------------------ */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 9px; border: 1px solid var(--borde-2); background: #fff; color: var(--texto); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; text-decoration: none !important; }
.btn:hover { background: var(--gris-bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-p { background: var(--primario); border-color: var(--primario); color: #fff; box-shadow: 0 2px 6px rgba(15,118,110,.25); }
.btn-p:hover { background: var(--primario-2); }
.btn-d { color: var(--mal); }
.btn-d:hover { background: var(--mal-bg); border-color: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-icon { padding: 6px 8px; }
.btn svg { width: 16px; height: 16px; }
.acciones { display: flex; gap: 4px; justify-content: flex-end; }

input, select, textarea {
  font: inherit; color: var(--texto); background: #fff; border: 1px solid var(--borde-2); border-radius: 9px; padding: 8px 11px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
select { cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: #b4c1d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #f8fafc; color: var(--texto-2); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primario); flex-shrink: 0; }
textarea { min-height: 72px; resize: vertical; }
label { font-weight: 600; font-size: .84rem; display: block; margin-bottom: 5px; color: #334155; }
.req::after { content: " *"; color: var(--mal); }
.campo { margin-bottom: 2px; }
.campo .err { color: var(--mal); font-size: .78rem; margin-top: 3px; font-weight: 500; }
.campo.con-error input, .campo.con-error select, .campo.con-error textarea { border-color: var(--mal); box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.campo .ayuda, .ayuda { font-size: .77rem; color: var(--texto-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.c-12 { grid-column: span 12; } .c-8 { grid-column: span 8; } .c-6 { grid-column: span 6; } .c-5 { grid-column: span 5; } .c-4 { grid-column: span 4; } .c-3 { grid-column: span 3; } .c-2 { grid-column: span 2; }
.seccion-form { grid-column: span 12; font-weight: 700; color: var(--primario-2); background: var(--primario-suave); border-radius: 8px; padding: 7px 12px; margin-top: 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--borde); background: #fbfcfd; border-radius: var(--radio) var(--radio) 0 0; }
.toolbar .buscar { flex: 1 1 220px; max-width: 340px; padding-left: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a97a8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center / 16px; }
.toolbar select { width: auto; max-width: 240px; }
.toolbar select.activo { border-color: var(--primario); background-color: var(--primario-suave); color: var(--primario-2); font-weight: 600; }
.toolbar .der { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ Tablas ------------------------------ */
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.tabla th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); background: #f6f8fb; padding: 10px 12px; border-bottom: 1px solid var(--borde); white-space: nowrap; position: sticky; top: 0; z-index: 2; font-weight: 700; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
.tabla tbody tr:nth-child(even) td { background: #fcfdfe; }
.tabla tbody tr:hover td { background: #f0f9ff; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla td.num, .tabla th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla td.centro, .tabla th.centro { text-align: center; }
.tabla .sub { color: var(--texto-2); font-size: .8rem; }
.tabla .clip { max-width: 360px; }
.tabla tr.fila-alerta td { background: #fff7ed !important; }
.tabla tr.fila-alerta td:first-child { box-shadow: inset 3px 0 0 var(--warn-2); }
.tabla tr.fila-total td { background: #f6f8fb !important; font-weight: 700; border-top: 2px solid var(--borde); }
.vacio { padding: 40px 20px; text-align: center; color: var(--texto-3); }
.vacio .icono-vacio { width: 52px; height: 52px; border-radius: 50%; background: var(--gris-bg); display: grid; place-items: center; margin: 0 auto 10px; color: var(--texto-3); }
.vacio .icono-vacio svg { width: 26px; height: 26px; }
.paginacion { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--texto-2); border-top: 1px solid var(--borde); }
.paginacion .pags { display: flex; gap: 4px; align-items: center; }

.spinner { width: 18px; height: 18px; border: 2.5px solid #cce7e4; border-top-color: var(--primario); border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 6px; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--texto-2); align-items: center; }
.leyenda span { display: inline-flex; align-items: center; gap: 2px; }

/* ------------------------------ Modal / toast ------------------------------ */
.modal-fondo { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 34px 14px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 660px; box-shadow: 0 25px 60px rgba(0,0,0,.28); animation: entra .16s ease-out; }
.modal.lg { max-width: 940px; } .modal.xl { max-width: 1180px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(180deg, #f6fffd, #fff); border-radius: 14px 14px 0 0; }
.modal-h h3 { margin: 0; font-size: 1.08rem; }
.modal-b { padding: 20px; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--borde); display: flex; justify-content: flex-end; gap: 8px; background: #f8fafc; border-radius: 0 0 14px 14px; position: sticky; bottom: 0; }
.cerrar { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--texto-2); line-height: 1; width: 34px; height: 34px; border-radius: 8px; }
.cerrar:hover { background: var(--gris-bg); }
@keyframes entra { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; right: 20px; bottom: 76px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px 12px 14px; border-radius: 10px; box-shadow: 0 12px 28px rgba(0,0,0,.22); max-width: 420px; font-size: .9rem; animation: entra .15s; display: flex; gap: 10px; align-items: flex-start; border-left: 4px solid #64748b; }
.toast.ok { background: #14532d; border-left-color: #4ade80; } .toast.ok::before { content: "✓"; font-weight: 700; }
.toast.mal { background: #7f1d1d; border-left-color: #f87171; } .toast.mal::before { content: "!"; font-weight: 700; }

/* Alertas */
.alertas { list-style: none; margin: 0; padding: 0; }
.alertas li { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid #f1f5f9; align-items: flex-start; font-size: .9rem; }
.alertas li:last-child { border-bottom: 0; }
.alertas .punto { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alertas .alta .punto { background: var(--mal-2); box-shadow: 0 0 0 4px var(--mal-bg); } .alertas .media .punto { background: var(--warn-2); box-shadow: 0 0 0 4px var(--warn-bg); }
.aviso { padding: 11px 15px; border-radius: 10px; background: var(--info-bg); color: #1e3a8a; margin-bottom: 14px; font-size: .9rem; border: 1px solid #bfdbfe; }
.aviso.warn { background: var(--warn-bg); color: #78350f; border-color: #fde68a; }
.aviso.ok { background: var(--ok-bg); color: #14532d; border-color: #bbf7d0; }

.semaforo { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.sem-ok { background: var(--ok-2); } .sem-warn { background: var(--warn-2); } .sem-mal { background: var(--mal-2); } .sem-na { background: #cbd5e1; }

.lista-def { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: .9rem; }
.lista-def dt { color: var(--texto-2); font-weight: 600; }
.lista-def dd { margin: 0; white-space: pre-line; }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); padding: 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 14px; cursor: pointer; font: inherit; font-weight: 600; color: var(--texto-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--texto); }
.tabs button.activo { color: var(--primario); border-bottom-color: var(--primario); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-lado { background: radial-gradient(circle at 20% 10%, #0ea5e9 0%, transparent 45%), linear-gradient(150deg, #082f49, #0369a1 65%, #0284c7); color: #ecfeff; padding: 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.login-lado h1 { font-size: 2rem; color: #fff; line-height: 1.2; }
.login-lado ul { padding-left: 0; list-style: none; line-height: 2.05; color: #e0f2fe; }
.login-lado li::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.15); margin-right: 10px; font-size: .75rem; }
.login-form { display: grid; place-items: center; padding: 30px; background: #fff; }
.login-form form { width: 100%; max-width: 370px; }

/* ------------------------------ Producción PyM ------------------------------ */
.grilla input[type=number] { width: 96px; padding: 5px 8px; text-align: right; }
.grilla input.cambiado { border-color: var(--acento); background: #f0f9ff; box-shadow: 0 0 0 2px rgba(2,132,199,.12); }
.grilla td { vertical-align: middle; }
.grilla .obs { width: 190px; padding: 5px 8px; }
.barra-fija { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--borde); padding: 12px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; border-radius: 0 0 var(--radio) var(--radio); box-shadow: 0 -6px 16px rgba(15,23,42,.05); }
.matriz th.mes, .matriz td.mes { text-align: center; min-width: 60px; padding: 5px 4px; font-size: .78rem; }
.matriz td.mes b { display: block; }
.matriz td.mes small { color: var(--texto-3); }
.matriz td.c-ok { background: #dcfce7 !important; } .matriz td.c-warn { background: #fef3c7 !important; } .matriz td.c-mal { background: #fee2e2 !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--borde-2); background: #fff; border-radius: 99px; padding: 5px 13px; font: inherit; font-size: .82rem; cursor: pointer; font-weight: 600; color: var(--texto-2); transition: all .12s; }
.chips button:hover { border-color: var(--primario); color: var(--primario); }
.chips button.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.piramide { display: grid; grid-template-columns: 1fr 54px 1fr; gap: 3px 6px; font-size: .76rem; align-items: center; }
.piramide .h, .piramide .m { height: 15px; border-radius: 3px; }
.piramide .h { background: #60a5fa; justify-self: end; } .piramide .m { background: #f472b6; }
.piramide .e { text-align: center; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.paso { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed #e2e8f0; }
.paso:last-child { border-bottom: 0; }
.paso .n { width: 28px; height: 28px; border-radius: 50%; background: var(--primario-claro); color: var(--primario-2); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.paso.hecho .n { background: var(--ok-2); color: #fff; }

/* Medidor y accesos rápidos del tablero */
.medidor { position: relative; height: 180px; }
.medidor .centro-txt { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; pointer-events: none; }
.medidor .centro-txt b { font-size: 2.1rem; display: block; line-height: 1; letter-spacing: -.02em; }
.accesos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.accesos a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; color: var(--texto); font-weight: 600; font-size: .86rem; }
.accesos a:hover { border-color: var(--primario); background: var(--primario-suave); text-decoration: none; color: var(--primario-2); }
.accesos a svg { width: 18px; height: 18px; color: var(--primario); flex-shrink: 0; }

/* ------------------------------ Adaptable ------------------------------ */
@media (max-width: 1200px) {
  .g-4, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .velo.abierto { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .principal { margin-left: 0; }
  .menu-btn { display: block; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .contenido { padding: 14px; }
  .c-8, .c-6, .c-5, .c-4, .c-3 { grid-column: span 12; }
  .c-2 { grid-column: span 4; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-lado { display: none; }
  .topbar .hospital small, .vigencia label, .btn-ayuda span { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .lista-def { grid-template-columns: 1fr; }
  .encabezado { padding: 14px 16px 14px 20px; }
  .encabezado .ico-pag { display: none; }
  .toolbar .der { margin-left: 0; }
}
@media (max-width: 560px) { .g-4, .g-6 { grid-template-columns: 1fr; } .accesos { grid-template-columns: 1fr; } .kpi .v { font-size: 1.55rem; } }

@media print {
  .sidebar, .topbar, .no-print, .ayuda-pagina, .toolbar .der, .acciones, .paginacion { display: none !important; }
  .principal { margin: 0; }
  body { background: #fff; font-size: 12px; }
  .contenido { padding: 0; max-width: none; }
  .card, .encabezado { box-shadow: none; break-inside: avoid; }
  .tabla th { position: static; }
}

/* Columna principal de tablas analíticas y filtro por semáforo */
.tabla td.col-principal { min-width: 300px; }
.filtro-sem { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px; align-items: center; border-bottom: 1px solid var(--borde); }
.filtro-sem button { border: 1px solid var(--borde-2); background: #fff; border-radius: 99px; padding: 4px 12px; font: inherit; font-size: .82rem; cursor: pointer; font-weight: 600; color: var(--texto-2); display: inline-flex; align-items: center; }
.filtro-sem button.activo { border-color: var(--primario); background: var(--primario-suave); color: var(--primario-2); }
