:root {
  --ink: #102a2a;
  --muted: #5b6f6f;
  --line: #dce7e4;
  --paper: #f7faf8;
  --surface: #ffffff;
  --brand: #0f766e;
  --brand-dark: #0b5c56;
  --brand-soft: #e6f4f1;
  --accent: #f59e0b;
  --danger: #b42318;
  --ok: #047857;
  --shadow: 0 18px 40px -24px rgba(15, 60, 56, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 56px;
  --nav-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 10px);
  scroll-padding-bottom: calc(var(--nav-h) + 20px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 380px at 10% -10%, #dff3ef 0%, transparent 60%),
    var(--paper);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img, svg { max-width: 100%; }
a { color: var(--brand); }
.hidden { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.4);
  outline-offset: 2px;
}

.wrap {
  width: min(1120px, calc(100% - 28px));
  margin-inline: auto;
}

/* ── Cabecera y navegación ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.08rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--brand), #14b8a6);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #fff;
}

/* Navegación inferior: pulgar, siempre visible, 2 objetivos grandes. */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px 10px calc(6px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 32px -24px rgba(15, 60, 56, 0.55);
}

.tabs { transition: transform 0.2s ease; }

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 50px;
  padding: 6px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

.tab-icon svg { width: 100%; height: 100%; }

.tab.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* ── Presentación ──────────────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: 18px;
  padding: 26px 0 12px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--brand);
}

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 10px; }
h1 { font-size: clamp(1.8rem, 8.6vw, 2.7rem); max-width: 16ch; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.05rem; }

.lede {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 62ch;
  margin: 0;
}

.hero-note { display: none; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 0.94rem; }
.steps span {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 0.8rem;
}

.panel {
  padding: 6px 0 20px;
  scroll-margin-top: calc(var(--header-h) + 10px);
}

.client-grid { display: grid; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(16, 42, 42, 0.03);
  min-width: 0;
}

.card h2 { margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.hint { color: var(--muted); font-size: 0.88rem; line-height: 1.45; min-height: 1.2em; margin: 10px 0; }
.form-error { color: var(--danger); font-weight: 650; min-height: 1.2em; margin: 4px 0 0; }

/* ── Categorías ────────────────────────────────────────────────────────── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 13px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.chip:hover { border-color: #a9cfc8; }
.chip:active { transform: scale(0.98); }
.chip.is-active { background: var(--brand-soft); border-color: #8ac7bd; color: var(--brand-dark); }
.chip .count {
  font-size: 0.72rem;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 7px;
}

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 10px 20px -12px rgba(15, 118, 110, 0.9); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); border-color: #c8e6e0; }
.btn-soft:hover { background: #d9eeea; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #a9cfc8; background: #fff; }
.btn-danger { background: #fff1f0; color: var(--danger); border-color: #ffd5d2; }
.danger-text { color: var(--danger); }
.btn-small { min-height: 44px; padding: 9px 13px; font-size: 0.86rem; border-radius: 10px; }

#locate-btn,
#apply-location,
#request-btn,
#provider-form button[type="submit"] { width: 100%; }

#apply-location { margin-top: 2px; }

/* ── Formularios ───────────────────────────────────────────────────────── */
.field-row { display: grid; gap: 2px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0;
  font-size: 0.8rem;
  font-weight: 650;
  min-width: 0;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 0;
  border-color: var(--brand);
}

.field .btn { margin-top: 2px; width: 100%; }

/* ── Mapa ──────────────────────────────────────────────────────────────── */
.map-card {
  position: relative;
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map {
  height: 46vh;
  height: clamp(250px, 44dvh, 360px);
  width: 100%;
  background: #e8f0ee;
  z-index: 0;
}

.map-small { height: 190px; }

.map-fallback {
  position: absolute;
  inset: auto 12px 12px 12px;
  margin: 0;
  padding: 11px 13px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.86rem;
}

.map-move-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 500;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 750;
  box-shadow: 0 6px 18px -10px rgba(15, 60, 56, 0.6);
  cursor: pointer;
}

.map-note {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 11px 13px; font-size: 0.9rem; }
.leaflet-control-zoom a {
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  font-size: 20px !important;
}

/* ── Estado de la solicitud ────────────────────────────────────────────── */
.request-card { margin-top: 14px; scroll-margin-top: calc(var(--header-h) + 12px); }
.request-head { display: grid; gap: 10px; }
.request-title { margin-bottom: 3px; overflow-wrap: anywhere; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.76rem;
  font-weight: 750;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #c8e6e0;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill-off { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.pill-warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.pill-ok { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.pill-danger { background: #fff1f0; color: var(--danger); border-color: #ffd5d2; }

.request-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.request-grid .metric:last-child { grid-column: 1 / -1; }

.metric {
  background: #f9fcfb;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  min-width: 0;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 750;
}
.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.timeline { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 7px; }
.timeline li { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 0.86rem; }
.timeline .dot { width: 9px; height: 9px; border-radius: 50%; background: #d1dbd9; flex: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done .dot { background: var(--brand); }
.timeline li.current .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }

/* ── Panel del oferente ────────────────────────────────────────────────── */
.narrow-card { max-width: 760px; }
.form { margin-top: 6px; }

.dashboard-head { display: grid; gap: 14px; }
.dashboard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dashboard-actions .btn { flex: 1 1 auto; }
.dashboard-actions .pill { flex: 1 1 100%; justify-content: center; }

.section-title { margin: 22px 0 10px; }
.stack { display: grid; gap: 12px; }

.offer-card { border-left: 5px solid var(--brand); }
.offer-card.new { border-left-color: var(--accent); background: #fffdf7; }
.offer-top { display: grid; gap: 8px; }
.offer-meta { display: grid; gap: 6px; margin: 11px 0; color: var(--muted); font-size: 0.88rem; }
.offer-meta strong { color: var(--ink); }
.offer-meta a { overflow-wrap: anywhere; }
.offer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.offer-actions .btn { flex: 1 1 140px; }
.empty-state {
  text-align: center;
  padding: 26px 16px;
  color: var(--muted);
  background: #fbfdfc;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

/* ── Pie y avisos ──────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); margin-top: 18px; padding: 20px 0 12px; }
.footer-inner { display: grid; gap: 8px; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  z-index: 1000;
  max-width: none;
  background: var(--ink);
  color: #fff;
  border-radius: 13px;
  padding: 13px 15px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 22px 50px -20px rgba(0, 0, 0, 0.55);
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast strong { display: block; margin-bottom: 2px; }

/* ── Tabletas y escritorio ─────────────────────────────────────────────── */
/* Al escribir en el móvil, la barra inferior se aparta para no tapar campos. */
@media (max-width: 760px) {
  body.keyboard-open .tabs { transform: translateY(calc(100% + 10px)); }
}

@media (min-width: 560px) {
  .field-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 20px; border-radius: var(--radius); }
  .client-grid { gap: 16px; }
  #locate-btn,
  #apply-location,
  #provider-form button[type="submit"] { width: auto; }
  #apply-location { margin-top: 0; }
  .request-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
  .request-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .request-grid .metric:last-child { grid-column: auto; }
  .offer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .offer-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; }
  .footer-inner { display: flex; justify-content: space-between; gap: 18px; }
}

@media (min-width: 761px) {
  body { padding-bottom: 0; }

  .site-header {
    background: rgba(247, 250, 248, 0.94);
    backdrop-filter: blur(12px);
  }

  .header-inner { justify-content: space-between; min-height: 68px; }

  .tabs {
    position: static;
    display: inline-flex;
    width: auto;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #e8f0ee;
    box-shadow: none;
    backdrop-filter: none;
  }

  .tab {
    flex-direction: row;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.94rem;
  }

  .tab-icon { display: none; }
  .tab.is-active { background: var(--surface); box-shadow: 0 2px 8px rgba(15, 60, 56, 0.12); }

  .hero { padding: 56px 0 28px; gap: 32px; }
  h1 { font-size: clamp(2.4rem, 4vw, 3.4rem); }
  .lede { font-size: 1.05rem; }
  .panel { padding: 16px 0 34px; }
  .client-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .card { padding: 24px; }
  .map { height: 420px; }
  .map-small { height: 220px; }
  .toast { left: auto; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); }
  .dashboard-head { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .dashboard-actions { justify-content: flex-end; }
  .dashboard-actions .btn { flex: 0 0 auto; }
  .dashboard-actions .pill { flex: 0 0 auto; }
}

@media (min-width: 761px) and (hover: hover) and (pointer: fine) {
  .map-move-btn,
  .map-note { display: none; }
}

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.35fr 0.85fr; align-items: end; }
  .hero-note {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
  }
  .wrap { width: min(1120px, calc(100% - 40px)); }
}

