:root {
  color-scheme: light;
  --bg: #F3F4F6;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --primary: #06C167; /* Uber/Rappi VIP Green */
  --primary-2: #059669;
  --accent: #F59E0B;
  --danger: #EF4444;
  --ok: #10B981;
  --soft: #F9FAFB;
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-deep: 0 24px 48px rgba(0, 0, 0, 0.12);
  --sheet-radius: 24px;
}

body.dark-mode {
  color-scheme: dark;
  --bg: #0F172A;
  --panel: #111827;
  --ink: #F9FAFB;
  --muted: #A7B0C0;
  --line: #243244;
  --primary: #22C55E;
  --primary-2: #16A34A;
  --accent: #FBBF24;
  --danger: #F87171;
  --ok: #34D399;
  --soft: #172033;
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.24);
  --shadow-deep: 0 24px 56px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* Global Nav */
.vip-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
}

body.dark-mode .vip-nav {
  background: rgba(15, 23, 42, 0.86);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}

.brand-home {
  text-align: left;
}

.brand-pill span {
  display: grid;
  gap: 0.05rem;
}

.brand-pill small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-logo-small {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.role-tabs-pill {
  display: flex;
  background: var(--line);
  padding: 0.25rem;
  border-radius: 999px;
  gap: 0.25rem;
}

body.launch-mode .role-tabs-pill {
  display: none;
}

.admin-tab {
  display: none;
}

body.admin-unlocked .admin-tab {
  display: flex;
}

.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  font-size: 1.2rem;
}

.role-tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.role-tab.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: var(--shadow-soft);
}

/* Main Container */
.vip-main {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Launch */
.launch-view {
  min-height: calc(100vh - 84px);
  padding: 1.5rem;
  display: none;
}

.launch-view.active {
  display: grid;
  place-items: center;
}

.launch-shell {
  width: min(100%, 960px);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 2rem;
  align-items: center;
}

.launch-brand {
  padding: 2rem 0;
}

.launch-brand img {
  width: 5rem;
  height: 5rem;
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.launch-kicker {
  color: var(--primary-2);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase;
}

.launch-brand h1 {
  font-size: clamp(2.6rem, 7vw, 5.5rem);
  line-height: 0.95;
  margin: 0;
}

.launch-brand p:last-child {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 34rem;
}

.launch-actions {
  display: grid;
  gap: 0.9rem;
}

.launch-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

body.dark-mode .launch-card,
body.dark-mode .request-card,
body.dark-mode .alert-card,
body.dark-mode .stat-card,
body.dark-mode .panel,
body.dark-mode .table-row,
body.dark-mode .ghost,
body.dark-mode .chat-message {
  background: var(--panel);
}

body.dark-mode .launch-card.primary {
  background: #020617;
  border-color: #020617;
}

.launch-card:hover {
  border-color: rgba(6, 193, 103, 0.45);
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.1);
  transform: translateY(-2px);
}

.launch-card.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.launch-card.primary small {
  color: rgba(255, 255, 255, 0.72);
}

.launch-card.quiet {
  background: rgba(255, 255, 255, 0.62);
}

.launch-icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(6, 193, 103, 0.12);
  color: var(--primary-2);
  font-size: 1.35rem;
}

.launch-card.primary .launch-icon {
  background: var(--primary);
  color: #fff;
}

.launch-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.launch-card small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.launch-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.admin-access {
  color: var(--muted);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
}

