/* Censo de Estudios — GBarmenia
   Misma identidad visual que el censo de colaboradoras: teal institucional y
   semáforo. Aquí el uso es de escritorio (lo diligencia el gerente de cuenta),
   pero sigue siendo responsive por si se llena en visita desde una tablet. */

:root {
  --teal: #0d5a68;
  --teal-dark: #094752;
  --teal-light: #e8f4f6;
  --green: #2f8f4e;
  --green-bg: #eaf7ee;
  --yellow: #c9860b;
  --yellow-bg: #fdf4e3;
  --red: #c0392b;
  --red-bg: #fdecea;
  --blue: #1f6f8b;
  --blue-bg: #e9f2f6;
  --text: #1f2d33;
  --text-muted: #5c6f77;
  --border: #d5e0e3;
  --bg: #f4f7f8;
  --white: #fff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(13, 90, 104, .08), 0 4px 16px rgba(13, 90, 104, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ─── Encabezado ─────────────────────────────────────────────────────────── */

.header { background: var(--teal); color: var(--white); padding: 20px; }

.header .inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.header h1 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.header p { margin: 4px 0 0; font-size: .88rem; opacity: .85; }
.brand { font-size: .85rem; opacity: .8; white-space: nowrap; }

.container { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; }

.intro {
  background: var(--teal-light);
  border-radius: var(--radius);
  padding: 15px 18px;
  font-size: .92rem;
  margin-bottom: 20px;
}

/* ─── Secciones ──────────────────────────────────────────────────────────── */

.section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.section > h2 {
  background: var(--teal-light);
  color: var(--teal);
  margin: 0;
  padding: 13px 18px;
  font-size: .98rem;
  font-weight: 700;
}

.section .body { padding: 18px; }
.section .nota { font-size: .82rem; color: var(--text-muted); margin: 0 0 14px; }

/* ─── Campos ─────────────────────────────────────────────────────────────── */

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .grid.four { grid-template-columns: repeat(4, 1fr); }
}

.field { display: flex; flex-direction: column; }

.field label {
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.hint { font-size: .78rem; color: var(--text-muted); font-weight: 400; margin-top: 4px; }
.stacked { margin-top: 14px; }
.required { color: var(--red); }

input[type="text"], input[type="tel"], input[type="email"], input[type="date"],
input[type="number"], input[type="password"], select, textarea {
  font-family: inherit;
  font-size: .95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  width: 100%;
  min-height: 42px;
}

textarea { resize: vertical; min-height: 80px; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
  border-color: var(--teal);
}

/* ─── Opciones ───────────────────────────────────────────────────────────── */

.options { display: grid; gap: 9px; grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .options.two { grid-template-columns: repeat(2, 1fr); }
  .options.three { grid-template-columns: repeat(3, 1fr); }
  .options.five { grid-template-columns: repeat(5, 1fr); }
}

.option {
  display: block;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--white);
  font-size: .9rem;
  transition: border-color .12s, background .12s;
}

.option:hover { border-color: var(--teal); }
.option input { margin-right: 7px; }
.option .title { font-weight: 700; font-size: .88rem; }
.option .desc { font-size: .78rem; color: var(--text-muted); margin-top: 3px; }
.option.selected { border-color: var(--teal); background: var(--teal-light); }
.option.green.selected { border-color: var(--green); background: var(--green-bg); }
.option.green .title { color: var(--green); }
.option.yellow.selected { border-color: var(--yellow); background: var(--yellow-bg); }
.option.yellow .title { color: var(--yellow); }
.option.red.selected { border-color: var(--red); background: var(--red-bg); }
.option.red .title { color: var(--red); }
.option.blue.selected { border-color: var(--blue); background: var(--blue-bg); }
.option.blue .title { color: var(--blue); }

.checkbox-grid { display: grid; gap: 9px; grid-template-columns: 1fr; }

@media (min-width: 640px) { .checkbox-grid { grid-template-columns: 1fr 1fr; } }

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  background: var(--white);
  min-height: 42px;
}

