* {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
      background: linear-gradient(135deg, #d1e0e0, #e5f7f6);
      min-height: 100vh;
      color: #333;
    }

    .container {
      max-width: 1200px;
      margin: 0 auto;
      display: grid;
      grid-template-columns: 350px 1fr;
      gap: 30px;
      align-items: start;
      padding: 4rem 2rem;
    }

    /* Header */
    .header {
      grid-column: 1 / -1;
      text-align: center;
      margin-bottom: 40px;
    }

    .header h1 {
      color: white;
      font-size: 2.5rem;
      font-weight: 700;
      letter-spacing: 2px;
    }

    .header span {
      color: #66a5ad;
    }

    #map-perfil {
        height: 300px;
        width: 100%;
        margin-top: 15px;
        border-radius: 10px;
    }

    /* Tarjeta de Usuario */
    .user-card {
      background: white;
      border-radius: 50px 45px 65px 45px;
      padding: 40px 30px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      position: relative;
      overflow: hidden;
    }

    .user-card::before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 120px;
      height: 120px;
      background: linear-gradient(135deg, #66a5ad 0%, #4a9098 100%);
      border-radius: 0 45px 0 120%;
      opacity: 0.08;
    }

    .user-avatar {
    width: 80px;
    height: 80px;
    background-color: #1a3d34; 
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 15px;
    text-transform: uppercase;
}
/* Badge elegante para presupuesto aceptado */
.badge-success-elegant {
    background-color: #d4edda;
    color: #155724;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
    border: 1px solid #c3e6cb;
}

/* Cambio de color sutil a la tarjeta aceptada */
.card-accepted {
    border-left: 5px solid #28a745 !important;
    background-color: #f9fff9;
}

