/* ============================================================
   SUBMIT REFERRAL VIEW
   ============================================================ */
.content-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* Subtle top-left glass reflection on content cards */
.content-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

/* Selettore Interesse Contatto (3 scelte parlanti) */
.temp-slider-container {
  margin: 16px 0 22px;
}

.temp-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.temp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 68px;
  padding: 10px 6px;
  background: var(--card-bg, rgba(255, 255, 255, 0.04));
  border: 1.5px solid var(--card-border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  color: var(--text-light, #94a3b8);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.temp-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.temp-btn-icon {
  font-size: 1.15rem;
  line-height: 1.1;
}

.temp-btn-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text, #ffffff);
  line-height: 1.2;
}

.temp-btn-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-light, #94a3b8);
  line-height: 1.2;
}

.temp-btn[data-val="1"].active {
  background: rgba(56, 189, 248, 0.14);
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 6px 16px rgba(56, 189, 248, 0.18);
}
.temp-btn[data-val="1"].active .temp-btn-title { color: #7dd3fc; }
.temp-btn[data-val="1"].active .temp-btn-sub { color: #bae6fd; }

.temp-btn[data-val="3"].active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 6px 16px rgba(245, 158, 11, 0.18);
}
.temp-btn[data-val="3"].active .temp-btn-title { color: #fcd34d; }
.temp-btn[data-val="3"].active .temp-btn-sub { color: #fde68a; }

.temp-btn[data-val="5"].active {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.38), 0 6px 16px rgba(239, 68, 68, 0.22);
}
.temp-btn[data-val="5"].active .temp-btn-title { color: #fca5a5; }
.temp-btn[data-val="5"].active .temp-btn-sub { color: #fecaca; }

@media (max-width: 370px) {
  .temp-selector {
    grid-template-columns: 1fr;
  }
  .temp-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 50px;
    padding: 8px 12px;
    text-align: left;
  }
}

/* ============================================================

   SHOP & ACTIVITY FILTER BAR
   ============================================================ */
.shop-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shop-filters::-webkit-scrollbar {
  display: none;
}

.shop-filter-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}

.shop-filter-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.shop-filter-btn.active {
  background: rgba(214, 25, 32, 0.12);
  border-color: rgba(214, 25, 32, 0.4);
  color: var(--primary-light);
  box-shadow: 0 0 10px rgba(214, 25, 32, 0.15);
}


/* ============================================================

/* ============================================================
   TOAST NOTIFICATIONS â€” PREMIUM
   ============================================================ */
.toast-container {
  position: fixed;
  top: calc(90px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-inverse);
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(-10px);
  animation: toastIn 0.35s var(--ease-out-back) forwards;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.toast .toast-emoji {
  flex-shrink: 0;
}

.toast .toast-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Spinner pulsante con mini-icona ufficiale dell'agenzia */
.zb-agency-spinner-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  vertical-align: middle;
}

.zb-agency-spinner {
  position: relative;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zb-agency-spinner::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2.2px solid rgba(255, 255, 255, 0.22);
  border-top-color: currentColor;
  border-right-color: var(--primary, #38bdf8);
  animation: zbSpinRing 0.75s linear infinite;
}

.zb-agency-spinner img {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

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

/* Progress bar at bottom */
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes toastIn {
  to { opacity: 1; transform: translateY(0); }
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}
.toast.toast-success::after {
  background: var(--success);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}
.toast.toast-error::after {
  background: var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--info);
}
.toast.toast-info::after {
  background: var(--info);
}

/* ============================================================

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--modal-bg, #0f172a);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(214, 25, 32, 0.05);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.35s var(--ease-out-back);
}
.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* CRM Partner Modal — Fix flex layout per desktop */
#modal-partner-crm .btn-primary {
  width: auto;
  flex-shrink: 0;
}
#modal-partner-crm .form-control {
  min-width: 0;
}
#modal-partner-crm select.form-control {
  min-width: 160px;
}
#modal-partner-crm #crm-actions-grid .btn-primary {
  width: 100%;
}


/* ============================================================

/* ============================================================
   ACCORDION STYLES (PROFILO)
   ============================================================ */
.accordion-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(214, 25, 32, 0.15), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.accordion-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  position: relative;
  transition: background 0.2s ease;
}

