/* Órdenes, calendario y estadísticas */
[x-cloak] { display: none !important; }
:root {
  --c-inst: #0469B1; --c-inst-bg: #E3F0FA;
  --c-sitio: #5F8212; --c-sitio-bg: #EEF6D8;
  --c-remoto: #7A3FB8; --c-remoto-bg: #F1E8FA;
  --c-curso: #D97706; --c-curso-bg: #FEF1D9;
}

/* Etiquetas */
.etq { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: #eee; color: #444; white-space: nowrap; }
.etq-instalacion { background: var(--c-inst-bg); color: var(--c-inst); }
.etq-sitio { background: var(--c-sitio-bg); color: var(--c-sitio); }
.etq-remoto { background: var(--c-remoto-bg); color: var(--c-remoto); }
.etq-programada { background: var(--c-inst-bg); color: var(--c-inst); }
.etq-en_curso { background: var(--c-curso-bg); color: var(--c-curso); }
.etq-completada { background: var(--c-sitio-bg); color: var(--c-sitio); }
.etq-cancelada { background: #ececec; color: #777; }
.etq-atrasada { background: #FDE4E5; color: var(--sl-rojo-oscuro); }
.etq-p-alta { background: var(--c-curso-bg); color: var(--c-curso); }
.etq-p-urgente { background: #FDE4E5; color: var(--sl-rojo-oscuro); }
.vacio { text-align: center; color: #888; padding: 3rem 1rem; background: #fff; border-radius: .8rem; border: 1px dashed #d8d8d8; }
.vacio i { font-size: 2.2rem; display: block; margin-bottom: .4rem; }

/* Colores por tipo de actividad */
.pt { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .25rem; background: #999; }
.pt.ev-instalacion { background: var(--c-inst); } .pt.ev-sitio { background: var(--c-sitio); } .pt.ev-remoto { background: var(--c-remoto); }

/* Barra y filtros del calendario */
.cx-barra { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.cx-nav { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.cx-titulo { font-size: 1.25rem; font-weight: 700; margin: 0 0 0 .5rem; }
.cx-acciones { display: flex; gap: .5rem; flex-wrap: wrap; }
.cx-filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.cx-filtros .form-select { width: auto; min-width: 190px; }
.cx-leyenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: #555; margin-left: auto; }

/* Vista mensual */
.cx-mes { background: #fff; border: 1px solid #e3e3e3; border-radius: .9rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.cx-cab, .cx-sem { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cx-cab { background: var(--sl-gris); color: #fff; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cx-cab div { padding: .55rem .6rem; }
.cx-dia { min-height: 118px; border-top: 1px solid #ececec; border-right: 1px solid #ececec; padding: .3rem .35rem; position: relative; }
.cx-dia:nth-child(7n) { border-right: 0; }
.cx-dia.finde { background: #fafafa; }
.cx-dia.fuera { background: #f6f6f6; } .cx-dia.fuera .cx-num a { color: #b5b5b5; }
.cx-dia.hoy { background: #FFF6F6; box-shadow: inset 0 0 0 2px var(--sl-rojo); }
.cx-num { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; font-weight: 600; }
.cx-num a { color: #333; text-decoration: none; }
.cx-dia.hoy .cx-num > a:first-child { background: var(--sl-rojo); color: #fff; border-radius: 999px; padding: 0 .45rem; }
.cx-mas { opacity: 0; color: #888; text-decoration: none; font-size: 1.1rem; line-height: 1; transition: opacity .15s; }
.cx-dia:hover .cx-mas, .sem-cab:hover .cx-mas { opacity: 1; }
.cx-evs { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.cx-ev { display: flex; gap: .3rem; align-items: baseline; font-size: .74rem; padding: 2px 5px; border-radius: 5px; text-decoration: none; overflow: hidden; border-left: 3px solid; }
.cx-ev .ev-hora { font-weight: 700; flex: none; }
.cx-ev .ev-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-instalacion { background: var(--c-inst-bg); color: #05508a; border-color: var(--c-inst); }
.ev-sitio { background: var(--c-sitio-bg); color: #46610d; border-color: var(--c-sitio); }
.ev-remoto { background: var(--c-remoto-bg); color: #5b2c8e; border-color: var(--c-remoto); }
.ev-cerrada { opacity: .6; text-decoration: line-through; }
.cx-ev:hover, .sem-ev:hover, .ag-ev:hover { filter: brightness(.96); }
.cx-otros { font-size: .72rem; color: #666; text-decoration: none; padding-left: 5px; }
.cx-puntos { display: none; }
.cx-agenda { display: none; }

/* Vista semanal */
.cx-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.sem-col { background: #fff; border: 1px solid #e3e3e3; border-radius: .8rem; overflow: hidden; display: flex; flex-direction: column; min-height: 260px; }
.sem-col.hoy { border-color: var(--sl-rojo); box-shadow: 0 0 0 1px var(--sl-rojo); }
.sem-cab { display: flex; gap: .4rem; align-items: baseline; padding: .55rem .7rem; background: #f4f4f4; font-size: .8rem; color: #555; }
.sem-cab strong { font-size: 1.15rem; color: #222; }
.sem-col.hoy .sem-cab { background: var(--sl-rojo); color: #fff; } .sem-col.hoy .sem-cab strong, .sem-col.hoy .cx-mas { color: #fff; }
.sem-cab .cx-mas { margin-left: auto; }
.sem-evs { padding: .5rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.sem-ev { display: block; border-left: 4px solid; border-radius: .5rem; padding: .45rem .55rem; text-decoration: none; font-size: .85rem; }
.sem-hora { font-weight: 700; font-size: .78rem; }
.sem-meta { opacity: .85; }
.sem-vacio { color: #ccc; text-align: center; padding-top: .6rem; }

/* Celular: la cuadrícula del mes pasa a puntos + lista */
@media (max-width: 767.98px) {
  .cx-dia { min-height: 54px; padding: .2rem; }
  .cx-evs { display: none; } .cx-mas { display: none; }
  .cx-puntos { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 2px; }
  .cx-cab div { padding: .4rem .2rem; text-align: center; font-size: .65rem; }
  .cx-agenda { display: block; margin-top: 1rem; }
  .ag-dia { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid #ececec; }
  .ag-dia.hoy .ag-fecha strong { background: var(--sl-rojo); color: #fff; border-radius: 999px; }
  .ag-fecha { width: 2.6rem; text-align: center; flex: none; display: flex; flex-direction: column; }
  .ag-fecha strong { font-size: 1.2rem; line-height: 1.7rem; height: 1.7rem; } .ag-fecha span { font-size: .7rem; color: #777; }
  .ag-evs { flex: 1; display: flex; flex-direction: column; gap: .4rem; }
  .ag-ev { display: block; border-left: 4px solid; border-radius: .5rem; padding: .45rem .6rem; text-decoration: none; }
  .cx-semana { grid-template-columns: 1fr; }
  .sem-col { min-height: 0; }
  .cx-leyenda { margin-left: 0; }
}
@media (min-width: 768px) and (max-width: 1199.98px) { .cx-semana { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Detalle de la orden: evidencias y línea de tiempo */
.evid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.evid { border: 1px solid #e3e3e3; border-radius: .7rem; overflow: hidden; background: #fff; }
.evid img { width: 100%; height: 130px; object-fit: cover; display: block; }
.evid-pdf { height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #FDE4E5; color: var(--sl-rojo-oscuro); text-decoration: none; font-weight: 700; }
.evid-pdf i { font-size: 2.6rem; }
.evid-pie { padding: .5rem .65rem; font-size: .85rem; }
.linea { position: relative; padding-left: 1.3rem; }
.linea::before { content: ""; position: absolute; left: .42rem; top: .3rem; bottom: .3rem; width: 2px; background: #e5e5e5; }
.linea-item { position: relative; padding-bottom: .9rem; }
.linea-punto { position: absolute; left: -1.3rem; top: .3rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--sl-azul); border: 2px solid #fff; box-shadow: 0 0 0 1px #d0d0d0; }
.linea-item.sistema .linea-punto { background: #bbb; }
.linea-item.sistema .linea-cuerpo { color: #666; font-size: .9rem; }

/* Estadísticas */
.est-kpi { background: #fff; border: 1px solid #e3e3e3; border-left: 5px solid var(--sl-gris); border-radius: .8rem; padding: .85rem 1rem; height: 100%; }
.est-kpi.verde { border-left-color: var(--sl-verde); } .est-kpi.rojo { border-left-color: var(--sl-rojo); } .est-kpi.azul { border-left-color: var(--sl-azul); } .est-kpi.remoto { border-left-color: var(--c-remoto); }
.est-kpi .l { font-size: .78rem; color: #666; text-transform: uppercase; letter-spacing: .03em; }
.est-kpi .v { font-size: 1.8rem; font-weight: 700; line-height: 1.15; }
.est-kpi .s { font-size: .8rem; color: #777; }
.barras { display: flex; align-items: flex-end; gap: .5rem; height: 220px; padding-top: .5rem; }
.barra-col { flex: 1; display: flex; flex-direction: column; align-items: stretch; height: 100%; min-width: 0; }
.barra-pila { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; background: #f5f5f5; border-radius: .4rem .4rem 0 0; overflow: hidden; }
.barra-pila .b-in { background: var(--c-inst); } .barra-pila .b-so { background: var(--c-sitio); }
.barra-num { text-align: center; font-size: .78rem; font-weight: 600; height: 1.2rem; }
.barra-et { text-align: center; font-size: .72rem; color: #666; margin-top: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-fila { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; font-size: .85rem; }
.prog-et { width: 6.2rem; flex: none; } .prog-n { width: 2rem; text-align: right; font-weight: 600; }
.prog { flex: 1; height: .65rem; background: #eee; border-radius: 999px; overflow: hidden; }
.prog > div { height: 100%; border-radius: 999px; }
.prog-programada { background: var(--c-inst); } .prog-en_curso { background: var(--c-curso); } .prog-completada { background: var(--sl-verde); } .prog-cancelada { background: #aaa; }
.prog-p-baja { background: #9db8cc; } .prog-p-media { background: var(--c-inst); } .prog-p-alta { background: var(--c-curso); } .prog-p-urgente { background: var(--sl-rojo); }
@media print { .cx-acciones, .cx-filtros .form-select { display: none; } }

/* Inicio */
.inicio-orden { display: flex; gap: .8rem; align-items: center; padding: .65rem .4rem; border-bottom: 1px solid #eee; text-decoration: none; color: inherit; border-radius: .5rem; }
.inicio-orden:hover { background: #f7f7f7; }
.io-fecha { width: 3rem; text-align: center; background: var(--sl-gris); color: #fff; border-radius: .6rem; padding: .25rem 0; flex: none; display: flex; flex-direction: column; line-height: 1.1; }
.io-fecha strong { font-size: 1.25rem; } .io-fecha span { font-size: .7rem; text-transform: uppercase; opacity: .8; }

/* Acta de entrega / servicio */
.acta { background: #fff; border: 1px solid #e3e3e3; border-radius: .9rem; padding: 1.6rem 1.8rem; max-width: 880px; margin: 0 auto; }
.acta-cab { display: flex; align-items: center; gap: 1.2rem; border-bottom: 3px solid var(--sl-rojo); padding-bottom: .9rem; margin-bottom: 1rem; }
.acta-cab { flex-wrap: wrap; }
.acta-logo { height: 52px; width: auto; max-width: 45%; object-fit: contain; }
.acta-tit { flex: 1 1 200px; }
.acta-tit h1 { font-size: 1.3rem; margin: 0; font-weight: 700; }
.acta-sec { margin-bottom: 1.1rem; }
.acta-sec h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #666; margin: 0 0 .4rem; }
.acta-t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.acta-t td, .acta-t th { border: 1px solid #ddd; padding: .35rem .55rem; vertical-align: top; }
.acta-t td:nth-child(odd) { background: #f6f6f6; font-weight: 600; width: 14%; }
.acta-rep td:nth-child(odd) { background: none; font-weight: 400; width: auto; }
.acta-rep th { background: #f0f0f0; text-align: left; }
.acta-txt { font-size: .92rem; }
.acta-firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 1rem; }
.acta-firma { text-align: center; font-size: .88rem; }
.acta-firma img, .acta-espacio { height: 90px; max-width: 100%; object-fit: contain; display: block; margin: 0 auto; }
.acta-linea { border-top: 1px solid #333; margin: .2rem 0 .3rem; }
.acta-pie { border-top: 1px solid #ddd; margin-top: 1rem; padding-top: .5rem; font-size: .75rem; color: #888; text-align: center; }
.firma-caja { border: 2px dashed #bbb; border-radius: .7rem; background: #fcfcfc; }
.firma-caja canvas { width: 100%; height: auto; display: block; cursor: crosshair; }

/* Etiqueta QR */
.qr-etiqueta { width: 340px; margin: 0 auto; background: #fff; border: 2px solid var(--sl-gris); border-radius: 1rem; padding: 1.2rem; text-align: center; }
.qr-logo { height: 40px; margin-bottom: .6rem; }
.qr-codigo { font-size: 1.6rem; font-weight: 800; letter-spacing: .03em; }
.qr-cliente { color: #555; margin-bottom: .6rem; }
.qr-img svg { width: 250px; height: 250px; }
.qr-pie { font-size: .8rem; color: #555; margin-top: .4rem; }

@media print {
  body.con-menu .app-main { margin-left: 0 !important; }
  .acta { border: 0; padding: 0; max-width: none; }
  .app-contenido { padding: 0 !important; }
  .qr-etiqueta { border-color: #000; }
}

/* Pausas */
.etq-pausada { background: var(--c-remoto-bg); color: var(--c-remoto); }
.prog-pausada { background: var(--c-remoto); }

/* Modo demostración */
.demo-barra { background: #FFF3CD; color: #664d03; border-bottom: 1px solid #ffe69c; padding: .45rem 1rem; font-size: .88rem; }
.demo-barra a { color: #664d03; font-weight: 600; }
.badge-demo { background: #FFC107; color: #3b2f00; font-size: .65rem; font-weight: 700; padding: .15rem .4rem; border-radius: .35rem; vertical-align: middle; letter-spacing: .04em; }

/* Catálogo y listas del administrador */
.table select.form-select-sm { min-width: 7.5rem; }
.table input.form-control-sm { min-width: 3.5rem; }

/* Archivos .ssr / .sss de la pantalla */
.arch-card { border: 1px solid #e3e3e3; border-left: 5px solid var(--sl-verde); border-radius: .7rem; padding: .7rem .9rem; background: #fff; height: 100%; }
.arch-card.falta { border-left-color: var(--sl-rojo); background: #FFF8F8; }
.etq-archivos { background: #FDE4E5; color: var(--sl-rojo-oscuro); }
