/* ============ Braymar · Control de maquinaria ============ */

:root {
  /* Azul del logo (oct 2026). Botones con letra blanca: contraste 5.3:1 (claro) y 4.9:1 (oscuro) */
  --accent: #1f6fb2;
  --accent-fuerte: #1a5f99;
  --accent-suave: #e3eef9;
  --tinta-accent: #ffffff;

  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --texto: #15181d;
  --muted: #646b76;
  --borde: #e1e4e9;

  --rojo: #c8282e;
  --rojo-suave: #fde8e8;
  --ambar: #9a5b00;
  --ambar-suave: #fff0d4;
  --verde: #1b7f45;
  --verde-suave: #e2f4e9;
  --gris-suave: #eceef2;

  --radio: 14px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --sombra-alta: 0 12px 40px rgba(16, 24, 40, .22);
  --sidebar: 244px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2b74b5;
    --accent-fuerte: #6cb4ec;
    --accent-suave: #13283d;
    --bg: #0e1014;
    --surface: #171a20;
    --surface-2: #1e222a;
    --texto: #e9ebee;
    --muted: #9aa1ac;
    --borde: #2a2f39;
    --rojo: #ff6b6f;
    --rojo-suave: #3d1719;
    --ambar: #ffb547;
    --ambar-suave: #3b2a0c;
    --verde: #4cc985;
    --verde-suave: #11301f;
    --gris-suave: #252a33;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
    --sombra-alta: 0 16px 48px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; } /* sin zoom por doble toque: los toques rápidos cuentan todos */
body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.modal-abierto { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
main:focus { outline: none; }

.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  min-height: 56px;
  padding: calc(8px + var(--safe-t)) 12px 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--borde);
}
/* (sin desenfoque detrás del encabezado: en celulares sencillos hace lento el desplazamiento) */
.topbar h1 {
  flex: 1; min-width: 0;
  font-size: 19px; font-weight: 750; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#btn-atras { margin-left: -8px; }
.top-acciones { display: flex; gap: 4px; align-items: center; }

main {
  max-width: 1120px; margin: 0 auto;
  padding: 16px 16px calc(100px + var(--safe-b));
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--borde);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar a .ic { width: 23px; height: 23px; }
.tabbar a.activo { color: var(--texto); }
.tabbar a.activo .ic { color: var(--accent-fuerte); stroke-width: 2.2; }
.tabbar .fab {
  justify-self: center;
  width: 54px; height: 54px; margin-top: -24px; margin-bottom: 4px;
  border: 4px solid var(--bg); border-radius: 50%;
  background: var(--accent); color: var(--tinta-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
  cursor: pointer;
}
.tabbar .fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 18px;
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--borde);
  }
  .marca { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
  .marca img { border-radius: 9px; }
  .marca strong { display: block; font-size: 16px; line-height: 1.2; }
  .marca small { color: var(--muted); font-size: 12px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    font-weight: 600; color: var(--muted);
  }
  .side-nav a:hover { background: var(--surface-2); color: var(--texto); }
  .side-nav a.activo { background: var(--accent-suave); color: var(--texto); }
  .side-nav a.activo .ic { color: var(--accent-fuerte); }
  .side-cta { margin-top: auto; }
  .contenido { margin-left: var(--sidebar); }
  .topbar { padding: 14px 32px; min-height: 64px; }
  .topbar h1 { font-size: 22px; }
  main { padding: 24px 32px 56px; }
  .tabbar { display: none; }
  .solo-movil { display: none !important; }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--borde); border-radius: 11px;
  background: var(--surface); color: var(--texto);
  font-weight: 650; font-size: 15px; white-space: nowrap;
  cursor: pointer; transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--tinta-accent); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn.peligro { color: var(--rojo); }