.accordion-item.active .accordion-header {
  background: rgba(214, 25, 32, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.acc-icon {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--primary-light);
  flex-shrink: 0;
}

.accordion-item.active .acc-icon {
  transform: rotate(180deg);
}

.accordion-content {
  overflow: hidden;
  max-height: 0;
  padding: 0 16px;
  opacity: 0;
  transition: max-height 0.45s ease, padding 0.35s ease, opacity 0.3s ease;
}

.accordion-item.active .accordion-content {
  padding: 16px;
  opacity: 1;
}

/* ============================================================

/* ============================================================
   FAB ADD REFERRAL
   ============================================================ */
.fab-add-referral {
  position: fixed;
  bottom: 85px;
  right: 20px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(214, 25, 32, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-add-referral:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 12px 30px rgba(214, 25, 32, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.fab-add-referral:active {
  transform: scale(0.95);
}

@keyframes popInList {
  0% { opacity: 0; transform: translateY(20px) scale(0.9); }
  50% { transform: translateY(-5px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.animated-list-item {
  animation: popInList 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
}



/* ============================================================
   AGENT CARDS — Consulente Assegnato (Client Profile)
   ============================================================ */
.agent-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  padding: 4px;
}

@media (max-width: 480px) {
  .agent-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
  }
  .agent-card {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
    min-width: 0;
    padding: 14px 6px 12px !important;
    box-sizing: border-box;
    overflow: hidden;
  }
  .agent-card-name {
    font-size: 0.82rem !important;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .agent-card-avatar {
    width: 56px !important;
    height: 56px !important;
  }
}

.agent-card {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 14px);
  padding: 20px 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(135deg, rgba(214, 25, 32, 0.12), rgba(214, 25, 32, 0.03));
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.agent-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.agent-card:active {
  transform: translateY(0) scale(0.97);
}

.agent-card.selected {
  border-color: var(--primary, #d61920);
  background: rgba(214, 25, 32, 0.1);
  box-shadow: 0 0 0 1px rgba(214, 25, 32, 0.25), 0 4px 16px rgba(214, 25, 32, 0.15);
}

.agent-card.selected::before {
  background: linear-gradient(135deg, rgba(214, 25, 32, 0.2), rgba(214, 25, 32, 0.06));
}

.agent-card-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #cc0000;
  margin: 0 auto 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.agent-card.selected .agent-card-avatar {
  border-color: var(--primary, #d61920);
  box-shadow: 0 4px 16px rgba(214, 25, 32, 0.3);
}

.agent-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-card-avatar .agent-initials {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.agent-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.agent-card-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  letter-spacing: 0.3px;
}

.agent-card-role.role-admin {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.08));
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.agent-card-role.role-agent {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.05));
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.agent-card-info-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-light, #94a3b8);
  margin-top: 10px;
  opacity: 0.6;
  transition: opacity 0.2s;
  position: relative;
  z-index: 1;
}

.agent-card:hover .agent-card-info-hint {
  opacity: 1;
  color: var(--primary-light, #ff616b);
}

/* Selected checkmark */
.agent-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #d61920);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
}

.agent-card.selected .agent-card-check {
  opacity: 1;
  transform: scale(1);
}

.agent-card-check svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
}

/* ============================================================
   CONTACT PREFERENCES TOGGLE (Staff Profile)
   ============================================================ */
.contact-pref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contact-pref-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.contact-pref-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.contact-pref-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.contact-pref-toggle input[type="checkbox"]:checked {
  background: var(--primary, #d61920);
  border-color: var(--primary, #d61920);
}

.contact-pref-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
}

.contact-pref-toggle:has(input:checked) {
  border-color: rgba(214, 25, 32, 0.3);
  background: rgba(214, 25, 32, 0.08);
}

.contact-pref-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

/* ============================================================
   AGENT DETAIL MODAL — Mini Scheda Tecnica
   ============================================================ */
.modal-agent-detail .modal-content {
  max-width: 380px;
  max-height: 90dvh;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d1525;
}

.agent-modal-header {
  position: relative;
  padding: 32px 24px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(214, 25, 32, 0.15) 0%, rgba(214, 25, 32, 0.02) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.agent-modal-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(214, 25, 32, 0.1), transparent 70%);
  pointer-events: none;
}

.agent-modal-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: #cc0000;
  margin: 0 auto 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 40px rgba(214, 25, 32, 0.1);
  position: relative;
  z-index: 1;
}

.agent-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-modal-avatar .agent-initials {
  color: #fff;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.agent-modal-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.agent-modal-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-modal-role-badge.role-admin {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(234, 179, 8, 0.1));
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.agent-modal-role-badge.role-agent {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.08));
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.agent-modal-body {
  padding: 20px 24px 24px;
}

.agent-modal-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.agent-modal-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.agent-modal-info-row:last-child {
  border-bottom: none;
}

.agent-modal-info-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--primary-light, #ff616b);
}

.agent-modal-info-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.agent-modal-info-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.agent-modal-info-value a {
  color: var(--primary-light, #ff616b);
  text-decoration: none;
  transition: opacity 0.2s;
}

.agent-modal-info-value a:hover {
  opacity: 0.8;
}

.agent-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.agent-modal-actions .btn-agent-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.agent-modal-actions .btn-agent-call {
  background: var(--primary, #d61920);
  color: #fff;
}

.agent-modal-actions .btn-agent-call:hover {
  background: #b71418;
  box-shadow: 0 4px 14px rgba(214, 25, 32, 0.3);
}

.agent-modal-actions .btn-agent-wa {
  background: #25D366;
  color: #fff;
}

.agent-modal-actions .btn-agent-wa:hover {
  background: #1fb855;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.agent-modal-actions .btn-agent-tg {
  background: #0088cc;
  color: #fff;
}

.agent-modal-actions .btn-agent-tg:hover {
  background: #0077b3;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.3);
}

.agent-modal-actions .btn-agent-email {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.agent-modal-actions .btn-agent-email:hover {
  background: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.2);
}

.agent-modal-footer {
  padding: 0 24px 20px;
  text-align: center;
}

.agent-modal-footer .btn-select-agent {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, var(--primary, #d61920), #b71418);
  color: #fff;
  box-shadow: 0 4px 16px rgba(214, 25, 32, 0.25);
}

.agent-modal-footer .btn-select-agent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(214, 25, 32, 0.35);
}

.agent-modal-footer .btn-select-agent.already-selected {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: none;
  cursor: default;
}

.agent-modal-close {
  position: sticky;
  top: 10px;
  float: right;
  margin: 10px 10px -40px 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.agent-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.agent-modal-close svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
}

/* Stagger animation for agent cards */
@keyframes agentCardIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-card {
  animation: agentCardIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
}

/* ============================================================
   REFERRAL TYPE SEGMENTED TOGGLE (Vendita / Affitto / Affitto · Vendita)
   ============================================================ */
.ref-type-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 12px);
  padding: 0;
  gap: 10px;
  min-height: 54px;
  align-items: stretch;
  margin-top: 6px;
}
.ref-type-pill {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 12px);
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  color: var(--text-light, #94a3b8);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  user-select: none;
}
.ref-type-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  transform: translateY(-1px);
}
.ref-type-pill.active {
  background: linear-gradient(135deg, var(--primary, #d61920), hsl(358, 85%, 38%));
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(214, 25, 32, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: none;
}
.ref-type-pill .type-icon {
  font-size: 1.2rem;
  line-height: 1;
}
@media (max-width: 440px) {
  .ref-type-toggle-group {
    min-height: 50px;
    gap: 6px;
  }
  .ref-type-pill {
    font-size: 0.84rem;
    gap: 5px;
    padding: 8px 6px;
  }
  .ref-type-pill .type-icon {
    font-size: 1.05rem;
  }
}

/* ============================================================
   GAMIFICATION ACCORDIONS (ADMIN PUNTI E LIVELLI)
   ============================================================ */
.gamif-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.gamif-accordion-item {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: clip;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  backdrop-filter: blur(8px);
}

.gamif-accordion-item:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.gamif-accordion-item.active {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(214, 25, 32, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(214, 25, 32, 0.15);
}

.gamif-accordion-header {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 14px;
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.2s ease;
}

.gamif-accordion-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.gamif-accordion-item.active .gamif-accordion-header {
  background: rgba(214, 25, 32, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gamif-acc-header-info {
  flex: 1;
  min-width: 0;
}

.gamif-acc-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gamif-acc-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
  letter-spacing: -0.01em;
}

.gamif-acc-subtitle {
  font-size: 0.84rem;
  color: var(--text-light, #94a3b8);
  margin: 4px 0 0 0;
  line-height: 1.45;
}

.gamif-acc-chevron {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light, #94a3b8);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.gamif-accordion-item.active .gamif-acc-chevron {
  transform: rotate(180deg);
  color: #fff;
  background: rgba(214, 25, 32, 0.25);
}

/* Status Pill in Header */
.gamif-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: all 0.25s ease;
}

.gamif-status-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.gamif-status-pill.pill-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.gamif-status-pill.pill-active .pill-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

.gamif-status-pill.pill-inactive {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gamif-status-pill.pill-inactive .pill-dot {
  background: #64748b;
}

/* Collapsible Body */
.gamif-accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.gamif-accordion-item.active .gamif-accordion-body {
  grid-template-rows: 1fr;
}

.gamif-accordion-inner {
  overflow: hidden;
  padding: 0 18px;
  transition: padding 0.35s ease;
}

.gamif-accordion-item.active .gamif-accordion-inner {
  padding: 16px 18px 20px;
  overflow: visible;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scrollable containers for actions grid and tiers on mobile */
#gamif-actions-container,
#gamif-tiers-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

#gamif-actions-container > div:first-child {
  min-width: 600px;
}

/* Status Control Bar Inside Accordion */
.gamif-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  margin-bottom: 16px;
}

.gamif-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gamif-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.25s ease;
}

.gamif-status-indicator.active .gamif-status-dot {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.gamif-status-indicator.inactive .gamif-status-dot {
  background: #64748b;
  box-shadow: none;
}

.gamif-status-text {
  font-size: 0.9rem;
  font-weight: 700;
  transition: color 0.25s ease;
}

.gamif-status-indicator.active .gamif-status-text {
  color: #4ade80;
}

.gamif-status-indicator.inactive .gamif-status-text {
  color: #94a3b8;
}

/* Toggle Switch Button */
.gamif-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.gamif-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.gamif-toggle-switch {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  display: inline-block;
  transition: background 0.25s ease;
  flex-shrink: 0;
}

.gamif-toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.gamif-toggle-btn.active .gamif-toggle-switch {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.gamif-toggle-btn.active .gamif-toggle-knob {
  transform: translateX(16px);
}

.gamif-toggle-btn-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
}

.gamif-toggle-btn.active .gamif-toggle-btn-label {
  color: #ffffff;
}

.gamif-module-content {
  transition: opacity 0.25s ease;
}

/* Progression Type Selector (Points vs Actions) */
.gamif-type-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-light, #94a3b8);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.gamif-type-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.gamif-type-pill.active {
  background: linear-gradient(135deg, var(--primary, #d61920) 0%, hsl(358, 85%, 38%) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(214, 25, 32, 0.35);
}

/* Month Selector Pills & Preset Buttons for Prize Rules */
.gamif-month-pill {
  padding: 8px 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.gamif-month-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.gamif-month-pill.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  font-weight: 700;
  border-color: #fbbf24;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.35);
}

.gamif-preset-btn {
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-light, #94a3b8);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gamif-preset-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.gamif-preset-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}


/* Action Check Item for Tier Progression */
.gamif-action-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.gamif-action-check-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.gamif-action-check-item.checked {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
}

.gamif-action-check-custom {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.gamif-action-check-item.checked .gamif-action-check-custom {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.gamif-action-check-item.checked .gamif-action-check-custom::after {
  content: "✓";
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

/* Prize Emoji Picker */
.prz-emoji-btn {
  width: 40px;
  height: 40px;
  font-size: 1.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}
.prz-emoji-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.1);
}
.prz-emoji-btn.active {
  border-color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.25) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45) !important;
  transform: scale(1.05);
}
#prz-emoji-trigger:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}

@media (max-width: 540px) {
  .prize-dati-base-grid {
    grid-template-columns: 80px 1fr !important;
  }
  .prize-dati-base-grid .form-group-valore {
    grid-column: 1 / -1;
  }
}

/* Livelli (tier): percorso sempre visibile durante lo scroll.
   Sticky richiede che nessun antenato sia un contenitore di scroll, quindi per questo accordion
   si disattiva overflow auto/hidden sull'area interna e sul contenitore dei livelli. */
#gamif-acc-tiers.active .gamif-accordion-inner {
  overflow: visible;
}
#gamif-acc-tiers #gamif-tiers-container {
  overflow: visible;
}
.gamif-tier-track-wrap {
  position: sticky;
  top: calc(78px + env(safe-area-inset-top, 0px));
  z-index: 20;
  margin: 0 -6px 12px;
  padding: 8px 6px 10px;
  background: var(--header-bg, #0d1426);
  border-bottom: 1px solid var(--header-border, rgba(255, 255, 255, 0.1));
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.7);
}
/* Punti per azione: schede con intestazione livelli sempre visibile (sticky) */
#gamif-acc-actions.active .gamif-accordion-inner {
  overflow: visible;
}
#gamif-acc-actions #gamif-actions-container {
  overflow: visible !important;
  container-type: inline-size;
  container-name: gamif-actions;
}
.gamif-pts-head {
  position: sticky;
  top: calc(78px + env(safe-area-inset-top, 0px));
  z-index: 20;
  margin: 0 0 12px;
  padding: 8px 15px 10px;
  background: #0d1426;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.7);
}
.gamif-pts-head-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 6px;
}
.gamif-pts-cols {
  display: grid;
  grid-template-columns: repeat(var(--tc, 1), minmax(0, 1fr));
  gap: 6px;
}
.gamif-action-tier-head {
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  color: #fff;
  padding: 6px 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  text-overflow: ellipsis;
}
.gamif-action-tier-head.is-new {
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.6);
}
.gamif-new-flag {
  font-size: 0.64rem;
  color: #fde047;
  font-weight: 700;
}
.gamif-action-card {
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.gamif-action-card.is-dragging {
  opacity: 0.45;
  border-color: #facc15;
  box-shadow: 0 12px 28px rgba(250, 204, 21, 0.25);
}
.gamif-action-card.is-drag-over {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}
.gamif-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  cursor: grab;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
}
.gamif-drag-handle:active {
  cursor: grabbing;
  color: #facc15;
  border-color: #facc15;
}
.gamif-action-arrows {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.gamif-move-action-btn {
  width: 34px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #facc15;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  transition: all 0.15s;
}
.gamif-move-action-btn:hover:not(:disabled) {
  background: rgba(250, 204, 21, 0.15);
  border-color: #facc15;
}
.gamif-move-action-btn:disabled {
  color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
}

/* Visibilità reattiva: Maniglia su Mobile (< 768px), Freccette su Desktop (>= 768px) */
@media (max-width: 767px) {
  .gamif-desktop-only {
    display: none !important;
  }
  .gamif-mobile-only {
    display: flex !important;
  }
}
@media (min-width: 768px) {
  .gamif-desktop-only {
    display: flex !important;
  }
  .gamif-mobile-only {
    display: none !important;
  }
}
.gamif-pts-row {
  margin-top: 12px;
}
/* Sfondo piu' scuro dietro le schede (livelli e punti per azione), cosi' si staccano meglio */
#gamif-acc-tiers .gamif-accordion-inner,
#gamif-acc-actions .gamif-accordion-inner {
  background: rgba(0, 0, 0, 0.3);
}
.gamif-pts-cell-label {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 3px;
}
/* Spazio stretto: niente intestazione fissa, ogni cella porta il nome del suo livello */
@container gamif-actions (max-width: 680px) {
  .gamif-pts-head {
    display: none;
  }
  .gamif-pts-cols.gamif-pts-row {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }
  .gamif-pts-cell-label {
    display: block;
  }
  /* Vendita, Affitto, Entrambe: tre pulsanti sulla stessa riga */
  .gamif-reqtype-group {
    width: 100%;
    flex-wrap: nowrap !important;
  }
  .gamif-reqtype-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 4px !important;
    gap: 4px !important;
    font-size: 0.78rem !important;
  }
}
/* Il contenuto di un accordion non deve mai allargare la pagina (mobile) */
.gamif-accordion-body {
  grid-template-columns: minmax(0, 1fr);
}
.gamif-accordion-inner {
  min-width: 0;
}

