/* Supervisión EMELIFT. Dirección visual en DESIGN.md: tema claro de AI Partner con el naranja de
   EMELIFT como color de seguridad; el número del reporte como indicador de piso de elevador. */
:root {
  --fondo: #F4F3F0;
  --papel: #FFFFFF;
  --acero: #2B2F33;
  --suave: #626884;
  --linea: #E4E8F6;
  --naranja: oklch(64% 0.145 47);
  --naranja-fuerte: #B85A22;
  --azul: #2C4BFF;
  --ok: #0B6E4B; --ok-bg: #E6F5EE;
  --alerta: #CC8A12; --alerta-txt: #8A5200; --alerta-bg: #FFF4E2;
  --mal: #C0142F; --mal-bg: #FDE8EC;
  --titulos: "Space Grotesk", system-ui, sans-serif;
  --texto: "Poppins", "Avenir Next", system-ui, sans-serif;
  --piso: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fondo); color: var(--acero); font-family: var(--texto); font-size: 14.5px; line-height: 1.5; }
button, select, input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--titulos); margin: 0; line-height: 1.2; }
h2 { font-size: 17px; }
p { margin: 0; }
.oculto { display: none !important; }
.suave { color: var(--suave); }
.xs { font-size: 12px; }
.num { font-family: var(--piso); font-weight: 600; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }

