/* Mesa de revisión · CIC — lavanda claro, violeta eléctrico y sellos de goma */
:root {
  --bg: #f3f2f8;
  --surface: #ffffff;
  --surface-2: #f8f7fc;
  --ink: #17151f;
  --ink-2: #4f4b63;
  --ink-3: #8a869e;
  --line: #e6e3ef;
  --line-2: #d8d4e6;
  --accent: #6a3df0;
  --accent-2: #8f6bff;
  --accent-soft: #efe9ff;
  --ok: #0f9f68;
  --ok-soft: #e1f5ec;
  --bad: #e0464c;
  --bad-soft: #fde9ea;
  --wait: #d98a0b;
  --wait-soft: #fcf1dc;
  --cx: #eb6834;
  --tv: #2a78d6;
  --r: 18px;
  --sombra: 0 1px 2px rgba(23, 21, 31, .04), 0 8px 24px -12px rgba(48, 32, 110, .16);
  --f-display: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  --f-texto: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--f-texto); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); }
kbd { font: 500 11px var(--f-mono); background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }
.sutil { color: var(--ink-3); }
.error { color: var(--bad); min-height: 1.3em; margin: 0; font-weight: 500; }
.centrar { display: flex; justify-content: center; padding: 18px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap;
  text-decoration: none; color: var(--ink); transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
.btn.primario { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px var(--accent); }
.btn.primario:hover { background: #5b2fe0; }
.btn.suave { background: var(--surface); border-color: var(--line); }
.btn.suave:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn.icono { width: 38px; padding: 0; }
.btn.enlace { background: none; height: auto; padding: 0; color: var(--accent); }
.btn.grande { height: 48px; font-size: 15px; border-radius: 14px; }
.btn.oscuro { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.12); }
.btn.oscuro:hover { background: rgba(255,255,255,.16); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- carga ---------- */
.giro { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: giro .8s linear infinite; display: inline-block; }
@keyframes giro { to { transform: rotate(360deg); } }
.carga-inicial { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-arte {
  position: relative; overflow: hidden; padding: 56px;
  background:
    radial-gradient(900px 500px at 10% 0%, #8f6bff55, transparent 60%),
    radial-gradient(700px 500px at 100% 100%, #ff8a5c40, transparent 60%),
    #17132b;
  color: #fff; display: flex; align-items: flex-end;
}
.login-arte::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, #000 30%, transparent 95%);
}
.login-titulo { position: relative; max-width: 520px; }
.marca-cic { font: 600 12px var(--f-mono); letter-spacing: .18em; text-transform: uppercase; opacity: .7; }
.login-titulo h1 { font: 800 clamp(52px, 7vw, 92px)/.92 var(--f-display); letter-spacing: -.035em; margin: 14px 0 18px; }
.login-titulo p { font-size: 16px; opacity: .78; max-width: 440px; margin: 0; }
.sello {
  position: absolute; font: 800 30px var(--f-display); letter-spacing: .12em; padding: 10px 22px;
  border: 4px solid currentColor; border-radius: 12px; opacity: .9; mix-blend-mode: screen;
  animation: sello 6s ease-in-out infinite;
}
.sello::after { content: ''; position: absolute; inset: 4px; border: 2px solid currentColor; border-radius: 7px; opacity: .6; }
.sello.s1 { color: #4ee3a8; top: 14%; left: 12%; transform: rotate(-12deg); }
.sello.s2 { color: #b59cff; top: 30%; right: 10%; transform: rotate(8deg); animation-delay: -2s; font-size: 24px; }
.sello.s3 { color: #ff7a7f; top: 48%; left: 30%; transform: rotate(-4deg); animation-delay: -4s; font-size: 22px; }
@keyframes sello { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.login-caja {
  align-self: center; justify-self: center; width: min(400px, calc(100% - 32px));
  display: grid; gap: 14px; padding: 8px 0;
}
.login-caja h2 { font: 700 30px var(--f-display); letter-spacing: -.02em; margin: 6px 0 0; }
.login-caja p.sutil { margin: -6px 0 8px; }
.login-caja label { display: grid; gap: 6px; font-weight: 550; font-size: 13px; color: var(--ink-2); }
.login-caja input {
  height: 48px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 14px; font-size: 15px;
}
.login-icono { width: 52px; height: 52px; border-radius: 16px; background: var(--accent); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 24px -10px var(--accent); }
.login-icono svg { width: 26px; height: 26px; stroke-width: 3; }

/* ---------- barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 20px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.barra-marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.barra-marca b { font: 700 16px/1.1 var(--f-display); letter-spacing: -.01em; display: block; }
.barra-marca small { color: var(--ink-3); font-size: 11.5px; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.logo svg { stroke-width: 3; }
.pestanas {
  position: relative; display: flex; gap: 2px; padding: 4px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; scrollbar-width: none;
}
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button {
  position: relative; z-index: 1; border: 0; background: none; height: 34px; padding: 0 14px; border-radius: 10px;
  font-weight: 550; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: color .2s;
}
.pestanas button.activa { color: #fff; }
.pestanas button em {
  font-style: normal; font: 600 11px var(--f-mono); padding: 1px 7px; border-radius: 99px;
  background: var(--wait-soft); color: #8a5800;
}
.pestanas button em:empty { display: none; }
.pestanas button.activa em { background: rgba(255,255,255,.22); color: #fff; }
.indicador { position: absolute; z-index: 0; top: 4px; height: 34px; border-radius: 10px; background: var(--ink); transition: left .3s cubic-bezier(.3,.8,.3,1), width .3s cubic-bezier(.3,.8,.3,1); }
.punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.punto.cx { background: var(--cx); } .punto.tv { background: var(--tv); }
.barra-acciones { display: flex; align-items: center; gap: 8px; }
.usuario { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.usuario span { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #ff8a5c); color: #fff; display: grid; place-items: center; font: 700 13px var(--f-display); }
.usuario b { font-weight: 600; font-size: 13px; }
#b-actualizar.girando svg { animation: giro .9s linear infinite; }

main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.vista { animation: aparecer .35s ease both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } }

/* ---------- tarjetas ---------- */
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sombra); min-width: 0; }
.tarjeta > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tarjeta h3 { margin: 0; font: 700 16px var(--f-display); letter-spacing: -.01em; }

/* ---------- resumen ---------- */
.saludo { display: flex; justify-content: space-between; align-items: end; margin: 6px 0 18px; }
.saludo h1 { font: 800 34px/1.05 var(--f-display); letter-spacing: -.03em; margin: 0 0 4px; }
.saludo p { margin: 0; }
.tarjetas-fuente { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.t-fuente {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center;
  padding: 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sombra);
}
.t-fuente::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.t-fuente .anillo { position: relative; width: 150px; height: 150px; }
.t-fuente .anillo svg { width: 150px; height: 150px; transform: rotate(-90deg); stroke-linecap: butt; }
.t-fuente .anillo .centro { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.t-fuente .anillo .centro b { display: block; font: 800 34px/1 var(--f-display); letter-spacing: -.03em; }
.t-fuente .anillo .centro small { color: var(--ink-3); font-size: 11.5px; }
.t-fuente h2 { margin: 0 0 4px; font: 700 22px var(--f-display); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.t-fuente .cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 16px; }
.cifra { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.cifra b { display: block; font: 700 22px/1.1 var(--f-display); }
.cifra span { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.cifra span::before { content: ''; width: 8px; height: 8px; border-radius: 3px; background: var(--k); }
.t-fuente .error-fuente { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 12px; font-size: 13px; margin: 10px 0; }
.rejilla-resumen { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.rejilla-resumen .ancha { grid-column: 1 / -1; }
.g-dias { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.g-dias .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; height: 100%; position: relative; min-width: 0; cursor: default; }
.g-dias .col i { display: block; border-radius: 3px; min-height: 0; }
.g-dias .col:hover::after {
  content: attr(data-t); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11.5px; padding: 5px 8px; border-radius: 8px; white-space: pre; z-index: 2; pointer-events: none;
}
.g-dias-ejes { display: flex; justify-content: space-between; font: 11px var(--f-mono); color: var(--ink-3); margin-top: 6px; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.g-tecnicos { display: grid; gap: 10px; max-height: 260px; overflow: auto; padding-right: 4px; }
.g-tec { display: grid; grid-template-columns: minmax(0, 150px) 1fr 34px; gap: 10px; align-items: center; font-size: 12.5px; }
.g-tec .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.g-tec .barra-h { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.g-tec .barra-h i { display: block; height: 100%; }
.g-tec b { font: 600 12px var(--f-mono); text-align: right; }
.actividad { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.actividad li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; cursor: pointer; }
.actividad li:hover { background: var(--surface-2); }
.actividad .que { min-width: 0; }
.actividad .que b { font-weight: 600; }
.actividad .que small { display: block; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actividad .estado { min-width: 96px; justify-content: center; }
.actividad time { font: 12px var(--f-mono); color: var(--ink-3); }
.vacio { padding: 26px; text-align: center; color: var(--ink-3); }

/* ---------- estado (chips y sellos) ---------- */
.estado { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado.pendiente { background: var(--wait-soft); color: #94600a; }
.estado.aprobado { background: var(--ok-soft); color: #0b7a50; }
.estado.rechazado { background: var(--bad-soft); color: #b8292f; }
.marca { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.marca.alerta { background: #fff4e0; border-color: #f6d9a4; color: #8a5800; }
.marca.cx { color: var(--cx); } .marca.tv { color: var(--tv); }
.marca.exito { background: #e3f4f2; border-color: #bfe3de; color: #0a7a71; }
.marca.fallo { background: #fdebe7; border-color: #f6c8bf; color: #c2412c; }

/* ---------- Survey123 ---------- */
.estado.survey_subido { background: var(--accent-soft); color: var(--accent); }
.estado.survey_pendiente { background: var(--surface-2); color: var(--ink-3); }
.chip-survey {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1.5px dashed var(--line-2);
}
.chip-survey svg { width: 14px; height: 14px; }
.chip-survey.subido { color: var(--accent); background: var(--accent-soft); border: 1.5px solid #d9ccff; }
.chip-survey.mini { height: 20px; padding: 0 7px; font-size: 11px; }
.chip-survey.mini svg { width: 12px; height: 12px; }
.survey-caja p { margin: -4px 0 12px; font-size: 13px; }
.survey-caja .btn { width: 100%; }
.survey-caja.subido { border-color: #d9ccff; background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.btn.btn-survey { background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent); height: 44px; }
.btn.btn-survey:hover { background: var(--accent); color: #fff; }
.btn.btn-survey kbd { background: var(--accent-soft); border-color: #d9ccff; color: var(--accent); }
.btn.btn-survey:hover kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: #fff; }
.survey-linea { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: center; margin: -4px 0 14px; font-size: 12.5px; color: var(--ink-2); }
.survey-linea svg { width: 16px; height: 16px; color: var(--accent); }
.survey-linea b { font-weight: 600; color: var(--ink); }
.barra-s { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.barra-s i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- vista de revisión ---------- */
.revisar { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.cola {
  position: sticky; top: 76px; height: calc(100vh - 96px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sombra); overflow: hidden;
}
.cola-cabeza { padding: 14px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.segmentos { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.segmentos button { flex: 1; border: 0; background: none; height: 32px; border-radius: 9px; padding: 0 8px; cursor: pointer; font-weight: 550; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.segmentos button b { font: 600 11px var(--f-mono); opacity: .7; margin-left: 2px; }
.segmentos button.activo { background: var(--ink); color: #fff; }
.cola-cabeza > * { min-width: 0; }
.estados { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.estados button { height: 46px; padding: 0 4px; display: grid; align-content: center; gap: 1px; font-size: 11.5px; line-height: 1.1; }
.estados button b { font: 700 16px var(--f-display); opacity: 1; margin: 0; }
.estados button[data-v="pendiente"].activo { background: var(--wait); }
.estados button[data-v="aprobado"].activo { background: var(--ok); }
.estados button[data-v="rechazado"].activo { background: var(--bad); }
.buscar { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); }
.buscar input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); height: 100%; }
.buscar:focus-within { border-color: var(--accent); }
.cola-filtros { display: flex; gap: 8px; }
.cola-filtros > * { flex: 1; min-width: 0; }
select, .fecha input {
  height: 36px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; min-width: 0; cursor: pointer;
}
.fecha { display: grid; gap: 3px; font-size: 11px; color: var(--ink-3); font-weight: 550; }
.fecha input { width: 100%; font-size: 12.5px; }
.cola-lista { flex: 1; overflow-y: auto; padding: 8px; scroll-padding: 8px; }
.item {
  position: relative; display: grid; gap: 4px; padding: 12px 12px 12px 16px; border-radius: 14px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.item::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--e); }
.item:hover { background: var(--surface-2); }
.item.sel { background: var(--accent-soft); border-color: #d9ccff; }
.item .fila1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item .fila1 b { font: 600 14px var(--f-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .fila1 time { font: 11.5px var(--f-mono); color: var(--ink-3); flex: none; }
.item .usu { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .fila3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }
.item .fila3 .tec { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .fotos-n { display: inline-flex; align-items: center; gap: 3px; font-family: var(--f-mono); }
.item .fotos-n svg { width: 13px; height: 13px; }

/* expediente */
.expediente { min-width: 0; }
.vacio-expediente { display: grid; place-items: center; text-align: center; padding: 80px 20px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); min-height: 60vh; align-content: center; }
.vacio-expediente svg { width: 110px; height: 110px; stroke: var(--accent-2); stroke-width: 3; opacity: .7; }
.vacio-expediente h3 { font: 700 20px var(--f-display); margin: 14px 0 6px; }
.exp-cabeza {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px 22px; box-shadow: var(--sombra);
  display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
}
.exp-cabeza .volver { display: none; }
.exp-cabeza h2 { margin: 6px 0 4px; font: 800 28px/1.05 var(--f-display); letter-spacing: -.025em; }
.exp-cabeza .sub { color: var(--ink-2); }
.exp-cabeza .marcas { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.exp-cabeza .id { font: 500 12px var(--f-mono); color: var(--ink-3); }
.exp-nav { display: flex; gap: 6px; align-items: center; }
.exp-nav span { font: 12px var(--f-mono); color: var(--ink-3); margin-right: 4px; }
.sello-grande {
  position: absolute; right: 28px; top: 50%; translate: 0 -50%; rotate: -10deg; pointer-events: none;
  font: 800 26px var(--f-display); letter-spacing: .14em; padding: 8px 18px; border: 4px solid currentColor; border-radius: 12px; opacity: .17;
}
.sello-grande::after { content: ''; position: absolute; inset: 3px; border: 2px solid currentColor; border-radius: 7px; }
.sello-grande.aprobado { color: var(--ok); } .sello-grande.rechazado { color: var(--bad); }
.sello-grande.golpe { animation: golpe .55s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes golpe { 0% { opacity: 0; scale: 2.2; } 60% { opacity: .5; scale: .94; } 100% { opacity: .17; scale: 1; } }

.exp-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; }
.exp-principal { display: grid; gap: 16px; min-width: 0; }
.exp-lateral { display: grid; gap: 16px; position: sticky; top: 76px; }
.grupo-fotos { display: grid; gap: 16px; }
.fotos-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.foto {
  position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
  cursor: zoom-in; padding: 0; display: block; width: 100%;
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s, transform .4s; }
.foto img.lista { opacity: 1; }
.foto:hover img { transform: scale(1.04); }
.foto .etq {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; text-align: left;
  background: linear-gradient(transparent, rgba(15, 12, 30, .78)); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.25;
}
.foto .etq small { display: block; font-weight: 400; opacity: .8; font-size: 11px; }
.foto .falla { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10px; color: var(--ink-3); font-size: 12px; }
.foto .esqueleto { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%) var(--surface-2); background-size: 220% 100%; animation: brillo 1.2s linear infinite; }
@keyframes brillo { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.foto .esq-estado { position: absolute; top: 8px; right: 8px; }
.sin-fotos { color: var(--ink-3); padding: 10px 0; }

.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 18px; margin: 0; }
.datos div { padding: 9px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.datos dt { font-size: 11.5px; color: var(--ink-3); font-weight: 550; margin-bottom: 2px; }
.datos dd { margin: 0; font-weight: 550; word-break: break-word; white-space: pre-line; }
.datos dd.vacio-dato { color: var(--line-2); }
.datos .largo { grid-column: 1 / -1; }

.mapa { height: 220px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); z-index: 0; }
.ubic-pie { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }

/* panel de decisión */
.decision { border: 1px solid var(--line); }
.decision h3 { margin-bottom: 4px; }
.decision textarea {
  width: 100%; min-height: 92px; resize: vertical; border-radius: 14px; border: 1px solid var(--line-2); padding: 10px 12px; background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.decision textarea:focus { outline: 0; border-color: var(--accent); background: var(--surface); }
.decision textarea.falta { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); animation: temblor .35s; }
@keyframes temblor { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
.motivos { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.motivos button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; height: 28px; padding: 0 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.motivos button:hover { border-color: var(--bad); color: var(--bad); }
.botones-decision { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.btn.aprobar { background: var(--ok); color: #fff; height: 46px; box-shadow: 0 8px 18px -10px var(--ok); }
.btn.aprobar:hover { background: #0b8a59; }
.btn.rechazar { background: var(--bad); color: #fff; height: 46px; box-shadow: 0 8px 18px -10px var(--bad); }
.btn.rechazar:hover { background: #c93a40; }
.btn kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: #fff; }
.decision .pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.ultima { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.ultima b { color: var(--ink); }
.linea-tiempo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.linea-tiempo li { position: relative; font-size: 12.5px; }
.linea-tiempo li::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--e); border: 2px solid var(--surface); }
.linea-tiempo time { display: block; font: 11.5px var(--f-mono); color: var(--ink-3); }
.linea-tiempo p { margin: 2px 0 0; color: var(--ink-2); white-space: pre-line; }

/* ---------- evidencias ---------- */
.filtros-linea { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtros-linea .segmentos { flex: none; }
.filtros-linea .buscar { flex: 1; min-width: 200px; max-width: 360px; }
.filtros-linea select { height: 38px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.galeria .foto { aspect-ratio: 1; }
.galeria .foto .etq small.fuente-cx::before, .galeria .foto .etq small.fuente-tv::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.galeria .foto .etq small.fuente-cx::before { background: var(--cx); }
.galeria .foto .etq small.fuente-tv::before { background: var(--tv); }

/* ---------- historial ---------- */
.tabla-caja { padding: 0; overflow: auto; max-height: calc(100vh - 170px); }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover td { background: var(--surface-2); }
.tabla td.mono { font: 12px var(--f-mono); white-space: nowrap; }
.tabla td.obs { max-width: 320px; white-space: pre-line; color: var(--ink-2); }

/* ---------- visor ---------- */
.visor { position: fixed; inset: 0; z-index: 60; background: #0d0b17; display: grid; grid-template-rows: auto 1fr auto; color: #fff; animation: aparecer .2s ease both; }
.visor-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.visor-titulo b { font: 700 17px var(--f-display); display: block; }
.visor-titulo span { font-size: 12.5px; opacity: .65; }
.visor-botones { display: flex; gap: 6px; flex-wrap: wrap; }
.visor-lienzo { position: relative; overflow: hidden; display: grid; place-items: center; touch-action: none; cursor: grab; }
.visor-lienzo.arrastrando { cursor: grabbing; }
.visor-lienzo img { max-width: 100%; max-height: 100%; user-select: none; -webkit-user-drag: none; transition: transform .18s ease-out; will-change: transform; }
.visor-lienzo.arrastrando img { transition: none; }
.visor-carga { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.visor-flecha { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center; }
.visor-flecha:hover { background: rgba(255,255,255,.18); }
.visor-flecha.izq { left: 16px; } .visor-flecha.der { right: 16px; }
.visor-flecha svg { width: 22px; height: 22px; }
.visor-tira { display: flex; gap: 8px; padding: 12px 16px 16px; overflow-x: auto; justify-content: safe center; }
.visor-tira button { flex: none; width: 72px; height: 54px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: rgba(255,255,255,.06); cursor: pointer; opacity: .55; transition: opacity .15s, border-color .15s; }
.visor-tira button.activa { border-color: var(--accent-2); opacity: 1; }
.visor-tira img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- avisos ---------- */
.avisos { position: fixed; bottom: 20px; left: 50%; translate: -50% 0; z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.aviso { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 14px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); font-weight: 550; animation: aparecer .25s ease both; pointer-events: auto; max-width: calc(100vw - 32px); }
.aviso.error { background: var(--bad); }
.aviso.ok { background: var(--ok); }

/* ---------- agenda (técnico × día) ---------- */
.ag-cabeza { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 6px 0 16px; }
.ag-titulo { font: 800 34px/1.05 var(--f-display); letter-spacing: -.03em; margin: 0 0 4px; }
.ag-cabeza p { margin: 0; }
.ag-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ag-nav .segmentos { margin-left: 6px; }
.ag-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ag-kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.ag-kpi > .ico { width: 38px; height: 38px; padding: 9px; border-radius: 12px; stroke-width: 2.4; flex: none; background: var(--k-bg); color: var(--k); }
.ag-kpi b { display: block; font: 800 24px/1 var(--f-display); letter-spacing: -.02em; }
.ag-kpi span { font-size: 12.5px; color: var(--ink-2); }
.ag-kpi.total { --k: var(--accent); --k-bg: var(--accent-soft); }
.ag-kpi.aprobado { --k: var(--ok); --k-bg: var(--ok-soft); }
.ag-kpi.rechazado { --k: var(--bad); --k-bg: var(--bad-soft); }
.ag-kpi.pendiente { --k: var(--wait); --k-bg: var(--wait-soft); }
.ag-kpi.tecnicos { --k: var(--ink-2); --k-bg: var(--surface-2); }

.ag-caja { padding: 0; overflow: hidden; }
.ag-scroll { overflow: auto; max-height: calc(100vh - 330px); min-height: 220px; }
.agenda { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.agenda th, .agenda td { padding: 0; }
.agenda thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.agenda tfoot th, .agenda tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); border-top: 1px solid var(--line); }
.agenda .tec { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 250px; max-width: 280px; border-right: 1px solid var(--line); }
.agenda thead .tec, .agenda tfoot .tec { z-index: 3; }
.agenda .esquina, .agenda tfoot .tec { padding: 12px 18px; font-size: 12px; font-weight: 600; color: var(--ink-3); vertical-align: bottom; }
.agenda tfoot td { text-align: center; font: 600 12px var(--f-mono); color: var(--ink-2); padding: 10px 0; }
.agenda tfoot .tec { background: var(--surface-2); }

/* encabezado de días */
.agenda th.dia { min-width: 52px; padding: 10px 2px 9px; text-align: center; font-weight: 400; transition: background .15s; }
.agenda th.dia span { display: block; font: 600 10.5px var(--f-mono); letter-spacing: .06em; color: var(--ink-3); }
.agenda th.dia b { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-top: 2px; border-radius: 10px; font: 700 17px var(--f-display); color: var(--ink); }
.agenda th.dia.domingo span, .agenda th.dia.domingo b { color: var(--ink-3); }
.agenda th.dia.hoy b { background: var(--accent); color: #fff; box-shadow: 0 6px 14px -6px var(--accent); }
.agenda th.dia.hoy span { color: var(--accent); }
.agenda th.dia.foco { background: var(--accent-soft); }
.agenda .lunes { border-left: 1px dashed var(--line-2); }

/* filas */
.agenda tbody tr:hover .tec, .agenda tbody tr:hover td { background: var(--surface-2); }
.agenda tbody td { text-align: center; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.agenda tbody .tec { border-bottom: 1px solid var(--line); }
.agenda tbody td.hoy { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.tec-caja { display: flex; align-items: center; gap: 11px; padding: 10px 16px; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  font: 700 13px var(--f-display); color: hsl(var(--h) 45% 32%); background: hsl(var(--h) 70% 93%); border: 1px solid hsl(var(--h) 50% 84%);
}
.tec-txt { min-width: 0; display: grid; gap: 2px; }
.tec-txt b { font: 600 13.5px var(--f-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tec-txt small { color: var(--ink-3); font-size: 11.5px; display: flex; align-items: center; gap: 4px; font-weight: 400; }
.alertas { display: flex; gap: 4px; flex-wrap: wrap; }
.ag-alerta { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.ag-alerta.rechazado { background: var(--bad-soft); color: #b8292f; }
.ag-alerta.pendiente { background: var(--wait-soft); color: #8a5800; }
.agenda td.total { min-width: 74px; padding: 6px 14px; border-left: 1px solid var(--line); text-align: right; }
.agenda td.total b { font: 700 15px var(--f-display); display: block; }
.agenda td.total .mb { position: static; display: flex; height: 4px; margin-top: 4px; }

/* celda tipo sello: número + símbolo + reparto */
.celda {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 46px; padding: 0;
  border-radius: 13px; border: 1.5px solid; font: 700 16px var(--f-display); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.celda:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -10px currentColor; }
.celda:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.celda b { font: inherit; margin-top: -4px; }
.celda .ico { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; stroke-width: 3; }
.celda .mb { position: absolute; left: 7px; right: 7px; bottom: 6px; height: 3px; display: flex; gap: 1px; border-radius: 2px; overflow: hidden; }
.mb i { display: block; height: 100%; }
.mb i.aprobado { background: var(--ok); } .mb i.rechazado { background: var(--bad); } .mb i.pendiente { background: var(--wait); }
.celda.aprobado { background: var(--ok-soft); border-color: #b5e4cf; color: #0b7a50; }
.celda.pendiente { background: var(--wait-soft); border-color: #f1d49c; color: #8a5800; }
.celda.rechazado { background: var(--bad-soft); border-color: #f5bcbe; color: #b8292f; }
.celda.vacia { border: 1.5px dashed transparent; color: var(--line-2); cursor: default; font-size: 20px; background: none; }
.celda.vacia:hover { transform: none; box-shadow: none; }
.ag-leyenda { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.ag-leyenda > span { display: inline-flex; align-items: center; gap: 7px; }
.celda.mini { width: 22px; height: 22px; border-radius: 7px; font-size: 13px; cursor: default; }
.celda.mini .ico { position: static; width: 12px; height: 12px; }
.celda.mini:hover { transform: none; box-shadow: none; }
.celda.mini.vacia { border-color: var(--line-2); }
.agenda td.vacio { padding: 40px; }

/* panel del día */
.ag-panel { position: fixed; inset: 0; z-index: 55; }
.ag-velo { position: absolute; inset: 0; background: rgba(23, 21, 31, .32); animation: aparecer .2s ease both; }
.ag-hoja {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100% - 24px)); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px; box-shadow: 0 30px 60px -20px rgba(23, 21, 31, .4); animation: entrarDer .25s cubic-bezier(.3,.8,.3,1) both;
}
@keyframes entrarDer { from { transform: translateX(30px); opacity: 0; } }
.ag-hoja header { display: flex; justify-content: space-between; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.ag-hoja header small { color: var(--ink-3); font-size: 12px; }
.ag-hoja h3 { margin: 4px 0 10px; font: 700 21px var(--f-display); letter-spacing: -.02em; }
.ag-p-resumen { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-p-lista { flex: 1; overflow-y: auto; padding: 10px; display: grid; align-content: start; gap: 6px; }
.ag-reg {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; text-align: left; width: 100%;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  border-left: 4px solid var(--e); transition: background .15s, border-color .15s;
}
.ag-reg:hover { background: var(--surface-2); border-color: var(--line-2); border-left-color: var(--e); }
.ag-reg-hora { font: 500 12px var(--f-mono); color: var(--ink-3); }
.ag-reg-txt { min-width: 0; display: grid; gap: 2px; }
.ag-reg-txt b { font: 600 14px var(--f-display); }
.ag-reg-txt small { color: var(--ink-3); font-size: 12px; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-reg-txt small.obs { color: var(--ink-2); font-style: italic; white-space: normal; }

@media (max-width: 1100px) { .ag-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .ag-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-kpi.total { grid-column: 1 / -1; }
  .agenda .tec { min-width: 150px; max-width: 170px; }
  .tec-caja { padding: 8px 10px; gap: 8px; }
  .avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }
  .alertas { display: none; }
  .ag-scroll { max-height: none; }
  .ag-hoja { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 85vh; border-radius: 22px 22px 0 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .exp-cuerpo { grid-template-columns: 1fr; }
  .exp-lateral { position: static; }
}
@media (max-width: 1100px) {
  .barra { flex-wrap: wrap; }
  .pestanas { order: 3; width: 100%; margin: 0; }
  .barra-acciones { margin-left: auto; }
  .tarjetas-fuente, .rejilla-resumen { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  main { padding: 14px 12px; }
  .login { grid-template-columns: 1fr; }
  .login-arte { min-height: 300px; padding: 28px 22px; }
  .sello { font-size: 20px !important; }
  .revisar { grid-template-columns: 1fr; }
  .cola { position: static; height: calc(100vh - 150px); }
  .revisar.con-registro .cola { display: none; }
  .revisar:not(.con-registro) .expediente { display: none; }
  .exp-cabeza .volver { display: inline-flex; }
  .exp-cabeza h2 { font-size: 23px; }
  .sello-grande { display: none; }
  .t-fuente { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .t-fuente h2 { justify-content: center; }
  .t-fuente > div:last-child { width: 100%; }
  .barra-marca small, .usuario b, #leido { display: none; }
  .fotos-grilla { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .galeria { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .visor-flecha { display: none; }
  .filtros-linea .buscar { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