/* Mobile: livelli e punti per azione */
@media (max-width: 560px) {
  .gamif-accordion-item.active .gamif-accordion-inner {
    padding: 12px 8px 16px;
  }
  .gamif-tier-row {
    padding: 10px !important;
  }
  .gamif-tier-initial {
    display: none;
  }
  .gamif-seg {
    flex: 1 1 0 !important;
  }
  .gamif-seg-name {
    font-size: 0.66rem !important;
  }
  .gamif-action-card {
    padding: 10px;
  }
  .gamif-reqtype-btn {
    flex-direction: column !important;
    gap: 2px !important;
    min-height: 52px !important;
    line-height: 1.1;
    overflow: hidden;
  }
}
/* Campi numerici di livelli e punti: dimensione media, uniforme, con unita' dentro al campo */
.gamif-field {
  display: flex;
  align-items: stretch;
  min-height: 46px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.gamif-field:hover {
  border-color: rgba(255, 255, 255, 0.4);
}
.gamif-field:focus-within {
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2);
  background: rgba(255, 255, 255, 0.11);
}
.gamif-field > input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.gamif-field-unit {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  max-width: 48%;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  color: var(--text-light);
  background: rgba(0, 0, 0, 0.28);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}
.gamif-field-static {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}
.gamif-field.is-static {
  background: rgba(255, 255, 255, 0.04);
  border-style: dashed;
}
input.gamif-pts-input[type="number"] {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 6px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  outline: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}
input.gamif-pts-input[type="number"]:hover {
  border-color: rgba(255, 255, 255, 0.4);
}
input.gamif-pts-input[type="number"]:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2);
  background: rgba(255, 255, 255, 0.11);
}
.gamif-field > input[type="number"]::-webkit-outer-spin-button,
.gamif-field > input[type="number"]::-webkit-inner-spin-button,
input.gamif-pts-input[type="number"]::-webkit-outer-spin-button,
input.gamif-pts-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================
   v2.02 · Scheda Pratica (iPhone safe area) e Bonus Traguardi
   ========================================================== */
