/* Viontek · estilo vidrio (administrador) */
:root {
  --azul: #1E3046;
  --acero: #253D57;
  --rojo: #A02924;
  --grafito: #484F5E;
  --claro: #F5F5F5;
  --texto: #F4F6FA;
  --texto-2: #B7C1D1;
  --vidrio: rgba(255, 255, 255, 0.08);
  --vidrio-borde: rgba(255, 255, 255, 0.16);
  --radio: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto);
  background: #0f1a28;
  -webkit-font-smoothing: antialiased;
}
.fondo { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(120% 90% at 10% 0%, #2a4466 0%, #16243a 45%, #0d1624 100%); }
.fondo span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; }
.fondo span:nth-child(1) { width: 480px; height: 480px; background: #2f5a8a; top: -120px; right: -80px; }
.fondo span:nth-child(2) { width: 380px; height: 380px; background: var(--rojo); bottom: -160px; left: 20%; opacity: .25; }
.fondo span:nth-child(3) { width: 320px; height: 320px; background: #4a6b8f; top: 40%; left: -120px; opacity: .3; }

a { color: #9cc3ff; }
h1 { font-size: 28px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
p { color: var(--texto-2); line-height: 1.5; }
.sub { color: var(--texto-2); margin: 0 0 24px; }

/* Menú lateral */
.menu {
  position: fixed; inset: 16px auto 16px 16px; width: 248px;
  display: flex; flex-direction: column; gap: 16px; padding: 16px;
  background: var(--vidrio); border: 1px solid var(--vidrio-borde); border-radius: 24px;
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.marca { background: #fff; border-radius: 14px; padding: 10px 12px; }
.marca img { display: block; width: 100%; height: auto; }
.menu nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--texto-2); text-decoration: none; font-weight: 500;
}
.menu nav a:hover { background: rgba(255,255,255,.06); color: var(--texto); }
.menu nav a.activo { background: rgba(255,255,255,.14); color: #fff; }
.usuario { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--vidrio-borde); }
.usuario > div:nth-child(2) { flex: 1; min-width: 0; }
.usuario strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario small { color: var(--texto-2); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--acero); display: grid; place-items: center; font-weight: 600; border: 1px solid var(--vidrio-borde); }

.contenido { padding: 32px 32px 48px; }
.con-menu .contenido { margin-left: 280px; max-width: 1180px; }

/* Tarjetas de vidrio */
.card {
  background: var(--vidrio); border: 1px solid var(--vidrio-borde); border-radius: var(--radio);
  padding: 20px; backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.grid { display: grid; gap: 16px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.grid.dos { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi .card small { color: var(--texto-2); font-size: 13px; }
.kpi .card .numero { font-size: 36px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }

.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--vidrio-borde);
  background: rgba(255,255,255,.1); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn:hover { background: rgba(255,255,255,.16); }
.btn.primario { background: var(--rojo); border-color: transparent; }
.btn.primario:hover { background: #b8302a; }
.btn.chico { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.icono { background: none; border: 0; color: var(--texto-2); cursor: pointer; padding: 6px; border-radius: 8px; }
.icono:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Formularios */
form.formulario { display: grid; gap: 14px; }
.fila { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: grid; gap: 6px; font-size: 14px; color: var(--texto-2); font-weight: 500; }
input, textarea, select {
  font: inherit; color: #fff; background: rgba(8, 16, 28, .45);
  border: 1px solid var(--vidrio-borde); border-radius: 12px; padding: 11px 12px; min-height: 44px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #6fa2e0; outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--texto); }
label.check input { width: 20px; height: 20px; min-height: 0; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ayuda { font-size: 13px; color: var(--texto-2); font-weight: 400; }

/* Tablas y listas */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tabla th { color: var(--texto-2); font-weight: 500; font-size: 13px; }
.tabla tr:last-child td { border-bottom: 0; }
.btn:disabled { opacity: .35; cursor: default; }
.tabla a { color: #fff; font-weight: 600; text-decoration: none; }
.tabla a:hover { text-decoration: underline; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lista li:last-child { border-bottom: 0; }
.lista small, .tenue { color: var(--texto-2); }
.etiqueta { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.12); color: var(--texto); }
.vacio { color: var(--texto-2); padding: 12px 0; }

.aviso { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.aviso.ok { background: rgba(46, 160, 90, .18); border-color: rgba(46,160,90,.5); }
.aviso.error { background: rgba(160, 41, 36, .25); border-color: rgba(220,80,70,.6); }

/* Inicio de sesión */
.sin-menu .contenido { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.acceso { width: 100%; max-width: 420px; }
.acceso .marca { margin-bottom: 20px; }
.acceso h1 { font-size: 22px; text-align: center; }
.acceso .sub { text-align: center; }
.selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; background: rgba(8,16,28,.4); padding: 6px; border-radius: 14px; }
.selector a { text-align: center; padding: 10px; border-radius: 10px; text-decoration: none; color: var(--texto-2); font-weight: 600; }
.selector a.activo { background: rgba(255,255,255,.16); color: #fff; }

/* Celular */
@media (max-width: 860px) {
  .menu { inset: auto 10px 10px 10px; width: auto; flex-direction: row; align-items: center; padding: 8px; gap: 8px; border-radius: 20px; z-index: 10; }
  .menu .marca, .usuario > div:nth-child(2), .usuario .avatar { display: none; }
  .menu nav { flex-direction: row; justify-content: space-around; }
  .menu nav a { flex-direction: column; gap: 3px; font-size: 11px; padding: 8px 10px; }
  .usuario { border: 0; padding: 0; }
  .con-menu .contenido { margin-left: 0; padding: 20px 16px 110px; }
  h1 { font-size: 24px; }
  .tabla .ocultar-movil { display: none; }
  .grid.kpi { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .kpi .card { padding: 14px; }
  .kpi .card .numero { font-size: 28px; }
  .kpi .card small { font-size: 12px; }
}

h3.mini { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); margin: 16px 0 4px; font-weight: 600; }

/* ---------- Pantallas del técnico: fondo sólido, alto contraste, botones grandes ---------- */
.modo-tecnico .fondo { background: #121c2b; }
.modo-tecnico .fondo span { display: none; }
.modo-tecnico .contenido { max-width: 760px; }
.modo-tecnico .card, .modo-tecnico .t-punto, .modo-tecnico .t-equipo, .modo-tecnico .t-hallazgo {
  backdrop-filter: none; -webkit-backdrop-filter: none; background: #1d2a3d; border: 1px solid #33445e; }
.modo-tecnico label { color: #dfe6f0; }
.modo-tecnico input, .modo-tecnico textarea, .modo-tecnico select { background: #0e1724; border-color: #3f5272; font-size: 17px; }
.t-cabecera { margin-bottom: 18px; }
.t-cabecera h1 { font-size: 26px; }
.t-cabecera p { margin: 2px 0; color: #c3cddb; }
.t-volver { display: inline-block; color: #9cc3ff; text-decoration: none; font-weight: 600; margin-bottom: 8px; font-size: 16px; }
.t-punto { border-radius: 16px; padding: 16px; margin-bottom: 12px; display: grid; gap: 12px; }
.t-texto { font-weight: 600; font-size: 17px; display: flex; gap: 10px; align-items: baseline; color: #fff; }
.t-num { min-width: 28px; height: 28px; border-radius: 50%; background: #2f4566; display: inline-grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff; }
.t-ticket { display: block; }
.t-ticket input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.t-ticket span { display: block; text-align: center; padding: 16px; border-radius: 14px; border: 2px solid #3f5272; font-weight: 700; font-size: 18px; color: #c3cddb; cursor: pointer; }
.t-ticket input:checked + span { background: #1f7a45; border-color: #2ea862; color: #fff; }
.t-valor { display: flex; align-items: center; gap: 10px; }
.t-valor span { font-weight: 700; color: #c3cddb; min-width: 40px; }
.t-opciones { display: flex; gap: 8px; flex-wrap: wrap; }
.t-opciones label { flex: 1; min-width: 80px; }
.t-opciones input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.t-opciones span { display: block; text-align: center; padding: 14px 10px; border-radius: 14px; border: 2px solid #3f5272; font-weight: 700; font-size: 16px; color: #c3cddb; cursor: pointer; }
.t-opciones input:checked + span { background: #2f5a8a; border-color: #6fa2e0; color: #fff; }
.t-punto details summary { cursor: pointer; color: #9cc3ff; font-weight: 600; padding: 4px 0; }
.t-punto details textarea { margin-top: 8px; }
.t-grande { width: 100%; min-height: 56px; font-size: 18px; margin-top: 6px; }
.t-estado { text-align: center; color: #9fb0c6; font-size: 14px; }
.t-foto { width: 100%; min-height: 54px; font-size: 17px; }
.t-equipo { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; margin-bottom: 10px; color: #fff; text-decoration: none; font-size: 17px; }
.t-equipo small { color: #a9b6c8; font-size: 14px; }
.t-hallazgo { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px; border-radius: 14px; margin-bottom: 10px; }
.t-hallazgo img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; }
.t-hallazgo:not(:has(img)) { grid-template-columns: 1fr; }
.t-avance { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; color: #c3cddb; }
.t-barra { flex: 1; height: 12px; border-radius: 6px; background: #22324a; overflow: hidden; }
.t-barra span { display: block; height: 100%; background: linear-gradient(90deg, #2f5a8a, #2ea862); }
.t-ayuda { color: #c3cddb; text-align: center; margin: 18px 0 6px; }
.t-firma { width: 100%; height: 220px; background: #fff; border-radius: 14px; touch-action: none; }
.prio-alta { background: #A02924; } .prio-media { background: #b5700f; } .prio-baja { background: #2e7d4f; }

/* ---------- Etiqueta QR imprimible ---------- */
.etiqueta-qr { background: #fff; color: #1E3046; width: 300px; margin: 0 auto 14px; padding: 16px; border-radius: 16px; text-align: center; }
.etq-logo { width: 220px; display: block; margin: 0 auto 6px; }
#qr svg { display: block; margin: 0 auto; }
.etq-nombre { font-weight: 700; font-size: 18px; margin-top: 6px; }
.etq-datos { font-size: 13px; color: #484F5E; }
@media print {
  body { background: #fff !important; }
  .fondo, .menu, .no-imprimir, .aviso { display: none !important; }
  .con-menu .contenido { margin: 0; padding: 0; }
  .etiqueta-qr { border: 1px dashed #999; border-radius: 0; margin: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Escáner de QR */
.t-escaner { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: 18px; overflow: hidden; }
.t-escaner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-mira { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.tabla-import td { vertical-align: top; padding: 8px 6px; }
.tabla-import input, .tabla-import select { min-height: 38px; padding: 7px 9px; font-size: 14px; }
@media (max-width: 860px) { .tabla-import tr { display: grid; grid-template-columns: 30px 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.1); } .tabla-import th { display: none; } .tabla-import td { border: 0; padding: 0; } .tabla-import td:nth-child(n+3) { grid-column: 2; } }

/* Incidencias anteriores */
.t-incidencia.pendiente { border-color: #c47a12 !important; box-shadow: inset 4px 0 0 #c47a12; }
.t-incidencia.revisada { opacity: .9; }
.alerta { color: #f0a640 !important; font-weight: 600; }

/* v0.7 planificador, inventario, resumen semanal */
.gantt { min-width: 760px; }
.gantt th, .gantt td { text-align: center; padding: 6px 4px; }
.gantt th:first-child, .gantt td:first-child { text-align: left; white-space: nowrap; padding-right: 12px; }
.celda { display: inline-block; cursor: pointer; margin: 0; }
.celda input { position: absolute; opacity: 0; pointer-events: none; }
.celda span { display: block; width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--vidrio-borde); background: rgba(255,255,255,.04); transition: background .15s; }
.celda input:checked + span { background: var(--rojo); border-color: #c8423c; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.celda input:focus-visible + span { outline: 2px solid #fff; }
.dia { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--vidrio-borde); }
.dia:first-of-type { border-top: 0; }
.dia-fecha { min-width: 90px; font-weight: 700; color: var(--texto-2); }
.dia > div:last-child { flex: 1; }
.inv-equipo { border-top: 1px solid var(--vidrio-borde); padding: 12px 0; }
.inv-cab { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.inv-equipo details { margin-top: 8px; }
.inv-equipo summary { cursor: pointer; color: var(--texto-2); font-size: .92rem; }
.tabla-import input, .tabla-import select { min-width: 90px; padding: 6px 8px; }
.modal-fondo { position: fixed; inset: 0; z-index: 100; background: rgba(5,10,18,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #1a2738; border: 1px solid var(--vidrio-borde); border-radius: var(--radio); padding: 20px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
@media (max-width: 640px) { .ocultar-movil { display: none; } .dia { flex-direction: column; gap: 4px; } }

/* v0.8 tipos de visita y Carta Gantt con colores */
.celda.m input:checked + span { background: var(--rojo); border-color: #c8423c; }
.celda.m.sec span { width: 20px; height: 20px; border-radius: 6px; margin: 0 auto; }
.celda.m.sec input:checked + span { background: #c9625d; }
.celda.i input:checked + span { background: #e0b100; border-color: #f2c94c; }
.celda.p input:checked + span { background: #2e9e57; border-color: #45c070; }
.gantt tr.g-esp td { border-top: 1px solid var(--vidrio-borde); }
.gantt tr.g-sec td:first-child { padding-left: 22px; color: var(--texto-2); font-size: .92rem; }
.leyenda { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; color: var(--texto-2); }
.ley { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; }
.ley.m { background: var(--rojo); } .ley.i { background: #e0b100; } .ley.p { background: #2e9e57; }
.tipo-vis { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--rojo); }
.tipo-vis.i { background: #b58f00; } .tipo-vis.p { background: #23804a; }

/* v0.10 vista móvil: barra superior con Salir y menú inferior deslizable */
.barra-movil { display: none; }
@media (max-width: 860px) {
  .barra-movil { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(15, 26, 40, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--vidrio-borde); }
  .modo-tecnico .barra-movil { background: #121c2b; }
  .barra-movil img { width: 30px; height: 30px; object-fit: contain; }
  .barra-movil .quien { flex: 1; min-width: 0; line-height: 1.15; }
  .barra-movil .quien strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .barra-movil .quien small { color: var(--texto-2); font-size: 12px; }
  .barra-movil form { margin: 0; }
  .barra-movil .btn { display: inline-flex; align-items: center; gap: 6px; }
  .barra-movil .btn svg { width: 16px; height: 16px; }
  .menu .usuario { display: none; }
  .menu { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .menu nav { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; -webkit-overflow-scrolling: touch; width: 100%; }
  .menu nav::-webkit-scrollbar { display: none; }
  .menu nav a { flex: 1 0 auto; min-width: 64px; padding: 8px 6px; }
  .con-menu .contenido { padding-top: 14px; overflow-x: hidden; }
  .encabezado { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 860px) { .tabla:not(.tabla-import) { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; } }

/* v0.11 cambio de vista técnico / administrador */
.form-vista { margin: 0; }
.cambio-vista { margin: 8px 0 10px; }
.cambio-vista .btn { width: 100%; justify-content: center; }
@media (max-width: 860px) { .cambio-vista { display: none; } .barra-movil .form-vista .btn { padding: 6px 10px; font-size: 13px; } }
/* aviso de cambios guardados en el celular (sin señal) */
#vt-cola { display: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 50; max-width: calc(100% - 24px);
  background: #6b4a06; color: #fff; border: 1px solid #c48a14; border-radius: 14px; padding: 10px 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
#vt-cola.visible { display: block; }
#vt-cola.enviando { background: #1f4f7a; border-color: #3d7fbf; }
.t-pendiente { border: 1px dashed #c48a14 !important; opacity: .95; }
@media (min-width: 861px) { #vt-cola { bottom: 20px; } }
.bloqueado { opacity: .55; }
.etq-codigo { font-size: 15px; color: #1E3046; margin-top: 6px; letter-spacing: .04em; }