.btn-peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; background: transparent; cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon .ic { width: 22px; height: 22px; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tarjetas y secciones ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}
.card-pad { padding: 16px; }
.seccion { margin-top: 24px; }
.seccion-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.seccion-head h2 { font-size: 17px; font-weight: 750; }
.lista { display: grid; gap: 10px; }
@media (min-width: 700px) and (max-width: 899px), (min-width: 1180px) { .lista.dos { grid-template-columns: 1fr 1fr; } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-vencido { background: var(--rojo-suave); color: var(--rojo); }
.b-proximo { background: var(--ambar-suave); color: var(--ambar); }
.b-ok { background: var(--verde-suave); color: var(--verde); }
.b-sin { background: var(--gris-suave); color: var(--muted); }
.b-nota { background: var(--accent-suave); color: var(--accent-fuerte); }
.t-vencido { color: var(--rojo); }
.t-proximo { color: var(--ambar); }
.t-ok { color: var(--verde); }
.t-sin { color: var(--muted); }

/* ---------- Estadísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.rojo b { color: var(--rojo); }
.stat.ambar b { color: var(--ambar); }
a.stat:hover { border-color: var(--accent); }

/* ---------- Tarjeta de máquina ---------- */
.mcard {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  padding: 12px;
}
a.mcard:hover, a.scard:hover, .pend:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--borde)); }
.thumb {
  width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
  background: var(--accent-suave); color: var(--accent-fuerte);
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ic { width: 32px; height: 32px; stroke-width: 1.6; }
.mcard-titulo { font-weight: 700; font-size: 16px; line-height: 1.25; }
.eco { color: var(--muted); font-weight: 600; font-size: 13px; }
.codigo {
  display: inline-block; margin-bottom: 3px; padding: 1px 8px; border-radius: 6px;
  background: var(--texto); color: var(--bg); font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.mcard .muted { font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta .ic { width: 15px; height: 15px; }
@media (max-width: 480px) {
  .mcard { grid-template-columns: 56px 1fr; }
  .mcard .thumb { width: 56px; height: 56px; }
  .mcard > .badge { grid-column: 2; justify-self: start; margin-top: -4px; }
}

/* ---------- Pendientes ---------- */
.pend { padding: 12px 14px; display: block; }
.pend-head { display: flex; align-items: center; gap: 10px; }
.pend-head .thumb { width: 42px; height: 42px; border-radius: 10px; }
.pend-head .thumb .ic { width: 22px; height: 22px; }
.pend-head > div:not(.thumb) { flex: 1; min-width: 0; }
.pend ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.pend li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.pend li .punto { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); background: currentColor; }
.pend li b { font-weight: 650; }

/* ---------- Tarjeta de servicio ---------- */
.scard { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.sfecha {
  text-align: center; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--borde); padding: 5px 0; line-height: 1.1;
}
.sfecha b { display: block; font-size: 20px; font-weight: 800; }
.sfecha span { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.scard-titulo { font-weight: 700; }
.scard .muted { font-size: 13px; }
.costo { font-weight: 700; white-space: nowrap; }

/* ---------- Detalle de máquina ---------- */
.hero { display: grid; gap: 16px; padding: 16px; }
@media (min-width: 700px) { .hero { grid-template-columns: 260px 1fr; padding: 20px; } }
.hero-foto {
  aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: var(--accent-suave); color: var(--accent-fuerte);
  display: flex; align-items: center; justify-content: center; cursor: zoom-in;
}
.hero-foto.vacia { cursor: default; }
.hero-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-foto .ic { width: 64px; height: 64px; stroke-width: 1.2; }
.hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 12px; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv-ficha { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 0; }
.kv-ficha dt { text-transform: none; letter-spacing: 0; }
.horo {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--borde);
}
.horo-valor { display: flex; align-items: center; gap: 8px; }
.horo-valor b { font-size: 22px; font-weight: 800; }
.horo-valor .ic { color: var(--accent-fuerte); width: 24px; height: 24px; }
.horo .prox { flex: 1; min-width: 180px; font-size: 14px; }
.notas-maquina { margin-top: 12px; white-space: pre-wrap; font-size: 14px; color: var(--muted); }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 20px -16px 14px; padding: 0 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--borde);
  font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer;
}
.tab .ic { width: 17px; height: 17px; }
.tab .cuenta {
  background: var(--gris-suave); color: var(--muted);
  padding: 0 7px; border-radius: 999px; font-size: 12px; line-height: 18px;
}
.tab.activo { background: var(--texto); color: var(--bg); border-color: var(--texto); }
.tab.activo .cuenta { background: var(--accent); color: var(--tinta-accent); }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-titulo { display: none; }

.comp { padding: 14px; cursor: pointer; display: grid; gap: 8px; }
.comp:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--borde)); }
.comp-top { display: flex; align-items: flex-start; gap: 12px; }
.comp-top > div:not(.cant) { flex: 1; min-width: 0; }
.comp-titulo { font-weight: 700; font-size: 15.5px; }
.comp-sub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.comp-sub b { color: var(--texto); font-weight: 700; }
.cant {
  flex: none; padding: 4px 10px; border-radius: 9px;
  background: var(--accent-suave); color: var(--texto);
  font-weight: 800; font-size: 15px; white-space: nowrap;
}
.comp-pie {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center;
  font-size: 13px; color: var(--muted);
  padding-top: 8px; border-top: 1px dashed var(--borde);
}
.comp-pie .estado-txt { font-weight: 650; }
.comp-notas { font-size: 13px; color: var(--muted); white-space: pre-wrap; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.mitad { grid-column: auto; }
.field label, .etiqueta { font-size: 13px; font-weight: 700; color: var(--muted); }
.field label .req { color: var(--rojo); }
input, select, textarea {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--borde); border-radius: 10px;
  background: var(--surface); color: var(--texto);
  font: inherit; font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent-fuerte); flex: none; }
input[type="date"] { -webkit-appearance: none; appearance: none; }
.ayuda { font-size: 12.5px; color: var(--muted); }
.form-card { padding: 18px; }
.form-card + .form-card { margin-top: 14px; }
.form-card h3 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.form-card h3 .ic { color: var(--accent-fuerte); }
.form-acciones {
  position: sticky; bottom: calc(76px + var(--safe-b)); z-index: 5;
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 16px; padding: 12px;
  background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra-alta);
}
@media (min-width: 900px) { .form-acciones { bottom: 16px; } }
.form-acciones .btn-primary { min-width: 140px; }
.input-sufijo { position: relative; }
.input-sufijo span {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.input-sufijo input { padding-right: 46px; }

.foto-picker { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.foto-prev {
  width: 120px; height: 90px; border-radius: 12px; overflow: hidden; flex: none;
  background: var(--accent-suave); color: var(--accent-fuerte);
  display: flex; align-items: center; justify-content: center;
}
.foto-prev img { width: 100%; height: 100%; object-fit: cover; }
.foto-prev .ic { width: 36px; height: 36px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.galeria .g-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.galeria img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria .quitar {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0, 0, 0, .65); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.galeria .quitar .ic { width: 16px; height: 16px; }
.btn-archivo { position: relative; overflow: hidden; }
.btn-archivo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.checklist { display: grid; gap: 6px; }
.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--surface-2);
}
.check-row.on { border-color: var(--accent); background: var(--accent-suave); }
.check-row label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.check-txt { display: flex; flex-direction: column; min-width: 0; }
.check-txt b { font-weight: 650; font-size: 14.5px; }
.check-txt small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.qty-in { width: 76px; min-height: 38px; padding: 6px 8px; text-align: right; flex: none; }
.unidad { font-size: 13px; color: var(--muted); width: 22px; flex: none; }
.check-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ---------- Buscador y filtros ---------- */
.buscador { position: relative; }
.buscador .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.buscador input { padding-left: 40px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 14px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--borde);
  font-size: 13.5px; font-weight: 650; color: var(--muted);
}
.chip.activo { background: var(--texto); color: var(--bg); border-color: var(--texto); }
.barra-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }

