:root {
  --green: #2e7d32;
  --green-light: #66bb6a;
  --green-pale: #e8f5e9;
  --orange: #e65100;
  --text: #333;
  --border: #ddd;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f5f5f5; color: var(--text); }

/* ─── Header ─── */
.header {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white; padding: 24px; text-align: center;
}
.header h1 { font-size: 1.8rem; }
.header p { opacity: .85; margin-top: 6px; }

/* ─── Contenedor ─── */
.container { max-width: 800px; margin: 30px auto; padding: 0 16px 60px; }

/* ─── Sección del formulario ─── */
.seccion {
  background: white; border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  margin-bottom: 24px; overflow: hidden;
}
.seccion-header {
  background: var(--green-pale); padding: 14px 20px;
  border-bottom: 2px solid #c8e6c9;
  display: flex; align-items: center; gap: 10px;
}
.seccion-header h2 { font-size: 1.05rem; color: var(--green); }
.seccion-body { padding: 20px; }

/* ─── Campos ─── */
.campo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label { font-size: .85rem; font-weight: 600; color: #555; }
.campo input, .campo select, .campo textarea {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 12px; font-size: .95rem; transition: border .2s;
  font-family: inherit;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(102,187,106,.2);
}
.campo textarea { resize: vertical; min-height: 70px; }
.campo-full { grid-column: 1 / -1; }

/* ─── Tabla recordatorio ─── */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--green); color: white; padding: 10px 12px; text-align: left; }
td { padding: 8px 12px; border-bottom: 1px solid #eee; }
td input, td select { width: 100%; border: 1px solid #ddd; border-radius: 4px; padding: 6px 8px; font-size: .85rem; }
tr:nth-child(even) td { background: #fafafa; }

/* ─── Frecuencia ─── */
.freq-table th:first-child { width: 200px; }
.freq-table td:not(:first-child), .freq-table th:not(:first-child) { text-align: center; width: 90px; }
.freq-table input[type=radio] { width: auto; }

/* ─── Botón submit ─── */
.btn-submit {
  display: block; width: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white; border: none; border-radius: var(--radius);
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
  transition: opacity .2s;
}
.btn-submit:hover { opacity: .9; }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ─── Éxito ─── */
.exito {
  display: none; background: white; border-radius: var(--radius);
  padding: 40px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.exito .icon { font-size: 4rem; }
.exito h2 { color: var(--green); margin: 16px 0 8px; }
.exito p { color: #666; }

/* ─── Admin: login ─── */
.login-box {
  max-width: 360px; margin: 80px auto; background: white;
  border-radius: var(--radius); padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); text-align: center;
}
.login-box h2 { color: var(--green); margin-bottom: 24px; }
.btn-green {
  background: var(--green); color: white; border: none;
  border-radius: 6px; padding: 10px 24px; font-size: 1rem;
  cursor: pointer; width: 100%; margin-top: 12px;
}
.btn-green:hover { background: #1b5e20; }

/* ─── Admin: dashboard ─── */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.admin-header {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white; padding: 20px; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700;
}
.badge-pendiente { background: #fff3e0; color: #e65100; }
.badge-revisado { background: #e3f2fd; color: #1565c0; }
.badge-enviado { background: #e8f5e9; color: #2e7d32; }

.card-paciente {
  background: white; border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 18px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: box-shadow .2s;
}
.card-paciente:hover { box-shadow: 0 4px 16px rgba(0,0,0,.14); }

.btn-sm {
  padding: 7px 16px; border-radius: 6px; font-size: .85rem;
  cursor: pointer; border: none; font-weight: 600;
}
.btn-revisar { background: #e3f2fd; color: #1565c0; }
.btn-enviar { background: var(--green-pale); color: var(--green); }
.btn-danger { background: #ffebee; color: #c62828; }

/* ─── Modal detalle ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 100;
  overflow-y: auto; padding: 20px;
}
.modal-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
.modal {
  background: white; border-radius: var(--radius);
  max-width: 750px; width: 100%; margin: auto;
  overflow: hidden;
}
.modal-header {
  background: var(--green); color: white;
  padding: 18px 20px; display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 24px; }
.modal-close { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

.macros-row { display: flex; gap: 12px; margin: 16px 0; }
.macro-box {
  flex: 1; padding: 14px; border-radius: 8px; text-align: center;
}
.macro-box .val { font-size: 1.5rem; font-weight: 700; }
.macro-box .lbl { font-size: .8rem; color: #666; }

@media(max-width:600px) {
  .campo-grid { grid-template-columns: 1fr; }
  .macros-row { flex-direction: column; }
}