#modal-ref-detail {
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
#modal-ref-detail .modal-content {
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
#modal-ref-detail #mdl-status {
  white-space: nowrap;
  flex-shrink: 0;
}

.gamif-ms-legal-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.06);
  border: 1px solid rgba(250, 204, 21, 0.22);
  font-size: 0.8rem;
  color: #fde68a;
  line-height: 1.5;
}
.gamif-ms-card {
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.gamif-ms-card.is-off { opacity: 0.55; }
.gamif-ms-card.is-dup { border-color: rgba(239, 68, 68, 0.68); }
.gamif-ms-row {
  display: grid;
  grid-template-columns: 184px minmax(200px, 1fr) 168px;
  gap: 10px;
  align-items: stretch;
}
.gamif-ms-box {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.gamif-ms-threshold-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gamif-ms-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}
.gamif-ms-box-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fde047;
  margin-bottom: 6px;
}
.gamif-ms-select,
.gamif-ms-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  box-sizing: border-box;
}
.gamif-ms-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.gamif-ms-input[type="number"]::-webkit-outer-spin-button,
.gamif-ms-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gamif-ms-input--num {
  width: 72px;
  min-width: 68px;
  flex: 0 0 72px;
  padding: 0 8px;
  text-align: center;
  font-size: 1rem;
}
@media (max-width: 680px) {
  .gamif-ms-row {
    grid-template-columns: 1fr 1fr;
  }
  .gamif-ms-box--action {
    grid-column: 1 / -1;
  }
}
@media (max-width: 420px) {
  .gamif-ms-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   INDIRIZZO + N° CIVICO + SENZA CIVICO (App Partner)
   ============================================================ */
.address-civico-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
}
@media (min-width: 768px) {
  .address-civico-row {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 12px;
  }
}
.snc-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-light, #b0bec5);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}
.snc-toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.42);
  color: #ffffff;
}
.snc-toggle-btn.active {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.7);
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}
.gamif-ms-select option { background: #0d1322; color: #fff; }
.gamif-ms-input.is-over {
  border-color: rgba(250, 204, 21, 0.7);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.16);
}
.gamif-ms-mode {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.gamif-ms-mode-btn {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-light);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.gamif-ms-mode-btn.active {
  border-color: rgba(250, 204, 21, 0.85);
  background: rgba(250, 204, 21, 0.14);
  color: #fff;
}
.gamif-ms-preview {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
}
.gamif-ms-preview strong { color: #fff; }
.gamif-ms-badge-resp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.28);
}

