:root {
  --azul: #2f5597;
  --azul-claro: #4472c4;
  --gris: #f4f6fb;
  --borde: #d8dee9;
  --texto: #1f2937;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--gris);
  color: var(--texto);
}
header {
  background: var(--azul);
  color: #fff;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
header h1 { font-size: 1.2rem; margin: 0; }
header nav a { color: #cfe0ff; text-decoration: none; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
footer { text-align: center; color: #8893a5; padding: 24px; }

.card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card h2 { margin-top: 0; color: var(--azul); }

label { display: block; margin: 12px 0; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: #6b7280; }
input, select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid var(--borde);
  border-radius: 7px;
  font-size: .95rem;
  font-family: inherit;
}
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row label { flex: 1; min-width: 140px; }

fieldset {
  border: 1px solid var(--borde);
  border-radius: 8px;
  margin: 14px 0;
  padding: 10px 14px;
}
legend { font-weight: 600; padding: 0 6px; }
.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  margin: 6px 14px 6px 0;
  width: auto;
}
.chk input { width: auto; margin: 0; }

details { margin: 14px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--azul); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
button, .btn {
  background: var(--azul);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 7px;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary, .btn.secondary { background: #fff; color: var(--azul); border: 1px solid var(--azul); }
button:hover, .btn:hover { opacity: .92; }

.alert {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #842029;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.hidden { display: none; }

.resumen { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 18px; }
.metric {
  background: var(--gris);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  min-width: 110px;
}
.metric .num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--azul); }
.metric .lbl { font-size: .8rem; color: #6b7280; }

.tabla-wrap { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--borde); text-align: left; white-space: nowrap; }
thead th { background: var(--azul); color: #fff; position: sticky; top: 0; }
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: #eef3fc; }
.vacio { color: #6b7280; padding: 20px 0; }

/* Encabezado del reporte (solo visible al imprimir / PDF) */
.print-header { display: none; }
.print-header .ph-empresa { font-size: 1.35rem; font-weight: 700; color: var(--azul); }
.print-header .ph-sub { font-size: .95rem; color: #444; margin-top: 2px; }
.print-header .ph-titulo { font-size: 1.05rem; font-weight: 600; margin-top: 10px; }
.print-header .ph-fecha { font-size: .8rem; color: #666; margin-top: 2px; }

/* Impresión / Guardar como PDF */
@media print {
  @page { size: A4 landscape; margin: 14mm; }
  body { background: #fff; }
  header, footer, #form, #estado, .no-print { display: none !important; }
  main { margin: 0; max-width: none; padding: 0; }
  .card.report-card { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .print-header {
    display: block;
    border-bottom: 2px solid var(--azul);
    padding-bottom: 8px; margin-bottom: 14px;
  }
  .resumen { margin: 10px 0 14px; }
  .tabla-wrap { overflow: visible; }
  table { font-size: .72rem; width: 100%; }
  th, td { white-space: normal; padding: 4px 6px; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
  thead th { position: static; }
  thead th, .metric, tbody tr:nth-child(even) {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
