:root {
  --navy: #1f3b57;
  --navy-2: #2a4d70;
  --blue: #2f86c8;
  --blue-soft: #e6f1fa;
  --gray: #7d868d;
  --ink: #1d2329;
  --muted: #5f6b76;
  --line: #e2e7ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --green: #1f9d63;
  --green-soft: #e3f5ec;
  --amber: #c98a0b;
  --amber-soft: #fdf3dc;
  --red: #cf3f3f;
  --red-soft: #fbe6e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.cap::first-letter { text-transform: uppercase; }
span.cap { display: inline-block; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { height: 38px; background: #fff; border-radius: 8px; padding: 3px 5px; }
.brand span { font-weight: 600; font-size: 14px; opacity: .9; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; color: rgba(255,255,255,.78); text-align: left;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; }
.nav-item .badge { margin-left: auto; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .spacer { flex: 1; }
/* Menú lateral: sin barra nativa (se ve distinta en cada equipo). En su lugar, un indicador propio:
   una cápsula delgada en degradado azul TIPSA que aparece al pasar el cursor o al desplazarse,
   el contenido se desvanece en el borde donde hay más opciones, y una flecha animada invita a bajar. */
.nav-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nav-scroll {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 6px 12px 10px 4px;
  scrollbar-width: none; --fade-top: 0px; --fade-bottom: 0px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
}
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-scroll.fade-top { --fade-top: 22px; }
.nav-scroll.fade-bottom { --fade-bottom: 46px; }
.nav-rail { position: absolute; top: 8px; bottom: 8px; right: -6px; width: 4px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); opacity: 0; transition: opacity .35s ease, width .2s ease, right .2s ease; }
.nav-rail.show, .nav-wrap:hover .nav-rail { opacity: 1; }
.nav-rail:hover { width: 6px; right: -7px; }
.nav-thumb { width: 100%; border-radius: 99px; cursor: grab; touch-action: none;
  background: linear-gradient(180deg, #a9d4f5 0%, #5B9BD5 50%, #2f86c8 100%);
  box-shadow: 0 0 8px rgba(91, 155, 213, .75), 0 0 2px rgba(255, 255, 255, .6) inset; }
.nav-thumb:active { cursor: grabbing; filter: brightness(1.15); }
.nav-more { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); width: 30px; height: 22px; border-radius: 99px;
  border: 1px solid rgba(169, 212, 245, .35); background: rgba(31, 59, 87, .85); color: #a9d4f5; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(2px); animation: nav-more-bounce 2.2s ease-in-out infinite; }
.nav-more:hover { background: #2a4d70; color: #fff; }
@keyframes nav-more-bounce { 0%, 70%, 100% { transform: translate(-50%, 0); } 80% { transform: translate(-50%, 3px); } 90% { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .nav-more { animation: none; } }
/* Grupos del menú que se abren y cierran (con animación) y buscador de secciones. */
.nav-group { margin-bottom: 2px; }
.nav-group-title { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; border-radius: 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.5); padding: 9px 10px 7px 12px; text-align: left; }
.nav-group-title:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-group.actual > .nav-group-title { color: rgba(255,255,255,.85); }
.nav-chev { transition: transform .22s ease; opacity: .8; }
.nav-group.abierto .nav-chev { transform: rotate(180deg); }
.nav-group-n { font-size: 10px; background: rgba(255,255,255,.1); border-radius: 99px; padding: 1px 7px; letter-spacing: 0; }
.nav-group-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav-group.abierto .nav-group-body { grid-template-rows: 1fr; }
.nav-group-body > div { overflow: hidden; min-height: 0; }
.nav-group.abierto .nav-group-body > div { padding-bottom: 6px; }
.nav-item { padding: 8px 12px; }
.nav-search { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; padding: 0 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; color: rgba(255,255,255,.6); cursor: text; }
.nav-search:focus-within { border-color: rgba(169,212,245,.6); background: rgba(255,255,255,.12); color: #fff; }
.nav-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: #fff; padding: 8px 0; font-size: 13px; }
.nav-search input::placeholder { color: rgba(255,255,255,.45); }
.nav-search-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; display: grid; place-items: center; }
.nav-item-grp { display: block; font-size: 10px; opacity: .55; font-weight: 400; }
.nav-empty { font-size: 12px; color: rgba(255,255,255,.55); padding: 10px 12px; }
@media (prefers-reduced-motion: reduce) { .nav-group-body, .nav-chev { transition: none; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .mobile-logo { display: none; height: 30px; }
.content { padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }

.bottom-nav { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .topbar .mobile-logo { display: block; }
  .content { padding: 16px 16px 96px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav button {
    flex: 1; background: none; border: 0; display: flex; flex-direction: column;
    align-items: center; gap: 2px; font-size: 11px; color: var(--muted);
    padding: 6px 2px; cursor: pointer; position: relative;
  }
  .bottom-nav button.active { color: var(--blue); font-weight: 600; }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .dot {
    position: absolute; top: 2px; right: calc(50% - 18px);
    background: var(--red); color: #fff; border-radius: 99px; font-size: 10px;
    min-width: 16px; height: 16px; padding: 0 4px; line-height: 16px;
  }
}

/* ---------- Building blocks ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: 1fr; }
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: 9px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f7f9fb; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #2777b3; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--card); border-color: #efc4c4; color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue); }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 16px; font-size: 16px; }
.comida-notice { text-align: left; align-items: center; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 99px;
  padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--blue-soft); color: var(--blue);
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: #eef1f4; color: var(--muted); }
.badge.count { background: var(--red); color: #fff; min-width: 20px; justify-content: center; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--blue-soft); color: var(--navy);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.r, th.r { text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%;
}
.input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.segmented { display: inline-flex; background: #eef1f4; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--muted);
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--blue-soft); color: var(--navy); font-size: 14px; }
.notice.amber { background: var(--amber-soft); color: #7a5506; }
.notice.red { background: var(--red-soft); color: #8a2525; }
.notice.green { background: var(--green-soft); color: #136b43; }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.bar { height: 8px; background: #eef1f4; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar.warn > span { background: var(--amber); }
.bar.over > span { background: var(--red); }

/* ---------- Worker clock ---------- */
.clock-card { text-align: center; padding: 28px 18px; }
.clock-time { font-size: 48px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock-btn {
  width: 190px; height: 190px; border-radius: 50%; border: 0; cursor: pointer;
  margin: 22px auto 14px; display: grid; place-items: center; color: #fff;
  font-size: 20px; font-weight: 700; box-shadow: 0 10px 30px rgba(47, 134, 200, .35);
  background: radial-gradient(circle at 30% 30%, #4aa0df, var(--blue));
  transition: transform .1s;
}
.clock-btn:active { transform: scale(.97); }
.clock-btn.out { background: radial-gradient(circle at 30% 30%, #3b5f86, var(--navy)); box-shadow: 0 10px 30px rgba(31, 59, 87, .35); }
.clock-btn svg { width: 40px; height: 40px; margin: 0 auto 6px; display: block; }

.steps { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.step { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.step .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #eef1f4; color: var(--muted); flex-shrink: 0; }
.step.ok .ic { background: var(--green-soft); color: var(--green); }
.step.warn .ic { background: var(--amber-soft); color: var(--amber); }
.step .ic svg { width: 18px; height: 18px; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 25, 35, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 24px; } }
.modal {
  background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 20px;
}
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 500;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
@media (min-width: 861px) { .toast { bottom: 24px; } }

.role-switch { background: var(--amber-soft); border-bottom: 1px solid #f0dfb4; padding: 8px 24px; font-size: 13px; }
.role-switch select { border: 1px solid #e7cf91; border-radius: 8px; padding: 4px 8px; background: #fff; }
@media (max-width: 860px) { .role-switch { padding: 8px 16px; } }

.update-banner { background: var(--navy); color: #fff; padding: 10px 24px; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.update-banner > .btn:first-of-type { margin-left: auto; }
/* Sobre el fondo azul marino: botón blanco con letra azul marino, y «Ahora no» con letra blanca y borde claro. */
.update-banner .btn { background: #fff; border-color: #fff; color: var(--navy); }
.update-banner .btn:hover { background: #e8eef4; }
.update-banner .btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; }
.update-banner .btn.ghost:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 860px) { .update-banner { padding: 10px 16px; flex-wrap: wrap; } }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 45%, var(--bg) 45%);
}
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 28px 24px; }
.login-logo { height: 76px; margin: 0 auto 14px; display: block; }
.chooser-item { background: none; border: 0; border-top: 1px solid var(--line); width: 100%; text-align: left; cursor: pointer; padding: 10px 4px; }
.chooser-item:hover { background: var(--bg); }

.bio-btn {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 2px #cfe3f4;
}
.bio-btn:hover { background: #d9eaf8; }

/* ---------- Cámara ---------- */
.camera-box { position: relative; background: #0f1923; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; margin: 0 auto; width: 100%; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.camera-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 24px; font-size: 14px; }

/* Marco guía del lector de QR */
.scan-frame { position: absolute; inset: 22% 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.place-pick .step { flex-direction: column; justify-content: center; text-align: center; gap: 8px; padding: 16px 10px; }

/* ---------- Hoja membretada (PDF) ---------- */
.folio { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.via-calc { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px; border-radius: 12px; background: var(--blue-soft); }
.via-calc b { font-size: 20px; font-variant-numeric: tabular-nums; }
.excess-box { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--amber-soft); }
.sign-row.three { grid-template-columns: repeat(3, 1fr); }
@media print {
  @page { size: letter; margin: 10mm 14mm 12mm 18mm; }
  .doc { font-family: "Arial Narrow", Arial, sans-serif; color: #000; }
  .lh { position: relative; padding: 0 0 10px; margin-bottom: 14px; border-bottom: 2px solid #5B9BD5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lh-row { display: flex; align-items: center; gap: 16px; padding-top: 60px; }
  .report-table { font-size: 8.5pt; }
  .report-table td, .report-table th { padding: 5px 4px; }
  .report-table .folio-cell { white-space: nowrap; font-size: 7pt; font-family: Consolas, "Courier New", monospace; }
  .print-table thead { display: table-header-group; }
  .print-table tr { break-inside: avoid; }
  .lh-logo { height: 62px; flex-shrink: 0; }
  .lh-company { flex: 1; text-align: center; font-weight: 700; font-size: 16pt; line-height: 1.1; white-space: nowrap; }
  .lh-title { text-align: right; font-weight: 700; font-size: 14pt; color: #FF0000; text-transform: uppercase; max-width: 230px; line-height: 1.15; }
  /* Esquina azul con la nomenclatura: dentro del área imprimible para que nunca se corte. */
  .lh-corner { position: absolute; top: 0; right: 0; width: 200px; height: 62px; background: #5B9BD5;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 44% 40%); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lh-corner span { position: absolute; top: 6px; right: 8px; color: #FF0000; font-weight: 700; font-size: 10pt; background: #fff; padding: 1px 7px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lh-sub { font-size: 9pt; color: #555; margin-top: 6px; }
  .doc-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #BFC8D0; margin-bottom: 14px; }
  .doc-grid > div { padding: 6px 8px; border-bottom: 1px solid #BFC8D0; font-size: 10pt; }
  .doc-grid > div:nth-child(odd):not(.span2) { border-right: 1px solid #BFC8D0; }
  .doc-grid > div.span2 { grid-column: 1 / -1; }
  .doc-grid span { display: block; font-size: 8pt; color: #5F6B76; text-transform: uppercase; letter-spacing: .03em; }
  .doc-h { font-size: 11pt; margin: 12px 0 6px; }
  .doc .print-table th { background: #1F3B57; color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc .print-table td, .doc .print-table th { border: 1px solid #BFC8D0; }
}

/* ---------- Sello azul de aprobación ---------- */
.stamp-slot { height: 92px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 4px; }
.stamp {
  display: inline-block; transform: rotate(-5deg); color: #1d4fa3; border: 3px double #1d4fa3; border-radius: 10px;
  padding: 4px 10px 5px; text-align: center; line-height: 1.15; font-family: "Arial Narrow", Arial, sans-serif;
  background: rgba(29, 79, 163, .04); -webkit-print-color-adjust: exact; print-color-adjust: exact; max-width: 170px;
}
.stamp-brand { font-size: 8pt; font-weight: 700; letter-spacing: .2em; border-bottom: 1px solid #1d4fa3; padding-bottom: 1px; margin-bottom: 2px; }
.stamp-text { font-size: 11pt; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.stamp-by { font-size: 9pt; font-weight: 700; }
.stamp-at { font-size: 8.5pt; }
.stamp-foot { font-size: 6.5pt; text-transform: uppercase; letter-spacing: .06em; opacity: .85; margin-top: 1px; }
/* Sello rojo de PAGADO: en los formatos donde Contabilidad registró un pago */
.stamp.paid { color: #c62828; border-color: #c62828; background: rgba(198, 40, 40, .05); transform: rotate(-7deg); max-width: 250px; padding: 5px 14px 6px; }
.stamp.paid .stamp-brand { border-bottom-color: #c62828; }
.stamp.paid .stamp-text { font-size: 17pt; letter-spacing: .12em; line-height: 1.05; }
.stamp.paid .stamp-amount { font-size: 10.5pt; font-weight: 700; }
.paid-row { display: flex; flex-wrap: wrap; gap: 28px; justify-content: flex-start; margin: 16px 0 6px; padding-left: 8px; }
/* Firmas y sellos (PAGADO, entregado, emitido) van juntos: si no caben, pasan completos a la siguiente hoja.
   Los sellos rojos comparten fila con el de «Emitido» para ocupar menos alto. */
.stamps { display: block; margin-top: 12px; break-inside: avoid; page-break-inside: avoid; }
.stamps::after { content: ''; display: block; clear: both; }
.stamps > .sign-row { margin-top: 0; gap: 14px; }
.stamps > .issued { float: right; margin: 12px 0 0 16px; }
.stamps > .paid-row { flex-wrap: nowrap; margin: 8px 190px 0 0; padding: 6px 0 0 6px; gap: 18px; }
.stamps .stamp-slot { height: 80px; }
.stamps .stamp.paid { padding: 3px 12px 4px; transform: rotate(-5deg); max-width: 235px; }
.stamps .stamp.paid .stamp-text { font-size: 14pt; }
.stamps .stamp.paid .stamp-amount { font-size: 9.5pt; }

.uuid { font-family: Consolas, "Courier New", monospace; font-size: 10.5px; word-break: break-all; }
.nowrap { white-space: nowrap; }
.field.span2 { grid-column: span 2; }
@media (max-width: 640px) { .line-grid.cols-3 { grid-template-columns: 1fr 1fr; } }
@media print {
  .gastos-table { font-size: 9pt; }
  .gastos-table .uuid { font-size: 7.5pt; width: 23%; }
  .gastos-table tr.rejected td { color: #888; text-decoration: line-through; }
  .gastos-table tfoot td { border-top: 2px solid #1F3B57; }
}
.filter-card { padding: 14px; }
.picker-wrap { position: relative; }
.picker-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 340px; max-width: 86vw; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16,32,48,.18); padding: 12px; }
.picker-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.picker-item:last-child { border-bottom: 0; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-row { gap: 16px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.login-tabs { display: flex; width: 100%; }
.login-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ---------- Notificaciones ---------- */
.bell-wrap { position: relative; }
.icon-btn.bell { color: var(--muted); position: relative; display: grid; place-items: center; }
.icon-btn.bell:hover { background: var(--bg); color: var(--ink); }
.icon-btn.bell svg { width: 22px; height: 22px; }
.icon-btn.bell.has { color: var(--blue); }
.bell-count { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; border-radius: 99px; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: 90vw; max-height: 70vh; overflow-y: auto; z-index: 30;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16,32,48,.18); padding: 12px; }
.notif { display: block; width: 100%; text-align: left; background: none; color: var(--ink); border: 0; border-top: 1px solid var(--line); padding: 10px 6px; cursor: pointer; border-radius: 8px; }
.notif:hover { background: var(--bg); }
.notif.unread { background: var(--blue-soft); }
.notif.unread .small { font-weight: 600; }
.rejected-line { margin-top: 10px; padding: 10px; border-radius: 10px; background: #fff; border: 1px dashed #efc4c4; }
/* ---------- QR de checado ---------- */
.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 18px; text-align: center; }
.qr-stage:fullscreen { justify-content: center; background: #fff; }
.qr-stage:fullscreen .qr-img { width: min(70vh, 80vw) !important; height: min(70vh, 80vw) !important; }
.qr-logo { height: 48px; }
.qr-site { font-size: 22px; font-weight: 700; }
.qr-img { margin: 0 auto; }
.qr-img svg { width: 100%; height: 100%; display: block; }
.qr-timer { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.admin-chip { border-color: #f0dfb4; background: var(--amber-soft); align-items: flex-start; }
.current-proj { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--blue-soft); }
.issued { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 22px; break-inside: avoid; }
.refund-box { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--red-soft); }

/* ---------- Visor de comprobantes ---------- */
.file-btn { padding: 3px 8px; font-size: 12px; }
.file-view { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f0f2f5; }
.file-view iframe { width: 100%; height: 65vh; border: 0; display: block; background: #fff; }
.file-view img { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto; }
.xml-pre { margin: 0; padding: 14px; max-height: 40vh; overflow: auto; font-size: 12px; background: #fff; white-space: pre-wrap; word-break: break-all; }
.doc-grid.screen { display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-bottom: 1px solid var(--line); }
.doc-grid.screen > div { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.doc-grid.screen span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* ---------- Gastos ---------- */
@media (min-width: 640px) { .modal.wide { max-width: 860px; } }
.line-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcfd; }
.line-card.rejected { border-color: #efc4c4; background: var(--red-soft); }
.line-grid { gap: 10px; }
.concept-row { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr auto; gap: 8px; align-items: center; }
.total-row { padding: 12px 4px; border-top: 2px solid var(--line); font-size: 17px; }
.timeline summary { cursor: pointer; padding: 6px 0; }
.gasto-item .avatar { background: #eef1f4; color: var(--navy); }
/* Permisos por módulo y solicitudes de almacén */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.perm-cell { display: flex; flex-direction: column; gap: 4px; }
.perm-cell .small, .perm-row .small { display: flex; align-items: center; gap: 5px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg); border-radius: 10px; }
.row-changed td { background: var(--amber-soft); }
.alm-line { display: grid; grid-template-columns: 1fr 2.2fr .7fr .8fr 1.6fr auto; gap: 8px; align-items: center; }
.alm-line select.bad { border-color: var(--amber); }
/* Organigrama: árbol con líneas que unen cada gerencia con la que la aprueba */
.org-wrap { overflow-x: auto; padding: 18px 10px; }
.org { width: max-content; min-width: 100%; }
.org ul { display: flex; justify-content: center; position: relative; margin: 0; padding: 22px 0 0; list-style: none; }
.org > ul { padding-top: 0; }
.org li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 22px 8px 0; }
.org > ul > li { padding-top: 0; }
.org li::before, .org li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid #b9c3cc; }
.org li::after { right: auto; left: 50%; border-left: 2px solid #b9c3cc; }
.org li:only-child::before, .org li:only-child::after { border-top: 0; }
.org li:only-child::after { left: 50%; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid #b9c3cc; border-radius: 0 8px 0 0; }
.org li:first-child::after { border-radius: 8px 0 0 0; }
.org li:only-child::after { border-radius: 0; }
.org > ul > li::before, .org > ul > li::after { display: none; }
.org ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid #b9c3cc; }
.org-card { width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.org-card.person .org-head { background: var(--ink); }
.org-card.hit { outline: 3px solid var(--amber); }
.org-head { background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; padding: 7px 10px; text-align: center; }
.org-boss { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.org-boss.hit, .org-members li.hit { background: var(--amber-soft); }
.org-toggle { width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--bg); color: var(--blue); font-size: 12px; font-weight: 600; padding: 6px; cursor: pointer; }
.org-members { list-style: none; margin: 0; padding: 4px 0; border-top: 1px solid var(--line); display: block; }
.org-members.collapsed { display: none; }
.org-members li { display: flex; align-items: center; gap: 7px; padding: 4px 10px; font-size: 12px; }
.org .org-members li { flex-direction: row; align-items: center; justify-content: flex-start; padding: 4px 10px; text-align: left; }
.org-members li .avatar { flex-shrink: 0; }
.org-card .avatar img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.org-members li::before, .org-members li::after { display: none; }
.org-members li span { display: block; color: var(--muted); font-size: 11px; }
.org .org-members { display: block; justify-content: initial; padding-top: 4px; }
.org .org-members.collapsed { display: none; }
.org .org-members::before { display: none; }
@media print {
  .org-page { page: org; }
  .org-wrap { overflow: visible; box-shadow: none; border: 0; padding: 0; }
  .org-members.collapsed, .org .org-members.collapsed { display: block; }
  .org-toggle { display: none; }
  .org-card { box-shadow: none; break-inside: avoid; }
  .org-page .card { break-inside: avoid; }
}
@page org { size: letter landscape; margin: 10mm; }

/* Programas de trabajo: tabla de actividades y Gantt */
.prog-table td { padding: 4px 5px; vertical-align: middle; }
.prog-table .input.sm { padding: 5px 7px; font-size: 13px; min-height: 0; }
.prog-table tr.ciclo td { background: var(--red-soft); }
.prog-card { cursor: pointer; }
.prog-bar { height: 7px; border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.prog-bar > div { height: 100%; background: var(--green); border-radius: 99px; }
.prog-stats .value.sm { font-size: 17px; }
.pg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
/* Gantt: encabezado azul marino con títulos centrados, renglones alternados, fines de semana sombreados. */
.pg { display: flex; border: 1px solid #d5dce3; border-radius: 10px; overflow: hidden; background: #fff; font-size: 12px; color: var(--ink); }
.pg-left { flex: 0 0 auto; width: 320px; border-right: 2px solid #c9d2db; }
.pg-right { flex: 1; min-width: 0; overflow-x: auto; }
.pg-hd { height: 48px; display: flex; align-items: stretch; background: var(--navy); color: #fff; font-weight: 600; font-size: 11px; letter-spacing: .02em; }
.pg-left .pg-hd > span { display: flex; align-items: center; justify-content: center; text-align: center; border-left: 1px solid rgba(255,255,255,.14); }
.pg-left .pg-hd > span:first-child { border-left: 0; }
.pg-left .pg-hd > span { color: #fff; font-size: 11px; }
.pg-row { height: 28px; display: flex; align-items: center; border-bottom: 1px solid #edf0f3; position: relative; }
.pg-row.par { background: #f8fafb; }
.pg-n { width: 32px; text-align: center; flex-shrink: 0; color: var(--muted); }
.pg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.pg-left .pg-hd .pg-name { justify-content: flex-start; padding-left: 12px; }
.pg-disc { width: 78px; flex-shrink: 0; text-align: center; font-size: 11px; color: var(--muted); }
.pg-dur { width: 50px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.pg-fecha { width: 104px; text-align: center; flex-shrink: 0; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pg-av { width: 54px; text-align: center; flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pg-time { flex-direction: column; }
.pg-grp, .pg-cols { display: flex; height: 24px; }
.pg-grp span { border-left: 1px solid rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; font-size: 11px; flex-shrink: 0; }
.pg-cols { background: #2b4c6e; }
.pg-cols span { border-left: 1px solid rgba(255,255,255,.14); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; line-height: 1.05; flex-shrink: 0; overflow: hidden; }
.pg-cols span small { font-size: 8px; opacity: .75; }
.pg-cols span.finde { background: rgba(255,255,255,.12); }
.pg-cols.compacto span { overflow: visible; font-size: 9px; align-items: flex-start; padding-left: 1px; }
.pg-cols.compacto span.marca { border-left-color: rgba(255,255,255,.5); }
/* En el PDF los nombres de actividad se ven completos (hasta dos renglones). */
.pd .pg-row { height: 27px; }
.pd .pg-bar { top: 6px; height: 15px; }
.pd .pg-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.18; font-size: 11px; }
.pd .pg-hd { height: 44px; }
.pd .pg-grp, .pd .pg-cols { height: 22px; }
.pg-body { position: relative; }
.pg-grid { position: absolute; inset: 0; display: flex; pointer-events: none; }
.pg-grid span { border-left: 1px solid #eef1f4; flex-shrink: 0; }
.pg-grid span.finde { background: rgba(31, 59, 87, .05); }
.pg-bar { position: absolute; top: 6px; height: 16px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-fill { height: 100%; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
/* Periodos especiales (p. ej. paro de planta): días en naranja en el encabezado, sombra suave y bordes punteados. */
.pg-cols span.ventana { background: #c8742a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-grid span.ventana { background: rgba(232, 140, 60, .12); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-grid span.v-ini { border-left: 2px dashed #e07b2c; }
.pg-grid span.v-fin { border-right: 2px dashed #e07b2c; }
.pg-tag { display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: .05em; color: #c2611f; background: #fff3e8; border: 1px solid #eba36a; border-radius: 3px; padding: 0 4px; margin-left: 6px; line-height: 13px; vertical-align: 1px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-ventana { display: inline-block; width: 13px; height: 12px; border: 1.5px dashed #e07b2c; background: #fbe3cd; border-radius: 2px; margin-right: 6px; vertical-align: -2px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-hoy { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .75; z-index: 2; }
.pg-hoy span { position: absolute; top: -1px; left: 3px; font-size: 9px; font-weight: 700; color: var(--red); background: #fff; padding: 0 3px; border-radius: 3px; }
.pg-full .pg-left { width: var(--pg-left, 620px); }
@media (max-width: 640px) { .pg-left { width: 170px; } .pg-dur, .pg-av { display: none; } }

/* Documento impreso del programa (para entregar al cliente) */
.pd-head { display: grid; grid-template-columns: 150px 1fr 190px; align-items: center; gap: 16px; padding-bottom: 10px; border-bottom: 3px solid var(--navy); }
.pd-logo { height: 58px; }
.pd-title { text-align: center; }
.pd-company { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.pd-title h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: .02em; color: var(--navy); text-transform: uppercase; }
.pd-sub { font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.pd-code { justify-self: end; text-align: right; display: flex; flex-direction: column; gap: 3px; }
.pd-code b { display: inline-block; align-self: flex-end; border: 2px solid var(--navy); color: var(--navy); padding: 2px 10px; border-radius: 6px; font-size: 14px; letter-spacing: .04em; }
.pd-code span { font-size: 10px; color: var(--muted); }
.pd-strip { display: flex; margin: 10px 0 12px; background: #f3f6f9; border-radius: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-strip > div { flex: 1 1 0; min-width: 0; padding: 7px 10px; border-left: 1px solid #dde3e9; display: flex; flex-direction: column; justify-content: center; }
.pd-strip > div:first-child, .pd-strip > div:nth-child(2) { flex-grow: 2.2; }
.pd-strip > div:first-child { border-left: 0; }
.pd-strip span { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.pd-strip b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Hojas chicas: los datos en dos renglones de cuatro, sin cortar textos. */
.pd-strip.dos { display: grid; grid-template-columns: 1.6fr 1.6fr 1fr 1fr; }
.pd-strip.dos > div { border-top: 1px solid #dde3e9; }
.pd-strip.dos > div:nth-child(-n+4) { border-top: 0; }
.pd-strip.dos > div:nth-child(4n+1) { border-left: 0; }
.pg-compact .pg-disc, .pg-compact .pg-left .pg-hd > .pg-disc { display: none; }
.pg-compact .pg-fecha { width: 98px; font-size: 10.5px; }
.pd-avance i { display: block; height: 5px; background: #dde3e9; border-radius: 99px; margin-top: 4px; overflow: hidden; }
.pd-avance em { display: block; height: 100%; background: var(--green); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-foot { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; margin-top: 12px; break-inside: avoid; }
.pd-legend-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; }
.pd-legend-row > span { white-space: nowrap; }
.pd-legend-row .pg-dot { width: 11px; height: 11px; }
.pd-note { font-size: 10px; color: var(--muted); margin-top: 6px; max-width: 760px; line-height: 1.4; }
.pd-firmas { display: flex; gap: 22px; }
.pd-firmas > div { width: 165px; text-align: center; display: flex; flex-direction: column; }
.pd-firmas i { display: block; border-top: 1px solid var(--ink); margin: 34px 0 4px; }
.pd-firmas b { font-size: 12px; }
.pd-firmas span { font-size: 10px; color: var(--muted); }
@media print {
  /* El tamaño de la hoja (página «programa») lo pone la app al imprimir, según el tamaño del programa. */
  /* La hoja va sin margen (para que el navegador no imprima fecha, título, dirección ni número de página);
     el margen blanco de 0.4 in lo da el propio documento. */
  .prog-page { page: programa; padding: 0.4in; }
  .prog-print .pg { border-radius: 0; }
  .prog-print .pg-right { overflow: visible; }
  .pg-hd, .pg-cols, .pg-cols span.finde, .pg-grid span.finde, .pg-row.par, .pg-dot, .pg-hoy { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pg-row { break-inside: avoid; }
  .pg-hoy span { display: none; }
}

/* Fotos de las entregas de almacén */
.alm-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.alm-thumb { position: relative; width: 84px; height: 84px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); padding: 0; display: grid; place-items: center; cursor: pointer; }
.alm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.alm-thumb.add { border-style: dashed; color: var(--muted); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.alm-thumb-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 99px; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.alm-fotos-print { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; break-inside: avoid; }
.alm-fotos-print figure { margin: 0; width: 160px; }
.alm-fotos-print img { width: 160px; height: 120px; object-fit: cover; border: 1px solid #BFC8D0; border-radius: 4px; }
.alm-fotos-print figcaption { font-size: 7.5pt; color: #555; margin-top: 2px; }
@media (max-width: 640px) {
  .alm-line { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .alm-line > input:nth-child(2) { grid-column: 1 / -1; order: -1; }
  .alm-line > .alm-proj { grid-column: 1 / -1; }
  .concept-row { grid-template-columns: 1fr 1fr; }
  .line-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .gasto-item { flex-wrap: wrap; }
}
.print-totals { margin: 14px 0 0 auto; width: 320px; font-size: 13px; break-inside: avoid; page-break-inside: avoid; }
.print-totals div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.sign-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 24px; text-align: center; break-inside: avoid; }
.sign-line { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 12px; min-height: 22px; }

/* ---------- Varios ---------- */
.step.pick { background: #fff; cursor: pointer; width: 100%; text-align: left; }
.step.pick:disabled { opacity: .45; cursor: not-allowed; }
.selfie-thumb { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: 0 1px 2px rgba(16,32,48,.08), 0 8px 24px rgba(16,32,48,.1); }
tr.clickable:hover td { background: #f8fafc; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; font-size: 13px; background: #fff; cursor: pointer; }
.vchk { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: #eef1f4; color: #aab2b9; }
.vchk.ok { background: var(--green-soft); color: var(--green); }
.vchk.bad { background: var(--amber-soft); color: var(--amber); }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.toggle-row:first-of-type { border-top: 0; padding-top: 0; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: #cfd6dc; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--green); }
.switch:checked::after { left: 21px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.12); }
.side-user .avatar { background: rgba(255,255,255,.15); color: #fff; }
.icon-btn { background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.top-user .avatar { display: none; }
.mobile-only { display: none; }
.print-only { display: none; }
@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }
  .topbar h1 { font-size: 17px; }
  .bottom-nav button.open { color: var(--blue); }
  /* Panel que sube desde la barra de abajo con las secciones de una categoría */
  .sheet-overlay { position: fixed; inset: 0; z-index: 9; background: rgba(15, 25, 35, .35); display: flex; align-items: flex-end; animation: sheetFade .15s ease; }
  .sheet { width: 100%; max-height: 72vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0;
    padding: 8px 12px calc(76px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(15, 25, 35, .18); animation: sheetUp .22s cubic-bezier(.2, .8, .2, 1); }
  .sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 2px auto 10px; }
  .sheet-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 6px 8px; }
  .sheet-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 10px; border: 0; background: none; border-radius: 12px;
    font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer; }
  .sheet-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
  .sheet-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #eef1f4; color: var(--muted); flex-shrink: 0; }
  .sheet-item.active .sheet-ic { background: #fff; color: var(--blue); }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }
  .req-item { flex-wrap: wrap; }
}
@media print {
  /* Al imprimir solo sale el documento membretado: nunca las ventanas abiertas, menús ni avisos. */
  .sidebar, .topbar, .bottom-nav, .role-switch, .update-banner, .no-print, .toast, .overlay, .picker-panel { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid var(--line); }
  .content { padding: 0; max-width: none; }
  .print-table { font-size: 11px; }
  .print-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 12px; margin-bottom: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
  .print-table th, .print-table td { padding: 6px 5px; }
  .print-table tr { break-inside: avoid; }
}

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.cal-day { display: flex; align-items: center; gap: 12px; }
.cal-day .d { width: 46px; text-align: center; border-radius: 10px; background: var(--blue-soft); color: var(--navy); padding: 4px 0; flex-shrink: 0; }
.cal-day .d b { display: block; font-size: 18px; }
.cal-day .d span { font-size: 11px; text-transform: uppercase; }
.cal-day.past .d { background: #eef1f4; color: var(--muted); }

/* Firmar documentos */
.firmas-top { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; }
.firmas-top h3 { margin: 0 0 10px; }
.firma-prev { border: 1px dashed var(--line); border-radius: 10px; min-height: 96px; display: flex; align-items: center; justify-content: center; padding: 10px;
  background: repeating-conic-gradient(#f2f4f7 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.firma-prev img { max-width: 100%; max-height: 96px; }
.firma-prev.grande { min-height: 150px; }
.firma-prev.grande img { max-height: 190px; }
.firma-drop { display: flex; align-items: center; justify-content: center; gap: 10px; border: 2px dashed var(--line); border-radius: 10px; padding: 18px 12px; color: var(--muted); font-size: 14px; cursor: pointer; text-align: center; }
.firma-drop:hover, .firma-drop.over { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); }
.firma-files { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 220px; overflow: auto; }
.firma-file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.firma-file:hover { background: var(--bg); }
.firma-file.sel { background: var(--blue-soft); border-color: var(--blue); }
.sol-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.rep-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.rep-fotos figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.rep-fotos img, .rep-foto-ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.rep-foto-ph { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.rep-fotos figcaption { font-size: 12px; color: var(--muted); }
.rep-fotos .input { padding: 6px 8px; font-size: 13px; }
.rep-fotos .firma-quitar { align-self: flex-start; }
.rep-h { margin: 14px 0 4px; font-size: 11pt; color: #1F3B57; border-bottom: 1px solid #BFC8D0; padding-bottom: 2px; }
.rep-txt { white-space: pre-wrap; font-size: 10pt; }
@media print {
  .rep-fotos.print { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rep-fotos.print figure { break-inside: avoid; }
  .rep-fotos.print img { aspect-ratio: auto; max-height: 230px; object-fit: contain; border-radius: 0; background: none; }
  .rep-fotos.print figcaption { color: #000; font-size: 9pt; }
}
.costo-barra { height: 6px; background: #e6eaef; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.costo-barra span { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.costo-barra span.amber { background: var(--amber); }
.costo-barra span.red { background: var(--red); }
.firma-qr { position: absolute; border: 1.5px dashed #8a94a6; background: rgba(255,255,255,.85); border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #5b6576; pointer-events: none; font-weight: 700; font-size: 12px; line-height: 1.1; }
.firma-qr small { font-weight: 500; font-size: 9px; }
.firma-extra { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.firma-quitar { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; background: #fff; border: 1px solid var(--line); color: var(--red); border-radius: 8px; padding: 4px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.firma-quitar:hover { background: var(--red); border-color: var(--red); color: #fff; }
.firma-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.firmas-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; position: sticky; top: 0; z-index: 5; }
.firma-hojas { display: flex; flex-direction: column; gap: 26px; max-width: 880px; width: 100%; margin: 8px auto 0; }
.firma-hojas:empty { display: none; }
.firma-hoja { position: relative; background: #fff; box-shadow: var(--shadow); cursor: crosshair; touch-action: pan-y; }
.firma-hoja canvas { display: block; width: 100%; height: 100%; }
.firma-hoja-num { position: absolute; top: -19px; right: 0; font-size: 12px; color: var(--muted); }
.firma-marco { position: absolute; outline: 1.5px dashed var(--blue); cursor: move; touch-action: none; }
.firma-marco img { display: block; width: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.firma-del, .firma-rs { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; padding: 0; }
.firma-del { top: -12px; right: -12px; background: var(--red); cursor: pointer; }
.firma-rs { bottom: -12px; right: -12px; background: var(--blue); cursor: nwse-resize; touch-action: none; }
.firma-pad { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; height: 220px; touch-action: none; }
.firma-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.firma-pad-linea { position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1px solid #c9ced6; pointer-events: none; }
.firma-pad-ph { position: absolute; left: 0; right: 0; top: 40%; text-align: center; color: #a3a9b2; pointer-events: none; padding: 0 12px; }
.firma-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; cursor: pointer; }
.firma-sw.on { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (max-width: 760px) {
  .firmas-top { grid-template-columns: 1fr; }
  .firma-pad { height: 180px; }
}