/* ============================================================
   SEZIONE ADMIN · ASPETTO E BRAND (#adm-section-branding)
   ============================================================ */
.adm-brand-sticky-bar {
  position: sticky;
  top: calc(76px + env(safe-area-inset-top, 0px));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgba(10, 17, 34, 0.92);
  border: 1px solid rgba(250, 204, 21, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
[data-theme="light"] .adm-brand-sticky-bar {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(217, 119, 6, 0.45);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  color: #0f172a;
}
.adm-brand-sticky-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.3;
}
.adm-brand-sticky-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.8);
  flex-shrink: 0;
}
[data-theme="light"] .adm-brand-sticky-dot {
  background: #d97706;
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.45);
}
.adm-brand-sticky-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.adm-brand-sticky-revert {
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: inherit;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
[data-theme="light"] .adm-brand-sticky-revert {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.16);
  color: #0f172a;
}
.adm-brand-sticky-save {
  padding: 8px 14px !important;
  border-radius: 9px !important;
  font-size: 0.8rem !important;
  font-weight: 800 !important;
}
@media (max-width: 560px) {
  .adm-brand-sticky-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .adm-brand-sticky-info {
    font-size: 0.74rem;
  }
  .adm-brand-sticky-actions {
    width: 100%;
  }
  .adm-brand-sticky-revert,
  .adm-brand-sticky-save {
    flex: 1;
    text-align: center;
  }
}

