*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: #eaf5fb;
  color: #111827;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 5;
  -webkit-box-shadow: 2px 0px 10px -4px rgba(0, 0, 0, 0.89);
  box-shadow: 2px 0px 10px -4px rgba(0, 0, 0, 0.15);
}

.logo {
  font-family: 'Sora', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  padding: 0 24px;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
}

.nav-item {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 12px;
  border-radius: 8px;
}

.nav-item.active {
  background-color: #e1f4fc;
  color: #0369a1;
  font-weight: 700;
}

.user-profile {
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-direction: column;
  align-items: flex-start;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e1f4fc;
  color: #0369a1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

/* --- MAIN AREA --- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  overflow: hidden;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
  gap: 16px;
}

.bell {
  width: 40px;
  height: 40px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.btn-upgrade {
  background: #fcd34d;
  border: none;
  border-radius: 8px;
  padding: 0 24px;
  font-weight: 600;
  color: #92400e;
}

.content-wrapper {
  display: flex;
  gap: 24px;
  flex: 1;
  overflow: hidden;
}

/* --- LEFT CARD --- */
.list-card {
  background: #ffffff;
  border-radius: 16px;
  width: 380px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  overflow-y: auto;
  border: 1px solid #e5e7eb;
}

.list-card h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.appointment-item {
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.appointment-item:last-child {
  border-bottom: none;
}

.appointment-item:hover {
  background-color: #f9fafb;
  border-radius: 8px;
  padding: 16px 8px;
  margin: 0 -8px;
}

.app-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.app-info p {
  font-size: 0.95rem;
  color: #4b5563;
}

.btn-briefing {
  background: #e1f4fc;
  color: #0369a1;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

/* --- RIGHT CARD --- */
.detail-card {
  background: #ffffff;
  border-radius: 16px;
  flex: 1;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  display: none;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.badge-urgency {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
}

.context-text {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 32px;
}

.bullet-list {
  list-style: none;
  margin-bottom: 32px;
}

.bullet-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.bullet-list li::before {
  content: "•";
  color: #0ea5e9;
  font-weight: bold;
  font-size: 1.5rem;
  position: absolute;
  left: 0;
  top: -5px;
}

.objection-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
}

.objection-box .quote {
  font-weight: 600;
  color: #9a3412;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.objection-box .advice {
  color: #c2410c;
  font-size: 0.95rem;
}

.opening-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 20px;
  color: #0369a1;
  font-weight: 500;
  font-size: 1.05rem;
}

.divider {
  height: 1px;
  background: #e5e7eb;
  margin: 32px 0;
}

/* --- SPA & OVERLAY --- */
.view-section {
  display: none !important;
}

.view-section.active-view {
  display: flex !important;
}

/* --- DASHBOARD --- */
.dashboard-view {
  min-height: 0;
  width: 100%;
}

.dashboard-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 24px;
}

.dashboard-header h2 {
  color: #111827;
  font-family: 'Sora', sans-serif;
  font-size: 1.35rem;
  margin-bottom: 18px;
}

.dashboard-header p {
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 700;
}

.dashboard-metrics {
  align-items: stretch;
  display: grid;
  gap: 8.5%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 80px 4px 0;
}

.dashboard-metric-card {
  aspect-ratio: 1.18 / 1;
  background: #eaf5fb;
  border: 1px solid #dbeaf1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 218px;
  padding: 16px 18px 14px;
}

.dashboard-metric-card h3 {
  color: #000000;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}

.dashboard-metric-card p {
  color: #000000;
  font-size: 0.88rem;
  line-height: 1.35;
}

.dashboard-metric-value {
  color: #000000;
  font-family: 'Sora', sans-serif;
  font-size: clamp(3.6rem, 5.7vw, 5.2rem);
  font-weight: 800;
  line-height: 0.95;
  margin-top: auto;
}

.dashboard-metric-arrow {
  align-self: flex-end;
  color: #000000;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.dashboard-updated {
  align-self: flex-end;
  color: #8a8a8a;
  font-size: 1.35rem;
  font-weight: 500;
  margin: auto 48px 14px 0;
}

@media (max-width: 1100px) {
  .dashboard-metrics {
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 48px;
  }
}

@media (max-width: 780px) {
  .dashboard-panel {
    overflow-y: auto;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-updated {
    align-self: flex-start;
    font-size: 1.05rem;
    margin: 40px 0 0;
  }
}

/* --- SETTINGS --- */
.settings-view {
  min-height: 0;
  width: 100%;
}

.settings-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.settings-header {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 36px;
}

.settings-header h2 {
  color: #111827;
  font-family: 'Sora', sans-serif;
  font-size: 1.35rem;
  margin-bottom: 18px;
}

.settings-header p {
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 700;
}

.settings-primary-action {
  background: #0369a1;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 18px;
  white-space: nowrap;
}

.settings-primary-action:hover {
  background: #0284c7;
}

.settings-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 22px;
}

.settings-wide-card {
  grid-column: 1 / -1;
}

.settings-card-heading {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.settings-card h3 {
  color: #111827;
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem;
}

.settings-avatar {
  align-items: center;
  background: #e1f4fc;
  border-radius: 50%;
  color: #0369a1;
  display: flex;
  flex: 0 0 auto;
  font-weight: 800;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.settings-field-list,
.settings-integration-list,
.settings-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-field,
.settings-integration,
.settings-toggle-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 14px 16px;
}

.settings-field span,
.settings-integration span,
.settings-toggle-row span {
  color: #6b7280;
  display: block;
  font-size: 0.86rem;
  line-height: 1.4;
}

.settings-field strong,
.settings-integration strong,
.settings-toggle-row strong {
  color: #111827;
  display: block;
  font-size: 0.95rem;
}

.settings-usage-value {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.settings-status-badge {
  background: #dcfce7;
  border-radius: 99px;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
}

.settings-dot {
  background: #cbd5e1;
  border-radius: 50%;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.settings-dot.active {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.13);
}

.settings-toggle-row {
  cursor: pointer;
}

.settings-toggle-row input {
  accent-color: #0369a1;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.settings-danger-card {
  background: #fff7ed;
  border-color: #fed7aa;
}

.settings-danger-content {
  align-items: center;
  background: #ffffff;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px;
}

.settings-danger-content strong {
  color: #111827;
  display: block;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.settings-danger-content span {
  color: #9a3412;
  display: block;
  font-size: 0.9rem;
  line-height: 1.45;
}

.settings-danger-action {
  background: #c2410c;
  border-radius: 8px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 11px 15px;
  text-decoration: none;
  white-space: nowrap;
}

.settings-danger-action:hover {
  background: #9a3412;
}

@media (max-width: 900px) {
  .settings-header {
    flex-direction: column;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-danger-content {
    align-items: flex-start;
    flex-direction: column;
  }
}

.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9998;
}

.chat-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.brief-modal-open {
  overflow: hidden;
}

.brief-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  display: none;
  padding: 32px;
  z-index: 10000;
}

.brief-modal.active {
  display: flex;
}

.brief-modal.active .brief-modal-panel {
  animation: brief-modal-in 0.28s cubic-bezier(0.2, 0.85, 0.28, 1.08);
}

.brief-modal.closing {
  display: flex;
}

.brief-modal.closing .brief-modal-panel {
  animation: brief-modal-out 0.18s ease-in forwards;
}

.brief-modal-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  margin: auto;
  overflow: hidden;
  width: min(1120px, 100%);
}

.brief-modal-header {
  align-items: flex-start;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
}

.brief-modal-header h2 {
  color: #111827;
  font-family: 'Sora', sans-serif;
  font-size: 1.65rem;
  margin: 0 0 8px;
}

.brief-modal-meta {
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 500;
}

.brief-modal-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brief-modal-close {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  display: flex;
  font-size: 1.35rem;
  height: 40px;
  justify-content: center;
  line-height: 1;
  width: 40px;
}

.brief-modal-close:hover {
  background: #e1f4fc;
  color: #0369a1;
}

.brief-modal-source {
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 24px 32px 0;
}

.brief-modal-content {
  color: #111827;
  flex: 1;
  font-size: 1.05rem;
  line-height: 1.7;
  overflow-y: auto;
  padding: 18px 32px 36px;
  white-space: pre-wrap;
}

@keyframes brief-modal-in {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.003);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes brief-modal-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

@media (max-width: 720px) {
  .brief-modal {
    padding: 14px;
  }

  .brief-modal-panel {
    height: calc(100vh - 28px);
  }

  .brief-modal-header {
    flex-direction: column;
    padding: 22px 20px 18px;
  }

  .brief-modal-actions {
    justify-content: space-between;
    width: 100%;
  }

  .brief-modal-source {
    padding: 20px 20px 0;
  }

  .brief-modal-content {
    font-size: 1rem;
    padding: 14px 20px 28px;
  }
}

/* --- SEZIONE LEAD & CHAT WIDGET --- */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 380px;
  height: 100%;
}

.left-column .list-card {
  width: 100%;
}

.lead-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lead-item:hover {
  background-color: #f8fafc;
  border-radius: 8px;
}

.lead-item .lead-response-time {
  transition: transform 0.2s ease;
}

/*Transizione verso sinistra lead*/
.lead-item:hover .lead-response-time {
  transform: translateX(-12px);
}

.lead-meta-info {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 3px;
}

.timeline {
  margin-top: 15px;
  padding-left: 10px;
  border-left: 2px solid #e5e7eb;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 15px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1em;
  top: 1em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #3b82f6;
}

.timeline-item.closed-won::before {
  background-color: #10b981;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
}

.timeline-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.badge-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

#leads-container .lead-item.selected {
  background-color: #e0f8ff;
  border-radius: 14px;
}

#leads-container .lead-item.selected:hover {
  background-color: #e0f8ff;
}

