/* Ligero-Go — design system premium (naranja #FF6B00). Shared by all surfaces. v13 */
:root {
  --bg: #F3F4F6;
  --bg2: #E5E7EB;
  --surface: #ffffff;
  --surface2: #F9FAFB;
  --border: rgba(31, 41, 55, 0.08);
  --text: #1F2937;
  --muted: #6B7280;
  --accent: #FF6B00;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 107, 0, 0.12);
  --accent-2: #FF4500;
  --accent-dim: rgba(255, 107, 0, 0.12);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --warn: #f79009;
  --warn-soft: rgba(247, 144, 9, 0.12);
  --danger: #f04438;
  --danger-soft: rgba(240, 68, 56, 0.12);
  --info: #2e90fa;
  --wa: #25d366;
  --radius: 20px;
  --radius-sm: 16px;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.06);
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-lift: 0 12px 28px rgba(31, 41, 55, 0.1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: 0.3s ease;
  --ease-in-out: 0.35s ease-in-out;
  --font: Outfit, system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
a,
.card,
.btn {
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), color var(--ease);
}

.hidden {
  display: none !important;
}

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

label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  margin-bottom: 12px;
  box-sizing: border-box;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 18px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  border-radius: 4px;
}

input[type="time"] {
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.check-row span {
  flex: 1;
  min-width: 0;
}

.field-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
  width: 100%;
}
.field-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 420px) {
  .field-grid--3 {
    grid-template-columns: 1fr;
  }
}
.field-grid > div {
  min-width: 0;
  overflow: hidden;
}
.field-grid label {
  margin: 0 0 4px;
}
.field-grid input,
.field-grid select,
.field-grid textarea {
  margin-bottom: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255, 107, 0, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.12);
}

.btn {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 107, 0, 0.32);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 8px;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(240, 68, 56, 0.25);
}

.btn-info {
  background: var(--info);
  color: #fff;
}

.btn-wa {
  background: var(--wa);
  color: #fff;
}

.btn-sm {
  padding: 11px 12px;
  font-size: 0.8rem;
  border-radius: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.sub {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Premium lift card utility */
.lift-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(31, 41, 55, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lift-card:hover,
.lift-card:active {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.1);
}

/* —— ImageUploader (premium, global) —— */
.file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.img-uploader {
  --iu-size: 112px;
  --iu-radius: 24px;
  position: relative;
  width: var(--iu-size);
  margin: 0 0 14px;
}

.img-uploader--sm { --iu-size: 72px; --iu-radius: 18px; }
.img-uploader--md { --iu-size: 112px; --iu-radius: 24px; }
.img-uploader--lg {
  --iu-size: 100%;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  --iu-radius: 20px;
}
.img-uploader--lg .img-uploader-hit {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.img-uploader--circle { --iu-radius: 50%; }
.img-uploader--cover {
  width: 100%;
  max-width: none;
  --iu-size: 100%;
  aspect-ratio: 16 / 9;
  --iu-radius: 20px;
}
.img-uploader--cover .img-uploader-hit {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.img-uploader-hit {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--iu-size);
  height: var(--iu-size);
  margin: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--iu-radius);
  border: 2px dashed #d1d5db;
  background: #f9fafb;
  color: #9ca3af;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.img-uploader-hit:hover,
.img-uploader-hit:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 107, 0, 0.06);
  color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.1);
}

.img-uploader-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  z-index: 1;
}

.img-uploader-ico {
  width: 2.25rem;
  height: 2.25rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.img-uploader--sm .img-uploader-ico {
  width: 1.5rem;
  height: 1.5rem;
}

.img-uploader--lg .img-uploader-ico {
  width: 2.75rem;
  height: 2.75rem;
}

.img-uploader-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: inherit;
  opacity: 0.9;
  text-align: center;
  line-height: 1.2;
  max-width: 9ch;
}

.img-uploader-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: none;
  z-index: 0;
  background: #e5e7eb;
}

.img-uploader.has-image .img-uploader-hit {
  border-style: solid;
  border-color: rgba(31, 41, 55, 0.08);
  background: #111;
}

.img-uploader.has-image .img-uploader-empty {
  display: none;
}

.img-uploader.has-image .img-uploader-thumb {
  display: block;
}

.img-uploader-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(31, 41, 55, 0.06);
  pointer-events: none;
}

.img-uploader-badge svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.img-uploader.has-image .img-uploader-badge {
  display: grid;
}

.img-uploader--sm .img-uploader-badge {
  width: 26px;
  height: 26px;
  right: 4px;
  bottom: 4px;
}

.img-uploader--sm .img-uploader-badge svg {
  width: 12px;
  height: 12px;
}

.img-uploader-clear {
  display: none;
  margin-top: 8px;
  width: auto;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 10px;
}

.img-uploader.has-image .img-uploader-clear {
  display: inline-flex;
}