.adm-brand-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .adm-brand-name-grid {
    grid-template-columns: 1fr;
  }
}

.adm-brand-themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.adm-brand-theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
}
[data-theme="light"] .adm-brand-theme-card {
  border-color: rgba(15, 23, 42, 0.12);
  background: #f8fafc;
}
.adm-brand-theme-card:hover {
  transform: translateY(-2px);
}
.adm-brand-theme-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 214, 25, 32), 0.22);
}
.adm-brand-theme-swatch {
  height: 54px;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.adm-brand-theme-swatch-pill {
  width: 34px;
  height: 10px;
  border-radius: 999px;
}
.adm-brand-theme-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-size: 0.88rem;
}
.adm-brand-theme-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
}
.adm-brand-theme-card.active .adm-brand-theme-badge {
  background: var(--primary);
  color: #ffffff;
}
.adm-brand-theme-desc {
  font-size: 0.76rem;
  color: var(--text-light);
  line-height: 1.4;
}

.adm-brand-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.adm-brand-swatch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
[data-theme="light"] .adm-brand-swatch-btn {
  border-color: rgba(15, 23, 42, 0.12);
  background: #f8fafc;
}
.adm-brand-swatch-btn:hover {
  transform: translateY(-1px);
}
.adm-brand-swatch-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 214, 25, 32), 0.25);
}
.adm-brand-swatch-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.adm-brand-custom-color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="light"] .adm-brand-custom-color-row {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}