#leads-container .lead-item.selected h3,
#leads-container .lead-item.selected .lead-meta-info {
  color: #1f2917 !important;
}

/* --- ANIMAZIONE CHAT CARD --- */
.chat-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.chat-card.fullscreen-chat {
  position: fixed;
  top: 3vh;
  left: 3vw;
  right: 3vw;
  bottom: 3vh;
  width: 94vw;
  height: 94vh;
  z-index: 9999;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

#btn-expand-chat {
  background: none;
  border: none;
  cursor: pointer;
  color: #0369a1;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

#btn-expand-chat:hover {
  background-color: #e1f4fc;
  transform: scale(1.05);
}

.chat-header {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.chat-disclaimer {
  display: none;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  padding: 6px 10px;
  margin-top: -4px;
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.3;
  background-color: #ffffff;
  border-top: 1px dashed #f1f5f9;
  width: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  padding-right: 5px;
}

.msg {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.4;
  word-wrap: break-word;
}

.cassandra-msg {
  background: #f0f9ff;
  color: #0369a1;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.user-msg {
  background: #0369a1;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input {
  display: flex;
  gap: 8px;
}

.chat-input input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: #0369a1;
}

.chat-input button {
  background: #0369a1;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: #0284c7;
}

.chat-suggestions-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.chat-suggestion {
  display: inline-flex;
  align-items: end;
  gap: 8px;
  background-color: #0369a1;
  /* Colore primario Cassandra */
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  width: fit-content;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-suggestion:hover {
  background-color: #0284c7;
  transform: translateY(-1px);
}

.chat-suggestion-icon {
  font-size: 1rem;
}

.chat-suggestion-text {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}


/* ==========================================================================
   CONTROLLO DISCLAIMER DINAMICO (SOLO IN FULLSCREEN)
   ========================================================================== */

/* Di base (box piccolo), il disclaimer è totalmente nascosto */
.chat-card .chat-disclaimer {
  display: none !important;
}

/* Diventa visibile SOLO quando la chat-card riceve la classe fullscreen-chat */
.chat-card.fullscreen-chat .chat-disclaimer {
  display: block !important;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  padding: 6px 10px;
  margin-top: 4px;
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.3;
  background-color: #ffffff;
  border-top: 1px dashed #f1f5f9;
  width: 100%;
}

/* --- THINKING/TYPING INDICATOR ANIMATION --- */
.thinking-indicator {
  align-self: flex-start;
  background: #f0f9ff;
  color: #0369a1;
  border-bottom-left-radius: 4px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 2px;
}

.dots::after {
  content: "";
  animation: typing-dots 1.6s steps(4, end) infinite;
}

@keyframes typing-dots {
  0% {
    content: "";
  }

  25% {
    content: ".";
  }

  50% {
    content: "..";
  }

  75% {
    content: "...";
  }

  100% {
    content: "";
  }
}

/* --- DRIVER.JS ONBOARDING OVERRIDES --- */
.driver-popover {
  background-color: #ebf5fa !important;
}

.driver-popover-arrow {
  border-color: transparent !important;
}

/* ===================================================================
   SESSIONS MODAL
   =================================================================== */
.sessions-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  display: none;
  padding: 32px;
  z-index: 10000;
}

