:root {
  --green: #2f5d3a;
  --green-2: #3f7a4c;
  --green-soft: #e6efe4;
  --wheat: #e2a93b;
  --wheat-soft: #fbf0d6;
  --soil: #7a5230;
  --bg: #f8f5ee;
  --card: #ffffff;
  --ink: #1f2a22;
  --muted: #6a7466;
  --line: #e4ddcf;
  --red: #b3412f;
  --red-soft: #f8e3df;
  --blue: #2e6a8e;
  --blue-soft: #e1eef5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 34, .06), 0 4px 16px rgba(31, 42, 34, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; font-size: 16px; line-height: 1.5; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }

/* ---------- Barra superior */
#topbar { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { color: #fff; text-decoration: none; font-size: 1.3rem; font-weight: 600; white-space: nowrap; }
.brand b { color: var(--wheat); }
.bar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bar nav a, .bar nav .link { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.bar nav a:hover, .bar nav .link:hover { background: rgba(255,255,255,.12); }
.bar nav a.active { background: rgba(255,255,255,.18); }
.bar nav .btn { background: var(--wheat); color: var(--ink); }
.bar nav .btn:hover { background: #eeb94e; }
.who { font-size: .85rem; opacity: .85; padding: 0 6px; }

/* ---------- Botones y formularios */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--green); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: .9rem; }
.btn-lg { padding: 15px 24px; font-size: 1.05rem; }
.btn-wheat { background: var(--wheat); color: var(--ink); }
.btn-wheat:hover { background: #eeb94e; }
.btn-ghost { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-ghost:hover { background: var(--green-soft); }
.btn-danger { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.link { background: none; border: 0; font: inherit; cursor: pointer; color: var(--green); padding: 0; }

form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%; font: inherit; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(63,122,76,.18); }
textarea { min-height: 110px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; display: none; }
.form-error.show { display: block; }

/* ---------- Tarjetas y layout */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.page { padding-top: 28px; padding-bottom: 60px; }
.narrow { max-width: 520px; margin: 0 auto; }
.mid { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Portada */
.hero { background: linear-gradient(160deg, #2f5d3a 0%, #3f7a4c 55%, #6b8f3e 100%); color: #fff; padding: 64px 0 90px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 60px; background: var(--bg); clip-path: ellipse(75% 100% at 50% 100%); }
.hero p.lead { font-size: 1.2rem; max-width: 620px; opacity: .95; margin-bottom: 26px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.7); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }
.section { padding: 44px 0; }
.section h2 { text-align: center; margin-bottom: 26px; }
.step { text-align: center; }
.step .num { width: 46px; height: 46px; border-radius: 50%; background: var(--wheat-soft); color: var(--soil); font-weight: 700; font-size: 1.2rem; display: grid; place-items: center; margin: 0 auto 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: .95rem; }
.plan { display: flex; flex-direction: column; }
.plan .price { font-size: 2.2rem; font-weight: 700; color: var(--green); margin: 6px 0; }
.plan .price small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.plan ul { padding-left: 0; list-style: none; margin: 10px 0 18px; flex: 1; }
.plan li { padding: 5px 0 5px 26px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--green-2); font-weight: 700; }
.plan.featured { border: 2px solid var(--wheat); }
footer.foot { text-align: center; color: var(--muted); padding: 30px 0 40px; font-size: .9rem; }

/* ---------- Registro: elegir rol */
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.role-opt { position: relative; }
.role-opt input { position: absolute; opacity: 0; pointer-events: none; }
.role-opt label { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; font-weight: 400; background: #fff; height: 100%; }
.role-opt label strong { display: block; font-size: 1.05rem; margin: 4px 0 2px; }
.role-opt label .ico { font-size: 1.8rem; }
.role-opt input:checked + label { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(63,122,76,.15); }
.role-opt input:focus-visible + label { outline: 3px solid var(--wheat); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: 400; cursor: pointer; margin: 0; background: #fff; }
.check input { width: auto; margin: 0; }
.check:has(input:checked) { border-color: var(--green-2); background: var(--green-soft); }
.demo-box { background: var(--wheat-soft); border-radius: 12px; padding: 14px; margin-top: 18px; font-size: .92rem; }
.demo-box .btn { margin: 6px 6px 0 0; }

/* ---------- Avisos */
.alert { border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.alert-warn { background: var(--wheat-soft); border: 1.5px solid #efd28f; }
.alert-info { background: var(--blue-soft); border: 1.5px solid #bcd7e7; }
.alert-ok { background: var(--green-soft); border: 1.5px solid #c4dbc0; }

/* ---------- Estadísticas */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 700; color: var(--green); }
.stat .l { color: var(--muted); font-size: .88rem; }
@media (max-width: 520px) { .stat .n { font-size: 1.4rem; } .stat { padding: 10px; } }

/* ---------- Lista de trabajos */
.jobs { display: grid; gap: 12px; }
.job { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: #fff; border-radius: 12px; padding: 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; border: 1.5px solid transparent; transition: border-color .15s, transform .1s; }
.job:hover { border-color: var(--green-2); }
.job .ico { width: 50px; height: 50px; border-radius: 12px; background: var(--green-soft); display: grid; place-items: center; font-size: 1.6rem; }
.job h3 { margin: 0 0 3px; }
.job .meta { color: var(--muted); font-size: .9rem; display: flex; gap: 12px; flex-wrap: wrap; }
.job .side { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.job .money { font-weight: 700; color: var(--soil); }
.job.new { animation: pulse 1.2s ease 2; }
@keyframes pulse { 50% { border-color: var(--wheat); box-shadow: 0 0 0 4px rgba(226,169,59,.25); } }
@media (max-width: 620px) {
  .job { grid-template-columns: auto 1fr; }
  .job .side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.st-open { background: var(--wheat-soft); color: #8a5d0a; }
.st-accepted { background: var(--blue-soft); color: var(--blue); }
.st-progress { background: #efe3f6; color: #6a3a88; }
.st-done { background: var(--green-soft); color: var(--green); }
.st-cancel { background: #eee; color: #777; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); background: #fff; border-radius: 12px; border: 2px dashed var(--line); }
.empty .big { font-size: 2.4rem; }

/* ---------- Pestañas y filtros */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tab { background: none; border: 0; font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--green); border-color: var(--green); }
.tab .count { background: var(--wheat); color: var(--ink); border-radius: 999px; padding: 0 7px; font-size: .78rem; margin-left: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters select { width: auto; min-width: 170px; padding: 8px 10px; }
.filters .check { padding: 7px 10px; }
.live { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3fb45a; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- Detalle de trabajo */
.detail-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.detail-head .ico { font-size: 2.2rem; width: 64px; height: 64px; border-radius: 14px; background: var(--green-soft); display: grid; place-items: center; flex-shrink: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.fact { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: .8rem; color: var(--muted); }
.fact .v { font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 26px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--green-2); }
.person { display: flex; gap: 12px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--wheat-soft); color: var(--soil); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.contact { background: var(--green-soft); border-radius: 10px; padding: 12px; margin-top: 12px; }
.contact a { font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stars-input { display: flex; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.stars-input input { display: none; }
.stars-input label { font-size: 2rem; color: #d8d2c4; cursor: pointer; margin: 0; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--wheat); }
.stars { color: var(--wheat); letter-spacing: 1px; }
.side-col { display: grid; gap: 16px; align-content: start; }
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 820px) { .detail-grid { grid-template-columns: 1fr; } }

.mp-note { border: 1.5px solid #9fc7e6; border-radius: 12px; padding: 14px; background: var(--blue-soft); margin: 14px 0; font-size: .92rem; }
.trial-tag { display: inline-block; background: var(--wheat-soft); color: #8a5d0a; font-weight: 700; font-size: .85rem; padding: 3px 10px; border-radius: 999px; margin-top: 4px; }

/* ---------- Administración */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin table { min-width: 760px; }
.admin td { vertical-align: top; }
.admin .filters input { max-width: 420px; }
.admin tr.is-blocked td { background: var(--red-soft); }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin: 2px 0; }
.kv { list-style: none; padding: 0; margin: 0; }
.kv li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
.kv li:first-child { border-top: 0; }

/* ---------- Avisos por WhatsApp */
.notifs { list-style: none; padding: 0; margin: 10px 0 0; }
.notifs li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.notifs li:first-child { border-top: 0; }
.notifs a { color: var(--ink); }

/* ---------- Mapa */
[hidden] { display: none !important; }
.map { height: 320px; border-radius: 10px; border: 1.5px solid var(--line); overflow: hidden; background: var(--bg); z-index: 0; }
.map .loading { padding: 40px 12px; }
.map-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.map-pin { font-size: 28px; line-height: 32px; text-align: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.map .leaflet-control-layers label { display: block; font-weight: 400; font-size: .85rem; margin: 0; }
.map .leaflet-control-layers input { width: auto; padding: 0; margin: 0 4px 0 0; border: 0; box-shadow: none; }
@media (max-width: 620px) { .map { height: 260px; } }

/* ---------- Suscripción */
.sub-status { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.on { background: #3fb45a; } .dot.off { background: #c9c2b3; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.demo-pay { border: 2px dashed var(--wheat); border-radius: 12px; padding: 14px; background: var(--wheat-soft); margin: 14px 0; font-size: .92rem; }

/* ---------- Toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }
#toast.ok { background: var(--green); }
