/* Inventario IT AVPuertos */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --texto: #1d2430; --suave: #5d6878; --borde: #dde1e7;
  --primario: #0b5cab; --primario-hover: #094a8a; --primario-suave: #e7f0fa;
  --ok: #1d7a46; --ok-bg: #e5f4ea; --warn: #9a6200; --warn-bg: #fdf2dc; --mal: #b42318; --mal-bg: #fdecea;
  --gris-bg: #eef0f3; --radio: 8px; --sombra: 0 1px 2px rgba(16,24,40,.06);
  --barra-bg: #0f2a47; --campo-bg: #ffffff; --campo-borde: #c7cdd6; --foco: #9cc5f0; --th-bg: #fafbfc;
  --fila-hover: #f8fafd; --btn-bg: #ffffff; --btn-primario: #0b5cab; --btn-primario-hover: #094a8a;
  --instalado-bg: #eef2ff; --instalado: #3e3fa8;
  --filtro-activo-bg: #e7f0fa; --filtro-activo: #0b5cab;
  color-scheme: light;
}
/* Modo oscuro (interruptor arriba a la derecha; se recuerda en este navegador) */
html[data-theme="dark"] {
  --bg: #0f141b; --panel: #171d26; --texto: #e4e8ee; --suave: #9ba6b5; --borde: #2a3340;
  --primario: #6cb0f2; --primario-hover: #8cc2f5; --primario-suave: #16304d;
  --ok: #63cf91; --ok-bg: #143324; --warn: #e6b555; --warn-bg: #382a0e; --mal: #f2837a; --mal-bg: #3d1a17;
  --gris-bg: #232b36; --sombra: 0 1px 2px rgba(0,0,0,.4);
  --barra-bg: #0a1522; --campo-bg: #10161e; --campo-borde: #3a4656; --foco: #2f6db0; --th-bg: #1b222c;
  --fila-hover: #1d2531; --btn-bg: #1d2430; --btn-primario: #1f6fc0; --btn-primario-hover: #2a7fd4;
  --instalado-bg: #24284f; --instalado: #aeb2f7;
  --filtro-activo-bg: #14304f; --filtro-activo: #8cc2f5;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--texto); line-height: 1.45; }
a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
td.mono:first-child, .nowrap { white-space: nowrap; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .9em; }
.suave { color: var(--suave); }
.chico { font-size: .85rem; }

/* barra superior */
.barra { background: var(--barra-bg); color: #fff; display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 54px; position: sticky; top: 0; z-index: 10; }
.barra .marca { font-weight: 700; color: #fff; white-space: nowrap; }
.barra .marca span { color: #8cc4ff; font-weight: 500; }
.barra nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.barra nav a { color: #cfe0f3; padding: .45rem .75rem; border-radius: 6px; white-space: nowrap; }
.barra nav a:hover, .barra nav a.activo { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.barra .usuario { display: flex; gap: .75rem; align-items: center; color: #cfe0f3; font-size: .9rem; white-space: nowrap; }
.barra .usuario button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; padding: .3rem .6rem; cursor: pointer; }

main { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* paneles y grillas */
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.15rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.grilla { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: .85rem 1rem; box-shadow: var(--sombra); color: var(--texto); }
.tarjeta:hover { border-color: var(--primario); text-decoration: none; }
.tarjeta .num { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tarjeta .lbl { color: var(--suave); font-size: .85rem; }

/* tablas */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); background: var(--th-bg); position: sticky; top: 0; }
tbody tr:hover { background: var(--fila-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.ficha th { width: 34%; text-transform: none; font-size: .9rem; letter-spacing: 0; background: none; position: static; }
table.ficha td, table.ficha th { padding: .35rem .5rem; }

/* etiquetas */
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--gris-bg); color: var(--suave); }
.chip.EN_STOCK, .chip.DISPONIBLE, .chip.CONFIRMADO { background: var(--ok-bg); color: var(--ok); }
.chip.ASIGNADO { background: var(--primario-suave); color: var(--primario); }
.chip.INSTALADO { background: var(--instalado-bg); color: var(--instalado); }
.chip.A_REVISAR, .chip.SIN_UBICACION, .chip.REVISAR, .chip.PENDIENTE { background: var(--warn-bg); color: var(--warn); }
.chip.NO_DISPONIBLE, .chip.BAJA { background: var(--mal-bg); color: var(--mal); }

/* formularios */
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem .75rem; align-items: end; }
.filtros .busqueda { grid-column: span 2; }
.filtros-cat { grid-column: 1 / -1; }
.filtros-cat:not(:empty) .filtros-cat-titulo { border-top: 1px dashed var(--borde); padding-top: .6rem; margin: .2rem 0 .4rem; font-size: .8rem; font-weight: 700; color: var(--primario); text-transform: uppercase; letter-spacing: .03em; display: flex; gap: .75rem; align-items: baseline; }
.filtros-cat-titulo a { text-transform: none; letter-spacing: 0; font-weight: 600; }
/* filtro con un valor elegido: se resalta para que se vea que está aplicado */
.filtros .con-valor { border-color: var(--filtro-activo); background: var(--filtro-activo-bg); box-shadow: 0 0 0 1px var(--filtro-activo); font-weight: 600; }
.filtros div:has(> .con-valor) > label { color: var(--filtro-activo); }
.filtros div:has(> .con-valor) > label::after { content: " ●"; font-size: .7em; vertical-align: middle; }
label { display: block; font-size: .8rem; color: var(--suave); margin-bottom: .2rem; font-weight: 600; }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=url], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid var(--campo-borde); border-radius: 6px; font: inherit; background: var(--campo-bg); color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--foco); border-color: var(--primario); }
select[multiple] { min-height: 6.5rem; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem 1rem; }
.campo .ayuda { font-size: .78rem; color: var(--suave); margin-top: .15rem; }
.campo .error, .errorlist { color: var(--mal); font-size: .82rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.campo.ancho { grid-column: 1 / -1; }
/* Otros datos: valor, latitud y longitud angostos; el enlace al mapa ocupa el resto de la fila */
.campos.otros { grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(240px, 2.6fr); }
textarea { resize: vertical; }
/* buscador de equipos y personas (V0.4.0) */
.buscador-entrada { position: relative; max-width: 640px; }
.buscador-lista { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: .25rem 0; list-style: none;
  background: var(--panel); border: 1px solid var(--campo-borde); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-height: 22rem; overflow-y: auto; }
.buscador-lista li { padding: .4rem .65rem; cursor: pointer; }
.buscador-lista li.marcado, .buscador-lista li:hover { background: var(--primario-suave); }
.buscador-lista li .chip { font-size: .7rem; margin-right: .25rem; }
.buscador-elegidos { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .35rem; }
.buscador-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .55rem; border: 1px solid var(--primario);
  background: var(--primario-suave); border-radius: 6px; }
.buscador-chip button { background: none; border: 0; color: var(--mal); cursor: pointer; font-weight: 700; padding: 0 .15rem; }
.buscador-equipos { margin-top: .4rem; align-items: center; }
/* credenciales y licencias en la ficha (V0.4.0) */
.con-ver { display: flex; gap: .35rem; }
.con-ver input { flex: 1; }
.form-clave { padding: .5rem 0; }
/* botón Volver (V0.4.0) */
.volver { display: inline-flex; align-items: center; gap: .3rem; margin: 0 0 .5rem; font-size: .9rem; font-weight: 600; }
/* "+ Crear nuevo" debajo de los desplegables (abre Administración) */
.campo .crear-nuevo { display: inline-block; font-size: .78rem; margin-top: .2rem; font-weight: 600; }
/* tabla de red: campos de una línea, anchos según el dato */
.tabla-red td { vertical-align: middle; padding: .35rem .4rem; }
.tabla-red input[type=text] { min-width: 7rem; padding: .35rem .45rem; }
.tabla-red td:nth-child(2) input, .tabla-red td:nth-child(4) input { min-width: 8.5rem; }   /* IP, gateway */
.tabla-red td:nth-child(5) input { min-width: 9.5rem; }   /* MAC */
.tabla-red td:nth-child(8) input { min-width: 4.5rem; }   /* puerto */
.tabla-red select { width: 5rem; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--btn-bg); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--primario); text-decoration: none; }
.btn.primario { background: var(--btn-primario); border-color: var(--btn-primario); color: #fff; }
.btn.primario:hover { background: var(--btn-primario-hover); }
.btn.chico { padding: .3rem .6rem; font-size: .85rem; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; }

/* mensajes */
.mensajes { list-style: none; padding: 0; margin: 0 0 1rem; }
.mensajes li { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .4rem; background: var(--primario-suave); }
.mensajes li.success { background: var(--ok-bg); color: var(--ok); }
.mensajes li.error { background: var(--mal-bg); color: var(--mal); }
.aviso { padding: .6rem .9rem; border-radius: 6px; background: var(--warn-bg); color: var(--warn); margin-bottom: 1rem; }

.paginacion { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .75rem 0 0; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.secreto { filter: blur(5px); cursor: pointer; user-select: none; }
.secreto.visible { filter: none; user-select: text; }
.linea-tiempo { list-style: none; padding: 0; margin: 0; }
.linea-tiempo li { padding: .5rem 0 .5rem .9rem; border-left: 2px solid var(--borde); position: relative; }
.linea-tiempo li::before { content: ""; position: absolute; left: -5px; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--primario); }
.barra-stock { height: 6px; background: var(--gris-bg); border-radius: 3px; overflow: hidden; min-width: 60px; }
.barra-stock span { display: block; height: 100%; background: var(--ok); }

/* interruptor de modo oscuro */
.tema-switch { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; padding: .25rem; color: #cfe0f3; font: inherit; font-size: .85rem; cursor: pointer; }
.tema-switch .pista { position: relative; width: 38px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.22); transition: background .2s; flex: none; }
.tema-switch .perilla { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.tema-switch[aria-checked="true"] .pista { background: #3d8be0; }
.tema-switch[aria-checked="true"] .perilla { transform: translateX(16px); }
.tema-switch svg { width: 16px; height: 16px; flex: none; }
.tema-switch:focus-visible { outline: 2px solid #8cc4ff; outline-offset: 2px; border-radius: 6px; }
.tema-flotante { position: fixed; top: .75rem; right: 1rem; z-index: 20; background: var(--barra-bg); border-radius: 999px; padding: .2rem .55rem; }

/* login */
.login { max-width: 400px; margin: 8vh auto; }
.login .panel { padding: 1.75rem; }
.btn-ms { width: 100%; justify-content: center; padding: .7rem; font-size: 1rem; }
.separador { text-align: center; color: var(--suave); font-size: .85rem; margin: 1.25rem 0 .75rem; }

/* ---- Compras y alta masiva (V0.5.0) */
.chip.garantia-vigente { background: var(--ok-bg); color: var(--ok); }
.chip.garantia-por_vencer { background: var(--warn-bg); color: var(--warn); }
.chip.garantia-vencida { background: var(--mal-bg); color: var(--mal); }
.opciones-radio { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: .25rem 0 .75rem; padding: 0; list-style: none; }
.opciones-radio label { font-weight: 500; display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.opciones-radio div { display: contents; }
.pestanas { display: flex; gap: .25rem; border-bottom: 1px solid var(--borde); margin-bottom: 1rem; }
.pestanas button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .9rem; font: inherit;
  font-weight: 600; color: var(--suave); cursor: pointer; }
.pestanas button[aria-selected="true"] { color: var(--primario); border-bottom-color: var(--primario); }
tr.fila-error td { background: var(--mal-bg); }
tr.fila-aviso td { background: var(--warn-bg); }
td .msj-error { color: var(--mal); }
td .msj-aviso { color: var(--warn); }
.lista-cats { columns: 3 14rem; margin: .5rem 0; }
.lista-cats label { display: block; font-weight: 400; margin: .15rem 0; }
.paso { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--primario); color: #fff; font-size: .85rem; font-weight: 700; margin-right: .4rem; }
html[data-theme="dark"] .paso { color: #0f141b; }

@media (max-width: 1000px) { .campos.otros { grid-template-columns: repeat(3, 1fr); } .campos.otros .campo:nth-child(4) { grid-column: 1 / -1; } }
@media (max-width: 700px) {
  .barra { flex-wrap: wrap; height: auto; padding: .5rem .75rem; gap: .5rem; }
  .barra nav { order: 3; width: 100%; }
  main { padding: .75rem; }
  .filtros .busqueda { grid-column: auto; }
  .campos.otros { grid-template-columns: 1fr; }
}
@media (max-width: 700px) { .tema-switch .tema-txt { display: none; } }
@media print { .barra, .acciones, .filtros, .paginacion, .tema-switch { display: none !important; } body { background: #fff; color: #000; } }

/* App .NET */
.pie { text-align: center; padding: 1.5rem 0 1rem; }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 6px; }
.clave-2fa { font-family: ui-monospace, monospace; letter-spacing: .08em; word-break: break-all; }

/* Etapa 3 · formularios de catálogo: listas de casillas (ubicaciones de un barrio, categorías de una marca) */
.lista-multiple { max-height: 260px; overflow: auto; border: 1px solid var(--borde); border-radius: 6px; padding: .4rem .6rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .15rem .75rem; }
.lista-multiple label { font-weight: normal; display: flex; gap: .35rem; align-items: center; }
.filtro-multiple { margin-bottom: .35rem; }
.admin-grupos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.admin-grupos ul { list-style: none; padding: 0; margin: 0; }
.admin-grupos li { padding: .35rem 0; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; gap: .5rem; }
.admin-grupos li:last-child { border-bottom: 0; }