.sessions-modal.active {
  display: flex;
}

.sessions-modal.active .sessions-modal-panel {
  animation: sessions-modal-in 0.28s cubic-bezier(0.2, 0.85, 0.28, 1.08);
}

.sessions-modal.closing {
  display: flex;
}

.sessions-modal.closing .sessions-modal-panel {
  animation: sessions-modal-out 0.18s ease-in forwards;
}

.sessions-modal-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
  margin: auto;
  overflow: hidden;
  width: min(680px, 100%);
}

.sessions-modal-header {
  align-items: flex-start;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
}

.sessions-modal-header h2 {
  color: #111827;
  font-family: 'Sora', sans-serif;
  font-size: 1.5rem;
  margin: 0 0 6px;
}

.sessions-modal-meta {
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
}

.sessions-modal-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.sessions-modal-close {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  display: flex;
  font-size: 1.35rem;
  height: 40px;
  justify-content: center;
  line-height: 1;
  width: 40px;
  transition: background 0.15s, color 0.15s;
}

.sessions-modal-close:hover {
  background: #e1f4fc;
  color: #0369a1;
}

.sessions-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sessions-modal-footer {
  border-top: 1px solid #e5e7eb;
  padding: 18px 32px;
  display: flex;
  justify-content: flex-end;
}