@media (min-width: 761px) and (max-width: 899px) {
  .wrap { width: min(1120px, calc(100% - 32px)); }
}

/* Teléfonos en horizontal y pantallas de poca altura. */
@media (orientation: landscape) and (max-height: 520px) {
  .hero { padding: 14px 0 8px; }
  .hero .lede { display: none; }
  h1 { font-size: clamp(1.55rem, 3.6vw, 2rem); max-width: none; }
  .eyebrow { margin-bottom: 4px; }
  .map:not(.map-small) { height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* commerce */
.account-card { margin: 16px 0; }
.account-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.account-top h2 { margin: 4px 0; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.money { color: var(--teal, #0f766e); }
.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(15, 23, 42, 0.55); }
.modal-card { width: min(620px, 100%); max-height: 92vh; overflow: auto; background: var(--surface, #fff); border-radius: 18px 18px 0 0; padding: 18px; box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.icon-btn { border: 0; background: transparent; font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 4px 8px; min-width: 44px; min-height: 44px; }
.modal-card .form { margin-top: 8px; }
.chat-backdrop { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, 0.55); }
.chat-drawer { width: min(620px, 100%); height: min(78vh, 620px); display: flex; flex-direction: column; background: var(--surface, #fff); border-radius: 18px 18px 0 0; padding: 14px; }
.chat-messages { flex: 1; overflow: auto; padding: 8px 2px; }
.chat-message { max-width: 85%; margin: 6px 0; padding: 8px 10px; border-radius: 12px; background: #f1f5f9; }
.chat-message p { margin: 0 0 4px; overflow-wrap: anywhere; }
.chat-message span { font-size: .72rem; color: #64748b; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; }
.chat-form input { flex: 1; min-width: 0; }
.commerce-summary { margin: 12px 0 4px; }
@media (min-width: 761px) {
  .modal-backdrop, .chat-backdrop { align-items: center; padding: 24px; }
  .modal-card, .chat-drawer { border-radius: 18px; }
  .chat-drawer { height: min(70vh, 620px); }
}