.adm-brand-assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.adm-brand-asset-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.11);
}
[data-theme="light"] .adm-brand-asset-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}
.adm-brand-asset-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.adm-brand-checkerboard {
  background-color: #1e293b;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.09) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.09) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.09) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.09) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
[data-theme="light"] .adm-brand-checkerboard {
  background-color: #e2e8f0;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.72) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.72) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.72) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.72) 75%);
}
.adm-brand-asset-thumb {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.adm-brand-asset-thumb--favicon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}
.adm-brand-asset-thumb--logo {
  width: 92px;
  height: 54px;
}
.adm-brand-asset-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.adm-brand-secondary-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.adm-brand-secondary-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
}
[data-theme="light"] .adm-brand-secondary-btn {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.38);
  color: #0369a1;
}
.adm-brand-autofav-bar {
  margin-bottom: 12px;
}
.adm-brand-browser-tab-box {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
[data-theme="light"] .adm-brand-browser-tab-box {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
}
.adm-brand-browser-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 7px 12px;
  border-radius: 10px 10px 4px 4px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 600;
}
.adm-brand-browser-tab img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}
.adm-brand-browser-tab span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.adm-brand-browser-tab-x {
  opacity: 0.55;
  font-size: 0.9rem;
  line-height: 1;
}
.adm-brand-reset-card {
  border: 1px dashed rgba(245, 158, 11, 0.35) !important;
}
.adm-brand-reset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.adm-brand-reset-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.adm-brand-reset-btn:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
}
[data-theme="light"] .adm-brand-reset-btn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(217, 119, 6, 0.45);
  color: #b45309;
}
[data-theme="light"] .adm-brand-asset-thumb {
  border-color: rgba(15, 23, 42, 0.14);
}
.adm-brand-size-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
}
[data-theme="light"] .adm-brand-size-badge {
  color: #0369a1;
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.28);
}
.adm-brand-crop-launch-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--primary-rgb, 214, 25, 32), 0.45);
  background: rgba(var(--primary-rgb, 214, 25, 32), 0.14);
  color: inherit;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
}
.adm-brand-crop-launch-btn:hover {
  background: rgba(var(--primary-rgb, 214, 25, 32), 0.24);
  border-color: var(--primary);
  transform: translateY(-1px);
}
[data-theme="light"] .adm-brand-crop-launch-btn {
  background: rgba(var(--primary-rgb, 214, 25, 32), 0.08);
  color: #0f172a;
}