.sessions-revoke-all-btn {
  background: #dc2626;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 11px 20px;
  transition: background 0.2s, transform 0.1s;
}

.sessions-revoke-all-btn:hover {
  background: #b91c1c;
}

.sessions-revoke-all-btn:active {
  transform: scale(0.97);
}

/* --- Session Card --- */
.session-card {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.session-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.session-card.current-session {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
}

.session-icon {
  align-items: center;
  background: #e1f4fc;
  border-radius: 12px;
  color: #0369a1;
  display: flex;
  flex: 0 0 auto;
  font-size: 1.5rem;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.session-card.current-session .session-icon {
  background: #dcfce7;
  color: #166534;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-info-primary {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.session-browser {
  color: #111827;
  font-size: 0.95rem;
  font-weight: 700;
}

.session-badge-current {
  background: #dcfce7;
  border-radius: 99px;
  color: #166534;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.session-detail-row {
  color: #6b7280;
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  margin-top: 2px;
}

.session-detail-row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.session-current-hint {
  color: #6b7280;
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 6px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease, margin-top 0.25s ease;
}

.session-card.current-session:hover .session-current-hint {
  max-height: 30px;
  opacity: 1;
}

.session-revoke-btn {
  background: transparent;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #dc2626;
  cursor: pointer;
  flex: 0 0 auto;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.session-revoke-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.session-revoke-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Loading State --- */
.sessions-loading {
  align-items: center;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  padding: 60px 0;
  font-size: 0.95rem;
}

.sessions-spinner {
  border: 3px solid #e5e7eb;
  border-top-color: #0369a1;
  border-radius: 50%;
  height: 32px;
  width: 32px;
  animation: spin 0.7s linear infinite;
}

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

/* --- Empty State --- */
.sessions-empty {
  align-items: center;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 60px 0;
  text-align: center;
}

.sessions-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

.sessions-empty strong {
  color: #111827;
  font-size: 1.05rem;
}

/* --- Animations --- */
@keyframes sessions-modal-in {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.003);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sessions-modal-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

/* Session card removal animation */
.session-card.removing {
  animation: session-remove 0.3s ease-in forwards;
}

@keyframes session-remove {
  0% {
    opacity: 1;
    transform: translateX(0);
    max-height: 120px;
  }

  50% {
    opacity: 0;
    transform: translateX(30px);
    max-height: 120px;
  }

  100% {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .sessions-modal {
    padding: 14px;
  }

  .sessions-modal-header {
    flex-direction: column;
    padding: 22px 20px 18px;
  }

  .sessions-modal-body {
    padding: 18px 20px;
  }

  .sessions-modal-footer {
    padding: 14px 20px;
  }

  .session-card {
    flex-wrap: wrap;
  }

  .session-revoke-btn {
    width: 100%;
    text-align: center;
  }
}


/* --- Floating Services Onboarding Bot --- */
.floating-bot {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 1000;
  cursor: pointer;
  animation: floatBounce 3s infinite ease-in-out;
}

@keyframes floatBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.floating-bot-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
  border: 3px solid white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating-bot:hover .floating-bot-icon {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.6);
}

.floating-bot-tooltip {
  background: white;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  font-weight: 500;
  color: #1f2937;
  max-width: 250px;
  position: relative;
}

.floating-bot-tooltip::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent white;
}

/* --- Services Modal --- */
.services-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.services-modal.open {
  display: flex;
}

.services-modal-panel {
  background: white;
  width: 90%;
  max-width: 500px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
  max-height: 90vh;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.services-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.services-modal-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.25rem;
  color: #111827;
  margin: 0;
}

.services-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
}

.services-modal-close:hover {
  color: #111827;
}

.services-modal-content {
  padding: 24px;
  overflow-y: auto;
}

.service-field-group {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}

.service-title-input,
.service-desc-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.service-desc-input {
  resize: vertical;
  margin-bottom: 0;
}

.service-title-input:focus,
.service-desc-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.remove-service-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-service-btn:hover {
  background: #f87171;
  color: white;
}

.add-service-btn {
  background: transparent;
  color: #3b82f6;
  border: 1px dashed #3b82f6;
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.add-service-btn:hover {
  background: #eff6ff;
}

.save-services-btn {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}

.save-services-btn:hover {
  background: #2563eb;
}