/* ==========================================================================
   DLUNA PARFUMS — SISTEMA DE AUTENTICACIÓN, ROLES Y GESTIÓN DE USUARIOS (CSS)
   ========================================================================== */

/* User Nav Container & Button */
.dluna-user-nav-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dluna-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card, #101B33);
  border: 1px solid var(--border-subtle, rgba(197, 160, 89, 0.25));
  color: var(--text-main, #F8F6F0);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full, 9999px);
  font-family: var(--font-sans, inherit);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.dluna-user-btn:hover {
  border-color: var(--gold-primary, #C5A059);
  color: var(--gold-light, #E2C78A);
  box-shadow: 0 4px 15px rgba(197, 160, 89, 0.2);
  transform: translateY(-1px);
}

.dluna-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(135deg, #F2DFB3 0%, #C5A059 100%));
  color: #070C18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.dluna-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.dluna-role-propietario {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.25) 0%, rgba(154, 123, 57, 0.35) 100%);
  color: var(--gold-light, #E2C78A);
  border: 1px solid rgba(197, 160, 89, 0.4);
}

.dluna-role-agente {
  background: rgba(34, 158, 217, 0.2);
  color: #58C0F5;
  border: 1px solid rgba(34, 158, 217, 0.35);
}

.dluna-discount-pill {
  font-size: 0.68rem;
  font-weight: 800;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #FFFFFF;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

/* User Dropdown Menu */
.dluna-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-surface, #0B1325);
  border: 1px solid var(--border-subtle, rgba(197, 160, 89, 0.3));
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  padding: 0.6rem 0;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(16px);
  animation: dlunaFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dluna-user-dropdown.open {
  display: block;
}

@keyframes dlunaFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dluna-dropdown-header {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.15);
}

.dluna-dropdown-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main, #F8F6F0);
}

.dluna-dropdown-sub {
  font-size: 0.75rem;
  color: var(--text-muted, #9BA5B7);
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dluna-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  color: var(--text-main, #F8F6F0);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.dluna-dropdown-item:hover {
  background: rgba(197, 160, 89, 0.12);
  color: var(--gold-light, #E2C78A);
}

.dluna-dropdown-divider {
  height: 1px;
  background: rgba(197, 160, 89, 0.12);
  margin: 0.4rem 0;
}

/* Modals System (Login & Users Admin) */
.dluna-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.dluna-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.dluna-modal-card {
  background: var(--bg-surface, #0B1325);
  border: 1px solid var(--border-subtle, rgba(197, 160, 89, 0.3));
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  position: relative;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dluna-modal-backdrop.open .dluna-modal-card {
  transform: scale(1);
}

.dluna-modal-card.wide {
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.dluna-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(197, 160, 89, 0.06) 0%, transparent 100%);
}

.dluna-modal-title {
  font-family: var(--font-serif, 'Cinzel', serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-light, #E2C78A);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.dluna-modal-close {
  background: none;
  border: none;
  color: var(--text-muted, #9BA5B7);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.2s ease;
}

.dluna-modal-close:hover {
  color: var(--gold-light, #E2C78A);
}

.dluna-modal-body {
  padding: 1.6rem;
  overflow-y: auto;
}

/* Form Styles */
.dluna-form-group {
  margin-bottom: 1.2rem;
}

.dluna-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-gold, #DFC488);
  margin-bottom: 0.4rem;
}

.dluna-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.dluna-input {
  width: 100%;
  background: var(--bg-card, #101B33);
  border: 1px solid var(--border-subtle, rgba(197, 160, 89, 0.25));
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-main, #F8F6F0);
  font-family: var(--font-sans, inherit);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.dluna-input:focus {
  outline: none;
  border-color: var(--gold-primary, #C5A059);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.18);
  background: var(--bg-card-hover, #162445);
}

.dluna-input-icon-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted, #9BA5B7);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
}

.dluna-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.84rem;
  margin-bottom: 1.2rem;
  display: none;
}

.dluna-alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.dluna-alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86EFAC;
}

/* User Management Admin Panel */
.dluna-admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dluna-table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(197, 160, 89, 0.18);
  border-radius: 10px;
}

.dluna-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.dluna-users-table th {
  background: rgba(197, 160, 89, 0.1);
  color: var(--gold-light, #E2C78A);
  font-family: var(--font-serif, serif);
  padding: 0.85rem 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.dluna-users-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.08);
  color: var(--text-main, #F8F6F0);
}

.dluna-users-table tr:hover td {
  background: rgba(197, 160, 89, 0.05);
}

.dluna-badge-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  display: inline-block;
}

.dluna-status-active {
  background: rgba(34, 197, 94, 0.15);
  color: #4ADE80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dluna-status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.dluna-action-btns {
  display: flex;
  gap: 0.4rem;
}

.dluna-btn-icon {
  background: var(--bg-card, #101B33);
  border: 1px solid var(--border-subtle, rgba(197, 160, 89, 0.25));
  color: var(--text-main, #F8F6F0);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.dluna-btn-icon:hover {
  border-color: var(--gold-primary, #C5A059);
  color: var(--gold-light, #E2C78A);
  transform: translateY(-1px);
}

.dluna-btn-icon.delete:hover {
  border-color: #EF4444;
  color: #F87171;
}

/* Dynamic Price Display when Discount is Active */
.dluna-price-box-discount {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dluna-price-original {
  font-size: 0.8rem;
  color: var(--text-muted, #9BA5B7);
  text-decoration: line-through;
}

.dluna-price-final {
  font-family: var(--font-serif, inherit);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-light, #E2C78A);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dluna-tag-discount {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #FFFFFF;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

/* Toast Notifications */
.dluna-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.dluna-toast {
  background: var(--bg-surface, #0B1325);
  border: 1px solid var(--gold-primary, #C5A059);
  color: var(--text-main, #F8F6F0);
  padding: 0.9rem 1.3rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: dlunaToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

@keyframes dlunaToastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dluna-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PRECIOS COMERCIALES (CONTADO -15%, 3 SEMANALIDADES, COMISIÓN VENDEDOR)
   ========================================================================== */
.dluna-commercial-pricing {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
  background: rgba(16, 27, 51, 0.6);
  border: 1px solid rgba(197, 160, 89, 0.22);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

.dluna-price-contado-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.dluna-price-contado-badge .dluna-badge-label {
  color: #86EFAC;
  font-weight: 700;
}
.dluna-price-contado-badge .dluna-badge-price {
  color: #86EFAC;
  font-weight: 800;
  font-family: var(--font-serif, inherit);
}

.dluna-price-semanas-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-main, #F8F6F0);
  border-top: 1px dashed rgba(197, 160, 89, 0.15);
  padding-top: 0.3rem;
}
.dluna-price-semanas-badge .dluna-badge-label {
  color: var(--text-gold, #DFC488);
  font-weight: 600;
}
.dluna-price-semanas-badge .dluna-badge-price {
  font-weight: 700;
}

.dluna-badge-comision {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.15) 0%, rgba(226, 199, 138, 0.08) 100%);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.76rem;
  color: var(--gold-light, #E2C78A);
  text-align: center;
  margin-top: 0.2rem;
}

.dluna-visitor-pricing {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.dluna-semanas-sub {
  font-size: 0.78rem;
  color: var(--gold-light, #E2C78A);
  font-weight: 500;
}
.dluna-contado-sub {
  font-size: 0.72rem;
  color: #86EFAC;
  font-weight: 600;
}

/* ==========================================================================
   CRM MODAL & COMPONENTES (CLIENTES, VENTAS, ABONOS, COMISIONES)
   ========================================================================== */
.dluna-crm-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
  overflow-x: auto;
}

.dluna-crm-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(197, 160, 89, 0.15);
  color: var(--text-muted, #9BA5B7);
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dluna-crm-tab-btn:hover {
  background: rgba(197, 160, 89, 0.1);
  color: var(--gold-light, #E2C78A);
}

.dluna-crm-tab-btn.active {
  background: var(--gold-gradient, linear-gradient(135deg, #C5A059 0%, #E2C78A 100%));
  color: #0A101D;
  border-color: var(--gold-primary, #C5A059);
  font-weight: 700;
}

.dluna-sales-filter-bar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(197, 160, 89, 0.22);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
}

.dluna-sales-filter-bar select,
.dluna-sales-filter-bar input {
  background: rgba(10, 16, 29, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: var(--text-main, #F8FAFC);
}

.dluna-sales-filter-bar select:focus,
.dluna-sales-filter-bar input:focus {
  border-color: var(--gold-primary, #C5A059);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.2);
}

.dluna-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dluna-stat-card {
  background: rgba(16, 27, 51, 0.7);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 10px;
  padding: 1rem;
}
.dluna-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted, #9BA5B7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.dluna-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold-light, #E2C78A);
  font-family: var(--font-serif, inherit);
}

.dluna-progress-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.dluna-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #25D366, #128C7E);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.dluna-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dluna-badge-pendiente {
  background: rgba(234, 179, 8, 0.15);
  color: #FDE047;
  border: 1px solid rgba(234, 179, 8, 0.35);
}
.dluna-badge-parcial {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.dluna-badge-liquidado {
  background: rgba(34, 197, 94, 0.15);
  color: #86EFAC;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.dluna-badge-comision-lista {
  background: rgba(168, 85, 247, 0.18);
  color: #D8B4FE;
  border: 1px solid rgba(168, 85, 247, 0.4);
}
.dluna-badge-comision-pagada {
  background: rgba(34, 197, 94, 0.2);
  color: #86EFAC;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

/* Panel de Comisiones y Cobro en Carrito */
.dluna-cart-commercial-panel {
  background: rgba(10, 16, 29, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 10px;
  padding: 0.9rem;
  margin: 1rem 0;
}

.dluna-cart-comm-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-gold, #DFC488);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dluna-cart-comm-box {
  background: rgba(16, 27, 51, 0.7);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.dluna-cart-comm-box.contado {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.dluna-cart-comm-box.pagos {
  border-color: rgba(197, 160, 89, 0.3);
  background: rgba(197, 160, 89, 0.05);
}

.dluna-cart-comm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dluna-cart-comm-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main, #F8F6F0);
}

.dluna-cart-comm-box.contado .dluna-cart-comm-label {
  color: #86EFAC;
}

.dluna-cart-comm-price {
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold-light, #E2C78A);
  font-family: var(--font-serif, inherit);
}

.dluna-cart-comm-box.contado .dluna-cart-comm-price {
  color: #86EFAC;
}

.dluna-cart-comm-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted, #9BA5B7);
  margin-top: 0.3rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 0.3rem;
}

/* Sección de Registro de Pedido para Cliente en Carrito */
.dluna-cart-order-section {
  background: rgba(16, 27, 51, 0.9);
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
}

.dluna-cart-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.18);
  padding-bottom: 0.5rem;
}

.dluna-cart-order-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-light, #E2C78A);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dluna-mode-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.dluna-mode-card {
  border: 1px solid rgba(197, 160, 89, 0.25);
  background: rgba(10, 16, 29, 0.6);
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dluna-mode-card.active {
  border-color: var(--gold-primary, #C5A059);
  background: rgba(197, 160, 89, 0.12);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.15);
}

.dluna-mode-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main, #F8F6F0);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dluna-mode-card-cost {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold-light, #E2C78A);
  font-family: var(--font-serif, inherit);
}

.dluna-mode-card-comision {
  font-size: 0.7rem;
  color: #86EFAC;
  font-weight: 600;
  margin-top: 0.15rem;
}

.btn-crm-order {
  width: 100%;
  background: var(--gold-gradient, linear-gradient(135deg, #C5A059 0%, #E2C78A 100%));
  color: #0A101D;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  margin-top: 0.6rem;
}

.btn-crm-order:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(197, 160, 89, 0.3);
}

/* ==========================================================================
   VENTAS MANUALES Y ABONOS (MODAL & DESGLOSE)
   ========================================================================== */
.dluna-manual-section {
  background: rgba(16, 27, 51, 0.6);
  border: 1px solid rgba(197, 160, 89, 0.22);
  border-radius: 10px;
  padding: 1.1rem;
  margin-bottom: 1.1rem;
}

.dluna-section-subtitle {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-light, #E2C78A);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.15);
  padding-bottom: 0.4rem;
}

.dluna-search-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface, #0B1325);
  border: 1px solid var(--gold-primary, #C5A059);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  z-index: 2500;
  display: none;
}

.dluna-search-result-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.1);
  cursor: pointer;
  transition: background 0.2s ease;
}

.dluna-search-result-item:hover {
  background: rgba(197, 160, 89, 0.15);
}

.dluna-result-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  background: #060B16;
  border-radius: 4px;
  border: 1px solid rgba(197, 160, 89, 0.2);
}

.dluna-source-pills-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.dluna-source-pill {
  padding: 0.35rem 0.8rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid rgba(197, 160, 89, 0.3);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted, #94A3B8);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dluna-source-pill:hover {
  background: rgba(197, 160, 89, 0.12);
  color: var(--gold-light, #E2C78A);
  border-color: rgba(197, 160, 89, 0.6);
}

.dluna-source-pill.active {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.28), rgba(197, 160, 89, 0.12));
  border-color: var(--gold-primary, #C5A059);
  color: #F8FAFC;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.25);
}

.dluna-search-section-header {
  padding: 0.4rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(197, 160, 89, 0.15);
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dluna-financial-summary-card {
  background: rgba(10, 16, 29, 0.9);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dluna-fin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.dluna-fin-label {
  color: var(--text-muted, #9BA5B7);
}

.dluna-fin-val {
  font-weight: 700;
  color: var(--text-main, #F8F6F0);
  font-family: var(--font-serif, inherit);
}

/* Modificar Venta - Propietario */
.dluna-btn-edit-sale {
  color: #93C5FD !important;
  border-color: rgba(147, 197, 253, 0.35) !important;
  transition: all 0.2s ease;
}

.dluna-btn-edit-sale:hover {
  background: rgba(147, 197, 253, 0.15) !important;
  border-color: #93C5FD !important;
  color: #BFDBFE !important;
}

#dluna-edit-sale-modal .dluna-modal-card {
  border-color: rgba(147, 197, 253, 0.4);
}

/* ==========================================================================
   GESTIÓN DE PEDIDOS Y COSTOS (EXCEL Y PDF)
   ========================================================================== */
.dluna-pdf-dropzone {
  background: rgba(197, 160, 89, 0.04);
  border: 2px dashed rgba(197, 160, 89, 0.35);
  border-radius: 12px;
  padding: 1.3rem;
  text-align: center;
  margin-bottom: 1.2rem;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.dluna-pdf-dropzone:hover, .dluna-pdf-dropzone.dragover {
  background: rgba(197, 160, 89, 0.1);
  border-color: var(--gold-primary, #C5A059);
  box-shadow: 0 0 15px rgba(197, 160, 89, 0.2);
}

.dluna-dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

.dluna-order-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: var(--gold-light, #E2C78A);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.dluna-order-row-main {
  cursor: pointer;
  transition: background 0.2s;
}

.dluna-order-row-main:hover {
  background: rgba(197, 160, 89, 0.06);
}

.dluna-order-details-box {
  background: rgba(6, 11, 22, 0.7);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 8px;
  padding: 0.8rem;
  margin: 0.5rem 0;
}

.dluna-tag-stock {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.dluna-tag-stock.available {
  background: rgba(34, 197, 94, 0.15);
  color: #86EFAC;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dluna-tag-stock.sold {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   ANALÍTICAS DE PRECIO Y STOCK PARA ROL PROPIETARIO (VENTANA EMERGENTE / MODAL)
   ========================================================================== */
.dluna-owner-price-analytics {
  margin-top: 1.5rem;
  padding: 1.4rem;
  background: linear-gradient(180deg, rgba(16, 27, 51, 0.85) 0%, rgba(11, 19, 37, 0.95) 100%);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 12px;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(197, 160, 89, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
}

.dluna-owner-analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
  padding-bottom: 0.8rem;
}

.dluna-owner-analytics-title {
  font-family: var(--font-serif, 'Cinzel', Georgia, serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light, #E2C78A);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.dluna-owner-badge-tag {
  background: rgba(197, 160, 89, 0.18);
  border: 1px solid var(--gold-primary, #C5A059);
  color: var(--gold-light, #E2C78A);
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dluna-owner-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.dluna-owner-metric-card {
  background: rgba(6, 11, 24, 0.75);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dluna-owner-metric-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #9BA5B7);
  font-weight: 600;
}

.dluna-owner-metric-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main, #F8F6F0);
  font-family: var(--font-serif, 'Cinzel', Georgia, serif);
}

.dluna-owner-metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted, #9BA5B7);
}

.dluna-owner-chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.dluna-owner-chart-tabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid rgba(197, 160, 89, 0.15);
}

.dluna-owner-chart-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #9BA5B7);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dluna-owner-chart-btn:hover {
  color: var(--gold-light, #E2C78A);
  background: rgba(197, 160, 89, 0.1);
}

.dluna-owner-chart-btn.active {
  background: var(--gold-gradient, linear-gradient(135deg, #C5A059 0%, #E2C78A 100%));
  color: #080D1A;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.dluna-owner-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 230px;
  background: rgba(4, 8, 18, 0.6);
  border: 1px solid rgba(197, 160, 89, 0.18);
  border-radius: 10px;
  padding: 0.8rem;
}

.dluna-owner-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--gold-light, #E2C78A);
  font-size: 0.85rem;
}

.dluna-owner-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(197, 160, 89, 0.2);
  border-top-color: var(--gold-primary, #C5A059);
  border-radius: 50%;
  animation: dlunaSpin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
  .dluna-owner-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dluna-owner-chart-canvas-wrap {
    height: 190px;
  }
}

/* ==========================================================================
   PESTAÑA EXTRA: AGRUPACIÓN DE COMPRAS Y DEUDAS POR CLIENTE (CRM)
   ========================================================================== */
.dluna-client-group-card {
  background: rgba(16, 27, 51, 0.75);
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 12px;
  margin-bottom: 1.1rem;
  padding: 1.2rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.dluna-client-group-card:hover {
  border-color: rgba(197, 160, 89, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.dluna-client-group-card.has-debt {
  border-left: 4px solid #EF4444;
}

.dluna-client-group-card.settled {
  border-left: 4px solid #22C55E;
}

.dluna-client-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.18);
  padding-bottom: 0.9rem;
  margin-bottom: 0.9rem;
}

.dluna-client-group-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dluna-client-group-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(135deg, #F2DFB3 0%, #C5A059 100%));
  color: #070C18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(197, 160, 89, 0.3);
  flex-shrink: 0;
}

.dluna-client-group-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light, #E2C78A);
  font-family: var(--font-serif, 'Cinzel', Georgia, serif);
  margin-bottom: 0.2rem;
}

.dluna-client-group-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.76rem;
  color: var(--text-muted, #9BA5B7);
}

.dluna-client-group-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.dluna-client-stat-box {
  background: rgba(8, 14, 28, 0.7);
  border: 1px solid rgba(197, 160, 89, 0.18);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dluna-client-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted, #9BA5B7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.dluna-client-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-serif, 'Cinzel', Georgia, serif);
  color: var(--text-main, #F8F6F0);
}

.dluna-client-stat-val.gold {
  color: var(--gold-light, #E2C78A);
}

.dluna-client-stat-val.paid {
  color: #86EFAC;
}

.dluna-client-stat-val.debt {
  color: #FCA5A5;
}

.dluna-client-group-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  border-top: 1px dashed rgba(197, 160, 89, 0.18);
  padding-top: 0.8rem;
}

.dluna-client-purchases-accordion {
  margin-top: 1rem;
  border-top: 1px solid rgba(197, 160, 89, 0.2);
  padding-top: 1rem;
  animation: dlunaFadeIn 0.3s ease;
}

.dluna-client-subtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.dluna-client-subtable th {
  background: rgba(197, 160, 89, 0.1);
  color: var(--gold-light, #E2C78A);
  padding: 0.65rem 0.8rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.dluna-client-subtable td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(197, 160, 89, 0.08);
  color: var(--text-main, #F8F6F0);
}

.dluna-client-subtable tr:hover td {
  background: rgba(197, 160, 89, 0.06);
}

.dluna-badge-debt-alert {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dluna-badge-settled {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86EFAC;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

@media (max-width: 768px) {
  .dluna-client-group-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .dluna-client-group-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

