:root {
  --plum: #343A30;
  --primary: #5C9A22;
  --primary-2: #4E8619;
  --teal: #1593AE;
  --teal-soft: #E3F5F9;
  --lav: #EEF6E3;
  --bg: #F6F8F3;
  --surface: #FFFFFF;
  --text: #2F332E;
  --muted: #737B6F;
  --line: #E1E8D9;
  --danger: #C2415B;
  --danger-soft: #FBE9ED;
  --warn: #B7791F;
  --warn-soft: #FFF6E2;
  --ok: #23866F;
  --ok-soft: #E2F5EF;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(45, 55, 35, .06), 0 8px 24px rgba(45, 55, 35, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
h1, h2, h3 { color: var(--plum); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 800; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }

/* ---------- Layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }
.screen { animation: aparece .25s ease; }
@keyframes aparece { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 248, 243, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.topbar .titulo { font-weight: 800; color: var(--plum); flex: 1; }
.topbar img { height: 30px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
.card.soft { background: var(--lav); box-shadow: none; }
.card h2 { margin-bottom: .75rem; }

/* ---------- Botones ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  border-radius: 999px;
  background: var(--primary); color: #fff;
  text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--primary-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.teal { background: var(--teal); }
.btn.teal:hover { background: #11809A; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--lav); }
.btn.danger { background: var(--danger); }
.btn.wa { background: #1FA855; }
.btn.wa:hover { background: #198F48; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; }
.btn.xl { min-height: 58px; font-size: 1.15rem; padding: 14px 34px; }
.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--plum);
}
.icon-btn:hover { background: var(--lav); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- Formularios ---------- */
label.lbl { display: block; font-weight: 700; font-size: .92rem; margin: 12px 0 6px; color: var(--plum); }
label.lbl .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%;
  font: inherit; font-size: 16px; color: var(--text);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(92, 154, 34, .14); }
.input.invalido { border-color: var(--danger); background: var(--danger-soft); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* Opciones tipo tarjeta (radio / checkbox) */
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opciones.una { grid-template-columns: 1fr; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opcion .caja {
  display: flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 700;
  transition: border-color .15s, background .15s;
}
.opcion .check {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid #C5D3B8; display: grid; place-items: center; background: #fff;
}
.opcion input:checked + .caja { border-color: var(--primary); background: var(--lav); }
.opcion input:checked + .caja .check { background: var(--primary); border-color: var(--primary); }
.opcion input:checked + .caja .check::after { content: ''; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.opcion input:focus-visible + .caja { box-shadow: 0 0 0 4px rgba(92, 154, 34, .2); }
.opcion .sub { display: block; font-weight: 600; font-size: .8rem; color: var(--muted); }

.si-no { display: flex; gap: 8px; }
.si-no .opcion { flex: 1; }
.si-no .opcion .caja { min-height: 46px; justify-content: center; }

/* ---------- Pantalla de inicio ---------- */
.inicio {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 20px 48px;
  background:
    radial-gradient(circle at 15% 10%, rgba(46, 196, 220, .14), transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(92, 154, 34, .16), transparent 50%),
    var(--bg);
}
.inicio .logo { width: min(380px, 90vw); height: auto; margin-bottom: 42px; }
.inicio .firma { margin-top: 22px; font-weight: 800; color: #6E6E6E; font-size: 1.12rem; letter-spacing: .2px; }
.inicio .firma small { display: block; font-weight: 600; color: var(--muted); font-size: .85rem; }

/* ---------- Pasos ---------- */
.pasos { display: flex; gap: 6px; margin: 14px 0 4px; }
.pasos span { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.pasos span.on { background: linear-gradient(90deg, #8CC63F, #2EC4DC); }
.paso-txt { font-size: .82rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Costos ---------- */
.costos { list-style: none; padding: 0; margin: 0; }
.costos li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.costos li:last-child { border-bottom: 0; }
.costos .precio { font-weight: 800; color: var(--teal); font-size: 1.1rem; white-space: nowrap; }
.nota { font-size: .86rem; color: var(--muted); margin-top: 10px; }

/* ---------- Agenda ---------- */
.semanas { display: flex; background: #fff; border-radius: 999px; padding: 4px; box-shadow: var(--shadow); margin: 14px 0; }
.semanas button {
  flex: 1; appearance: none; border: 0; background: transparent; font: inherit; font-weight: 800;
  color: var(--muted); padding: 10px 6px; border-radius: 999px; cursor: pointer; font-size: .92rem;
}
.semanas button.on { background: var(--primary); color: #fff; }
.semanas button small { display: block; font-weight: 600; font-size: .74rem; opacity: .85; }

.dia { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin: 10px 0; }
.dia.vacio { box-shadow: none; background: transparent; border: 1.5px dashed var(--line); padding: 10px 14px; }
.dia-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dia.vacio .dia-cab { margin: 0; }
.dia-fecha {
  width: 48px; height: 52px; border-radius: 12px; background: var(--lav);
  display: grid; place-items: center; line-height: 1; flex: none;
}
.dia-fecha b { font-size: 1.25rem; color: var(--plum); }
.dia-fecha small { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.dia-nombre { font-weight: 800; color: var(--plum); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot {
  appearance: none; font: inherit; font-weight: 800; cursor: pointer;
  min-height: 48px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--plum);
}
.slot:hover:not(:disabled) { border-color: var(--primary); }
.slot.sel { background: var(--teal); border-color: var(--teal); color: #fff; }
.slot:disabled { background: #EFF1EC; color: #A9B1A3; border-color: transparent; cursor: not-allowed; text-decoration: line-through; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; border: 2px solid var(--line); }
.leyenda i.sel { background: var(--teal); border-color: var(--teal); }
.leyenda i.ocu { background: #EFF1EC; border-color: #EFF1EC; }

/* Barra inferior fija */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.barra .in { max-width: 560px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.barra .resumen { flex: 1; font-size: .88rem; line-height: 1.3; min-width: 0; }
.barra .resumen b { color: var(--plum); display: block; font-size: .95rem; }

/* ---------- Ficha ---------- */
.seccion-tit { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.seccion-tit .num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem; flex: none;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800;
  background: var(--lav); color: var(--primary);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.teal { background: var(--teal-soft); color: #0F6F85; }
.badge.gris { background: #EFEDF2; color: #6A6478; }

.archivos { list-style: none; padding: 0; margin: 10px 0 0; }
.archivos li { display: flex; align-items: center; gap: 10px; background: var(--lav); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: .9rem; }
.archivos li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px dashed #C5D7B2; border-radius: 14px; padding: 18px; text-align: center;
  color: var(--muted); cursor: pointer; background: #FBFDF8;
}
.dropzone:hover { border-color: var(--primary); }
.check-linea { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check-linea input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--primary); flex: none; }

.alerta { border-radius: 12px; padding: 12px 14px; font-size: .92rem; margin: 12px 0; }
.alerta.error { background: var(--danger-soft); color: #8E2238; }
.alerta.info { background: var(--teal-soft); color: #0F6F85; }
.alerta.warn { background: var(--warn-soft); color: #7A5214; }

/* ---------- Éxito ---------- */
.exito { text-align: center; padding: 48px 8px; }
.exito .circulo {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 22px;
  background: var(--teal-soft); display: grid; place-items: center;
  animation: pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.cargando { display: grid; place-items: center; padding: 48px; color: var(--muted); }
.cargando .spinner { border-color: var(--line); border-top-color: var(--primary); width: 30px; height: 30px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--plum); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 700; font-size: .92rem; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