.adm-brand-psd-bar {
  padding: 14px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.34);
}
[data-theme="light"] .adm-brand-psd-bar {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.34);
}
.adm-brand-psd-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}
.adm-brand-psd-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.adm-brand-psd-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.adm-brand-psd-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}
.adm-brand-psd-btn--primary {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.42);
  color: #7dd3fc;
}
[data-theme="light"] .adm-brand-psd-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.15);
  color: #0f172a;
}
[data-theme="light"] .adm-brand-psd-btn--primary {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.4);
  color: #0369a1;
}

/* Modale Cropper Brand (#modal-brand-cropper) */
.adm-brand-cropper-modal {
  width: 94%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px;
  text-align: left;
}
.adm-brand-cropper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.adm-brand-cropper-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
[data-theme="light"] .adm-brand-cropper-close {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.adm-brand-cropper-hint {
  margin: 0 0 12px 0;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.45;
}
.adm-brand-cropper-stage {
  position: relative;
  width: 100%;
  height: 290px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 12px;
}
@media (max-width: 480px) {
  .adm-brand-cropper-stage {
    height: 240px;
  }
}
.adm-brand-cropper-stage img {
  display: block;
  max-width: 100%;
}
#modal-brand-cropper .cropper-bg {
  background-image: none !important;
  background-color: transparent !important;
}
#modal-brand-cropper .cropper-view-box {
  outline: 2px solid #38bdf8;
  outline-offset: -1px;
}
#modal-brand-cropper .cropper-modal {
  background-color: #020617;
  opacity: 0.68;
}
#brand-cropper-stage.is-icon-mode .cropper-crop-box::after {
  content: "SAFE ZONE 80%";
  position: absolute;
  inset: 10%;
  border: 1.5px dashed rgba(250, 204, 21, 0.9);
  border-radius: 18%;
  pointer-events: none;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: rgba(250, 204, 21, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.adm-brand-cropper-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.adm-brand-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.adm-brand-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .adm-brand-tool-btn {
  border-color: rgba(15, 23, 42, 0.16);
  background: #f1f5f9;
  color: #0f172a;
}
.adm-brand-tool-btn--magic {
  flex: 1 1 190px;
}
.adm-brand-tool-btn--magic.is-active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #6ee7b7;
}
[data-theme="light"] .adm-brand-tool-btn--magic.is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: #059669;
  color: #047857;
}
[data-theme="light"] .adm-brand-browser-tab {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.16);
  color: #0f172a;
}

.adm-brand-dual-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.adm-brand-prev-box {
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.adm-brand-prev-box--dark {
  background: linear-gradient(135deg, #162a54 0%, #080f1e 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}
.adm-brand-prev-box--light {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: #0f172a;
}
.adm-brand-prev-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}
.adm-brand-prev-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  width: 100%;
}
.adm-brand-prev-canvas img {
  display: block;
  object-fit: contain;
}
.adm-brand-prev-canvas img.is-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}
.adm-brand-prev-canvas img.is-logo {
  max-width: 100%;
  max-height: 50px;
}

.adm-brand-cropper-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-brand-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .adm-brand-actions-bar {
  border-top-color: rgba(15, 23, 42, 0.1);
}
