/* CATU · Reportes de Supervisión — familia navy + gold, campo + expediente */
:root {
  --navy: #1E3A8A;
  --navy-deep: #152C6B;
  --ink: #0B1220;
  --page: #F3F6FB;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --gold: #C9A227;
  --gold-soft: #F8F1D8;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --warn: #C2410C;
  --warn-soft: #FFEDD5;
  --crit: #B91C1C;
  --crit-soft: #FEE2E2;
  --teal: #0F766E;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--page);
  color: var(--text);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
  background: #fff;
  border-bottom: 2px solid var(--gold);
  padding: 0.7rem 1rem;
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
}
.brand { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.brand img { height: 38px; width: auto; }
.brand h1 { font-size: 0.82rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.brand p { font-size: 0.62rem; color: var(--muted); }
.header-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font-size: 0.68rem; font-weight: 700;
  padding: 0.22rem 0.55rem; border-radius: 999px;
  background: var(--gold-soft); color: #7A6110;
  border: 1px solid rgba(201,162,39,.4);
}
.chip.off { display: none; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #FDBA74; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: #86EFAC; }
.chip.crit { background: var(--crit-soft); color: var(--crit); border-color: #FECACA; }

main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 1rem 1rem 5.5rem; }
.screen { display: none; animation: fade .28s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 0.6rem 0 1.2rem; }
.hero img { width: 120px; margin-bottom: 0.8rem; }
.hero h2 { font-size: 1.35rem; color: var(--navy); line-height: 1.25; }
.hero h2 span { color: var(--gold); }
.hero .lead { color: var(--muted); margin: 0.7rem auto 1rem; max-width: 34rem; font-size: 0.92rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1rem 0 1.2rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.4rem; }
.stat .num { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.stat .label { font-size: 0.68rem; color: var(--muted); }

.features { display: grid; gap: 0.6rem; }
.feature {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem; display: flex; gap: 0.75rem; align-items: flex-start;
  box-shadow: var(--shadow);
}
.feature .icon {
  flex: 0 0 28px; height: 28px; border-radius: 8px;
  background: var(--navy); color: var(--gold); font-weight: 800;
  display: grid; place-items: center; font-size: 0.75rem;
}
.feature h3 { font-size: 0.88rem; color: var(--navy); }
.feature p { font-size: 0.8rem; color: var(--muted); }

.legal-box {
  margin-top: 1rem; background: #fff; border-left: 4px solid var(--gold);
  border-radius: 8px; padding: 0.85rem 1rem; font-size: 0.8rem; color: var(--muted);
}
.legal-box strong { color: var(--navy); }

.btn {
  border: 0; cursor: pointer; font-weight: 700;
  border-radius: 10px; padding: 0.72rem 1.1rem; font-size: 0.9rem;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-deep); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-danger { background: var(--crit-soft); color: var(--crit); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.9rem; }
.btn-row .btn { flex: 1; min-width: 140px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 0.75rem; box-shadow: var(--shadow);
}
.card h3 { font-size: 0.95rem; color: var(--navy); margin-bottom: 0.55rem; }
.card .hint { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.7rem; }

label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--navy); margin: 0.55rem 0 0.25rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="tel"],
select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 0.55rem 0.7rem; font-size: 0.9rem; background: #fff; color: var(--text);
}
textarea { min-height: 78px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.45rem; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
}

