/* =========================================================================
   SGPP Multihospital · Sistema de Gestión de Procesos y Procedimientos
   Hoja de estilos principal (sin dependencias) · v2
   ========================================================================= */
:root {
  --primario: #0b5cad;
  --primario-2: #084a8c;
  --primario-claro: #e0ecfb;
  --primario-suave: #f2f7fd;
  --acento: #7ab72f;
  --amarillo: #f5c400;
  --fondo: #f3f6fa;
  --superficie: #ffffff;
  --borde: #e3e9f1;
  --borde-2: #cfd8e3;
  --texto: #0f1d33;
  --texto-2: #4b5b70;
  --texto-3: #8796a8;
  --ok: #15803d;     --ok-bg: #dcfce7;
  --warn: #b45309;   --warn-bg: #fef3c7;
  --mal: #dc2626;    --mal-bg: #fee2e2;
  --info: #2563eb;   --info-bg: #dbeafe;
  --gris-bg: #f1f5f9;
  --p: #2563eb; --h: #16a34a; --v: #d97706; --a: #9333ea;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(15, 29, 51, .05), 0 2px 6px rgba(15, 29, 51, .05);
  --sombra-2: 0 10px 30px rgba(15, 29, 51, .12);
  --sidebar: 262px;
  --sidebar-min: 72px;
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
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; }
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; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
small, .muted { color: var(--texto-2); }
.hidden { display: none !important; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.der { margin-left: auto; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .86em; }
.pre { white-space: pre-line; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; border-radius: 6px; }
::selection { background: #bfdbfe; }
* { scrollbar-width: thin; scrollbar-color: #c3cede transparent; }
.saltar { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 999; box-shadow: var(--sombra-2); }
.saltar:focus { left: 8px; }
mark { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 3px; }
kbd { font: 600 .72rem/1 Consolas, monospace; background: #fff; border: 1px solid var(--borde-2); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; color: var(--texto-2); }

/* ------------------------------ Menú lateral ------------------------------ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: linear-gradient(180deg, #0c2340 0%, #0d2a4d 100%); color: #dbeafe; flex-shrink: 0;
  position: fixed; inset: 0 auto 0 0; z-index: 40; transition: width .2s, transform .2s; display: flex; flex-direction: column;
}
.sidebar .marca { padding: 16px 16px 12px; display: flex; gap: 11px; align-items: center; color: #fff; }
.sidebar .marca:hover { text-decoration: none; }
.sidebar .marca .logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #2f80d8, var(--acento)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .72rem; flex-shrink: 0; box-shadow: 0 4px 12px rgba(47, 128, 216, .35); }
.sidebar .marca b { display: block; font-size: 1.08rem; letter-spacing: .4px; }
.sidebar .marca span { font-size: .74rem; color: #93c5fd; line-height: 1.2; display: block; }
.menu-buscar { margin: 2px 12px 8px; position: relative; }
.menu-buscar svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: #7dd3fc; }
.menu-buscar input { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: #fff; padding: 7px 10px 7px 32px; font-size: .86rem; border-radius: 9px; }
.menu-buscar input::placeholder { color: #93a9c7; }
.menu-buscar input:focus { outline: none; border-color: #60a5fa; background: rgba(255,255,255,.1); }
.sidebar nav { padding: 0 10px 16px; overflow-y: auto; flex: 1; }
.sidebar .grupo { all: unset; box-sizing: border-box; width: 100%; margin: 12px 0 3px; padding: 4px 8px; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #7dd3fc; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-radius: 6px; }
.sidebar .grupo:hover { background: rgba(255,255,255,.05); }
.sidebar .grupo svg { width: 13px; height: 13px; transition: transform .2s; opacity: .8; }
.grupo-menu.plegado .grupo svg { transform: rotate(-90deg); }
.grupo-menu.plegado .items { display: none; }
.sidebar a.item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: #d6e4f5; font-size: .9rem; position: relative; margin: 1px 0; }
.sidebar a.item:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar a.item.activo { background: linear-gradient(90deg, #2563eb, #3b82f6); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.sidebar a.item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .95; }
.sidebar a.item .cuenta { margin-left: auto; background: var(--amarillo); color: #422006; border-radius: 99px; font-size: .7rem; font-weight: 800; padding: 0 7px; min-width: 20px; text-align: center; }
.sidebar-pie { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.contraer { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: #93c5fd; cursor: pointer; font-size: .85rem; }
.contraer:hover { background: rgba(255,255,255,.07); color: #fff; }
.contraer svg { width: 18px; height: 18px; transition: transform .2s; }
.velo { display: none; }

/* Menú contraído (solo íconos) */
html.menu-contraido .sidebar { width: var(--sidebar-min); }
html.menu-contraido .principal { margin-left: var(--sidebar-min); }
html.menu-contraido .sidebar .marca-texto, html.menu-contraido .sidebar .txt, html.menu-contraido .menu-buscar,
html.menu-contraido .sidebar .grupo span, html.menu-contraido .sidebar .grupo svg { display: none; }
html.menu-contraido .sidebar .grupo { height: 1px; padding: 0; margin: 10px 8px; background: rgba(255,255,255,.1); }
html.menu-contraido .grupo-menu.plegado .items { display: block; }
html.menu-contraido .sidebar a.item { justify-content: center; padding: 10px 0; }
html.menu-contraido .sidebar a.item .cuenta { position: absolute; top: 2px; right: 6px; padding: 0 5px; font-size: .62rem; }
html.menu-contraido .contraer { justify-content: center; }
html.menu-contraido .contraer svg { transform: rotate(180deg); }
html.menu-contraido .sidebar .marca { justify-content: center; padding: 16px 0 12px; }
html.menu-contraido [data-tip-der]:hover::after {
  content: attr(data-tip-der); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: #0f1d33; color: #fff; padding: 5px 10px; border-radius: 7px; font-size: .8rem; font-weight: 500; white-space: nowrap; z-index: 60; box-shadow: var(--sombra-2);
}

/* ------------------------------ Barra superior ------------------------------ */
.principal { margin-left: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s; }
.topbar {
  height: 62px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; gap: 10px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar .hospital { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .hospital img { height: 38px; width: auto; max-width: 70px; object-fit: contain; }
.topbar .hospital > div { display: flex; flex-direction: column; min-width: 0; }
.topbar .hospital b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.topbar .hospital small { font-size: .75rem; }
.sel-hospital small { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--texto-3); }
.sel-hospital select { border: 0; padding: 0 22px 0 0; font-weight: 700; background-color: transparent; max-width: 360px; cursor: pointer; }
.topbar .espacio { flex: 1; }
.buscador { display: flex; align-items: center; gap: 8px; background: var(--gris-bg); border: 1px solid var(--borde); border-radius: 10px; padding: 7px 10px; color: var(--texto-3); cursor: pointer; font: inherit; min-width: 300px; }
.buscador:hover { border-color: var(--borde-2); background: #fff; }
.buscador svg { width: 16px; height: 16px; }
.buscador span { flex: 1; text-align: left; font-size: .88rem; }
.icono-top { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; display: grid; place-items: center; cursor: pointer; color: var(--texto-2); }
.icono-top:hover { background: var(--gris-bg); color: var(--primario); }
.icono-top svg { width: 20px; height: 20px; }
.icono-top .punto { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--mal); color: #fff; font-size: .65rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.menu-btn { display: none; background: none; border: 0; cursor: pointer; color: var(--texto); width: 38px; height: 38px; border-radius: 10px; }
.menu-btn svg { width: 22px; height: 22px; }
.usuario { display: flex; align-items: center; gap: 8px; position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primario), #3b82f6); 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: .85rem; flex-shrink: 0; }
.avatar.grande { width: 44px; height: 44px; cursor: default; }
.dropdown { position: absolute; right: 0; top: 48px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra-2); min-width: 270px; padding: 6px; display: none; animation: entra .12s ease-out; z-index: 50; }
.dropdown.ancho { width: 360px; }
.dropdown.abierto { display: block; }
.dropdown .cab { padding: 10px; border-bottom: 1px solid var(--borde); margin-bottom: 4px; display: flex; gap: 10px; align-items: flex-start; }
.dropdown .cab small { display: block; }
.dropdown button, .dropdown a.op { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--texto); font: inherit; }
.dropdown button svg { width: 17px; height: 17px; color: var(--texto-2); }
.dropdown button:hover, .dropdown a.op:hover { background: var(--gris-bg); text-decoration: none; }
.dropdown .salir { color: var(--mal); } .dropdown .salir svg { color: var(--mal); }
.lista-campana a { display: flex; gap: 10px; padding: 8px; border-radius: 8px; color: var(--texto); align-items: center; font-size: .86rem; }
.lista-campana a:hover { background: var(--gris-bg); text-decoration: none; }

/* ------------------------------ Contenido ------------------------------ */
.contenido { padding: 22px 26px 30px; max-width: 1560px; width: 100%; flex: 1; }
.cabecera { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.cab-icono { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--primario), #3b82f6); color: #fff; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 6px 16px rgba(11, 92, 173, .25); }
.cab-texto { flex: 1; min-width: 260px; }
.cab-texto h1 { margin: 1px 0 2px; }
.cab-texto p { margin: 0; color: var(--texto-2); max-width: 920px; font-size: .92rem; }
.cab-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.migas { font-size: .76rem; color: var(--texto-3); font-weight: 600; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.migas a { color: var(--texto-2); }
.migas span { color: var(--borde-2); }
.encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.encabezado p { margin: 2px 0 0; color: var(--texto-2); max-width: 900px; }
.pie { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 26px; color: var(--texto-3); font-size: .78rem; border-top: 1px solid var(--borde); }
.arriba { position: fixed; right: 20px; bottom: 20px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--primario); color: #fff; box-shadow: var(--sombra-2); cursor: pointer; display: grid; place-items: center; z-index: 25; }
.arriba svg { width: 20px; height: 20px; }

/* ------------------------------ Tarjetas ------------------------------ */
.card { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.card .card-h { padding: 13px 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 svg { width: 18px; height: 18px; color: var(--primario); }
.card .card-b { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.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-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; display: block; color: inherit; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--sombra-2); }
.kpi .t { font-size: .74rem; color: var(--texto-2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding-right: 40px; }
.kpi .v { font-size: 1.85rem; font-weight: 800; margin: 4px 0 2px; letter-spacing: -.02em; }
.kpi .s { font-size: .8rem; color: var(--texto-2); }
.kpi .ic { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primario-claro); color: var(--primario); }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi.ok .ic { background: var(--ok-bg); color: var(--ok); } .kpi.warn .ic { background: var(--warn-bg); color: var(--warn); }
.kpi.mal .ic { background: var(--mal-bg); color: var(--mal); } .kpi.info .ic { background: var(--info-bg); color: var(--info); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primario); }
.kpi.ok::before { background: var(--ok); } .kpi.warn::before { background: #f59e0b; } .kpi.mal::before { background: var(--mal); } .kpi.info::before { background: var(--info); }

.accesos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.acceso { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: #fff; border: 1px solid var(--borde); color: var(--texto); box-shadow: var(--sombra); transition: all .15s; cursor: pointer; font: inherit; text-align: left; }
.acceso:hover { border-color: #93c5fd; transform: translateY(-2px); text-decoration: none; box-shadow: var(--sombra-2); }
.acceso .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primario-claro); color: var(--primario); flex-shrink: 0; }
.acceso .ic svg { width: 20px; height: 20px; }
.acceso b { display: block; font-size: .92rem; }
.acceso small { font-size: .78rem; }
.saludo { background: linear-gradient(120deg, #0c2340, #0b5cad 70%, #2f80d8); color: #fff; border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; position: relative; overflow: hidden; }
.saludo::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); }
.saludo h1 { color: #fff; margin: 0 0 4px; font-size: 1.45rem; }
.saludo p { margin: 0; color: #dbeafe; }
.saludo .fecha { margin-left: auto; text-align: right; color: #bfdbfe; font-size: .85rem; position: relative; z-index: 1; }

.barra { height: 8px; background: #e8eef5; border-radius: 99px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--primario); border-radius: 99px; transition: width .6s; }
.barra.ok > span { background: #22c55e; } .barra.warn > span { background: #f59e0b; } .barra.mal > span { background: #ef4444; }
.prog { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.prog .barra { flex: 1; }
.prog b { font-size: .8rem; min-width: 38px; text-align: right; }
.chart-box { position: relative; height: 270px; }
.chart-box.sm { height: 210px; }

/* ------------------------------ Badges ------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--gris-bg); color: var(--texto-2); line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.sin-punto::before, .badge[class*="zona-"]::before { display: none; }
.b-ok { background: var(--ok-bg); color: #166534; } .b-warn { background: var(--warn-bg); color: #92400e; }
.b-mal { background: var(--mal-bg); color: #991b1b; } .b-info { background: var(--info-bg); color: #1e40af; }
.b-morado { background: #f3e8ff; color: #6b21a8; } .b-gris { background: #e2e8f0; color: #334155; }
.fase { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-weight: 800; font-size: .75rem; color: #fff; }
.fase-P { background: var(--p); } .fase-H { background: var(--h); } .fase-V { background: var(--v); } .fase-A { background: var(--a); }
.zona-BAJO { background: #22c55e; color: #fff; } .zona-MODERADO { background: #facc15; color: #422006; }
.zona-ALTO { background: #f97316; color: #fff; } .zona-EXTREMO { background: #dc2626; color: #fff; }

/* ------------------------------ Botones / formularios ------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: 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; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; position: relative; }
.btn:hover { background: var(--gris-bg); text-decoration: none; border-color: #b6c3d3; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.cargando { color: transparent !important; pointer-events: none; }
.btn.cargando::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: gira .7s linear infinite; }
.btn:not(.btn-p):not(.btn-ok).cargando::after { border-color: #cbd5e1; border-top-color: var(--primario); }
.btn-p { background: var(--primario); border-color: var(--primario); color: #fff; box-shadow: 0 2px 6px rgba(11, 92, 173, .25); }
.btn-p:hover { background: var(--primario-2); border-color: var(--primario-2); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn-ok:hover { background: #166534; }
.btn-warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.btn-d { color: var(--mal); }
.btn-d:hover { background: var(--mal-bg); border-color: #fca5a5; }
.btn-sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn-icon { padding: 6px 7px; }
.btn-texto { border-color: transparent; background: none; color: var(--primario); padding-left: 6px; padding-right: 6px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.acciones { display: flex; gap: 4px; justify-content: flex-end; }
.acciones .btn { border-color: transparent; color: var(--texto-2); }
.acciones .btn:hover { border-color: var(--borde-2); color: var(--primario); background: #fff; }
.acciones .btn-d:hover { color: var(--mal); }

/* Tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #0f1d33; color: #fff; padding: 5px 9px; border-radius: 7px; font-size: .76rem; font-weight: 500; white-space: nowrap;
  z-index: 70; pointer-events: none; box-shadow: var(--sombra-2); animation: entra .12s;
}
.topbar [data-tip]:hover::after { bottom: auto; top: calc(100% + 7px); }

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;
}
input:hover, select:hover, textarea:hover { border-color: #b6c3d3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px rgba(11, 92, 173, .15); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primario); }
input[readonly] { background: var(--gris-bg); }
select { cursor: pointer; }
textarea { min-height: 70px; resize: vertical; }
label { font-weight: 600; font-size: .84rem; display: block; margin-bottom: 5px; color: #2c3d52; }
.req::after { content: " *"; color: var(--mal); }
.campo .err { color: var(--mal); font-size: .78rem; margin-top: 4px; font-weight: 600; }
.campo.con-error input, .campo.con-error select, .campo.con-error textarea { border-color: var(--mal); background: #fffafa; }
.campo .ayuda { font-size: .76rem; 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-4 { grid-column: span 4; } .c-3 { grid-column: span 3; }
.seccion-form { grid-column: span 12; font-weight: 700; color: var(--primario); border-bottom: 1px solid var(--borde); padding-bottom: 6px; margin-top: 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.leyenda-req { grid-column: span 12; font-size: .78rem; color: var(--texto-3); margin-top: -4px; }
.leyenda-req b { color: var(--mal); }

/* ------------------------------ Barra de herramientas / tablas ------------------------------ */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--borde); }
.buscar-wrap { position: relative; flex: 1 1 240px; max-width: 360px; }
.buscar-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--texto-3); pointer-events: none; }
.buscar-wrap input { padding-left: 34px; }
.toolbar .buscar { flex: 1 1 220px; max-width: 360px; }
.toolbar select { width: auto; max-width: 240px; }
.toolbar select.activo { border-color: var(--primario); background: var(--primario-suave); color: var(--primario-2); font-weight: 600; }
.toolbar .der { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.resumen-filtros { display: flex; align-items: center; gap: 8px; padding: 8px 18px; background: var(--primario-suave); border-bottom: 1px solid var(--borde); font-size: .84rem; color: var(--texto-2); flex-wrap: wrap; }

.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: #f7f9fc; padding: 10px 12px; border-bottom: 1px solid var(--borde); white-space: nowrap; font-weight: 700; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.tabla tbody tr { transition: background .1s; }
.tabla tbody tr:hover td { background: #f6f9fe; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla td.num, .tabla th.num { text-align: right; white-space: nowrap; }
.tabla td.centro, .tabla th.centro { text-align: center; }
.tabla .sub { color: var(--texto-2); font-size: .8rem; margin-top: 1px; }
.tabla tr.fila-alerta td { background: #fff8f0; }
.vacio { padding: 36px; text-align: center; color: var(--texto-3); }
.estado-vacio { padding: 46px 20px; text-align: center; color: var(--texto-2); }
.estado-vacio .ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--primario-claro); color: var(--primario); display: grid; place-items: center; }
.estado-vacio .ic svg { width: 30px; height: 30px; }
.estado-vacio b { display: block; color: var(--texto); font-size: 1rem; margin-bottom: 4px; }
.estado-vacio p { margin: 0 auto 14px; max-width: 420px; font-size: .88rem; }
.esqueleto td { padding: 14px 12px; }
.linea-esq { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: brillo 1.2s infinite; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.paginacion { display: flex; align-items: center; justify-content: space-between; padding: 12px 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; flex-wrap: wrap; }
.paginacion .pag { min-width: 34px; padding: 5px 8px; }
.paginacion .pag.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
.paginacion select { width: auto; padding: 4px 8px; }

/* ------------------------------ Mapa de procesos ------------------------------ */
.mapa { display: grid; grid-template-columns: 54px 1fr 54px; gap: 12px; align-items: stretch; }
.mapa .lateral { writing-mode: vertical-rl; border-radius: 12px; font-weight: 700; color: #fff; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; padding: 18px 0; text-align: start; line-height: 54px; }
.mapa .lateral span { position: sticky; top: 80px; }
.mapa .lateral.entrada { background: linear-gradient(0deg, #0c4a6e, #0284c7); }
.mapa .lateral.salida { background: linear-gradient(0deg, #14532d, #16a34a); }
.mapa .centro { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.franja { border-radius: 14px; padding: 14px; border: 2px solid; background: #fff; box-shadow: var(--sombra); }
.franja > h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.franja > h3 .n { margin-left: auto; font-size: .72rem; color: var(--texto-3); font-weight: 600; text-transform: none; letter-spacing: 0; }
.franja .procesos { display: flex; flex-wrap: wrap; gap: 10px; }
.franja .grupo-proc { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 10px; flex: 1 1 260px; background: #f8fafc; }
.franja .grupo-proc > b { font-size: .76rem; color: var(--texto-2); display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.franja .grupo-proc .procesos { gap: 7px; }
.proc { display: block; border-radius: 10px; padding: 9px 11px; color: #fff; flex: 1 1 180px; min-width: 160px; max-width: 330px; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .15s, box-shadow .15s, opacity .15s; }
.proc:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.proc .sig { font-size: .7rem; font-weight: 800; opacity: .85; letter-spacing: .06em; }
.proc .nom { font-size: .8rem; font-weight: 600; line-height: 1.3; margin: 2px 0 7px; }
.proc .met { display: flex; gap: 5px; flex-wrap: wrap; font-size: .68rem; }
.proc .met span { background: rgba(255,255,255,.2); border-radius: 99px; padding: 0 7px; }
.proc .sin-car { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--amarillo); box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.mapa.filtrando .proc { opacity: .25; }
.mapa.filtrando .proc.coincide { opacity: 1; outline: 3px solid var(--amarillo); outline-offset: 2px; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--texto-2); align-items: center; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------ Documento / ficha ------------------------------ */
.ficha-cab { background: #fff; border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra); padding: 18px 20px; margin-bottom: 16px; }
.ficha-cab .fila1 { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ficha-cab h1 { margin: 2px 0 6px; font-size: 1.4rem; }
.ficha-cab .codigo { font-family: Consolas, monospace; font-weight: 800; color: var(--primario); background: var(--primario-claro); padding: 2px 9px; border-radius: 7px; font-size: .9rem; }
.ficha-cab .acciones-ficha { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.metadatos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--borde); }
.metadatos div { min-width: 0; }
.metadatos small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--texto-3); }
.metadatos b { font-size: .9rem; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.doc-cab { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.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; }
.bloque { margin-bottom: 22px; scroll-margin-top: 80px; }
.bloque > h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primario); border-bottom: 2px solid var(--primario-claro); padding-bottom: 6px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.bloque p { margin: 0 0 6px; }
.con-indice { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.indice { position: sticky; top: 80px; border-left: 2px solid var(--borde); padding-left: 2px; }
.indice a { display: block; padding: 5px 10px; font-size: .84rem; color: var(--texto-2); border-left: 2px solid transparent; margin-left: -4px; }
.indice a:hover, .indice a.activo { color: var(--primario); border-left-color: var(--primario); text-decoration: none; background: var(--primario-suave); }
.phva-tabla td:first-child { width: 34px; }
.phva-sep td { background: #f7f9fc !important; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-2); }
.control { color: var(--warn); font-weight: 700; font-size: .72rem; white-space: nowrap; }
.caract { width: 100%; border-collapse: collapse; font-size: .82rem; }
.caract th, .caract td { border: 1px solid var(--borde); padding: 7px 9px; vertical-align: top; }
.caract th { background: #f1f5f9; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.caract td.fase-celda { color: #fff; font-weight: 800; text-align: center; width: 36px; }
.caract ul { margin: 0; padding-left: 16px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--borde); }
.timeline li:last-child::before { display: none; }
.timeline .pto { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--texto-3); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--borde); }
.timeline .pto.ok { background: var(--ok); } .timeline .pto.mal { background: var(--mal); } .timeline .pto.info { background: var(--info); }
.timeline small { display: block; }

/* Flujo de estados (pasos) */
.estados { display: flex; gap: 0; flex-wrap: wrap; margin: 8px 0 4px; }
.estados span { padding: 6px 16px 6px 22px; font-size: .74rem; font-weight: 700; background: #e2e8f0; color: #64748b; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -6px; }
.estados span:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 14px; }
.estados span.hecho { background: #bfdbfe; color: #1e3a8a; }
.estados span.actual { background: var(--primario); color: #fff; }
.estados span.devuelto { background: var(--mal); color: #fff; }
.flujo-card { border-left: 4px solid var(--primario); }
.flujo-card.devuelto { border-left-color: var(--mal); }

/* Editor de listas */
.editor-lista table { width: 100%; min-width: 1120px; border-collapse: collapse; font-size: .85rem; }
.editor-lista th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); padding: 8px 6px; background: #f7f9fc; border-bottom: 1px solid var(--borde); }
.editor-lista td { padding: 5px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.editor-lista tbody tr:hover td { background: #fbfcfe; }
.editor-lista td input, .editor-lista td select, .editor-lista td textarea { padding: 6px 8px; font-size: .84rem; }
.editor-lista td textarea { min-height: 40px; }
.editor-lista td.mover { width: 96px; white-space: nowrap; }
.editor-lista td select[multiple] { min-width: 150px; min-height: 64px; }
.editor-lista .pie { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 0; gap: 8px; flex-wrap: wrap; }
.editor-lista [data-estado].sucio { color: var(--warn); font-weight: 600; }
.pasos-secciones { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pasos-secciones button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--borde-2); background: #fff; border-radius: 99px; padding: 6px 13px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; color: var(--texto-2); }
.pasos-secciones button:hover { border-color: var(--primario); color: var(--primario); }
.pasos-secciones button.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.pasos-secciones .estado-sec { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .65rem; background: #e2e8f0; color: #64748b; }
.pasos-secciones .estado-sec.si { background: #22c55e; color: #fff; }
.pasos-secciones button.activo .estado-sec { background: rgba(255,255,255,.25); color: #fff; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--borde); padding: 0 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 13px; cursor: pointer; font: inherit; font-weight: 600; color: var(--texto-2); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--primario); }
.tabs button.activo { color: var(--primario); border-bottom-color: var(--primario); }
.tabs button .n { background: var(--gris-bg); border-radius: 99px; padding: 0 7px; font-size: .72rem; }
.tabs button.activo .n { background: var(--primario-claro); color: var(--primario); }

.calor { display: grid; grid-template-columns: 26px repeat(5, 1fr); gap: 4px; font-size: .8rem; }
.calor div { aspect-ratio: 1.6; display: grid; place-items: center; border-radius: 7px; font-weight: 800; }
.calor .eje { background: none; color: var(--texto-2); font-weight: 600; }

/* ------------------------------ Modal / cajón / paleta / toast ------------------------------ */
.modal-fondo { position: fixed; inset: 0; background: rgba(15, 29, 51, .5); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 34px 14px; overflow-y: auto; animation: aparece .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 660px; box-shadow: 0 25px 60px rgba(0,0,0,.28); animation: entra .18s ease-out; display: flex; flex-direction: column; }
.modal.lg { max-width: 940px; } .modal.xl { max-width: 1220px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; font-size: 1.06rem; }
.modal-b { padding: 20px; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--borde); display: flex; justify-content: flex-end; align-items: center; gap: 8px; background: #f7f9fc; border-radius: 0 0 16px 16px; position: sticky; bottom: 0; }
.modal-f .ayuda-tecla { margin-right: auto; font-size: .76rem; color: var(--texto-3); }
.cerrar { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--texto-2); line-height: 1; width: 34px; height: 34px; border-radius: 9px; }
.cerrar:hover { background: var(--gris-bg); color: var(--texto); }
@keyframes entra { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes gira { to { transform: rotate(360deg); } }
@keyframes desliza { from { transform: translateX(100%); } to { transform: none; } }

.confirmar-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; background: var(--info-bg); color: var(--info); }
.confirmar-ic.peligro { background: var(--mal-bg); color: var(--mal); }
.confirmar-ic svg { width: 26px; height: 26px; }

.cajon-fondo { position: fixed; inset: 0; background: rgba(15, 29, 51, .35); z-index: 110; animation: aparece .15s; }
.cajon { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: #fff; z-index: 111; box-shadow: var(--sombra-2); display: flex; flex-direction: column; animation: desliza .2s ease-out; }
.cajon .modal-h { background: linear-gradient(120deg, #0c2340, #0b5cad); color: #fff; }
.cajon .modal-h h3 { color: #fff; display: flex; gap: 8px; align-items: center; }
.cajon .cerrar { color: #fff; } .cajon .cerrar:hover { background: rgba(255,255,255,.15); color: #fff; }
.cajon .modal-b { overflow-y: auto; flex: 1; }
.pasos-ayuda { counter-reset: paso; list-style: none; padding: 0; margin: 0; }
.pasos-ayuda li { counter-increment: paso; position: relative; padding: 0 0 14px 40px; line-height: 1.5; }
.pasos-ayuda li::before { content: counter(paso); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--primario-claro); color: var(--primario); font-weight: 800; font-size: .8rem; display: grid; place-items: center; }

.paleta-fondo { position: fixed; inset: 0; background: rgba(15, 29, 51, .45); backdrop-filter: blur(2px); z-index: 120; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 14px; animation: aparece .12s; }
.paleta { width: min(640px, 100%); background: #fff; border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,.3); overflow: hidden; animation: entra .15s; }
.paleta .entrada { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--borde); }
.paleta .entrada svg { width: 20px; height: 20px; color: var(--texto-3); }
.paleta .entrada input { border: 0; padding: 4px; font-size: 1.05rem; box-shadow: none; }
.paleta .resultados { max-height: 56vh; overflow-y: auto; padding: 6px; }
.paleta .grupo-res { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-3); padding: 10px 10px 4px; }
.paleta a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--texto); }
.paleta a .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--gris-bg); display: grid; place-items: center; color: var(--texto-2); flex-shrink: 0; }
.paleta a .ic svg { width: 17px; height: 17px; }
.paleta a small { display: block; font-size: .78rem; }
.paleta a:hover, .paleta a.sel { background: var(--primario-suave); text-decoration: none; }
.paleta a.sel .ic { background: var(--primario); color: #fff; }
.paleta .pie-paleta { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--borde); font-size: .76rem; color: var(--texto-3); background: #f7f9fc; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f1d33; color: #fff; padding: 11px 12px 11px 14px; border-radius: 12px; box-shadow: var(--sombra-2); width: 380px; max-width: calc(100vw - 36px); font-size: .9rem; animation: entra .15s; display: flex; gap: 10px; align-items: flex-start; position: relative; overflow: hidden; }
.toast .ic { width: 22px; height: 22px; flex-shrink: 0; }
.toast .msg { flex: 1; }
.toast .x { background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.toast .x:hover { color: #fff; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.45); animation: consume var(--dur, 4s) linear forwards; }
@keyframes consume { from { width: 100%; } to { width: 0; } }
.toast.ok { background: #166534; } .toast.mal { background: #991b1b; } .toast.info { background: #1e40af; }

.aviso { padding: 11px 14px 11px 42px; border-radius: 10px; background: var(--info-bg); color: #1e3a8a; margin-bottom: 14px; font-size: .9rem; border: 1px solid #bfdbfe; position: relative; }
.aviso::before { content: "i"; position: absolute; left: 12px; top: 11px; width: 20px; height: 20px; border-radius: 50%; background: var(--ic, #2563eb); color: #fff; font: 800 .75rem/20px Georgia, serif; text-align: center; opacity: .85; }

.aviso.warn { background: var(--warn-bg); color: #78350f; border-color: #fde68a; --ic: #d97706; } .aviso.warn::before { content: "!"; font-family: inherit; }
.aviso.ok { background: var(--ok-bg); color: #14532d; border-color: #bbf7d0; --ic: #16a34a; } .aviso.ok::before { content: "✓"; font-family: inherit; }
.aviso.mal { background: var(--mal-bg); color: #7f1d1d; border-color: #fecaca; --ic: #dc2626; } .aviso.mal::before { content: "!"; font-family: inherit; }
.aviso.sin-icono { padding-left: 14px; } .aviso.sin-icono::before { display: none; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #f1f5f9; }
.checklist .si, .checklist .no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; color: #fff; font-weight: 800; }
.checklist .si { background: #22c55e; } .checklist .no { background: var(--mal); }

.semaforo { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.sem-VERDE { background: #22c55e; } .sem-AMARILLO { background: #eab308; } .sem-ROJO { background: var(--mal); } .sem-na { background: #cbd5e1; }

.pendientes { list-style: none; margin: 0; padding: 0; }
.pendientes li { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f1f5f9; align-items: center; }
.pendientes li:last-child { border-bottom: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-lado { background: radial-gradient(circle at 80% 10%, rgba(122,183,47,.25), transparent 40%), linear-gradient(150deg, #0c2340, #0b5cad 60%, #3b82f6); color: #eff6ff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.login-lado h1 { font-size: 2.1rem; color: #fff; letter-spacing: -.02em; }
.login-lado .caracteristicas { display: grid; gap: 12px; margin-top: 26px; max-width: 560px; }
.login-lado .carac { display: flex; gap: 12px; align-items: flex-start; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 12px 14px; }
.login-lado .carac svg { width: 22px; height: 22px; flex-shrink: 0; color: #a7f3d0; }
.login-lado .carac b { display: block; color: #fff; }
.login-lado .carac span { color: #dbeafe; font-size: .88rem; }
.login-form { display: grid; place-items: center; padding: 30px; background: #fff; }
.login-form form { width: 100%; max-width: 380px; }
.login-form .logo-login { width: 56px; height: 56px; border-radius: 15px; background: linear-gradient(135deg, var(--primario), var(--acento)); display: grid; place-items: center; color: #fff; font-weight: 800; margin-bottom: 18px; box-shadow: 0 8px 20px rgba(11,92,173,.3); }
.campo-clave { position: relative; }
.campo-clave input { padding-right: 44px; }
.campo-clave button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; color: var(--texto-3); width: 36px; height: 34px; border-radius: 8px; }
.campo-clave button:hover { color: var(--primario); background: var(--gris-bg); }
.aviso-mayus { font-size: .78rem; color: var(--warn); margin-top: 4px; font-weight: 600; }

/* ------------------------------ Adaptación a pantallas ------------------------------ */
@media (max-width: 1200px) {
  .g-4, .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buscador { min-width: 0; } .buscador span, .buscador kbd { display: none; }
  .con-indice { grid-template-columns: 1fr; } .indice { display: none; }
}
@media (max-width: 900px) {
  .sidebar, html.menu-contraido .sidebar { transform: translateX(-100%); width: var(--sidebar); }
  .sidebar.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .sidebar.abierto ~ .velo { display: block; position: fixed; inset: 0; background: rgba(15, 29, 51, .45); z-index: 35; }
  html.menu-contraido .sidebar .txt, html.menu-contraido .sidebar .marca-texto, html.menu-contraido .menu-buscar { display: initial; }
  .principal, html.menu-contraido .principal { margin-left: 0; }
  .menu-btn { display: grid; place-items: center; }
  .sidebar-pie { display: none; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .contenido { padding: 16px; }
  .c-8, .c-6, .c-4, .c-3 { grid-column: span 12; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-lado { display: none; }
  .topbar .hospital small, .sel-hospital small { display: none; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .hospital img { height: 30px; }
  .sel-hospital select { max-width: 150px; }
  .topbar .hospital b { max-width: 150px; }
  .lista-def { grid-template-columns: 1fr; }
  .mapa { grid-template-columns: 1fr; }
  .mapa .lateral { writing-mode: horizontal-tb; padding: 8px; line-height: 1.3; text-align: center; }
  .cab-icono { width: 42px; height: 42px; border-radius: 12px; }
  .cab-acciones { width: 100%; }
  .toolbar .der { margin-left: 0; width: 100%; }
  .buscar-wrap, .toolbar .buscar { max-width: none; }
  .toolbar select { max-width: none; flex: 1 1 140px; }
  .dropdown.ancho { width: min(360px, calc(100vw - 20px)); right: -50px; }
  /* Tablas como tarjetas */
  table.tabla.adaptable thead { display: none; }
  table.tabla.adaptable, table.tabla.adaptable tbody, table.tabla.adaptable tr, table.tabla.adaptable td { display: block; width: 100%; }
  table.tabla.adaptable tr { border-bottom: 1px solid var(--borde); padding: 8px 4px; }
  table.tabla.adaptable td { border: 0; padding: 4px 12px; display: flex; gap: 10px; text-align: left !important; }
  table.tabla.adaptable td[data-label]::before { content: attr(data-label); flex: 0 0 38%; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-3); font-weight: 700; padding-top: 2px; }
  table.tabla.adaptable td > .celda { min-width: 0; flex: 1; }
  .toolbar select { width: 100%; }
  .cab-icono { display: none; }
  table.tabla.adaptable td.celda-acciones::before { content: none; }
  table.tabla.adaptable td.celda-acciones .acciones { justify-content: flex-start; width: 100%; }
  .saludo .fecha { margin-left: 0; text-align: left; }
}
@media (max-width: 560px) { .g-4, .g-5 { grid-template-columns: 1fr; } .accesos { grid-template-columns: 1fr; } }

@media print {
  .sidebar, .topbar, .no-print, .pie, .arriba, .toasts { display: none !important; }
  .principal { margin: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
