/* Sistema de facturación — Hospital Español.
   Azul marino y azul real sobre fondo gris frío; tarjetas blancas con relieve sutil; menú lateral oscuro. */
:root {
  --navy-0: #06183d; --navy-1: #0a2a66; --navy-2: #123b85;
  --azul: #1f5fe0; --azul-h: #174fc0; --azul-claro: #e6eefc; --azul-borde: #c9daf8;
  --fondo: #d5dbe5; --fondo-2: #dfe4ec; --blanco: #ffffff;
  --tinta: #0e1e3d; --tinta-2: #4b5b78; --tinta-3: #8190ab;
  --linea: #d3dae8; --linea-2: #c1cbe0;
  --error: #b32a43; --alerta: #a85d00;
  --accion: var(--azul); --accion-h: var(--azul-h);
  --lateral: 244px;
  --sombra: 0 1px 2px rgba(14, 30, 61, .08), 0 10px 26px -14px rgba(14, 30, 61, .30);
  --relieve: 0 1px 0 rgba(255,255,255,.95) inset, 0 -2px 0 rgba(14,30,61,.05) inset, 0 1px 2px rgba(14,30,61,.12), 0 8px 16px -8px rgba(14,30,61,.26);
  --relieve-h: 0 1px 0 rgba(255,255,255,.95) inset, 0 -2px 0 rgba(14,30,61,.06) inset, 0 2px 4px rgba(14,30,61,.16), 0 14px 22px -10px rgba(14,30,61,.34);
}
* { box-sizing: border-box; }
html { background: var(--fondo); }
body { margin: 0; color: var(--tinta); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; min-height: 100vh;
  background: linear-gradient(180deg, var(--fondo-2), var(--fondo)); background-attachment: fixed; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- tonos para los recuadros de ícono ---------- */
.t-azul  { --p-bg: #dbe7fd; --p-fg: #1f56c4; --p-suave: #eef3fd; --p-barra: #7fa6f0; }
.t-lima  { --p-bg: #dcf0e3; --p-fg: #1f7a4a; --p-suave: #eef8f1; --p-barra: #7cc79b; }
.t-viol  { --p-bg: #e7defb; --p-fg: #5a35b5; --p-suave: #f3effd; --p-barra: #b6a0ee; }
.t-ambar { --p-bg: #ffe8c9; --p-fg: #9a5200; --p-suave: #fff6e8; --p-barra: #f0bf7d; }
.t-turq  { --p-bg: #d3eef1; --p-fg: #1b7482; --p-suave: #ebf7f8; --p-barra: #7fc7d1; }
.t-rojo  { --p-bg: #fbdde2; --p-fg: #a3263d; --p-suave: #fdf0f2; --p-barra: #ec9aa9; }
.t-gris  { --p-bg: #e2e7f0; --p-fg: #4b5b78; --p-suave: #f1f4f9; --p-barra: #b4c0d6; }
.t-oscuro { --p-bg: var(--azul); --p-fg: #fff; --p-suave: var(--azul-claro); }

/* ---------- íconos ---------- */
svg.ico { width: 1.2em; height: 1.2em; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; fill: currentColor; fill-opacity: .14; }
svg.ico.libre { fill: none; }
.ib { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px; background: var(--p-bg, #dbe7fd); color: var(--p-fg, #1f56c4); }
.ib svg.ico { width: 56%; height: 56%; fill-opacity: .2; stroke-width: 1.8; }
.ib.mini { width: 30px; height: 30px; border-radius: 10px; }
.ib.grande, .ib.medio { width: 44px; height: 44px; border-radius: 13px; }

/* ---------- formularios y botones ---------- */
label { display: grid; gap: 5px; color: var(--tinta-2); font-size: 12px; font-weight: 500; }
input, select, textarea { background: var(--blanco); color: var(--tinta); border: 1px solid var(--linea-2); border-radius: 10px; padding: 9px 12px; font: inherit; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--tinta-3); }
textarea { min-height: 68px; resize: vertical; line-height: 1.4; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--azul); outline-offset: 1px; border-color: transparent; }
button:focus-visible, tr:focus-visible, a:focus-visible, .orden:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }
.error { color: var(--error); margin: 0; min-height: 1.2em; }
button.primario { background: linear-gradient(180deg, #3478f0, var(--azul)); color: #fff; border: 0; padding: 11px 20px; border-radius: 10px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 -2px 0 rgba(0,0,0,.16) inset, 0 2px 0 #153f9a, 0 8px 14px -6px rgba(31,95,224,.55); }
button.primario:hover { background: linear-gradient(180deg, #2b6ee8, var(--azul-h)); transform: translateY(-1px); }
button.primario:active, button.sec:active { transform: translateY(1px); box-shadow: 0 2px 4px rgba(14,30,61,.25) inset; }
button.sec { background-image: linear-gradient(180deg, #fff, #f1f4fa); background-color: #fff; color: var(--tinta); border: 1px solid var(--linea-2); padding: 10px 16px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; font-weight: 500; box-shadow: var(--relieve); }
button.sec:hover { box-shadow: var(--relieve-h); transform: translateY(-1px); }
button.peligro { background: #fdf0f2; color: var(--error); border: 1px solid #f1c6cf; padding: 10px 16px; border-radius: 10px; font-weight: 500; }
button.peligro:hover { background: #fbe1e6; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.link { background: none; border: 0; color: var(--tinta-2); border-radius: 8px; padding: 7px 10px; }
.link:hover { color: var(--tinta); background: rgba(255,255,255,.7); }

/* ---------- inicio de sesión ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, var(--navy-1), var(--navy-0)); }
.login-card { width: min(400px, 100%); background: var(--blanco); border-radius: 20px; padding: 32px; display: grid; gap: 14px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); --cruz: #1f5fe0; }
.login-card h1 { font-size: 18px; margin: 4px 0 0; font-weight: 600; }
.login-card .marca-txt { color: var(--navy-1); }

/* ---------- marco: menú lateral oscuro + zona principal ---------- */
.shell { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100vh; }
.lateral { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 16px; overflow: hidden; color: #fff;
  background: linear-gradient(190deg, var(--navy-2) 0%, var(--navy-1) 38%, var(--navy-0) 100%); }
.lateral::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(118deg, transparent 52%, rgba(80, 140, 255, .16) 52% 66%, transparent 66%), linear-gradient(118deg, transparent 72%, rgba(80, 140, 255, .09) 72% 80%, transparent 80%); }
.lateral > * { position: relative; }
.marca-card { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: 0 8px 18px -8px rgba(0,0,0,.5); }
.marca { display: flex; align-items: center; gap: 11px; }
.marca-logo { display: block; height: 44px; }
.marca-logo svg, .marca-logo img { height: 44px; width: auto; display: block; }
.marca-txt { font-weight: 600; letter-spacing: .04em; font-size: 14px; line-height: 1.05; color: var(--navy-1); }
.marca-card { --cruz: #1f5fe0; }
#menu { display: grid; gap: 3px; align-content: start; flex: 1; overflow-y: auto; scrollbar-width: none; }
#menu::-webkit-scrollbar { display: none; }
#menu button { display: flex; align-items: center; gap: 13px; background: none; border: 0; color: rgba(255,255,255,.84); padding: 11px 14px; border-radius: 12px; text-align: left; font-weight: 500; }
#menu button:hover { background: rgba(255,255,255,.09); color: #fff; }
#menu button.activo { background: linear-gradient(90deg, #2f73f2, var(--azul)); color: #fff; font-weight: 600; box-shadow: 0 10px 20px -8px rgba(31, 95, 224, .8), inset 0 1px 0 rgba(255,255,255,.25); }
#menu button svg.ico { width: 1.3em; height: 1.3em; fill-opacity: .22; }
#menu button.sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 12px 7px 48px; font-size: 13px; line-height: 1.25; border-radius: 10px; color: rgba(255,255,255,.72); }
#menu button.sub.activo { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; }
#menu button.sub small { background: rgba(255,255,255,.14); color: #dbe7ff; border-radius: 99px; padding: 0 8px; font-size: 11px; font-weight: 600; }
.pami { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); }
.pami svg { width: 40px; height: 40px; flex: none; }
.pami b { font-size: 20px; letter-spacing: .02em; display: block; line-height: 1.1; }
.pami small { color: rgba(255,255,255,.75); font-size: 11px; line-height: 1.25; display: block; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 20px; padding: 16px 32px 6px; }
.busqueda { flex: 0 1 560px; display: flex; flex-direction: row; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 0 14px; color: var(--tinta-3); box-shadow: var(--relieve); height: 46px; }
.busqueda input { flex: 1; border: 0; background: none; box-shadow: none; padding: 0; height: 100%; color: var(--tinta); }
.busqueda input:focus-visible { outline: none; }
.busqueda:focus-within { box-shadow: var(--relieve), 0 0 0 2px var(--azul); }
.busqueda kbd { font: 11px/1 "Segoe UI", system-ui, sans-serif; color: var(--tinta-3); background: #eef2f9; border: 1px solid var(--linea); border-radius: 6px; padding: 4px 7px; }
.top-der { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.reloj { display: grid; text-align: right; color: var(--tinta-2); font-size: 12.5px; line-height: 1.3; }
.reloj span:last-child { color: var(--tinta-3); }
.usuario { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 5px 14px 5px 6px; box-shadow: var(--relieve); }
.usuario-txt { display: grid; line-height: 1.15; }
.usuario-txt b { font-weight: 600; }
.usuario-txt small { color: var(--tinta-2); text-transform: capitalize; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; background: var(--azul-claro); color: #1f56c4; box-shadow: inset 0 -2px 0 rgba(14,30,61,.08); }
main { position: relative; min-width: 0; padding: 8px 32px 28px; }
.fondo-hospital { position: absolute; top: -6px; right: 0; width: min(720px, 62%); height: 330px; pointer-events: none; z-index: 0;
  background: linear-gradient(120deg, rgba(31, 95, 224, .22), rgba(31, 95, 224, 0) 70%), url("hospital.jpg") center 22% / cover no-repeat;
  background-blend-mode: multiply; opacity: .62;
  -webkit-mask-image: linear-gradient(to left, #000 30%, transparent 100%), linear-gradient(to top, transparent 0%, #000 45%); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to left, #000 30%, transparent 100%), linear-gradient(to top, transparent 0%, #000 45%); mask-composite: intersect; }
main > *:not(.fondo-hospital) { position: relative; z-index: 1; }
.encab { margin: 6px 0 18px; }
.encab h1 { font-size: 34px; line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.01em; color: var(--navy-1); }
.encab p { margin: 4px 0 0; color: var(--tinta-2); font-size: 15px; }
main.sin-encab .encab { display: none; }

/* ---------- Panel: título + filtros a la izquierda, indicador circular a la derecha ---------- */
.panel-cab { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 18px; min-height: 176px; }
.panel-cab h1 { margin: 6px 0 0; font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.015em; color: var(--navy-1); }
.panel-cab p { margin: 4px 0 16px; color: var(--tinta-2); font-size: 15px; }
.filtros-fila { display: flex; flex-wrap: wrap; gap: 10px; }
.filtros-fila label { position: relative; background-image: linear-gradient(180deg, #fff, #f4f6fb); background-color: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 6px 34px 6px 14px; min-width: 132px; gap: 0; box-shadow: var(--relieve); cursor: pointer; }
.filtros-fila label::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--tinta-3); border-bottom: 2px solid var(--tinta-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.filtros-fila label:hover { box-shadow: var(--relieve-h); }
.filtros-fila label:focus-within { box-shadow: var(--relieve), 0 0 0 2px var(--azul); }
.filtros-fila select { background: none; border: 0; padding: 2px 0; color: var(--tinta); font-weight: 600; font-size: 14px; appearance: none; -webkit-appearance: none; cursor: pointer; box-shadow: none; width: 100%; }
.filtros-fila select:focus-visible { outline: none; }
.anillo-card { position: relative; flex: none; width: 190px; height: 190px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 0 #fff inset, 0 2px 4px rgba(14,30,61,.12), 0 24px 36px -16px rgba(14,30,61,.45); }
.anillo-card svg { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); }
.anillo-card .pista { fill: none; stroke: #e1e9f8; stroke-width: 11; }
.anillo-card .prog { fill: none; stroke: url(#grad-anillo); stroke-width: 11; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 64px 64px; transition: stroke-dasharray .5s ease; }
.anillo-txt { position: relative; text-align: center; line-height: 1.15; max-width: 110px; }
.anillo-txt b { display: block; font-size: 46px; font-weight: 700; color: var(--navy-1); letter-spacing: -.02em; }
.anillo-txt span { display: block; font-size: 12px; color: var(--tinta-2); font-weight: 500; }
.anillo-tipo { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(180deg, #3478f0, var(--azul)); padding: 4px 14px; border-radius: 99px; box-shadow: 0 6px 12px -4px rgba(31,95,224,.6); }
.panel-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 16px; align-items: stretch; }
.tarjeta-lista { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.lista-cab { display: flex; align-items: center; gap: 12px; padding: 16px 22px 10px; flex: none; }
.lista-cab h2 { margin: 0; font-size: 19px; font-weight: 600; color: var(--tinta); }

/* ---------- tarjetas blancas, tablas, chips ---------- */
.blanca { background: var(--blanco); color: var(--tinta); border: 1px solid rgba(255,255,255,.8); border-radius: 18px; padding: 18px 20px; min-width: 0; box-shadow: var(--sombra); }
.blanca-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.blanca-cab h2 { margin: 0; font-size: 18px; font-weight: 600; }
.cuenta { background: var(--azul-claro); color: #1f56c4; border-radius: 99px; padding: 1px 11px; font-weight: 700; font-size: 13px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--tinta-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 9px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #e9eef7; white-space: nowrap; color: var(--tinta); font-size: 13.5px; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #f4f7fd; }
tbody tr.sel td { background: var(--azul-claro); }
tbody tr.sel td:first-child { border-radius: 10px 0 0 10px; box-shadow: inset 3px 0 var(--azul); } tbody tr.sel td:last-child { border-radius: 0 10px 10px 0; }
tbody tr.op td:first-child { box-shadow: inset 3px 0 #9a7be6; }
tbody tr.op.sel td:first-child { box-shadow: inset 3px 0 var(--azul); }
tbody tr.demorada .dias { color: var(--error); font-weight: 600; }
td small, .sub { display: block; color: var(--tinta-2); font-size: 12px; }
.persona { display: flex; align-items: center; gap: 10px; }
.persona b { font-weight: 600; display: block; }
.vacio { color: var(--tinta-2); text-align: center; padding: 28px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #ffe8c9; color: #9a5200; }
.chip.op { background: #ffe8c9; color: #9a5200; }
.chip.proceso, .chip.cap { background: #dbe7fd; color: #1f56c4; }
.chip.obs, .chip.mal { background: #fbdde2; color: #a3263d; }
.chip.pur { background: #e7defb; color: #5a35b5; }
.chip.ok { background: #d9f1e2; color: #1a6b43; }
.chip.neutro { background: #e2e7f0; color: #46557a; }
.chev { color: var(--tinta-3); }

/* ---------- lista del Panel (se desplaza adentro) y detalle ---------- */
.lista-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 12px 12px 22px; scrollbar-width: thin; scrollbar-color: #c1cbe0 transparent; }
.lista-scroll::-webkit-scrollbar { width: 8px; } .lista-scroll::-webkit-scrollbar-thumb { background: #c1cbe0; border-radius: 8px; }
.lista-scroll .scroll { overflow: visible; }
.lista-scroll th { position: sticky; top: 0; z-index: 2; background: #fff; box-shadow: 0 1px 0 var(--linea); border-bottom: 0; }
.detalle { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c1cbe0 transparent; }
.detalle .vacio { color: var(--tinta-2); }
.det-pac, .tile, .det-aut { background-image: linear-gradient(180deg, #fff, #f6f8fc); background-color: #fff; border: 1px solid var(--linea); border-radius: 12px; box-shadow: var(--relieve); }
.det-pac { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.det-pac .avatar { width: 46px; height: 46px; font-size: 15px; }
.det-pac h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--tinta); }
.det-pac p { margin: 2px 0 0; color: var(--tinta-2); font-size: 13px; }
.det-pac .chip { margin-left: auto; flex: none; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { padding: 7px 10px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tile > div { min-width: 0; }
.tile small { display: block; color: var(--tinta-2); font-size: 11px; line-height: 1.25; }
.tile b { font-weight: 600; display: block; overflow-wrap: anywhere; color: var(--tinta); }
.tile.nb b { white-space: nowrap; }
.tile.ancho { grid-column: 1 / -1; }
.det-aut { display: flex; align-items: center; gap: 12px; padding: 9px 12px; }
.det-aut div { flex: 1; min-width: 0; }
.det-aut small { color: var(--tinta-2); display: block; }
.det-aut .ib { width: 38px; height: 38px; }
.det-acc { position: sticky; bottom: -14px; margin: auto -14px -14px; padding: 10px 14px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; background: #fff; box-shadow: 0 -10px 12px -8px rgba(14, 30, 61, .14); border-radius: 0 0 18px 18px; z-index: 2; }
.det-acc button { white-space: nowrap; }
.aviso-prev { border: 1px solid #ecd2ab; background: #fdf4e3; color: #8a5a14; border-radius: 10px; padding: 9px 12px; font-size: 13px; }

/* ---------- avatares de iniciales ---------- */
.avatar.c0 { background: #dbe7fd; color: #1f56c4; } .avatar.c1 { background: #d3eef1; color: #1b7482; }
.avatar.c2 { background: #e7defb; color: #5a35b5; } .avatar.c3 { background: #ffe8c9; color: #9a5200; }
.avatar.c4 { background: #fbdde2; color: #a3263d; } .avatar.c5 { background: #dcf0e3; color: #1f7a4a; }
td .avatar { width: 38px; height: 38px; font-size: 12px; }

/* ---------- filtros de otras vistas ---------- */
.filtros { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px; }
.filtros .buscador { flex: 1; min-width: 220px; display: flex; flex-direction: row; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 0 14px; color: var(--tinta-3); box-shadow: var(--relieve); border: 1px solid var(--linea); }
.filtros .buscador input { background: none; border: 0; flex: 1; padding: 13px 0; box-shadow: none; }
.filtros .buscador input:focus-visible { outline: none; }
.filtros .buscador:focus-within { box-shadow: var(--relieve), 0 0 0 2px var(--azul); }
.barra-filtros { display: flex; flex-wrap: wrap; align-items: stretch; background: #fff; border: 1px solid var(--linea); border-radius: 14px; box-shadow: var(--relieve); margin-bottom: 16px; overflow: hidden; }
.barra-filtros > * { min-height: 52px; }
.barra-filtros .filtro-ico { width: 46px; display: grid; place-items: center; color: var(--tinta-2); flex: none; }
.barra-filtros label { flex: 1 1 148px; min-width: 0; padding: 6px 14px; gap: 1px; justify-content: center; border-left: 1px solid var(--linea); cursor: pointer; }
.barra-filtros label:hover, .barra-filtros label:focus-within { background: #f4f7fd; }
.barra-filtros select, .barra-filtros input[type="date"] { background: none; border: 0; box-shadow: none; padding: 2px 0; color: var(--tinta); font-weight: 600; font-size: 13.5px; cursor: pointer; min-width: 0; }
.barra-filtros select:focus-visible, .barra-filtros input:focus-visible { outline: none; }
.barra-filtros .buscador { flex: 2 1 240px; display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 0 14px; border-left: 1px solid var(--linea); color: var(--tinta-3); }
.barra-filtros .buscador input { background: none; border: 0; box-shadow: none; flex: 1; padding: 12px 0; }
.barra-filtros .buscador:focus-within { box-shadow: inset 0 0 0 2px var(--azul); }
.barra-filtros .limpiar { border-radius: 0; border-left: 1px solid var(--linea); padding: 0 16px; color: var(--azul); font-weight: 600; }
.barra-filtros .limpiar:hover { background: #f4f7fd; color: var(--azul-h); }
.blanca-cab .dato { font-size: 13px; }

/* ---------- secciones y formularios ---------- */
.tarjeta { background: var(--blanco); border: 1px solid rgba(255,255,255,.8); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--sombra); }
.tarjeta h3, h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--tinta); }
.barra { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.dato { color: var(--tinta-2); }
.dato b { color: var(--tinta); font-weight: 600; }
pre { background: #f1f4fa; border: 1px solid var(--linea); padding: 12px; border-radius: 10px; overflow: auto; color: var(--tinta); }
input[type="file"] { color: var(--tinta-2); }
input[type="file"]::file-selector-button { background: #f1f4fa; color: var(--tinta); border: 1px solid var(--linea-2); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { background-color: var(--p-suave, #fff); background-image: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0)); border: 1px solid rgba(255,255,255,.8); border-radius: 16px; padding: 16px 18px 18px; display: grid; gap: 8px; align-content: start; min-height: 130px; box-shadow: var(--sombra); }
.kpi-cab { display: flex; align-items: center; gap: 12px; color: var(--tinta-2); font-weight: 500; }
.kpi-valor { display: flex; align-items: baseline; gap: 8px; }
.kpi-valor b { font-size: 34px; line-height: 1.1; font-weight: 600; color: var(--tinta); }
.kpi.alerta .kpi-valor b { color: var(--alerta); }

/* ---------- lista de órdenes y guardias (tarjetas, no planilla) ---------- */
.ordenes { display: grid; gap: 8px; margin-top: 6px; min-width: 0; }
.ordenes > .orden { min-width: 0; }
.orden { display: grid; grid-template-columns: var(--cols, 112px 86px minmax(160px, 1.1fr) minmax(190px, 1.4fr) minmax(200px, 1.15fr) minmax(130px, .9fr) minmax(150px, .9fr)); gap: 14px; align-items: center; padding: 12px 16px; border: 1px solid var(--linea); border-radius: 14px; background-color: #fff; background-image: linear-gradient(180deg, #fff, #f6f8fc); box-shadow: var(--relieve); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.orden:not(.cab):hover { transform: translateY(-1px); box-shadow: var(--relieve-h); }
.orden .op { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .01em; }
.orden .persona { min-width: 0; } .orden .persona b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orden .practica { display: flex; align-items: center; gap: 8px; min-width: 0; }
.orden .practica em { font-style: normal; flex: none; background: #eef2f9; border-radius: 7px; padding: 1px 8px; font-size: 12px; color: var(--tinta-2); font-weight: 600; }
.orden .practica span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinta); }
.orden .chip { justify-self: start; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.orden.cab { border: 0; background: none; box-shadow: none; padding: 2px 16px 0; cursor: default; color: var(--tinta-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.orden small { display: block; color: var(--tinta-2); font-size: 12px; }
.orden .prestador { display: grid; min-width: 0; }
.orden .prestador span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orden .prestador small { color: var(--tinta-3); font-size: 11.5px; }
.mas { margin: 10px auto 2px; display: flex; }
.ord-card { background: #fff; border: 1px solid var(--linea); border-radius: 14px; padding: 14px 16px; display: grid; gap: 12px; box-shadow: var(--relieve); }
.ord-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ord-cab small, .kv small { display: block; color: var(--tinta-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.ord-nro { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.ord-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ord-prac { display: flex; gap: 10px; align-items: flex-start; background: #f1f4fa; border-radius: 10px; padding: 10px 12px; line-height: 1.4; }
.ord-prac em { font-style: normal; flex: none; background: #fff; border: 1px solid var(--linea); border-radius: 7px; padding: 1px 8px; font-weight: 600; font-size: 12.5px; color: var(--tinta-2); }
.ord-datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.kv b { display: block; font-weight: 600; overflow-wrap: anywhere; color: var(--tinta); }

/* ---------- panel lateral (formularios) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(6, 24, 61, .5); display: flex; justify-content: flex-end; z-index: 20; }
.panel { width: min(620px, 100%); background: #f2f5fa; border-left: 1px solid var(--linea); box-shadow: -16px 0 40px -12px rgba(6, 24, 61, .4); padding: 24px; overflow: auto; display: grid; gap: 12px; align-content: start; color: var(--tinta); }
.panel h2 { margin: 0; font-size: 20px; font-weight: 600; }
.panel .fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel .blanca { padding: 8px 12px; border-radius: 12px; box-shadow: none; }
.aviso { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--blanco); color: var(--tinta); border: 1px solid var(--linea); border-left: 4px solid var(--azul); padding: 12px 18px; border-radius: 10px; z-index: 30; box-shadow: 0 12px 30px -10px rgba(6, 24, 61, .45); }
.aviso.error { border-left-color: var(--error); }

/* ---------- pantallas medianas y chicas ---------- */
@media (max-width: 1400px) {
  :root { --lateral: 214px; }
  .panel-cuerpo { grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; }
  .panel-cab h1 { font-size: 34px; }
  .anillo-card { width: 168px; height: 168px; } .anillo-txt b { font-size: 38px; }
  main { padding-left: 22px; padding-right: 22px; } .top { padding-left: 22px; padding-right: 22px; }
  .lista-scroll th, .lista-scroll td { padding-left: 6px; padding-right: 6px; font-size: 12.5px; }
  .lista-scroll { padding-left: 16px; }
  .lista-scroll td .avatar { width: 32px; height: 32px; font-size: 11px; }
  .lista-scroll .persona { gap: 8px; }
  .lista-scroll .chip { padding: 2px 9px; font-size: 11.5px; }
  .filtros-fila label { min-width: 116px; }
}
@media (max-height: 800px) {
  .detalle { padding: 10px; gap: 6px; }
  .tile.nb small:last-of-type { display: none; }
  .det-pac { padding: 6px 10px; } .det-pac .avatar { width: 34px; height: 34px; font-size: 13px; } .det-pac p { font-size: 12px; }
  .tile { padding: 5px 8px; } .tile .ib { display: none; }
  .det-aut { padding: 6px 10px; } .det-aut .ib { display: none; } .det-aut small:last-child { display: none; }
  .det-acc { padding: 8px 10px 10px; margin: 0 -10px -10px; bottom: -10px; }
  button.sec, button.primario { padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 1180px) {
  .panel-cuerpo { grid-template-columns: 1fr; }
  .lista-scroll { max-height: 70vh; }
  .anillo-card { width: 150px; height: 150px; } .anillo-txt b { font-size: 32px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; padding: 12px; gap: 10px; }
  #menu { display: flex; overflow-x: auto; } #menu button { white-space: nowrap; }
  .pami { display: none; }
  .top { flex-wrap: wrap; padding: 12px 14px; } .busqueda { flex: 1 1 100%; } .reloj { display: none; } .usuario-txt { display: none; }
  main { padding: 8px 14px 24px; } .fondo-hospital { display: none; }
  .panel-cab { flex-direction: column; align-items: flex-start; } .panel-cab h1 { font-size: 28px; }
  .barra-filtros label, .barra-filtros .buscador { flex: 1 1 45%; border-top: 1px solid var(--linea); }
  .panel .fila2, .tiles, .ord-datos { grid-template-columns: 1fr; }
  .orden { grid-template-columns: 1fr 1fr; row-gap: 8px; } .orden.cab { display: none; }
}

/* ---- pantallas bajas: el menú lateral cede lugar para que entren todos los ítems (incluidas las subdivisiones) ---- */
@media (max-height: 900px) {
  .pami { padding: 8px 12px; } .pami svg { width: 32px; height: 32px; } .pami b { font-size: 17px; }
  .lateral { gap: 12px; padding-bottom: 12px; }
  #menu button { padding-top: 9px; padding-bottom: 9px; }
  #menu button.sub { padding-top: 6px; padding-bottom: 6px; }
}
@media (max-height: 720px) { #menu button { padding-top: 7px; padding-bottom: 7px; } .marca-card { padding: 5px 10px; } }

/* ---- el logo se adapta al ancho del menú; el indicador no roza las tarjetas ---- */
.marca-card .marca-logo { min-width: 0; flex: 1; height: auto; }
.marca-card .marca-logo img { height: auto !important; width: 100% !important; max-height: 46px; object-fit: contain; object-position: left center; }
.panel-cab { margin-bottom: 30px; }

/* ================= Panel más compacto: la lista de pendientes gana alto y cantidad de filas ================= */
.top { padding: 12px 32px 2px; }
.busqueda { height: 42px; }
main { padding-top: 4px; padding-bottom: 16px; }
.panel-cab { min-height: 132px; margin-bottom: 24px; gap: 20px; }
.panel-cab h1 { font-size: 32px; margin-top: 2px; }
.panel-cab p { margin: 2px 0 12px; font-size: 14px; }
.filtros-fila label { padding-top: 4px; padding-bottom: 4px; }
.anillo-card { width: 140px; height: 140px; }
.anillo-card svg { inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
.anillo-card .pista, .anillo-card .prog { stroke-width: 10; }
.anillo-txt { max-width: 92px; }
.anillo-txt b { font-size: 34px; }
.anillo-txt span { font-size: 10.5px; line-height: 1.2; }
.anillo-tipo { font-size: 11px; padding: 3px 12px; bottom: -11px; }
.lista-cab { padding: 12px 22px 6px; }
.lista-scroll td { padding-top: 7px; padding-bottom: 7px; }
.lista-scroll th { padding-top: 7px; padding-bottom: 7px; }
.lista-scroll td .avatar { width: 34px; height: 34px; }
@media (max-width: 1400px) {
  .anillo-card { width: 126px; height: 126px; } .anillo-txt b { font-size: 29px; } .anillo-txt { max-width: 84px; }
  .panel-cab h1 { font-size: 28px; } .panel-cab { min-height: 120px; }
  .lista-scroll td, .lista-scroll th { padding-top: 6px; padding-bottom: 6px; }
}
@media (max-height: 800px) { .panel-cab p { display: none; } .panel-cab { min-height: 104px; margin-bottom: 20px; } }

/* ================= foto de fondo nueva (hospital de noche) ================= */
.fondo-hospital { top: 0; width: min(860px, 68%); height: 340px; opacity: .95; background: url("hospital.jpg") 50% 50% / cover no-repeat; background-blend-mode: normal;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 38%), linear-gradient(to top, transparent 0%, #000 34%); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0%, #000 38%), linear-gradient(to top, transparent 0%, #000 34%); mask-composite: intersect; }

/* ================= menú lateral: degradé y botones con profundidad ================= */
.lateral { background: linear-gradient(180deg, #2d6fe6 0%, #1c50b6 20%, #12388a 46%, #0b2358 74%, #061434 100%); box-shadow: 8px 0 26px -10px rgba(6, 20, 51, .7); }
.lateral::before { background: linear-gradient(118deg, transparent 50%, rgba(120, 175, 255, .18) 50% 64%, transparent 64%), linear-gradient(118deg, transparent 70%, rgba(120, 175, 255, .10) 70% 79%, transparent 79%); }
#menu { gap: 7px; padding: 2px 2px 8px; }
#menu button { background: linear-gradient(180deg, rgba(255,255,255,.15), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.13);
  box-shadow: 0 7px 12px -5px rgba(0, 8, 30, .7), 0 1px 2px rgba(0, 8, 30, .4), inset 0 1px 0 rgba(255,255,255,.26), inset 0 -2px 0 rgba(0, 10, 40, .3);
  transition: transform .12s, box-shadow .12s, background .12s; }
#menu button:hover { transform: translateY(-1px); background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.08));
  box-shadow: 0 11px 16px -6px rgba(0, 8, 30, .75), 0 1px 2px rgba(0, 8, 30, .4), inset 0 1px 0 rgba(255,255,255,.32), inset 0 -2px 0 rgba(0, 10, 40, .3); }
#menu button:active { transform: translateY(1px); box-shadow: inset 0 3px 6px rgba(0, 8, 30, .55); }
#menu button.activo { background: linear-gradient(180deg, #5b9bff, #2a6df0 52%, #1d56cc); border-color: rgba(170, 205, 255, .6);
  box-shadow: 0 13px 22px -8px rgba(31, 95, 224, .95), 0 0 0 1px rgba(8, 35, 110, .45), inset 0 1px 0 rgba(255,255,255,.55), inset 0 -3px 0 rgba(8, 35, 110, .5); }
#menu button.sub { background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 4px 8px -4px rgba(0, 8, 30, .6), inset 0 1px 0 rgba(255,255,255,.14); }
#menu button.sub.activo { background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,.14)); border-color: rgba(255,255,255,.34);
  box-shadow: 0 6px 10px -4px rgba(0, 8, 30, .6), inset 0 1px 0 rgba(255,255,255,.4); color: #fff; }
.pami { box-shadow: 0 8px 16px -8px rgba(0, 8, 30, .7), inset 0 1px 0 rgba(255,255,255,.18); }


/* ================= logos: el del hospital en blanco sobre el azul, y el de PAMI siempre visible ================= */
.marca-card { background: none; box-shadow: none; border-radius: 0; padding: 4px 4px 0; --cruz: #fff; }
.marca-card .marca-txt { color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.marca-card .marca-logo img { filter: drop-shadow(0 3px 6px rgba(0, 8, 30, .35)); }
.marca-card .marca-logo img:not(.blanco) { filter: brightness(0) invert(1) drop-shadow(0 3px 6px rgba(0, 8, 30, .35)); }
.pami b { text-shadow: 0 2px 6px rgba(0,0,0,.3); }
#menu { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
#menu::-webkit-scrollbar { display: block; width: 6px; }
#menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 6px; }
@media (max-height: 760px) { .pami small { display: none; } .pami { padding: 6px 12px; } .marca-card .marca-logo img { max-height: 38px; } }

@media (max-height: 800px) { .panel-cab h1 { margin-bottom: 12px; } }