.role-pick { display: grid; gap: 0.6rem; }
.role-opt {
  border: 2px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem;
  background: #fff; cursor: pointer; text-align: left;
}
.role-opt.active { border-color: var(--navy); background: #EEF2FF; }
.role-opt h4 { color: var(--navy); font-size: 0.92rem; }
.role-opt p { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }

.banner-solidaridad {
  display: none;
  background: #1B1208; color: #F8F1D8;
  border-radius: 12px; padding: 0.85rem 1rem; margin: 0.7rem 0;
  border: 1px solid var(--gold);
}
.banner-solidaridad.show { display: block; }
.banner-solidaridad strong { color: var(--gold); }
.banner-solidaridad p { font-size: 0.8rem; margin-top: 0.3rem; }

.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.8rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem; }
.kpi .k { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.kpi.semaforo-verde { border-color: #86EFAC; background: var(--ok-soft); }
.kpi.semaforo-amarillo { border-color: #FDBA74; background: var(--warn-soft); }
.kpi.semaforo-rojo { border-color: #FECACA; background: var(--crit-soft); }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
@media (min-width: 720px) { .type-grid { grid-template-columns: 1fr 1fr 1fr; } }
.type-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 0.75rem; cursor: pointer; min-height: 92px;
}
.type-card:active { transform: scale(.99); }
.type-card .n { font-size: 0.68rem; font-weight: 800; color: var(--gold); }
.type-card h4 { font-size: 0.82rem; color: var(--navy); margin: 0.2rem 0; }
.type-card .meta { font-size: 0.68rem; color: var(--muted); }

.check-item {
  display: grid; grid-template-columns: 1fr auto; gap: 0.4rem;
  padding: 0.65rem 0; border-bottom: 1px solid var(--line);
}
.check-item:last-child { border-bottom: 0; }
.check-item .t { font-size: 0.82rem; }
.check-item .f { font-size: 0.68rem; color: var(--muted); margin-top: 0.15rem; }
.check-item .crit-alta { color: var(--crit); font-weight: 700; font-size: 0.65rem; }
.select-mini { min-width: 108px; font-size: 0.78rem; padding: 0.35rem; }

.start-block { border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.7rem; margin-bottom: 0.45rem; }
.start-block .letra {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 6px; background: var(--navy); color: var(--gold);
  font-size: 0.7rem; font-weight: 800; margin-right: 0.35rem;
}

.qty-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.qty-table th { text-align: left; background: #EEF2FF; color: var(--navy); padding: 0.35rem; }
.qty-table td { border-bottom: 1px solid var(--line); padding: 0.25rem; }
.qty-table input { padding: 0.3rem; font-size: 0.75rem; }

.photos { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.photo-thumb {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line);
}
.photo-wrap { position: relative; }
.photo-wrap button {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border: 0; border-radius: 50%; background: var(--crit); color: #fff; font-size: 0.7rem; cursor: pointer;
}

.report-list { display: grid; gap: 0.45rem; }
.report-row {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 0.8rem; display: flex; justify-content: space-between; gap: 0.5rem; align-items: center;
}
.report-row h4 { font-size: 0.82rem; color: var(--navy); }
.report-row p { font-size: 0.7rem; color: var(--muted); }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  display: none; padding: 0.45rem 0.6rem calc(0.45rem + env(safe-area-inset-bottom));
  gap: 0.4rem;
}
.dock.show { display: flex; }
.dock .btn { flex: 1; padding: 0.65rem 0.4rem; font-size: 0.8rem; }

.modal-back {
  position: fixed; inset: 0; background: rgba(11,18,32,.55); z-index: 80;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-back.show { display: flex; }
.modal {
  background: #fff; width: 100%; max-width: 560px; max-height: 88dvh;
  overflow: auto; border-radius: 16px 16px 0 0; padding: 1.1rem 1rem 1.4rem;
}
.modal h3 { color: var(--navy); margin-bottom: 0.5rem; }
.modal p, .modal pre { font-size: 0.82rem; color: var(--muted); white-space: pre-wrap; }

.consent { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.8rem 0; font-size: 0.78rem; color: var(--muted); }
.form-error { color: var(--crit); font-size: 0.78rem; min-height: 1em; }

.pdf-sheet {
  width: 190mm; padding: 12mm 14mm; background: #fff; color: #111;
  font-family: "Times New Roman", Times, serif; font-size: 11px; line-height: 1.35;
}
.pdf-sheet h1 { font-size: 16px; color: #1E3A8A; margin: 0 0 2px; }
.pdf-sheet h2 { font-size: 13px; color: #1E3A8A; border-bottom: 1.5px solid #C9A227; padding-bottom: 3px; margin: 12px 0 6px; }
.pdf-sheet .muted { color: #555; font-size: 10px; }
.pdf-sheet table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.pdf-sheet td, .pdf-sheet th { border: 1px solid #ccc; padding: 3px 5px; vertical-align: top; }
.pdf-sheet .foot {
  margin-top: 8px; font-size: 9px; color: #444;
  border-top: 1px solid #C9A227; padding-top: 4px;
}
.pdf-sheet img.evid { width: 45mm; height: 34mm; object-fit: cover; margin: 2px; }
.pdf-sheet .pdf-chart {
  margin: 8px 0 4px;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  padding: 6px 8px 4px;
  background: #FAFBFD;
}
.pdf-sheet .pdf-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: #1E3A8A;
  margin-bottom: 4px;
  font-family: Arial, Helvetica, sans-serif;
}
.pdf-sheet .pdf-chart svg { display: block; width: 100%; height: auto; max-width: 520px; }
.pdf-sheet .pdf-chart-cap { font-size: 10px; color: #374151; margin: 4px 0 2px; }
#pdf-root { position: absolute; left: -9999px; top: 0; }

.logo-block {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 0.8rem;
  align-items: start;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}
@media (max-width: 640px) { .logo-block { grid-template-columns: 1fr; } }
.logo-preview-frame {
  width: 140px; height: 140px;
  border: 1px dashed #C9A227;
  border-radius: 12px;
  background: #FFFEF8;
  display: grid; place-items: center;
  overflow: hidden;
}
.logo-preview-frame img { max-width: 92%; max-height: 92%; object-fit: contain; }
.logo-empty { font-size: 0.68rem; color: var(--muted); text-align: center; padding: 0.4rem; }
.dash-logo {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 0.75rem;
}
.dash-logo img {
  height: 48px; width: auto; max-width: 140px; object-fit: contain;
  background: #fff; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line);
}
.dash-logo .who { font-size: 0.72rem; color: var(--muted); }
.dash-logo .org { font-size: 0.88rem; font-weight: 800; color: var(--navy); }

.pdf-sheet .pdf-membrete { display: table; width: 100%; margin-bottom: 4px; }
.pdf-sheet .pdf-membrete > div { display: table-cell; vertical-align: middle; }
.pdf-sheet .pdf-logo-user { width: 28mm; padding-right: 4mm; }
.pdf-sheet .pdf-logo-user img { max-width: 26mm; max-height: 18mm; object-fit: contain; }
.pdf-sheet .pdf-logo-catu { width: 24mm; text-align: right; font-size: 8px; color: #6B7280; }
.pdf-sheet .pdf-logo-catu img { max-width: 22mm; max-height: 12mm; object-fit: contain; display: block; margin-left: auto; }
.pdf-sheet .pdf-goldbar { height: 3px; background: #C9A227; margin: 4px 0 8px; }

.small { font-size: 0.75rem; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 0.8rem 0; }