/* ---------- Detalle servicio ---------- */
.lista-simple { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lista-simple li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--borde);
  font-size: 14.5px;
}
.lista-simple li span:last-child { font-weight: 700; white-space: nowrap; }
.texto-largo { white-space: pre-wrap; }

/* ---------- Refacciones ---------- */
.ref { padding: 14px; display: grid; gap: 8px; }
.ref-top { display: flex; align-items: flex-start; gap: 12px; }
.ref-top > div:not(.ref-total) { flex: 1; min-width: 0; }
.ref-total { font-size: 20px; font-weight: 800; white-space: nowrap; }
.ref-usos { display: flex; flex-wrap: wrap; gap: 6px; }
.uso { font-size: 12.5px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--borde); }
.uso b { font-weight: 700; }

/* ---------- Vacíos ---------- */
.vacio { text-align: center; padding: 36px 20px; }
.vacio .ic-grande {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-suave); color: var(--accent-fuerte);
}
.vacio .ic-grande .ic { width: 38px; height: 38px; stroke-width: 1.5; }
.vacio h2 { font-size: 20px; margin-bottom: 6px; }
.vacio p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }
.vacio .fila-botones { justify-content: center; }
.vacio-mini { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }

.aviso {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 12px; background: var(--ambar-suave); color: var(--texto); font-size: 14px;
}
.aviso .ic { color: var(--ambar); }
.aviso > div { flex: 1; }

/* ---------- Avance de captura y diferencias ---------- */
.avance { display: grid; gap: 10px; padding: 14px 16px; margin-bottom: 14px; }
.avance b { display: block; }
.barra { height: 8px; border-radius: 999px; background: var(--gris-suave); overflow: hidden; }
.barra span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
a.aviso { color: var(--texto); }
.aviso-rojo { background: var(--rojo-suave); }
.aviso-rojo .ic { color: var(--rojo); }
.lista-dif { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.aplicar-modelo {
  align-items: flex-start; padding: 12px; border-radius: 10px; font-size: 14px;
  background: var(--accent-suave); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--borde));
}
.aplicar-modelo input { margin-top: 1px; }
.chips-empresa { margin-top: 0; }
.field[hidden] { display: none !important; }