/* Cabecera */
.cabecera { background: var(--acero); color: #fff; position: sticky; top: 0; z-index: 20; border-bottom: 3px solid var(--naranja); }
.cab-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { height: 30px; width: auto; }
.cab-titulo { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; }
.cab-titulo b { font-family: var(--titulos); font-size: 16px; }
.cab-titulo span { font-size: 12px; color: #B8BEC4; }
.cab-der { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usuario { font-size: 13px; color: #D9DDE0; }
.usuario i { font-style: normal; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: #454B51; border-radius: 3px; padding: 1px 6px; margin-left: 6px; }
#ver-como { color: #B8BEC4; display: flex; gap: 6px; align-items: center; }
#ver-como select { background: #3A3F44; color: #fff; border: 1px solid #555B61; border-radius: 4px; padding: 3px 6px; }

.btn { border: 1px solid var(--linea); background: var(--papel); border-radius: 4px; padding: 8px 14px; font-weight: 500; cursor: pointer; font-size: 13px; min-height: 36px; }
.btn.claro { background: transparent; color: #fff; border-color: #555B61; }
.btn.claro:hover { background: #3A3F44; }
.btn.principal { background: var(--naranja); border-color: var(--naranja); color: #1B1209; font-weight: 600; font-size: 15px; padding: 12px 22px; }
.btn.principal:hover { background: oklch(70% 0.145 47); }
.btn.grande { min-height: 52px; font-size: 15px; width: 100%; text-align: left; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn.peligro { border-color: var(--mal); color: var(--mal); }
.btn[disabled] { opacity: .5; cursor: progress; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 20px; }
.aviso { padding: 10px 14px; border-left: 4px solid var(--alerta); background: var(--alerta-bg); color: var(--alerta-txt); border-radius: 0 4px 4px 0; }
.aviso.mal { border-color: var(--mal); background: var(--mal-bg); color: var(--mal); }

/* Franjas de zona */
.zonas { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.zona { background: var(--papel); border: 1px solid var(--linea); border-top: 4px solid var(--linea); padding: 12px 14px; text-align: left; cursor: pointer; display: grid; gap: 8px; }
.zona.con-pendientes { border-top-color: var(--naranja); }
.zona.al-dia { border-top-color: var(--ok); }
.zona.mal { border-top-color: var(--mal); }
.zona[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--acero); }
.zona-nom { display: flex; align-items: center; gap: 8px; font-family: var(--titulos); font-weight: 700; font-size: 16px; }
.luz { font-size: 13px; line-height: 1; }
.luz.on { color: var(--ok); }
.luz.off { color: var(--suave); }
.zona-nom small { font-family: var(--texto); font-weight: 400; color: var(--suave); font-size: 12px; margin-left: auto; }
.conteos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.conteo b { display: block; font-family: var(--piso); font-weight: 600; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.conteo span { font-size: 11.5px; color: var(--suave); }
.conteo.sin b { color: var(--naranja-fuerte); }
.conteo.fs b { color: var(--mal); }
.conteo.cero b { color: #A8ADB4; }

/* Pestañas y filtros */
.pestanas { display: flex; gap: 2px; border-bottom: 2px solid var(--linea); overflow-x: auto; }
.pestanas button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; font-weight: 500; color: var(--suave); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--acero); border-bottom-color: var(--naranja); }
.filtros { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--linea); background: var(--papel); padding: 6px 12px; border-radius: 3px; cursor: pointer; font-size: 13px; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--acero); color: #fff; border-color: var(--acero); }
.campo { display: grid; gap: 3px; font-size: 12px; color: var(--suave); }
.campo.crece { flex: 1 1 180px; }
.campo select, .campo input, .form input, .form select { border: 1px solid #CBD0E4; background: var(--papel); border-radius: 4px; padding: 7px 10px; min-height: 36px; color: var(--acero); }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; min-height: 36px; }

/* Lista de reportes: tabla en PC, filas de dos líneas en celular */
.lista { background: var(--papel); border: 1px solid var(--linea); }
.fila { display: grid; grid-template-columns: 86px minmax(0, 1fr) 170px 150px 70px; gap: 4px 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--linea); cursor: pointer; width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-top: 0; }
.fila:last-child { border-bottom: 0; }
.fila:hover { background: #FAF9F7; }
.fila.cab { cursor: default; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--suave); background: #FAF9F7; padding-top: 8px; padding-bottom: 8px; }
.fila.cab .der { text-align: right; }
.fila.cab:hover { background: #FAF9F7; }
.piso { display: inline-block; font-family: var(--piso); font-weight: 600; font-size: 22px; line-height: 1; background: var(--acero); color: #fff; padding: 4px 9px 3px; border-radius: 3px; letter-spacing: .04em; font-variant-numeric: tabular-nums; text-align: center; min-width: 64px; }
.piso.gris { background: #8C9197; }
.proy { min-width: 0; }
.proy b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proy span { font-size: 12.5px; color: var(--suave); }
.tec.sin { color: var(--naranja-fuerte); font-weight: 600; }
.etq { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 3px; white-space: nowrap; }
.etq.abierto { background: var(--alerta-bg); color: var(--alerta-txt); }
.etq.fuera { background: var(--mal-bg); color: var(--mal); }
.etq.cerrado { background: var(--ok-bg); color: var(--ok); }
.etq.hist { background: #ECEDEF; color: #5A6067; }
.dias { font-family: var(--piso); font-weight: 600; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.dias small { font-family: var(--texto); font-weight: 400; font-size: 11px; color: var(--suave); }
.vacio { padding: 24px; text-align: center; color: var(--suave); }

/* Detalle: panel lateral en PC, hoja desde abajo en celular */
.velo { position: fixed; inset: 0; background: rgba(20, 22, 25, .45); z-index: 30; }
.detalle { position: fixed; z-index: 31; background: var(--papel); right: 0; top: 0; bottom: 0; width: min(460px, 100%); overflow-y: auto; padding: 18px 18px 28px; box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 16px; }
.det-cab { display: flex; gap: 12px; align-items: flex-start; }
.det-cab .piso { font-size: 30px; padding: 6px 12px 4px; }
.det-cab h2 { font-size: 18px; }
.cerrar { margin-left: auto; border: 1px solid var(--linea); background: var(--papel); width: 40px; height: 40px; border-radius: 4px; cursor: pointer; font-size: 20px; line-height: 1; }
.acciones { display: grid; gap: 8px; }
.sub { border: 1px solid var(--linea); border-radius: 4px; padding: 8px; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.sub .btn { text-align: left; min-height: 44px; }
.sub .btn[aria-current="true"] { border-color: var(--naranja); background: #FFF6EF; }
.cliente { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.cliente dt { color: var(--suave); }
.cliente dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tiempo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--linea); display: grid; gap: 10px; }
.tiempo li { position: relative; font-size: 13.5px; }
.tiempo li::before { content: ""; position: absolute; left: -20px; top: 7px; width: 8px; height: 8px; background: var(--naranja); border-radius: 50%; }
.tiempo time { color: var(--suave); font-size: 12px; display: block; }

/* Ajustes y admin */
.paneles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.panel { background: var(--papel); border: 1px solid var(--linea); padding: 14px; display: grid; gap: 10px; }
.form { display: grid; gap: 8px; }
.form .doble { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tabla-simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla-simple th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--suave); font-weight: 500; padding: 4px 6px; }
.tabla-simple td { padding: 7px 6px; border-top: 1px solid var(--linea); vertical-align: middle; }
.tabla-simple input { width: 100%; }
.ok-txt { color: var(--ok); } .mal-txt { color: var(--mal); }

/* Bitácora, pie, avisos */
.bitacora { background: var(--papel); border: 1px solid var(--linea); padding: 14px; }
.bitacora ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.bitacora li { display: flex; gap: 10px; }
.bitacora time { font-family: var(--piso); font-weight: 600; color: var(--suave); min-width: 46px; font-variant-numeric: tabular-nums; }
.pie { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px 28px; color: var(--suave); font-size: 12px; }
.pie img { height: 18px; width: auto; opacity: .7; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--acero); color: #fff; padding: 10px 18px; border-radius: 4px; z-index: 40; max-width: 92vw; }
.toast.mal { background: var(--mal); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--acero); }
.login .caja { background: var(--papel); border-top: 4px solid var(--naranja); padding: 28px; max-width: 420px; display: grid; gap: 14px; }
.login img { height: 40px; width: auto; justify-self: start; background: var(--acero); padding: 8px 12px; }
.error { color: var(--mal); }

/* Celular: franjas apiladas y filas de dos líneas */
@media (max-width: 760px) {
  .cab-titulo { margin-right: 0; flex: 1; }
  .fila { grid-template-columns: 78px minmax(0, 1fr) auto; grid-template-areas: "piso proy estado" "piso tec dias"; padding: 10px 12px; }
  .fila.cab { display: none; }
  .fila > .c-piso { grid-area: piso; align-self: start; }
  .fila > .proy { grid-area: proy; }
  .fila > .tec { grid-area: tec; font-size: 13px; }
  .fila > .c-estado { grid-area: estado; justify-self: end; }
  .fila > .dias { grid-area: dias; justify-self: end; }
  .zonas { grid-template-columns: 1fr; }
  .detalle { top: auto; width: 100%; max-height: 92vh; border-radius: 10px 10px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
  .btn.grande { min-height: 56px; }
}
@media (prefers-reduced-motion: no-preference) { .detalle { animation: sube .18s ease-out; } @keyframes sube { from { transform: translateY(14px); opacity: .6; } } }
