:root {
  --reparo-orange: #FF6B1A;
  --reparo-dark: #1B1F27;
  --reparo-gray: #F4F5F7;
  --reparo-green: #16A34A;
  --reparo-red: #DC2626;
  --reparo-blue: #2563EB;
  --text-main: #1B1F27;
  --border: #E5E7EB;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--reparo-gray);
  color: var(--text-main);
  overflow-x: hidden; 
}

a { text-decoration: none; color: inherit; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--reparo-dark);
  color: #fff;
  padding: 14px 24px;
}
.navbar .logo { font-size: 22px; font-weight: 800; color: var(--reparo-orange); letter-spacing: 1px; }
.navbar .logo span { color: #1c1c1c; }

.theme-toggle-nav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4em;
  line-height: 1;
  padding: 4px;
  margin: 0 4px;
  vertical-align: middle;
  filter: grayscale(100%) opacity(0.55);
  transition: filter 0.2s ease, transform 0.15s ease;
}
.theme-toggle-nav:hover { transform: scale(1.1); }
.theme-toggle-nav.is-on {
  filter: none;
  text-shadow: 0 0 10px rgba(255, 214, 51, 0.9);
}

html.dark-mode {
  --reparo-gray: #14161B;
  --text-main: #EDEEF0;
  --border: #2B2F38;
}
html.dark-mode body { background: var(--reparo-gray); color: var(--text-main); }
html.dark-mode .card { background: #1E222B; color: var(--text-main); }
html.dark-mode .card h2, html.dark-mode .card h3 { color: var(--text-main); }
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
  background: #262B35;
  color: var(--text-main);
  border-color: var(--border);
}
html.dark-mode label { color: var(--text-main); }
html.dark-mode table { color: var(--text-main); }
html.dark-mode th { background: #1E222B; }
html.dark-mode th, html.dark-mode td { border-color: var(--border); }
html.dark-mode .tabs a { background: #1E222B; border-color: var(--border); color: var(--text-main); }
html.dark-mode .tabs a.active { background: var(--reparo-orange); color: #fff; }
html.dark-mode .stat-box { background: #1E222B; }
html.dark-mode .chat-box { background: #1E222B; }
html.dark-mode .chat-msg.theirs { background: #262B35; border-color: var(--border); color: var(--text-main); }
html.dark-mode .category-tile { background: #1E222B; border-color: var(--border); }
html.dark-mode .category-tile.selected { background: #2A2210; }
html.dark-mode .img-container { background-color: #262B35; }
html.dark-mode hr { border-color: var(--border); }
html.dark-mode canvas.signature-pad { background: #1E222B; border-color: var(--border); }
html.dark-mode .navbar .logo span { color: #fff; }
.navbar-links { display: flex; gap: 18px; align-items: center; }
.navbar-links a, .navbar-links button {
  color: #fff; background: none; border: none; cursor: pointer; font-size: 14px;
}
.navbar-links .btn-logout { background: var(--reparo-orange); padding: 8px 14px; border-radius: 8px; font-weight: 600; }

.navbar { position: relative; }

.menu-toggle-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--reparo-dark);
  font-size: 1.6em;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

html.dark-mode .menu-toggle-btn {
  color: #fff;
}
.menu-toggle-icon { display: inline-block; transition: transform 0.25s ease; }
.menu-toggle-btn.abierto .menu-toggle-icon { transform: rotate(90deg); }

.menu-toggle-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: #dc3545;
  color: #fff;
  border-radius: 50%;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: bold;
}

.menu-desplegable {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--reparo-dark);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  z-index: 999;
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}
.menu-desplegable.abierto {
  max-height: 1200px;
  overflow-y: auto;
}

.menu-desplegable-inner {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  color: #fff;
  opacity: 0.85;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 24px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.menu-item:hover, .menu-item.active { opacity: 1; background: rgba(255,255,255,0.06); }
.menu-item-icon { font-size: 1.3em; line-height: 1; }
.menu-item-label { flex: 1; }

.menu-badge {
  background-color: #dc3545;
  color: #fff;
  border-radius: 50%;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: bold;
}

.menu-item-logout {
  margin: 10px 24px 4px;
  width: calc(100% - 48px);
  border-radius: 8px;
  background: var(--reparo-orange);
  justify-content: center;
  border-bottom: none;
}

@media (min-width: 700px) {
  .menu-desplegable { width: 320px; left: auto; right: 0; border-radius: 0 0 12px 12px; }
}

.container { 
  max-width: 1100px; 
  margin: 0 auto; 
  padding: 24px; 
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.container-sm { max-width: 480px; margin: 60px auto; padding: 24px; }

.login-grande {
  max-width: 960px;
  margin: 100px auto;
  padding: 24px;
}
.login-grande .card { padding: 48px; border-radius: 24px; }
.login-grande label { font-size: 20px; margin: 18px 0 8px; }
.login-grande input {
  padding: 20px 24px;
  font-size: 19px;
  border-radius: 12px;
}
.login-grande .btn {
  font-size: 22px;
  padding: 20px 32px;
  border-radius: 12px;
}
.login-grande .footer-login-link { font-size: 18px; margin-top: 24px; }
.login-grande hr { margin: 32px 0; }
.login-grande .alert { font-size: 17px; padding: 18px 22px; }

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  width: 100%;
}

.card h2, .card h3 { margin-top: 0; }

.grid { 
  display: grid; 
  gap: 12px; 
  width: 100%; 
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3, .grid-4 { 
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important; 
}

.category-tile {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center; 
  justify-content: flex-start;
  width: 100%;
  height: 100%;
}
.category-tile:hover { border-color: var(--reparo-orange); transform: translateY(-2px); }
.category-tile.selected { border-color: var(--reparo-orange); background: #FFF3EC; }
.category-tile .icon { font-size: 34px; margin-bottom: 4px; display: flex; justify-content: center; width: 100%;}

.img-container, 
.category-tile .icon img,
.category-tile img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important; 
  object-fit: cover !important;
  margin-bottom: 8px !important;
  border-radius: 8px !important;
  display: block; 
  margin-left: auto;
  margin-right: auto;
}

.category-tile div {
  font-size: 12px !important; 
  font-weight: 600;
  word-wrap: break-word;
  text-align: center; 
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1; 
}

label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-block;
  background: var(--reparo-orange);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  text-align: center; 
}
.btn:hover { opacity: 0.92; }
.btn-outline { background: none; border: 2px solid var(--reparo-orange); color: var(--reparo-orange); }
.btn-green { background: var(--reparo-green); }
.btn-red { background: var(--reparo-red); }
.btn-blue { background: var(--reparo-blue); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-pendiente { background: #FEF3C7; color: #92400E; }
.badge-cotizado { background: #DBEAFE; color: #1E40AF; }
.badge-aceptado, .badge-finalizado, .badge-pagado { background: #DCFCE7; color: #166534; }
.badge-rechazado, .badge-cancelado { background: #FEE2E2; color: #991B1B; }
.badge-asignado, .badge-en_camino, .badge-en_proceso { background: #EDE9FE; color: #5B21B6; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #FAFAFA; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.tabs a {
  padding: 8px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--border); font-size: 14px; font-weight: 600; text-align: center;
}
.tabs a.active { background: var(--reparo-dark); color: #fff; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; text-align: center; }
.alert-error { background: #FEE2E2; color: #991B1B; }
.alert-success { background: #DCFCE7; color: #166534; }

.chat-box { border: 1px solid var(--border); border-radius: 8px; height: 260px; overflow-y: auto; padding: 12px; background: #FAFAFA; margin-bottom: 10px; }
.chat-msg { padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; max-width: 75%; font-size: 14px; }
.chat-msg.mine { background: var(--reparo-orange); color: #fff; margin-left: auto; }
.chat-msg.theirs { background: #fff; border: 1px solid var(--border); }

.stat-box { background: #fff; border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.stat-box .num { font-size: 28px; font-weight: 800; color: var(--reparo-orange); }

#map, .map-canvas { width: 100%; height: 320px; border-radius: 8px; background: #E5E7EB; }

.footer-login-link { text-align: center; margin-top: 14px; font-size: 14px; }
canvas.signature-pad { border: 2px dashed var(--border); border-radius: 8px; touch-action: none; width: 100%; height: 180px; background: #fff; margin: 0 auto; display: block; }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 15px;
}

.neon-border {
  position: relative;
  border-radius: var(--neon-radius, 16px);
  isolation: isolate;
}

.neon-border::before,
.neon-border::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: var(--neon-thickness, 3px);
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    var(--neon-color, var(--reparo-orange)) 8%,
    transparent 22%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: neon-rotate var(--neon-speed, 6s) linear infinite;
  pointer-events: none;
}

.neon-border::after {
  animation-delay: calc(var(--neon-speed, 6s) / -2);
  filter: blur(8px);
  opacity: 0.75;
}

.neon-border > .card {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}

@keyframes neon-rotate {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .neon-border::before,
  .neon-border::after {
    animation: none;
  }
}

.liveness-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 10px 0 18px;
  text-align: center;
  background: #FAFAFA;
}
.liveness-video-wrap {
  width: 220px;
  height: 220px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--reparo-orange);
  background: #000;
}
.liveness-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.liveness-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.liveness-dot {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #E5E7EB;
  color: #6B7280;
}
.liveness-dot.completado {
  background: var(--reparo-green);
  color: #fff;
}
.liveness-status {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  min-height: 20px;
}
.liveness-status.liveness-ok { color: var(--reparo-green); }
.liveness-status.liveness-error { color: var(--reparo-red); }

html.dark-mode .liveness-box { background: #1E222B; }
html.dark-mode .liveness-dot { background: #262B35; color: #9CA3AF; }

.reg-progreso {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--reparo-orange);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.reg-step { display: none; }
.reg-step.activo { display: block; animation: regFadeIn 0.25s ease; }
@keyframes regFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.reg-check-msg {
  color: var(--reparo-green);
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
}
.reg-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
}
.reg-nav .btn { flex: 1; }

.boton-descarga-app .texto-corto { display: none; }

@media (max-width: 700px) {
  .navbar { padding: 10px 14px; }
  .navbar .logo { font-size: 16px; white-space: nowrap; }
  .navbar .navbar-derecha { gap: 8px; }
  .boton-descarga-app .texto-largo { display: none; }
  .boton-descarga-app .texto-corto { display: inline; }

  .container { padding: 14px; }
  .container-sm { margin: 24px auto; padding: 14px; }
  .card { padding: 18px; }

  .login-grande { margin: 28px auto; padding: 14px; }
  .login-grande .card { padding: 26px 20px; border-radius: 18px; }
  .login-grande label { font-size: 16px; margin: 14px 0 6px; }
  .login-grande input { padding: 14px 16px; font-size: 16px; }
  .login-grande .btn { font-size: 18px; padding: 15px 20px; }
  .login-grande .footer-login-link { font-size: 15px; }
  .login-grande hr { margin: 22px 0; }
  .login-grande .alert { font-size: 15px; padding: 12px 14px; }

  input, select, textarea { font-size: 16px; }

  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px; font-size: 13px; }

  img, video, iframe { max-width: 100%; }
  .chat-msg { max-width: 85%; }

  [style*="display: flex"], [style*="display:flex"] { flex-wrap: wrap; }
}