.img-uploader-clear:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* —— Adaptive Role Nav (Fase 1) —— */
.lg-role-nav {
  width: 100%;
  max-width: 100%;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  z-index: 40;
  flex-shrink: 0;
  box-sizing: border-box;
}
.lg-role-nav-inner {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: #f3f4f6;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid rgba(31, 41, 55, 0.06);
  box-sizing: border-box;
}
.lg-role-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  z-index: 0;
  width: calc((100% - 8px) / 3);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.1), 0 1px 2px rgba(31, 41, 55, 0.06);
  transform: translate3d(0, 0, 0);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  will-change: transform;
}
.lg-role-nav[data-role="cliente"] .lg-role-thumb { transform: translate3d(0, 0, 0); }
.lg-role-nav[data-role="comercio"] .lg-role-thumb { transform: translate3d(100%, 0, 0); }
.lg-role-nav[data-role="repartidor"] .lg-role-thumb { transform: translate3d(200%, 0, 0); }
.lg-role-nav button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: clamp(0.68rem, 2.8vw, 0.74rem);
  font-weight: 800;
  color: #6b7280;
  padding: 11px 4px;
  border-radius: 999px;
  transition: color 0.22s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-role-nav button.on {
  color: #1f2937;
}
.lg-role-nav button:active {
  transform: scale(0.97);
}

/* Enter / leave — solo en .lg-role-stage interno, NUNCA en body */
.lg-role-stage {
  will-change: transform, opacity;
}
/* body/html como stage: anular cualquier animación residual (evita UI desplazada) */
body.lg-role-enter-fade,
body.lg-role-enter-slide-l,
body.lg-role-enter-slide-r,
body.lg-role-leave-fade,
body.lg-role-leave-slide-l,
body.lg-role-leave-slide-r,
html.lg-role-enter-fade,
html.lg-role-enter-slide-l,
html.lg-role-enter-slide-r,
html.lg-role-leave-fade,
html.lg-role-leave-slide-l,
html.lg-role-leave-slide-r,
body[data-role-stage].lg-role-leave-slide-l,
body[data-role-stage].lg-role-leave-slide-r,
body[data-role-stage].lg-role-enter-slide-l,
body[data-role-stage].lg-role-enter-slide-r {
  animation: none !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
html, body {
  overflow-x: clip;
  max-width: 100%;
}
@keyframes lgRoleFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes lgRoleFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes lgRoleSlideInL {
  from { opacity: 0.85; transform: translate3d(100%, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes lgRoleSlideInR {
  from { opacity: 0.85; transform: translate3d(-100%, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes lgRoleSlideOutL {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0.7; transform: translate3d(-100%, 0, 0); }
}
@keyframes lgRoleSlideOutR {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0.7; transform: translate3d(100%, 0, 0); }
}
.lg-role-stage.lg-role-enter-fade { animation: lgRoleFadeIn 0.28s ease both; }
.lg-role-stage.lg-role-leave-fade { animation: lgRoleFadeOut 0.2s ease both; pointer-events: none; }
.lg-role-stage.lg-role-enter-slide-l { animation: lgRoleSlideInL 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
.lg-role-stage.lg-role-enter-slide-r { animation: lgRoleSlideInR 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
.lg-role-stage.lg-role-leave-slide-l { animation: lgRoleSlideOutL 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; pointer-events: none; }
.lg-role-stage.lg-role-leave-slide-r { animation: lgRoleSlideOutR 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; pointer-events: none; }

/* Desktop ≥768px: tabs + hover, sin swipe visual */
@media (min-width: 768px) {
  .lg-role-nav {
    padding: calc(8px + var(--safe-t)) 24px 16px;
  }
  .lg-role-nav-inner {
    max-width: 520px;
    background: transparent;
    border: 0;
    padding: 0;
    gap: 6px;
    border-radius: 0;
  }
  .lg-role-thumb {
    display: none;
  }
  .lg-role-nav button {
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 0.82rem;
    color: #6b7280;
    background: transparent;
    border: 1px solid transparent;
  }
  .lg-role-nav button:hover {
    color: #1f2937;
    background: rgba(255, 107, 0, 0.08);
    border-color: rgba(255, 107, 0, 0.14);
    transform: translateY(-1px);
  }
  .lg-role-nav button.on {
    color: #fff;
    background: linear-gradient(135deg, #ff6b00, #ff4500);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.28);
  }
  .lg-role-nav button:active {
    transform: none;
  }
  .lg-role-desk-card,
  .lg-role-desk-card .auth-card,
  .lg-role-desk-card .panel-card,
  .lg-role-desk-card .card {
    max-width: 56rem; /* max-w-4xl */
    margin-left: auto;
    margin-right: auto;
  }
}

/* Sobre mapa repartidor / fondos oscuros */
.lg-role-nav--over-map {
  position: relative;
  z-index: 60;
  padding-top: calc(8px + var(--safe-t));
  background: linear-gradient(180deg, rgba(243, 244, 246, 0.96), rgba(243, 244, 246, 0.88));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html.lg-role-desktop [data-role-swipe] {
  touch-action: pan-y;
}