/* ---------- Nube: sesión y sincronización ---------- */
.side-pie { margin-top: auto; display: grid; gap: 6px; padding: 0 8px; }
.side-pie + .side-cta { margin-top: 10px; }
.estado-nube {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.estado-nube::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.estado-nube.en-ok::before { background: var(--verde); }
.estado-nube.en-sync::before { background: var(--accent); animation: latido 1s infinite alternate; }
.estado-nube.en-off::before { background: var(--ambar); }
.estado-nube.en-error { color: var(--rojo); }
.estado-nube.en-error::before { background: var(--rojo); }
#vista > .estado-nube { margin-bottom: 12px; }
@keyframes latido { from { opacity: .35; } to { opacity: 1; } }
.ajuste-fila .estado-nube { display: flex; margin-top: 2px; }

body.sin-sesion .sidebar, body.sin-sesion .tabbar, body.sin-sesion .topbar { display: none; }
body.sin-sesion .contenido { margin-left: 0; }
.login { max-width: 420px; margin: 6vh auto 0; display: grid; gap: 16px; }
.login-marca { display: flex; align-items: center; gap: 12px; justify-content: center; }
.login-marca img { border-radius: 14px; }
.login-marca b { display: block; font-size: 20px; }
.login-marca span { font-size: 13px; }
.login .form-card h3 { font-size: 18px; }

.usuario-fila { display: grid; grid-template-columns: 44px 1fr minmax(180px, 240px); gap: 12px; align-items: center; padding: 12px; }
.usuario-controles { display: grid; gap: 6px; }
.nom-permisos { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; }
.nom-permisos .toggle { font-weight: 600; gap: 6px; }
.nom-permisos input { width: 18px; height: 18px; min-height: 0; }
.usuario-fila .thumb { width: 44px; height: 44px; }
.usuario-fila .thumb .ic { width: 22px; height: 22px; }
@media (max-width: 520px) {
  .usuario-fila { grid-template-columns: 44px 1fr; }
  .usuario-controles { grid-column: 1 / -1; grid-template-columns: 1fr auto; }
}
.comp.solo-lectura { cursor: default; }
.comp.solo-lectura:hover { border-color: var(--borde); }

/* ---------- Supervisión ---------- */
body.solo-consulta .tabbar { grid-template-columns: repeat(4, 1fr); }
.situacion { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--borde); }
.situacion .etiqueta { display: block; margin-bottom: 8px; }
.situacion-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; }
.situacion-grid > div { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

/* ---------- Bodega ---------- */
.bod-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.bod-botones .btn, .fila-botones .btn { white-space: normal; text-align: center; line-height: 1.2; min-width: 0; max-width: 100%; }
.bod-botones .btn { padding: 8px 10px; }
.btn-grande { min-height: 56px; font-size: 16px; border-radius: 14px; }
.bod-grupo { margin-top: 18px; }
.bod-grupo-tit { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 17px; margin: 0 0 6px; }
.bod-grupo-tit .ic { width: 20px; height: 20px; color: var(--accent-fuerte); }
.bod-grupo-tit .muted { font-weight: 500; margin-left: auto; }
.bod-grupo-tit .cuenta { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--accent-suave); color: var(--accent-fuerte); }
.bod-marca { margin-top: 10px; }
.bod-marca-tit { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 0 0 6px 2px; }
.bod-marca-tit .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.chips-chicas .chip { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.chips.chips-envolver { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.compra-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.compra-cant { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.compra-cant b { font-size: 16px; color: var(--accent-fuerte); }
.compra-motivos { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.compra-motivos:empty { display: none; }
.prod { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 12px; }
.prod .thumb { width: 52px; height: 52px; }
.prod .thumb .ic { width: 26px; height: 26px; }
.stock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; text-align: right; }
.stock b { font-size: 24px; font-weight: 800; }
.stock span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stock.grande b { font-size: 40px; }
.stock.grande { gap: 4px; }
.prod-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.prod-hero h2 { font-size: 22px; }
.item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 100px 120px auto; gap: 8px; align-items: start;
  padding: 10px 0; border-bottom: 1px dashed var(--borde);
}
.item-row:has([data-item-costo]) { grid-template-columns: minmax(0, 1fr) 90px 110px 100px auto; }
.item-row select[data-item-umed]:disabled { opacity: .8; }
.item-row .item-info { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.item-row .item-info.t-vencido { color: var(--rojo); font-weight: 650; }
.item-row .item-info.t-proximo { color: var(--ambar); font-weight: 650; }
@media (max-width: 560px) {
  .item-row { grid-template-columns: 1fr 1fr auto; }
  .item-row:has([data-item-costo]) { grid-template-columns: 1fr 1fr 1fr auto; }
  .item-row .item-prod { grid-column: 1 / -1; }
}
.firma-caja { position: relative; }
.firma-caja canvas {
  display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair;
  background: #fff; border: 2px dashed #c9ced6; border-radius: 12px;
}
.firma-caja .btn { position: absolute; right: 8px; bottom: 8px; }
.firma-img { background: #fff; border-radius: 10px; padding: 6px; display: inline-block; max-width: 100%; border: 1px solid var(--borde); }
.firma-img img { max-height: 140px; display: block; }
.anulado .scard-titulo, .anulado .muted, tr.anulado td { text-decoration: line-through; opacity: .65; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--borde); }
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla tr:last-child td { border-bottom: none; }
.tabla tr[data-href] { cursor: pointer; }
.tabla tr[data-href]:hover td { background: var(--surface-2); }
.tabla .der { text-align: right; white-space: nowrap; }
.card:has(> .tabla) { overflow-x: auto; }
.rep-titulo { font-size: 20px; }
a.tab { text-decoration: none; }
@media print {
  .reporte .seccion { break-inside: auto; }
  .tabla { font-size: 11px; }
  .tabla td, .tabla th { padding: 5px 6px; }
  .firma-img { border: 1px solid #ccc; }
}

/* ---------- Cotizaciones de renta ---------- */
.acceso { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px; }
.acceso > .ic:first-child { width: 26px; height: 26px; color: var(--accent-fuerte); flex: none; }
.acceso > div { flex: 1; min-width: 0; }
.acceso b { display: block; }
.acceso > .ic:last-child { color: var(--muted); }
.cot-titulo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cot-titulo h3 { margin-bottom: 0; }
.cot-item { padding: 12px 0 14px; border-top: 1px dashed var(--borde); }
.cot-item:first-child { border-top: none; padding-top: 0; }
.cot-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px; }
.cot-item-sub { margin-top: 8px; font-weight: 650; }
.cot-grid .field, .cot-extra .field { grid-column: auto; }
.cot-extra { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 90px 110px auto; gap: 8px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--borde); }
@media (max-width: 560px) {
  .cot-extra { grid-template-columns: 1fr 1fr auto; }
  .cot-extra .field:first-child { grid-column: 1 / -1; }
}
/* Usuarios agrupados por rol */
.usuarios-grupo { font-size: 15px; font-weight: 750; margin: 14px 2px 2px; }
.usuarios-grupo:first-child { margin-top: 0; }
/* Nómina: gente de cada encargado */
.nom-encargados { display: grid; gap: 6px; }
.nom-enc { border-radius: 10px; background: var(--surface-2); border: 1px solid var(--borde); }
.nom-enc summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; list-style: none; font-size: 14.5px; }
.nom-enc summary::-webkit-details-marker { display: none; }
.nom-enc summary::before { content: '›'; font-weight: 700; color: var(--muted); transition: transform .15s; margin-right: -4px; }
.nom-enc[open] summary::before { transform: rotate(90deg); }
.nom-enc-nombre { flex: 1; min-width: 0; }
.nom-enc-estado { font-weight: 700; white-space: nowrap; }
.nom-enc-gente { display: grid; border-top: 1px solid var(--borde); max-height: 420px; overflow-y: auto; }
.nom-enc-persona { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 12px 9px 28px;
  background: none; border: 0; border-bottom: 1px solid var(--borde); color: var(--texto); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.nom-enc-persona:last-child { border-bottom: 0; }
.nom-enc-persona:hover, .nom-enc-persona:focus-visible { background: var(--surface); }
.nom-enc-persona > span:last-child { white-space: nowrap; font-weight: 650; }
.nom-enc-nota { display: block; margin-top: 2px; color: var(--accent-fuerte); font-size: 12.5px; white-space: normal; }
.nom-nota-enc { margin: 0 0 12px; }
/* Buscador (máquinas y productos): se escribe en lugar de deslizar una lista larga */
.bus-resultados { margin-top: 6px; border: 1px solid var(--borde); border-radius: 10px; background: var(--surface); max-height: 320px; overflow-y: auto; }
.bus-opcion { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--borde); color: var(--texto); cursor: pointer; font: inherit; }
.bus-opcion:last-child { border-bottom: 0; }
.bus-opcion:hover, .bus-opcion:focus-visible { background: var(--surface-2); }
.bus-opcion small { color: var(--muted); font-size: 12.5px; }
.bus-elegido { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 6px 6px 6px 12px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent-suave); font-weight: 650; }
.bus-elegido span { min-width: 0; overflow-wrap: anywhere; }
.item-prod { min-width: 0; }
/* Cotización de materiales */
a.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.chip svg { width: 16px; height: 16px; }
.cot-pestanas { margin-top: 0; }
.mat-item, .mat-extra { display: grid; gap: 8px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--borde); }
.mat-item { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.mat-extra { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) auto; }
.mat-item .field, .mat-extra .field { grid-column: auto; }
@media (max-width: 560px) {
  .mat-item { grid-template-columns: 1fr 1fr auto; }
  .mat-item .field:first-child { grid-column: 1 / -1; }
  .mat-extra { grid-template-columns: 1fr auto; }
  .mat-extra .field:first-child { grid-column: 1 / -1; }
}
.mat-precios td { padding: 6px; vertical-align: middle; }
.mat-precios input:not([type=checkbox]) { min-height: 36px; padding: 6px 8px; min-width: 90px; }
.mat-precios input[type=number] { text-align: right; max-width: 120px; }
.mat-poblados td:first-child input { min-width: 170px; }
.mat-poblados td:nth-child(2) input { min-width: 70px; max-width: 80px; }
.mat-poblados td.der { white-space: nowrap; }
.cot-tot { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.cot-tot.grande { font-size: 19px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--borde); }
.cot-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.cot-card > div:first-child { flex: 1; }
.cot-card-der { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; white-space: nowrap; }
.cot-det-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cot-det-head h2 { font-size: 20px; }
.cot-total { text-align: right; }
.cot-total b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.cot-total span { font-size: 12px; color: var(--muted); }
.cot-estado { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cot-estado label { font-size: 13px; font-weight: 700; color: var(--muted); }
.cot-estado select { max-width: 220px; }
.cot-hojas { display: grid; gap: 16px; margin-top: 16px; }
.cot-hojas img { display: block; width: 100%; max-width: 860px; margin: 0 auto; background: #fff; border: 1px solid var(--borde); border-radius: 6px; box-shadow: var(--sombra); }
.cot-pick { display: grid; gap: 6px; }
.cot-pick .check-row[hidden] { display: none; }
@media print {
  #vista:has(.cot-hojas) > :not(.cot-hojas) { display: none !important; }
  .cot-hojas { margin: 0; gap: 0; }
  .cot-hojas img { max-width: none; border: none; border-radius: 0; box-shadow: none; break-after: page; }
  .cot-hojas img:last-child { break-after: auto; }
}

/* ---------- Evidencias de tramo ---------- */
body.rol-encargado [data-oculto-encargado], body.rol-rrhh [data-oculto-encargado], body.rol-vendedor [data-oculto-encargado] { display: none !important; }
.ev-obra { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ev-obra > .ic { width: 24px; height: 24px; color: var(--accent-fuerte); flex: none; }
.ev-obra > div { flex: 1; min-width: 0; }
.ev-obra b { display: block; }
.ev-fecha-chip { display: inline-flex; align-items: center; gap: 6px; }
.ev-fecha-chip input { border: none; background: transparent; padding: 0; min-height: 0; width: 120px; font: inherit; color: inherit; }
.ev-trabajo { padding: 12px 14px; }
.ev-trabajo-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 10px; }
.ev-trabajo-der { display: flex; align-items: center; gap: 4px; flex: none; }
.ev-trabajo-head .btn-icon, .ev-obra .btn-icon { width: 36px; height: 36px; }
.ev-etapas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ev-etapa { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--borde); min-width: 0; }
.ev-etapa-tit { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ev-etapa-tit span { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--tinta-accent); text-align: center; }
.ev-minis { display: flex; flex-wrap: wrap; gap: 4px; }
.ev-minis:empty { display: none; }
.ev-mini { position: relative; padding: 0; border: none; background: none; cursor: pointer; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; }
.ev-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-pend { position: absolute; right: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--ambar); border: 1.5px solid #fff; }
.ev-foto { width: 100%; justify-content: center; padding: 0 6px; }
.ev-grande { display: block; width: 100%; max-height: 60dvh; object-fit: contain; background: #000; border-radius: 10px; }
@media (max-width: 420px) {
  .ev-etapa { padding: 6px; }
  .ev-foto { font-size: 13px; }
}

/* Cámara a pantalla completa */
body.camara-abierta { overflow: hidden; }
/* Con la cámara abierta, la app de atrás no se dibuja (en celulares sencillos traba la cámara, sobre todo al girar) */
body.camara-abierta > :not(#ev-cam):not(#modal-root):not(#toast) { visibility: hidden; content-visibility: hidden; }
.ev-cam {
  position: fixed; inset: 0; z-index: 200; background: #000; color: #fff;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr);
  padding: calc(8px + var(--safe-t)) 10px calc(12px + var(--safe-b));
}
.ev-cam .btn-icon { color: #fff; }
.ev-cam-top { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; min-width: 0; }
.ev-cam-top .btn-icon { flex: none; }
.ev-cam-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-cam-titulo b, .ev-cam-titulo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-cam-titulo span { font-size: 12px; opacity: .75; }
.ev-gps { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.ev-gps.ok { background: #1f7a3a; }
.ev-gps.medio { background: #a26b00; }
.ev-gps.sin { background: #8a1c1c; }
.ev-cam-visor { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; touch-action: none; overflow: hidden; }
.ev-cam-marco { position: relative; width: 100%; height: 100%; max-width: 100%; max-height: 100%; overflow: hidden; border-radius: 8px; }
/* Los botones siempre encima: la imagen nunca debe taparlos */
.ev-cam-top, .ev-cam-etapas, .ev-cam-bottom { position: relative; z-index: 2; }
.ev-cam-marco video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; transform-origin: center; }
.ev-cam-abriendo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; opacity: .8; pointer-events: none; }
.ev-cam-abriendo[hidden] { display: none; }
/* Zoom: tocar cambia 1× → 2× → 3×; también se puede pellizcar la imagen */
.ev-zoom { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); min-width: 48px; min-height: 36px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .4); background: rgba(0, 0, 0, .55); color: #fff;
  font: 700 14px/1 Helvetica, Arial, sans-serif; cursor: pointer; }
.ev-zoom[hidden] { display: none; }
/* Marca de agua: solo letras blancas, abajo a la derecha (igual que en la foto guardada) */
.ev-marca {
  position: absolute; right: 2.6%; bottom: 2.6%; max-width: 94%; text-align: right; color: #fff;
  font: 500 12px/1.25 Helvetica, Arial, sans-serif; text-shadow: 0 0 .12em rgba(0, 0, 0, .45);
  pointer-events: none;
}
.ev-marca div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-marca .ev-marca-t { font-weight: 700; }
/* Celular de lado con la pantalla vertical: la marca se ve derecha para quien sostiene el celular */
.ev-marca.giro-izq { writing-mode: vertical-rl; right: auto; left: 2.6%; max-width: none; max-height: 94%; }
.ev-marca.giro-der { writing-mode: vertical-rl; transform: rotate(180deg); bottom: auto; top: 2.6%; max-width: none; max-height: 94%; }
.ev-giro { flex: none; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); color: #fff;
  font: 700 12px/1 Helvetica, Arial, sans-serif; padding: 6px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
/* Pantalla acostada (sin bloqueo de giro): cámara a la izquierda y botones a la derecha */
@media (orientation: landscape) and (max-height: 540px) {
  .ev-cam {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
    padding: calc(6px + var(--safe-t)) calc(10px + env(safe-area-inset-right, 0px)) calc(6px + var(--safe-b)) calc(10px + env(safe-area-inset-left, 0px));
  }
  .ev-cam-top { grid-column: 1 / -1; padding-bottom: 4px; }
  .ev-cam-visor { grid-column: 1; grid-row: 2 / 4; }
  .ev-cam-etapas { grid-column: 2; grid-row: 2; flex-direction: column; justify-content: center; padding: 0 0 0 10px; }
  .ev-cam-bottom { grid-column: 2; grid-row: 3; grid-template-columns: auto; justify-items: center; gap: 8px; padding-left: 10px; }
}
.ev-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.ev-flash.on { animation: evflash .25s ease-out; }
@keyframes evflash { from { opacity: .8; } to { opacity: 0; } }
.ev-cam-aviso { position: absolute; inset: 10%; display: flex; flex-direction: column; justify-content: center; gap: 12px; text-align: center; background: rgba(20, 20, 20, .92); border-radius: 14px; padding: 18px; }
.ev-cam-aviso[hidden] { display: none; }
.ev-cam-etapas { display: flex; justify-content: center; gap: 8px; padding: 10px 0 6px; }
.ev-cam-etapas .chip { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); font-weight: 700; }
.ev-cam-etapas .chip.activo { background: var(--accent); color: var(--tinta-accent); border-color: var(--accent); }
.ev-cam-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.ev-cam-ultima { position: relative; width: 52px; height: 52px; }
.ev-cam-ultima img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 2px solid #fff; }
.ev-cam-ultima b { position: absolute; right: -8px; top: -8px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: var(--tinta-accent); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.ev-disparador { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, .25); cursor: pointer; }
.ev-disparador:active { background: #fff; transform: scale(.95); }
.ev-listo { justify-self: end; }

/* ---------- Bitácora ---------- */
.bit-grupo { padding: 6px 14px 8px; margin-bottom: 12px; }
.bit-grupo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.bit-fila { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px dashed var(--borde); font-size: 14px; }
.bit-fila:last-child { border-bottom: none; }
.bit-ic { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.bit-ic .ic { width: 15px; height: 15px; }
.bit-ic.t-ok { color: var(--verde); background: var(--verde-suave); }
.bit-ic.t-proximo { color: var(--ambar); background: var(--ambar-suave); }
.bit-ic.t-vencido { color: var(--rojo); background: var(--rojo-suave); }
.bit-txt { min-width: 0; overflow-wrap: anywhere; }
.bit-hora { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bit-hora small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.bit-veces { display: inline-block; padding: 0 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--borde); font-size: 12px; font-weight: 700; }

/* ---------- Ajustes ---------- */
.ajuste-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--borde); }
.ajuste-fila:first-of-type { border-top: none; }
.ajuste-fila > div { min-width: 0; }
.ajuste-fila b { display: block; }
.instalar { display: grid; gap: 10px; }
.instalar div { padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--borde); font-size: 14px; }
.instalar b:first-child { display: block; margin-bottom: 2px; }

/* ---------- Modal ---------- */
.modal-fondo {
  position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 14, .5);
  animation: aparecer .15s ease-out;
}
.modal {
  position: fixed; z-index: 91; left: 0; right: 0; bottom: 0;
  max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: var(--sombra-alta);
  animation: subir .22s cubic-bezier(.2, .8, .2, 1);
}
.modal header { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 18px; border-bottom: 1px solid var(--borde); }
.modal header h3 { flex: 1; font-size: 17px; }
.modal-cuerpo { padding: 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal footer {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--borde);
}
.modal footer .izq { margin-right: auto; }
@media (max-width: 699px) {
  .modal footer { flex-wrap: nowrap; }
  .modal footer .btn { flex: 1 1 auto; padding: 0 10px; }
  .modal footer .btn.izq { margin-right: 0; }
  .modal footer:has(.izq) [data-action="cerrar-modal"] { display: none; }
  .hero-foto { aspect-ratio: 16 / 9; }
}
@media (min-width: 700px) {
  .modal {
    left: 50%; top: 50%; bottom: auto; right: auto; transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 32px)); max-height: 86vh; border-radius: 18px;
    animation: aparecer .15s ease-out;
  }
  .modal footer { padding-bottom: 12px; }
}
.modal.foto { background: #000; }
.modal.foto .modal-cuerpo { padding: 0; display: flex; align-items: center; justify-content: center; }
.modal.foto img { max-height: 80dvh; object-fit: contain; }
.hoja { display: grid; gap: 8px; }
.hoja button {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px; border-radius: 12px; border: 1px solid var(--borde); background: var(--surface-2); cursor: pointer;
}
.hoja button .ic { width: 24px; height: 24px; color: var(--accent-fuerte); }
.hoja button b { display: block; }
.hoja button small { color: var(--muted); }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Nómina ---------- */
.nom-pestanas { margin-top: 0; }
.nom-cabeza { margin-bottom: 14px; }
.nom-selector { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.nom-selector select { max-width: 320px; }
.nom-semana-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.nom-semana-nav > div { display: flex; flex-direction: column; min-width: 150px; text-align: center; }
.nom-semana-nav input[type=date] { width: auto; min-height: 36px; padding: 4px 8px; }
.nom-estado { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.nom-stats { margin-bottom: 14px; }
.nom-stats .stat b { font-size: 22px; }
.nom-h3 { font-size: 15px; margin: 0 0 10px; }
.nom-h4 { font-size: 14px; margin: 16px 0 10px; }
.nom-h3-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nom-h3-fila .nom-h3 { margin: 0; }
.nom-grupo { margin-bottom: 12px; overflow: hidden; }
.nom-grupo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 14px 8px; }
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nom-tabla { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.nom-tabla th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em;
  padding: 6px 8px; border-bottom: 1px solid var(--borde); white-space: nowrap; background: var(--surface-2); }
.nom-tabla td { padding: 7px 8px; border-bottom: 1px solid var(--borde); vertical-align: middle; white-space: nowrap; }
.nom-tabla tbody tr[data-action] { cursor: pointer; }
.nom-tabla tbody tr[data-action]:hover { background: var(--surface-2); }
.nom-tabla tbody tr.baja { opacity: .6; }
.nom-tabla .num { text-align: right; }
.nom-tabla .centro, .centro { text-align: center; }
.nom-tabla td small { display: block; font-size: 10.5px; color: var(--muted); }
.nom-tabla .dia { text-align: center; min-width: 30px; padding: 7px 3px; }
.nom-tabla .dia small { color: var(--accent-fuerte); font-weight: 700; }
.nom-tabla .dom { background: color-mix(in srgb, var(--accent-suave) 55%, transparent); }
.nom-nombre { min-width: 170px; white-space: normal !important; }
.nom-nombre b { display: block; }
.nom-nombre .muted { display: block; }
.nom-nombre .badge { margin: 3px 4px 0 0; }
.nom-gran-total { font-weight: 800; border-top: 2px solid var(--texto) !important; }
.btn-mini { width: 28px; height: 28px; min-height: 0; vertical-align: middle; }
.btn-mini .ic { width: 16px; height: 16px; }
@media (min-width: 700px) { .modal.modal-ancho { width: min(760px, calc(100vw - 32px)); } }
.nom-asis-grid { display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr)); gap: 5px; align-items: center; }
.nom-asis-grid input { padding: 6px 2px; text-align: center; min-height: 38px; }
.nom-montos { display: grid; gap: 6px; margin: 6px 0; }
.nom-monto-fila { display: grid; grid-template-columns: 1fr 110px auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.nom-monto-fila > span { font-size: 14px; grid-column: 1 / 2; }
.nom-monto-fila > span + input { grid-column: 2 / 4; }
.nom-desglose { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--borde); }
.nom-detalle li span:first-child { font-weight: 500; }
.nom-trab-barra { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; margin-bottom: 14px; }
@media (max-width: 699px) { .nom-trab-barra { grid-template-columns: 1fr auto; } .nom-trab-barra .buscador { grid-column: 1 / -1; } }
.nom-membrete { min-height: 40px; padding: 10px; border: 1px dashed var(--borde); border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; }
.nom-membrete img { max-width: 100%; max-height: 120px; }
.asis-grupo { margin-bottom: 14px; }
.asis-card { padding: 10px 12px; margin-bottom: 8px; }
.asis-nombre { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 2px 0 8px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.asis-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.asis-dia { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 52px; padding: 4px 0; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--surface-2); color: var(--texto); font: inherit; cursor: pointer; }
.asis-dia small { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.asis-dia b { font-size: 17px; line-height: 1.1; }
.asis-dia i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent-fuerte); }
.asis-dia.v-1 { background: var(--verde-suave); border-color: color-mix(in srgb, var(--verde) 45%, transparent); color: var(--verde); }
.asis-dia.v-m { background: var(--ambar-suave); border-color: color-mix(in srgb, var(--ambar) 45%, transparent); color: var(--ambar); }
.asis-dia.v-0 { background: var(--rojo-suave); border-color: color-mix(in srgb, var(--rojo) 45%, transparent); color: var(--rojo); }
.asis-dia.hoy { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 12px;
  background: var(--texto); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: var(--sombra-alta); transition: opacity .2s, transform .2s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
/* Con la cámara abierta, los avisos van encima (si no, "La cámara aún no está lista" no se veía) */
body.camara-abierta #toast { z-index: 300; bottom: auto; top: calc(64px + var(--safe-t)); }
@media (min-width: 900px) { #toast { bottom: 24px; left: calc(50% + var(--sidebar) / 2); } }

/* ---------- Impresión (ficha técnica) ---------- */
.solo-impresion { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 12px; }
  .sidebar, .topbar, .tabbar, #toast, #modal-root, .no-imprimir, .tabs, .btn, .btn-icon { display: none !important; }
  .contenido { margin: 0 !important; }
  main { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  .solo-impresion { display: block; }
  .panel-comp { display: block !important; margin-top: 14px; }
  .panel-titulo { display: block; font-size: 15px; margin: 10px 0 6px; }
  .comp, .scard { break-inside: avoid; }
  .lista { gap: 6px; }
  .hero { grid-template-columns: 180px 1fr; }
  .cant { border: 1px solid #ccc; }
}

/* ---------- Rapidez en celulares sencillos ---------- */
/* Las tarjetas de listas largas que no están en pantalla no se dibujan hasta que se llega a ellas */
.lista > .card { content-visibility: auto; contain-intrinsic-size: auto 84px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print { .lista > .card { content-visibility: visible; } }

/* ---------- Manuales de las máquinas (v1.23) ---------- */
.man-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--texto); text-decoration: none; }
.man-item:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--borde)); }
.man-ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-suave); color: var(--accent-fuerte); }
.man-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.man-info b { overflow-wrap: anywhere; }
.man-flecha { flex: none; color: var(--muted); }
.man-campo { margin: 14px 0 6px; }
.man-maqs { display: grid; gap: 8px; margin: 8px 0; }
.man-maqs .toggle { font-weight: 500; color: var(--texto); }
.man-campo select { margin-top: 4px; }
.man-progreso { margin-top: 14px; }
.man-barra { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--borde); overflow: hidden; }
.man-barra span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.man-progreso p { margin-top: 6px; }
.man-barra-sup { display: grid; gap: 8px; margin-bottom: 12px; }
.man-barra-sup .fila-botones { align-items: center; }
.man-zoom { min-width: 52px; text-align: center; font-weight: 700; }
.man-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.man-hojas { display: grid; gap: 14px; min-width: 100%; }
.man-pag { margin: 0; position: relative; background: #fff; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.man-pag canvas { display: block; width: 100%; height: 100%; }
.man-pag:not(.lista) canvas { background: repeating-linear-gradient(-45deg, #f3f4f6 0 12px, #fafafa 12px 24px); }
.man-pag figcaption { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none; }
.man-pag figcaption span { font-size: 12px; font-weight: 600; color: #fff; background: rgba(21, 24, 29, .62); padding: 3px 8px; border-radius: 99px; }
.man-pag figcaption .btn-mini { pointer-events: auto; background: rgba(21, 24, 29, .62); color: #fff; border: 0; border-radius: 99px; font-size: 16px; }
.man-pag.error figcaption span { background: var(--rojo); }
.man-hojas.sin-descarga, .man-hojas.sin-descarga canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media print { .man-hojas.sin-descarga { display: none !important; } }

/* ---------- Evidencias compartidas y "Nuevo trabajo" con botones (v1.25) ---------- */
.ev-trabajo-tit { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-obra .small { display: block; }
.ev-nueva-obra > summary { list-style: none; display: inline-flex; }
.ev-nueva-obra > summary::-webkit-details-marker { display: none; }
.ev-paso { margin-bottom: 16px; }
.ev-paso > .etiqueta { display: block; margin-bottom: 8px; }
.ev-opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.ev-opciones.ev-tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ev-op { position: relative; cursor: pointer; }
.ev-op input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ev-op span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 8px 10px;
  border: 1.5px solid var(--borde); border-radius: 12px; background: var(--surface); font-weight: 600; line-height: 1.2; }
.ev-op input:checked + span { border-color: var(--accent); background: var(--accent-suave); color: var(--accent-fuerte); }
.ev-op input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-paso input[name="otro"], .ev-paso input[name="ref"] { margin-top: 10px; width: 100%; }
.ev-km { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 20px; font-weight: 700; }
.ev-km input { width: 5.2em; font-size: 22px; font-weight: 700; text-align: center; padding: 10px 6px; }
.ev-km[hidden], .ev-paso [data-donde][hidden] { display: none; }
.ev-prev { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--borde); }
.ev-prev b { overflow-wrap: anywhere; }

/* ---------- Avance por concepto (v1.26) ---------- */
.av-sin { margin: -4px 0 10px; }
.av-acceso { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 12px; color: var(--texto); text-decoration: none; }
.av-acceso:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--borde)); }
.av-acceso-tit { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.av-acceso-pct { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 90px; }
.av-acceso-pct b { font-size: 20px; }
.av-barra { display: block; width: 100%; min-width: 80px; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--borde); overflow: hidden; }
.av-barra > span { display: block; height: 100%; background: var(--verde, #1f7a3a); }
.av-barra.pasado > span { background: var(--rojo); }
.av-trabajo { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--borde); display: grid; gap: 6px; }
.av-trabajo .btn { justify-self: start; }
.av-linea { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.av-vista { margin-top: 10px; }
.av-grupo td { background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); white-space: normal !important; }
.av-desc { display: block; white-space: normal; min-width: 200px; max-width: 420px; }
.av-tabla td { vertical-align: top; }
.av-tabla td small { display: block; }
.av-pasado td { background: color-mix(in srgb, var(--rojo) 8%, transparent); }
.av-pct-c { min-width: 120px; }
.av-pct-c .av-barra { margin-bottom: 3px; }
.av-cabeza { display: grid; gap: 2px; }
.av-rep { padding: 12px 14px; display: grid; gap: 4px; }
.av-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.av-num { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.av-num[hidden], [data-modo="tramo"][hidden] { display: none; }
.av-num input { font-size: 18px; font-weight: 700; padding: 10px; }
.av-tramo { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 700; }
.av-tramo > span:first-child { min-width: 56px; }
.av-tramo input { width: 5em; font-size: 20px; font-weight: 700; text-align: center; padding: 8px 4px; }
.ev-opciones.av-dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#av-con { width: 100%; }