.checkbox input { width: 17px; height: 17px; flex-shrink: 0; }
.checkbox.selected { border-color: var(--teal); background: var(--teal-light); }

/* ─── Filas de daño (sí/no + detalle) ────────────────────────────────────── */

.damage-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.damage-row:last-child { border-bottom: none; }

@media (min-width: 760px) {
  .damage-row { grid-template-columns: 170px 150px 1fr; }
}

.damage-row .nombre { font-size: .9rem; font-weight: 600; }
.damage-row .si-no { display: flex; gap: 8px; }

.si-no label {
  flex: 1;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 4px;
  cursor: pointer;
  font-size: .85rem;
  background: var(--white);
  margin: 0;
}

.si-no label.selected { border-color: var(--teal); background: var(--teal-light); font-weight: 700; }
.si-no label.selected.danger { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.si-no input { display: none; }

/* ─── Botones ────────────────────────────────────────────────────────────── */

.btn {
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
}

.btn.primary { background: var(--teal); color: var(--white); }
.btn.primary:hover { background: var(--teal-dark); }
.btn.primary:disabled { background: #9bb6bc; cursor: not-allowed; }
.btn.secondary { background: var(--white); color: var(--teal); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--teal); }
.btn.danger { background: var(--white); color: var(--red); border-color: #f0c4bf; }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: 7px 13px; font-size: .85rem; min-height: 36px; }
.btn.block { width: 100%; }

/* ─── Avisos ─────────────────────────────────────────────────────────────── */

.alert { padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; }
.alert.error { background: var(--red-bg); color: var(--red); border: 1px solid #f0c4bf; }
.alert.success { background: var(--green-bg); color: var(--green); border: 1px solid #bfe3ca; }
.alert.info { background: var(--teal-light); color: var(--teal-dark); }

.footer-note {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ─── Login ──────────────────────────────────────────────────────────────── */

.login-box { max-width: 380px; margin: 56px auto; }

/* ─── Tablero ────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.summary-cards {
  display: grid;
  gap: 11px;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 20px;
}

@media (min-width: 760px) { .summary-cards { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}

.card .number { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.card .label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.card.red { border-left-color: var(--red); } .card.red .number { color: var(--red); }
.card.yellow { border-left-color: var(--yellow); } .card.yellow .number { color: var(--yellow); }
.card.green { border-left-color: var(--green); } .card.green .number { color: var(--green); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters .field { flex: 1 1 200px; }

.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  background: var(--white);
  border-radius: var(--radius);
  padding: 13px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border-left: 4px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.row:hover { background: #fbfdfd; }
.row.crit { border-left-color: var(--red); }
.row.alta { border-left-color: var(--yellow); }
.row.ok { border-left-color: var(--green); }
.row .nombre { font-weight: 700; }
.row .meta { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.row .chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  background: #f0f3f4;
  color: var(--text-muted);
}

.chip.red { background: var(--red-bg); color: var(--red); }
.chip.yellow { background: var(--yellow-bg); color: var(--yellow); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ─── Plan de acción ─────────────────────────────────────────────────────── */

.actions-table { display: flex; flex-direction: column; gap: 10px; }

.action-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

@media (min-width: 760px) {
  .action-row { grid-template-columns: 2.2fr 1.3fr 1.1fr 1.1fr auto; align-items: center; }
}

.action-row .remove {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px 8px;
}

/* ─── Firmas ─────────────────────────────────────────────────────────────── */

.signature-box {
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--white);
  touch-action: none;
}

.signature-box canvas { display: block; width: 100%; height: 130px; border-radius: 8px; }
.signature-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; }

/* ─── Barra fija de guardado ─────────────────────────────────────────────── */

.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 13px 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin: 0 -16px -64px;
  box-shadow: 0 -4px 16px rgba(13, 90, 104, .06);
}

.save-bar .izquierda { margin-right: auto; }
