/* Censo de Apoyo — GBarmenia
   Identidad tomada del formulario original: teal institucional y semáforo.
   Diseño primero para móvil: es donde se va a diligenciar. */

:root {
  --teal: #0d5a68;
  --teal-dark: #094752;
  --teal-light: #e8f4f6;
  --green: #2f8f4e;
  --green-bg: #eaf7ee;
  --yellow: #c9860b;
  --yellow-bg: #fdf4e3;
  --red: #c0392b;
  --red-bg: #fdecea;
  --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: 22px 20px;
}

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

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

/* ─── Contenedor ─────────────────────────────────────────────────────────── */

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

.intro {
  background: var(--teal-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: .95rem;
  margin-bottom: 22px;
}

/* ─── 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: 1rem;
  font-weight: 700;
}

.section .body { padding: 18px; }

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

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

@media (min-width: 620px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr 1fr; }
}

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

.field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

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

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

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

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

.required { color: var(--red); }

/* ─── Opciones tipo tarjeta ──────────────────────────────────────────────── */

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

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

.option {
  display: block;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  background: var(--white);
  transition: border-color .12s, background .12s;
}

.option:hover { border-color: var(--teal); }
.option input { margin-right: 8px; }
.option .title { font-weight: 700; font-size: .92rem; }
.option .desc { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

.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.selected { border-color: var(--teal); background: var(--teal-light); }

/* ─── Casillas ───────────────────────────────────────────────────────────── */

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

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

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

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

/* ─── Firma ──────────────────────────────────────────────────────────────── */

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

#signature { display: block; width: 100%; height: 150px; border-radius: 8px; }

.signature-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

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

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 48px;
}

.btn.primary { background: var(--teal); color: var(--white); width: 100%; }
.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.small { padding: 8px 14px; font-size: .88rem; min-height: 38px; }

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

.alert { padding: 13px 16px; border-radius: 8px; font-size: .92rem; 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: .82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ─── Pantalla de éxito ──────────────────────────────────────────────────── */

.success-screen { text-align: center; padding: 44px 22px; }
.success-screen .check { font-size: 3rem; color: var(--green); line-height: 1; }
.success-screen h2 { color: var(--teal); margin: 14px 0 8px; }
.success-screen p { color: var(--text-muted); margin: 0 auto; max-width: 420px; }

/* ─── Panel de administración ────────────────────────────────────────────── */

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

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

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

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

.card .number { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.card .label { font-size: .78rem; 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 160px; }

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

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

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

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.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.pending { background: #f0f3f4; color: var(--text-muted); }
.chip.in_progress { background: var(--yellow-bg); color: var(--yellow); }
.chip.resolved { background: var(--green-bg); color: var(--green); }

/* ─── Detalle ────────────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 40, 46, .55);
  z-index: 40;
  overflow-y: auto;
  padding: 20px 12px;
}

.detail {
  background: var(--bg);
  max-width: 780px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-header {
  background: var(--teal);
  color: var(--white);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.detail-header h2 { margin: 0; font-size: 1.1rem; }
.close { background: none; border: none; color: var(--white); font-size: 1.7rem; cursor: pointer; line-height: 1; padding: 0 6px; }
.detail-body { padding: 18px; }

.data-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .data-grid { grid-template-columns: 1fr 1fr; } }

.data-item .key { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.data-item .value { font-size: .95rem; word-break: break-word; }
.data-item.full { grid-column: 1 / -1; }

.admin-only {
  border: 2px solid var(--teal);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 18px;
}

.admin-only > h2 {
  background: var(--teal);
  color: var(--white);
  margin: 0;
  padding: 12px 18px;
  font-size: 1rem;
}

.admin-badge {
  background: rgba(255, 255, 255, .18);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .7rem;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.group-label { font-size: .82rem; font-weight: 600; display: block; margin-bottom: 8px; }
.divider { margin: 20px 0; border: none; border-top: 1px solid var(--border); }

/* ─── Tabla de acciones ──────────────────────────────────────────────────── */

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

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

@media (min-width: 700px) {
  .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;
}

.signature-view { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--white); }

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

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