/* Apariencia "Windows clásico" para mantener las pantallas tal como se veían en escritorio */
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: 'Microsoft Sans Serif', Tahoma, Arial, sans-serif; font-size: 8.25pt; background: #3a6ea5; overflow: auto; }

.escritorio { position: relative; min-height: 100vh; min-width: 100vw; background: #3a6ea5 url('../img/res/logo.png') no-repeat center 40%; background-size: 260px; }

/* ---------- Ventanas ---------- */
.ventana { position: absolute; background: #f0f0f0; border: 1px solid #6d6d6d; box-shadow: 0 6px 24px rgba(0,0,0,.35); border-radius: 6px 6px 0 0; z-index: 10; }
.ventana.centrada { left: 50%; top: 40px; transform: translateX(-50%); }
.ventana.activa { z-index: 20; }
.ventana.modal { z-index: 40; }
.ventana.bloqueada { pointer-events: none; }
.ventana .titulo { height: 28px; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 8px; background: linear-gradient(#e8eef7, #cfdcec); border-bottom: 1px solid #a6b7cd; border-radius: 6px 6px 0 0; cursor: move; user-select: none; }
.ventana.activa .titulo { background: linear-gradient(#cfe0f5, #a9c4e8); }
.ventana .titulo .icono { width: 16px; height: 16px; }
.ventana .titulo .texto-titulo { flex: 1; font-size: 9pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ventana .titulo .cerrar { width: 40px; height: 22px; border: none; background: transparent; font-size: 12px; cursor: pointer; border-radius: 3px; }
.ventana .titulo .cerrar:hover { background: #e81123; color: #fff; }
.ventana .cliente { position: relative; overflow: hidden; background-color: #f0f0f0; font-family: 'Microsoft Sans Serif', Tahoma, Arial, sans-serif; font-size: 8.25pt; }

.velo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.08); z-index: 35; }
.velo-modal.velo-dialogo { z-index: 90; background: rgba(0,0,0,.15); }
.fin-sesion { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-size: 12pt; gap: 12px; }
.fin-sesion img { width: 220px; }

/* ---------- Controles ---------- */
.cliente > *, .wf-grupo > *, .wf-contenedor > * { position: absolute; box-sizing: border-box; }
.deshabilitado { color: #6d6d6d; }

.wf-etiqueta { overflow: hidden; white-space: pre-wrap; line-height: 1.15; }
.wf-etiqueta.con-borde { border: 1px solid #7a7a7a; }
.wf-etiqueta img { vertical-align: middle; }

.wf-texto, .wf-combo, .wf-fecha, .wf-lista { font: inherit; font-size: 8.25pt; border: 1px solid #7a7a7a; background: #fff; padding: 1px 3px; margin: 0; border-radius: 0; }
.wf-texto[readonly] { background: #f0f0f0; }
.wf-texto:disabled, .wf-combo:disabled, .wf-fecha:disabled { background: #f0f0f0; color: #6d6d6d; }
.wf-multilinea { resize: none; white-space: pre-wrap; }
.wf-combo { padding: 1px; height: 21px; }
.wf-fecha { padding: 0 2px; }

.wf-check { display: flex; align-items: center; gap: 3px; white-space: nowrap; cursor: default; }
.wf-check input { margin: 0 2px 0 0; }
.wf-check img { max-height: 100%; }
.wf-check-boton { border: 1px solid #adadad; background: #e1e1e1; justify-content: center; }
.wf-check-boton input { display: none; }
.wf-check-boton:has(input:checked) { background: #cce4f7; border-color: #005499; }

.wf-boton { font: inherit; font-size: 8.25pt; border: 1px solid #adadad; background: #e1e1e1; cursor: default; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; }
.wf-boton:hover:not(:disabled) { background: #e5f1fb; border-color: #0078d7; }
.wf-boton:disabled { color: #8a8a8a; }
.wf-boton img { max-height: 90%; }

.wf-imagen { overflow: hidden; }
.wf-imagen.clicable { cursor: pointer; }
.wf-imagen.clicable:hover { outline: 1px dotted #555; }
.wf-imagen.deshabilitado { cursor: not-allowed; }
.wf-imagen img { display: block; }

.wf-progreso { border: 1px solid #bcbcbc; background: #e6e6e6; }
.wf-progreso .barra { height: 100%; background: #06b025; }

.wf-grupo { }
.wf-grupo .marco { position: absolute; left: 0; right: 0; top: 7px; bottom: 0; border: 1px solid #d5dfe5; border-radius: 3px; pointer-events: none; }
.wf-grupo .leyenda { position: absolute; left: 7px; top: 0; padding: 0 2px; background: inherit; line-height: 14px; white-space: nowrap; }
.cliente .wf-grupo .leyenda { background-color: inherit; }

/* Grilla */
.wf-grilla { overflow: auto; border: 1px solid #828790; background: #abababff; }
.wf-grilla table { border-collapse: collapse; table-layout: fixed; background: #fff; font-size: 8.25pt; }
.wf-grilla th { position: sticky; top: 0; background: #f4f4f4; border: 1px solid #c8c8c8; font-weight: normal; text-align: left; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; z-index: 1; }
.wf-grilla td { border: 1px solid #d8d8d8; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 20px; cursor: default; }
.wf-grilla th .orden { font-size: 7pt; color: #666; margin-left: 4px; }
.wf-grilla .encabezado-fila { background: #f4f4f4; text-align: center; font-size: 7pt; }
.wf-grilla tr.seleccionada td:not(.encabezado-fila) { background: #0078d7 !important; color: #fff !important; }
.wf-grilla .celda-check { text-align: center; }
.wf-grilla .celda-check input { pointer-events: none; }
.wf-grilla .celda-editable { padding: 0; }
.wf-grilla .celda-editable input { width: 100%; height: 100%; border: none; font: inherit; box-sizing: border-box; padding: 1px 4px; }

/* Árbol */
.wf-arbol { overflow: auto; background: #fff; border: 1px solid #828790; }
.wf-arbol ul { list-style: none; margin: 0; padding-left: 16px; }
.wf-arbol > ul { padding-left: 2px; }
.wf-arbol li { white-space: nowrap; line-height: 18px; }
.wf-arbol .expansor { display: inline-block; width: 11px; height: 11px; line-height: 9px; text-align: center; border: 1px solid #919191; font-size: 9px; margin-right: 3px; cursor: pointer; background: #fff; vertical-align: middle; }
.wf-arbol .expansor.vacio { border-color: transparent; cursor: default; }
.wf-arbol .nodo { padding: 0 2px; cursor: default; }
.wf-arbol .nodo.seleccionado { background: #0078d7; color: #fff; }

/* Gráfico */
.wf-grafico { display: flex; background: #fff; }
.wf-grafico .leyenda { overflow: auto; font-size: 7.5pt; padding: 4px; box-sizing: border-box; }
.wf-grafico .leyenda .item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.wf-grafico .leyenda .muestra { width: 10px; height: 10px; display: inline-block; flex: none; }

/* Calendario */
.wf-calendario { background: #fff; border: 1px solid #828790; font-size: 8pt; user-select: none; }
.wf-calendario .cabecera { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.wf-calendario .cabecera button { border: none; background: transparent; cursor: pointer; }
.wf-calendario table { width: 100%; border-collapse: collapse; text-align: center; }
.wf-calendario th { font-weight: normal; color: #555; }
.wf-calendario td { cursor: pointer; padding: 1px; }
.wf-calendario td.otro-mes { color: #aaa; }
.wf-calendario td.sel { background: #cce8ff; }
.wf-calendario td.hoy { outline: 1px solid #0078d7; }
.wf-calendario td.negrita { font-weight: bold; }
.wf-calendario .pie { padding: 2px 6px; cursor: pointer; }

/* Menú */
.wf-menu { display: flex; align-items: stretch; background: #f0f0f0; z-index: 30; user-select: none; }
.wf-menu .item-raiz { position: relative; padding: 0 7px; display: flex; align-items: center; gap: 4px; cursor: default; }
.wf-menu .item-raiz:hover, .wf-menu .item-raiz.abierto { background: #cce8ff; }
.wf-menu .item-raiz img, .wf-menu .item img { width: 16px; height: 16px; }
.wf-menu .submenu { position: absolute; top: 100%; left: 0; min-width: 200px; background: #f2f2f2; border: 1px solid #ccc; box-shadow: 2px 2px 4px rgba(0,0,0,.25); padding: 2px 0; z-index: 50; }
.wf-menu .submenu .submenu { top: -3px; left: 100%; display: none; }
.wf-menu .submenu .item { position: relative; display: flex; align-items: center; gap: 6px; padding: 3px 20px 3px 4px; white-space: nowrap; }
.wf-menu .submenu .item:hover { background: #91c9f7; }
.wf-menu .submenu .item.con-hijos:hover > .submenu { display: block; }
.wf-menu .submenu .icono { width: 20px; display: inline-flex; justify-content: center; }
.wf-menu .submenu .flecha { position: absolute; right: 6px; font-size: 7pt; }
.wf-menu .submenu .separador { height: 1px; background: #ccc; margin: 3px 2px 3px 28px; }
.wf-menu .deshabilitado { color: #a0a0a0; pointer-events: none; }
.velo-menu { position: fixed; inset: 0; z-index: 25; }

/* Mensajes (MsgBox) y diálogo de archivo */
.dialogo-mensaje { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -30%); min-width: 320px; max-width: 640px; background: #fff; border: 1px solid #6d6d6d; box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 100; outline: none; }
.dialogo-mensaje .titulo { height: 28px; display: flex; align-items: center; padding: 0 8px; background: linear-gradient(#cfe0f5, #a9c4e8); font-size: 9pt; }
.dialogo-mensaje .cuerpo { display: flex; gap: 12px; padding: 20px 16px; font-size: 9pt; }
.dialogo-mensaje .texto { white-space: pre-wrap; word-break: break-word; }
.dialogo-mensaje .botones { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; background: #f0f0f0; }
.dialogo-mensaje .botones .wf-boton { min-width: 75px; height: 24px; }
.dialogo-mensaje .error { color: #b00; margin-top: 8px; }
.icono-mensaje { width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 18px; }
.icono-mensaje.error { background: #e81123; }
.icono-mensaje.error::after { content: '✕'; }
.icono-mensaje.pregunta { background: #0063b1; }
.icono-mensaje.pregunta::after { content: '?'; }
.icono-mensaje.advertencia { background: #ffb900; color: #000; border-radius: 4px; }
.icono-mensaje.advertencia::after { content: '!'; }
.icono-mensaje.informacion { background: #0063b1; }
.icono-mensaje.informacion::after { content: 'i'; font-family: Georgia, serif; }

#blazor-error-ui { background: #ffffe0; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }

/* Cada grilla/árbol/calendario es su propio contexto de apilado: el encabezado fijo (z-index) de una grilla
   no debe quedar por encima de otro control que en el diseño original la tapa (p.ej. dgvPagos detrás de
   dgvTabla en Trabajar con recibos). */
.wf-grilla, .wf-arbol, .wf-calendario, .wf-grafico { isolation: isolate; }