/* Botón Rechazar */
.btn-reject {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-reject:hover {
    background-color: #f5c6cb;
}
.btn-pay {
    background-color: #009ee3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-pay:hover {
    background-color: #007eb5;
}

.text-locked {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

    .user-name {
      text-align: center;
      font-size: 1.5rem;
      font-weight: 700;
      color: #1a3d34;
      margin-bottom: 30px;
    }

    .user-info-item {
      display: flex;
      align-items: flex-start;
      gap: 15px;
      padding: 18px 0;
      border-bottom: 1px solid #e8f0ee;
    }

    .user-info-item:last-of-type {
      border-bottom: none;
      padding-bottom: 0;
    }

    .user-info-icon {
      width: 45px;
      height: 45px;
      background: #e8f5f3;
      border-radius: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 1.3rem;
    }

    .user-info-content {
      flex: 1;
    }

    .user-info-label {
      font-size: 0.75rem;
      color: #888;
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 4px;
      font-weight: 600;
    }

    .user-info-value {
      font-size: 0.95rem;
      color: #1a3d34;
      font-weight: 500;
      line-height: 1.4;
    }

    .btn-edit {
      width: 100%;
      padding: 16px 30px;
      background: linear-gradient(135deg, #66a5ad 0%, #4a9098 100%);
      color: white;
      border: none;
      border-radius: 25px;
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
      margin-top: 30px;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .btn-edit:hover {
      transform: translateY(-3px);
      box-shadow: 0 15px 40px rgba(102, 165, 173, 0.4);
    }

    .btn-edit:active {
      transform: translateY(-1px);
    }

    /* Sección Principal */
    .main-content {
      background: white;
      border-radius: 45px 60px 45px 45px;
      padding: 40px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

    .section-title {
      font-size: 1.6rem;
      font-weight: 700;
      color: #1a3d34;
      margin-bottom: 30px;
    }

    /* Sistema de Tabs */
    .tabs {
      display: flex;
      gap: 12px;
      margin-bottom: 35px;
      background: #f0f5f4;
      padding: 8px;
      border-radius: 22px;
      margin-left: -5px;
      margin-right: -5px;
    }

    .tab-btn {
      flex: 1;
      padding: 14px 25px;
      border: none;
      background: transparent;
      font-size: 0.95rem;
      font-weight: 600;
      color: #666;
      cursor: pointer;
      border-radius: 18px;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      white-space: nowrap;
    }

    .tab-btn.active {
      background: white;
      color: #1a3d34;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .tab-btn:hover:not(.active) {
      background: rgba(255, 255, 255, 0.6);
      color: #333;
    }

    .tab-badge {
      background: #1a3d34;
      color: white;
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 700;
      min-width: 24px;
      text-align: center;
    }

    .tab-btn.active .tab-badge {
      background: #66a5ad;
    }

    /* Contenido de Tabs */
    .tab-content {
      display: none;
      animation: fadeIn 0.3s ease;
    }

    .tab-content.active {
      display: block;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Lista de Solicitudes */
    .request-list {
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .request-card {
      background: #fafcfb;
      border-radius: 22px;
      padding: 25px;
      display: grid;
      grid-template-columns: auto 1fr auto auto;
      align-items: center;
      gap: 20px;
      transition: all 0.3s ease;
      border: 2px solid transparent;
    }

    .request-card:hover {
      border-color: #66a5ad;
      background: white;
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
      transform: translateX(5px);
    }

    .request-icon {
      width: 60px;
      height: 60px;
      border-radius: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 1.8rem;
    }

    .request-icon.pending {
      background: #f7b731;
    }

    .request-icon.active {
      background: #66c5cf;
    }

    .request-icon-letter {
      font-size: 1.7rem;
      font-weight: 800;
      color: white;
      font-family: 'Segoe UI', Arial, sans-serif;
      line-height: 1;
      text-shadow: 0 2px 6px rgba(0,0,0,0.18);
      letter-spacing: -1px;
    }

    .request-info {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .request-title {
      font-size: 1.05rem;
      font-weight: 600;
      color: #1a3d34;
    }

    .request-date {
      font-size: 0.85rem;
      color: #888;
    }

    .request-status {
      padding: 8px 16px;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      text-align: center;
      white-space: nowrap;
    }

    .status-pending {
      background: #fff3e0;
      color: #e65100;
    }

    .status-active {
      background: #e0f7f4;
      color: #00897b;
    }

    .btn-details {
      padding: 12px 24px;
      background: #1a3d34;
      color: white;
      border: none;
      border-radius: 16px;
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s ease;
      white-space: nowrap;
    }

    .btn-details:hover {
      background: #2a5d4a;
      transform: scale(1.05);
    }

    .btn-details:active {
      transform: scale(0.98);
    }

    /* Botones de acción en solicitudes activas */
    .active-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-width: 160px;
    }

    .btn-action {
      padding: 10px 16px;
      border: none;
      border-radius: 14px;
      font-size: 0.82rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.25s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      letter-spacing: 0.2px;
    }

    .btn-chat {
      background: #e8f5f3;
      color: #1a3d34;
      border: 2px solid #b2ddd6;
    }

    .btn-chat:hover {
      background: #1a3d34;
      color: white;
      border-color: #1a3d34;
    }

    .btn-accept {
      background: linear-gradient(135deg, #66a5ad 0%, #4ecdc4 100%);
      color: white;
    }

    .btn-accept:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(102, 165, 173, 0.45);
    }

    .btn-cancel {
      background: #fdf0f0;
      color: #c0392b;
      border: 2px solid #f5c6c6;
    }

    .btn-cancel:hover {
      background: #c0392b;
      color: white;
      border-color: #c0392b;
    }

    /* Modal de Chat */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      z-index: 1000;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal {
      background: white;
      border-radius: 30px;
      width: 100%;
      max-width: 480px;
      box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
      overflow: hidden;
      animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
      from { opacity: 0; transform: translateY(30px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .modal-header {
      background: linear-gradient(135deg, #1a3d34 0%, #2a5d4a 100%);
      color: white;
      padding: 25px 30px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .modal-header-info {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .modal-title {
      font-size: 1.1rem;
      font-weight: 700;
    }

    .modal-subtitle {
      font-size: 0.8rem;
      color: #a0cfc9;
    }

    .modal-close {
      background: rgba(255,255,255,0.15);
      border: none;
      border-radius: 12px;
      width: 36px;
      height: 36px;
      cursor: pointer;
      color: white;
      font-size: 1.2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .modal-close:hover {
      background: rgba(255,255,255,0.28);
    }

    .chat-messages {
      padding: 25px 25px 10px;
      min-height: 220px;
      max-height: 260px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    /* Nombre del remitente en el chat */
    .chat-sender-name {
        font-size: 0.75rem;
        font-weight: bold;
        margin-bottom: 4px;
        color: #1a3d34;
        opacity: 0.8;
    }

    .chat-bubble {
      max-width: 78%;
      padding: 12px 16px;
      border-radius: 18px;
      font-size: 0.9rem;
      line-height: 1.5;
      word-wrap: break-word;
    }

    .bubble-agent {
      background: #e8f5f3;
      color: #1a3d34;
      border-bottom-left-radius: 6px;
      align-self: flex-start;
    }

    .bubble-user {
      background: linear-gradient(135deg, #66a5ad 0%, #4ecdc4 100%);
      color: white;
      border-bottom-right-radius: 6px;
      align-self: flex-end;
    }

    /* El nombre en mis burbujas no es necesario o se ve diferente */
    .bubble-user .chat-sender-name {
        color: rgba(255, 255, 255, 0.9);
        display: block; 
    }

    .bubble-time {
      font-size: 0.72rem;
      opacity: 0.6;
      margin-top: 4px;
    }

    .chat-input-area {
      padding: 15px 20px 20px;
      display: flex;
      gap: 10px;
      border-top: 1px solid #eef2f1;
      align-items: flex-end; /* Alinear botón abajo si el textarea crece */
    }

    .chat-input {
      flex: 1;
      padding: 12px 18px;
      border: 2px solid #e0ece9;
      border-radius: 20px;
      font-size: 0.9rem;
      outline: none;
      font-family: inherit;
      color: #1a3d34;
      transition: border-color 0.2s;
      resize: none; /* Evitar resize manual feo */
      height: 48px; /* Altura inicial */
      max-height: 120px;
      overflow-y: auto;
      scrollbar-width: none; /* Firefox */
      -ms-overflow-style: none; /* IE/Edge */
    }

    .chat-input::-webkit-scrollbar {
      display: none; /* Chrome, Safari, Opera */
    }

    .chat-input:focus {
      border-color: #66a5ad;
    }

    .btn-send {
      width: 46px;
      height: 46px;
      background: linear-gradient(135deg, #66a5ad 0%, #4ecdc4 100%);
      border: none;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.2s;
      flex-shrink: 0;
    }

    .btn-send:hover {
      transform: scale(1.1);
    }

    .btn-send svg {
      width: 20px;
      height: 20px;
      fill: white;
    }

    /* Modal de Confirmacion */
    .modal-confirm-body {
      padding: 30px;
      text-align: center;
    }

    .modal-confirm-icon {
      font-size: 3.5rem;
      margin-bottom: 16px;
    }

    .modal-confirm-title {
      font-size: 1.2rem;
      font-weight: 700;
      color: #1a3d34;
      margin-bottom: 8px;
    }

    .modal-confirm-text {
      font-size: 0.92rem;
      color: #666;
      line-height: 1.6;
      margin-bottom: 28px;
    }

    .modal-confirm-actions {
      display: flex;
      gap: 12px;
    }

    .btn-confirm-yes {
      flex: 1;
      padding: 14px;
      border: none;
      border-radius: 18px;
      font-size: 0.95rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.25s;
    }

    .btn-confirm-no {
      flex: 1;
      padding: 14px;
      background: #f0f4f3;
      color: #666;
      border: none;
      border-radius: 18px;
      font-size: 0.95rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.25s;
    }

    .btn-confirm-no:hover {
      background: #e0e8e6;
    }

    .btn-confirm-accept {
      background: linear-gradient(135deg, #66a5ad 0%, #4ecdc4 100%);
      color: white;
    }

    .btn-confirm-accept:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(102,165,173,0.4);
    }

    .btn-confirm-danger {
      background: #c0392b;
      color: white;
    }

    .btn-confirm-danger:hover {
      background: #a93226;
      transform: translateY(-2px);
    }

    /* Estado Vacío */
    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: #999;
    }

    .empty-state-icon {
      font-size: 3rem;
      margin-bottom: 20px;
    }

    .empty-state p {
      font-size: 0.95rem;
      color: #888;
    }

    @media (max-width: 900px) {
      .container {
        padding: 4rem 3rem;
      }
    }

    /* Responsive */
    @media (max-width: 900px) {
      .container {
        grid-template-columns: 1fr;
      }

      .request-card {
        grid-template-columns: auto 1fr auto;
      }

      .request-status {
        grid-column: 1 / -1;
        justify-self: flex-start;
        margin-top: 10px;
      }

      .btn-details {
        grid-column: 3;
      }

      .tabs {
        flex-direction: column;
      }

      .tab-btn {
        justify-content: flex-start;
      }
    }

    @media (max-width: 600px) {
      .header h1 {
        font-size: 1.8rem;
      }

      .container {
        gap: 20px;
      }

      .user-card,
      .main-content {
        padding: 25px 20px;
      }

      .request-card {
        grid-template-columns: auto 1fr;
        gap: 15px;
      }

      .request-status,
      .btn-details {
        grid-column: 1 / -1;
        width: 100%;
        text-align: center;
      }

      .section-title {
        font-size: 1.3rem;
      }
    }
    /* --- NUEVOS ESTILOS PARA ACCIONES DE TRAMITADOS --- */

/* Contenedor de botones a la derecha */
.active-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
}

/* Base para todos los botones de acción */
.btn-action {
  padding: 10px 16px;
  border: none;
  border-radius: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Botón Aceptar: Usa tu color de marca celeste/teal */
.btn-accept {
  background: linear-gradient(135deg, #66a5ad 0%, #4a9098 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 165, 173, 0.25);
}

.btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(102, 165, 173, 0.4);
}

/* Botón Chatear: Fondo claro con borde, muy elegante */
.btn-chat {
  background: #f0f7f6;
  color: #1a3d34;
  border: 2px solid #b2ddd6;
}

.btn-chat:hover {
  background: #1a3d34;
  color: white;
  border-color: #1a3d34;
}

/* Botón Finalizar: Rojo suave para no ser agresivo */
.btn-finish {
  background: #fff5f5;
  color: #c0392b;
  border: 2px solid #f5c6c6;
}

.btn-finish:hover {
  background: #c0392b;
  color: white;
  border-color: #c0392b;
}

/* Ajuste para que en móviles los botones ocupen el ancho total */
@media (max-width: 900px) {
  .active-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    width: 100%;
  }
  .btn-action {
    flex: 1;
  }
}

/* === CHAT MODAL STYLES === */
/* Spinner y Empty State */
.chat-loading, .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    gap: 15px;
    text-align: center;
}

.chat-loading i {
    font-size: 2rem;
    color: #66a5ad;
    animation: spinChat 1s linear infinite;
}

.precio_p_solicitud{
  color: green;
  font-weight: bold;
  font-size: 1.1rem;
}

@keyframes spinChat { 100% { transform: rotate(360deg); } }

/* Separador de fecha */
.chat-date-separator {
    text-align: center;
    font-size: 0.75rem;
    color: #aaa;
    margin: 15px 0 10px 0;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-date-separator::before,
.chat-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eef2f1;
    margin: 0 10px;
}

/* Iconos de estado (leído/enviado) */
.msg-status {
    font-size: 0.7rem;
    margin-left: 4px;
}
.msg-status.read { color: #a8e6cf; } /* Verde claro para leído */
.msg-status.sent { color: rgba(255,255,255,0.7); } /* Blanco transp para enviado */

#swal-input-region{
  width: 100%;
  font-size: 1.2rem;
  border: 1px solid gray;
  border-radius: 4px;
  width: 100%;
}

/* Ajustes Modal Responsive */
@media (max-width: 600px) {
    .modal {
        max-height: 70%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .chat-messages {
        flex: 1; /* Ocupar todo el espacio disponible */
        max-height: none;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
}

/* Botón flotante para abrir chat si fuera necesario (opcional) */
.chat-trigger-btn {
    /* Estilos para el botón que abre el chat desde la lista */
    cursor: pointer;
}

/* Scrollbar personalizado para el chat */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #c1dcdc;
    border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0cfc9;
}