/* Mobile Wrapper */
.mobile-view {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
  background: var(--bg);
  box-shadow: var(--shadow-deep);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.desktop-view {
  max-width: 1080px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Map Hero & Bottom Sheet */
.map-hero {
  position: relative;
  width: 100%;
  height: 35vh;
  min-height: 250px;
  max-height: 400px;
  z-index: 1;
  background: #E5E3DF;
  display: block;
}

.bottom-sheet {
  position: relative;
  z-index: 10;
  background: var(--panel);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  padding: 1.5rem 1.5rem 4rem 1.5rem;
  margin-top: -20px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.08);
  min-height: 65vh;
}

.sheet-handle {
  width: 40px;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  margin: 0 auto 1.5rem auto;
}

/* VIP Forms & Inputs */
.form-header, .section-header {
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.section-divider {
  height: 8px;
  background: var(--bg);
  margin: 2rem -1.5rem;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--soft);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.input-group:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(6, 193, 103, 0.1);
}

body.dark-mode .input-group:focus-within {
  background: #1E293B;
}

.input-group.align-top {
  align-items: flex-start;
}

.input-group i {
  font-size: 1.4rem;
  color: var(--muted);
}

.select-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.label-float {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.vip-form input, 
.vip-form select, 
.vip-form textarea,
.chat-form input,
.tech-settings select,
.tech-settings input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
}

.vip-form textarea {
  resize: vertical;
}

.vip-grid {
  display: grid;
  gap: 0.75rem;
}

.vip-grid.two {
  grid-template-columns: 1fr 1fr;
}

/* Buttons */
.sticky-cta {
  position: sticky;
  bottom: 1rem;
  margin-top: 1.5rem;
  z-index: 20;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 8px 24px rgba(6, 193, 103, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(6, 193, 103, 0.2);
}

.btn-secondary {
  width: 100%;
  background: var(--ink);
  color: white;
  font-weight: 800;
  border-radius: 16px;
  padding: 0.85rem;
}

.btn-icon {
  background: var(--primary);
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

/* Lists & Cards */
.list {
  display: grid;
  gap: 1rem;
}

.request-card, .alert-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.request-card header, .alert-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.request-card h3, .alert-card h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.request-meta span {
  background: var(--soft);
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
}

.request-status {
  background: #FEF3C7;
  color: #92400E;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

body.dark-mode .request-status {
  background: rgba(251, 191, 36, 0.16);
  color: #FDE68A;
}

/* Chat */
.chat-container {
  background: var(--soft);
  border-radius: 16px;
  padding: 1rem;
}

.chat-box {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-height: 12rem;
  max-height: 18rem;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  line-height: 1.4;
}

.chat-message.mine {
  justify-self: end;
  background: var(--primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.chat-message strong {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  opacity: 0.8;
}

/* Wallet Card */
.vip-wallet-card {
  background: linear-gradient(135deg, var(--ink), #1F2937);
  border-radius: 16px;
  padding: 1.25rem;
  color: white;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-deep);
}

.wallet-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.wallet-balance span {
  font-size: 0.85rem;
  opacity: 0.8;
}

.wallet-balance strong {
  display: block;
  font-size: 2.2rem;
  margin-top: 0.2rem;
}

.wallet-balance small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  margin-top: 0.15rem;
}

/* Map Containers overrides */
.map-container {
  display: block;
  width: 100%;
}
.map-container .leaflet-control-container {
  display: none; /* Ocultar controles de leaflet para un look más limpio */
}

.wallet-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.toggle {
  width: 3rem;
  height: 1.6rem;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  position: relative;
  transition: all 0.2s ease;
}

.toggle span {
  display: block;
  width: 1.3rem;
  height: 1.3rem;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  transition: all 0.2s ease;
}

.toggle.active {
  background: var(--primary);
}

.toggle.active span {
  transform: translateX(1.4rem);
}

.quick-recharge {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.quick-recharge button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}

.quick-recharge button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gift-redeem {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.gift-redeem input {
  min-width: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  outline: none;
  font-weight: 700;
  text-transform: uppercase;
}

.gift-redeem input::placeholder {
  color: rgba(255, 255, 255, 0.56);
  text-transform: none;
}

.gift-redeem button {
  background: #fff;
  color: var(--ink);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-weight: 900;
}

body.dark-mode .gift-redeem button {
  color: #111827;
}

/* Action buttons in cards */
.job-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.ghost {
  border: 1px solid var(--line);
  padding: 0.5rem;
  border-radius: 8px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}

.danger {
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: var(--danger);
  padding: 0.5rem;
  border-radius: 8px;
  font-weight: 700;
}

body.dark-mode .danger {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
}

/* Map Pins */
.map-pin {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1.1rem;
}

.map-pin.client {
  background: var(--ink);
  color: white;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.15);
}

.map-pin.tech {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(6, 193, 103, 0.2);
}

/* Admin Stats */
.vip-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-soft);
}

.stat-card i {
  font-size: 2.5rem;
  color: var(--primary);
  opacity: 0.8;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
}

.admin-header h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem 0;
}

.admin-header p {
  color: var(--muted);
  margin-top: 0;
}

.admin-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

.admin-tool-card h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

.admin-tool-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 1rem;
}

.admin-form .input-group {
  margin-bottom: 0;
}

.compact {
  margin-top: 1rem;
}

.compact .table-row {
  box-shadow: none;
  border: 1px solid var(--line);
}

.badge-price {
  background: #FEF2F2;
  color: var(--danger);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 800;
}

body.dark-mode .badge-price {
  background: rgba(248, 113, 113, 0.14);
}

.inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translate(-50%, 4rem);
  background: var(--ink);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow-deep);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.toast.show {
  transform: translate(-50%, 0);
}

.empty {
  text-align: center;
  padding: 2rem;
  background: var(--soft);
  border-radius: 16px;
  color: var(--muted);
  font-weight: 600;
}

.table-row {
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  box-shadow: var(--shadow-soft);
}

.table-row strong {
  display: block;
}

.table-row span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

@media (min-width: 1024px) {
  .vip-nav {
    flex-direction: row;
    justify-content: space-between;
    padding: 1rem 2rem;
  }
}

@media (max-width: 760px) {
  .launch-view {
    min-height: calc(100vh - 74px);
    padding: 1rem;
  }

  .launch-shell {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .launch-brand {
    padding: 1rem 0 0;
  }

  .launch-brand img {
    width: 4rem;
    height: 4rem;
  }

  .launch-brand p:last-child {
    font-size: 1rem;
  }

  .launch-card {
    grid-template-columns: auto 1fr;
  }

  .launch-card > i {
    display: none;
  }

  .launch-footer {
    justify-content: center;
  }
}

/* Modals and Interactive Ratings */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
}
.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.stars-container {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}
.stars-container i {
  font-size: 2.5rem;
  color: #E5E7EB;
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
}
.stars-container i.active {
  color: #FBBF24; /* Yellow */
}
.stars-container i:hover {
  transform: scale(1.1);
}

/* Role Specific Branding for Production Separation */
body.role-tecnico {
  --primary: #2563EB; /* Pro Blue */
  --primary-2: #1D4ED8;
}
body.role-tecnico.dark-mode {
  --primary: #3B82F6;
  --primary-2: #2563EB;
}

body.role-admin {
  --primary: #6366F1; /* Admin Indigo */
  --primary-2: #4F46E5;
  --bg: #F8FAFC;
}
body.role-admin.dark-mode {
  --primary: #818CF8;
  --primary-2: #6366F1;
}
