/* ============================================
   Robo de Vendas V2 — Dashboard Styles
   Professional SaaS Dashboard
   ============================================ */

/* --- CSS Variables (ADS4PROS Design System v2) --- */
:root {
  /* === Brand — Azul royal (identidade) === */
  --brand-50:   #e8f1fc;
  --brand-100:  #bcd5f5;
  --brand-300:  #3585e0;  /* azure — accents */
  --brand-500:  #0a6ad8;  /* royal — primário, igual ao logo A4P */
  --brand-700:  #0a3d7a;
  --brand-900:  #01122c;  /* navy — backgrounds editoriais */

  /* === Detail — Verde WhatsApp (ação/tempero) === */
  --detail:       #25d366;
  --detail-2:     #128c7e;
  --detail-warm:  #2bdd6e;

  /* === Surfaces === */
  --ink:       #01122c;
  --ink-2:     #061b3a;
  --ink-3:     #0a2647;
  --paper:     #f6f7f9;
  --paper-2:   #eef0f4;
  --paper-3:   #dee2ea;
  --line:      #cbd2dc;
  --line-dark: rgba(255, 255, 255, 0.12);

  /* === Steel — cinza-azulado === */
  --steel-100: #c8cdd4;
  --steel-300: #8a93a0;
  --steel-500: #5b6470;
  --steel-700: #3a414c;
  --steel-900: #1c2128;

  /* === Foreground === */
  --fg:        #01122c;
  --fg-dim:    #3a414c;
  --fg-dimmer: #5b6470;

  /* === Aliases legados (compatibilidade) === */
  --accent:   #0a6ad8;
  --accent-2: #073060;
  --cyan:     #3585e0;
  --cyan-dim: #7fb5e8;

  /* === Estados === */
  --success:  #16a34a;
  --warning:  #f59e0b;
  --danger:   #dc2626;

  /* === Display type scale === */
  --font-display-xl: clamp(56px, 4rem + 4vw, 115px);
  --font-display-lg: clamp(40px, 3rem + 2.5vw, 88px);
  --font-display-md: clamp(32px, 2rem + 1.5vw, 64px);
  --font-display-sm: clamp(28px, 1.75rem + 1vw, 48px);

  /* === Aliases pra vars antigas (não quebrar telas em produção) === */
  --primary:        var(--brand-500);
  --primary-dark:   var(--brand-700);
  --sidebar-bg:     var(--brand-900);
  --bg:             var(--paper);

  /* === Aliases adicionais (preservados do :root anterior) === */
  --primary-hover:  var(--brand-700);
  --primary-light:  var(--brand-300);
  --primary-bg:     var(--brand-50);

  --sidebar-hover:  var(--ink-3);
  --sidebar-active: rgba(10, 106, 216, 0.15);
  --sidebar-border: var(--ink-3);
  --sidebar-width:  260px;

  --success-light:  #22c55e;
  --success-bg:     #f0fdf4;
  --warning-light:  #fbbf24;
  --warning-bg:     #fffbeb;
  --danger-light:   #ef4444;
  --danger-bg:      #fef2f2;

  --orange:         #25d366;
  --orange-bg:      #fff7ed;

  /* Gray scale — preservada (muitas telas referenciam diretamente) */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --content-bg:  var(--paper);
  --card-bg:     #ffffff;

  --font-family: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius:      8px;
  --radius-sm:   6px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --transition:      200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: 'ss01', 'cv11';
    -webkit-font-smoothing: antialiased;
    color: var(--gray-800);
    background: var(--content-bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--gray-900);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

::selection {
    background: var(--primary);
    color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ================================================
   LAYOUT: Sidebar + Content
   ================================================ */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
}

.logo-img {
    display: block;
    max-width: 120px;
    height: auto;
    margin: 0 auto 0.75rem;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.sidebar-logo {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    text-align: center;
}

.sidebar-logo h1 {
    font-size: 1.15rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.sidebar-logo h1 span {
    color: var(--primary-light);
}

.sidebar-tenant {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-tenant label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.sidebar-tenant select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-700);
    background: var(--gray-800);
    color: #fff;
    font-size: 0.85rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

.sidebar-tenant select:focus {
    outline: none;
    border-color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* --- Accordion nav groups --- */
.nav-group {
    margin: 1px 0;
}
.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1.5rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--gray-400);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.nav-group-toggle:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.nav-group-label {
    flex: 1;
}
.nav-group-caret {
    display: inline-flex;
    transition: transform var(--transition-fast);
    opacity: 0.7;
}
.nav-group.open .nav-group-caret {
    transform: rotate(180deg);
}
.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-fast) ease-out;
}
.nav-group.open .nav-group-items {
    max-height: 320px;
}
.nav-group-items a {
    padding: 0.5rem 1.5rem 0.5rem 3.4rem;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
    color: var(--gray-400);
    display: block;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.nav-group-items a:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.nav-group-items a.active {
    background: var(--sidebar-active);
    color: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* --- User profile box (bottom of sidebar) --- */
.sidebar-user {
    position: relative;
    margin: 0.5rem 0.75rem 0.75rem;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    color: #e2e8f0;
    cursor: pointer;
    transition: background var(--transition-fast);
    margin-top: 0.5rem;
}
.sidebar-user-trigger:hover {
    background: rgba(255,255,255,0.08);
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light, #3585e0));
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-user-avatar-img {
    object-fit: cover;
    background: transparent;
}
.sidebar-user-meta {
    flex: 1;
    min-width: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
}
.sidebar-user-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-tenant {
    font-size: 0.7rem;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-caret {
    display: inline-flex;
    color: var(--gray-400);
    transition: transform var(--transition-fast);
}
.sidebar-user.open .sidebar-user-caret {
    transform: rotate(180deg);
}
.sidebar-user-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 1000;
    box-shadow: 0 12px 24px rgba(0,0,0,0.35);
}
.sidebar-user.open .sidebar-user-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.sidebar-user-menu a {
    display: block;
    padding: 0.55rem 0.9rem;
    font-size: 0.82rem;
    color: #e2e8f0;
    text-decoration: none;
    transition: background var(--transition-fast);
}
.sidebar-user-menu a:hover {
    background: rgba(255,255,255,0.08);
}
.sidebar-user-logout {
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #fca5a5 !important;
}

/* --- Mobile hamburger --- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem 2rem;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
    background: var(--content-bg);
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.page-header p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ================================================
   CARDS
   ================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ================================================
   KPI CARDS
   ================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.kpi-card:hover::after {
    opacity: 1;
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.kpi-card .kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.kpi-card .kpi-trend {
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
}

.kpi-trend.up {
    color: var(--success);
    background: var(--success-bg);
}

.kpi-trend.down {
    color: var(--danger);
    background: var(--danger-bg);
}

.kpi-trend.neutral {
    color: var(--gray-500);
    background: var(--gray-100);
}

/* ================================================
   KANBAN BOARD
   ================================================ */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
    min-height: calc(100vh - 180px);
    scroll-snap-type: x proximity;
}

.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.kanban-column {
    flex: 1 1 0;
    min-width: 200px;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
    scroll-snap-align: start;
}

.kanban-column-header {
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--gray-200);
    flex-shrink: 0;
}

.kanban-column-header .count {
    background: var(--gray-300);
    color: var(--gray-700);
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.85rem;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    border-left: 4px solid var(--gray-300);
}

.kanban-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.kanban-card.score-cold { border-left-color: var(--gray-400); }
.kanban-card.score-warm { border-left-color: var(--warning); }
.kanban-card.score-hot { border-left-color: var(--orange); }
.kanban-card.score-ready { border-left-color: var(--success); }

.kanban-card .card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
}

.kanban-card .card-company {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.6rem;
}

.kanban-card .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-card .card-time {
    font-size: 0.7rem;
    color: var(--gray-400);
}

/* ================================================
   SCORE BADGES (Pill shaped)
   ================================================ */
.score-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
}

.score-cold {
    background: var(--gray-100);
    color: var(--gray-600);
}

.score-warm {
    background: var(--warning-bg);
    color: #92400e;
}

.score-hot {
    background: var(--orange-bg);
    color: #9a3412;
}

.score-ready {
    background: var(--success-bg);
    color: #166534;
}

/* ================================================
   SPICED PROGRESS BARS
   ================================================ */
.spiced-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.spiced-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.spiced-label {
    width: 110px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    flex-shrink: 0;
}

.spiced-bar-wrapper {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.spiced-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--primary);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.spiced-bar.level-0 { width: 0%; background: var(--gray-300); }
.spiced-bar.level-1 { width: 20%; background: var(--danger); }
.spiced-bar.level-2 { width: 40%; background: var(--orange); }
.spiced-bar.level-3 { width: 60%; background: var(--warning); }
.spiced-bar.level-4 { width: 80%; background: var(--primary); }
.spiced-bar.level-5 { width: 100%; background: var(--success); }

.spiced-value {
    width: 24px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700);
}

/* ================================================
   CHAT BUBBLES (WhatsApp-style)
   ================================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    max-height: 60vh;
    overflow-y: auto;
    background: #efeae2;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d5cfc4' fill-opacity='0.2'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.chat-bubble {
    max-width: 70%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.chat-bubble .chat-time {
    font-size: 0.65rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
    display: block;
    text-align: right;
}

.chat-bubble.user {
    align-self: flex-start;
    background: #ffffff;
    color: var(--gray-800);
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
}

.chat-bubble.bot {
    align-self: flex-end;
    background: #d9fdd3;
    color: var(--gray-800);
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.chat-bubble.specialist {
    align-self: flex-end;
    background: #d1e7ff;
    color: var(--gray-800);
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.chat-sender {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    letter-spacing: 0.02em;
}

.chat-bubble.user .chat-sender { color: var(--gray-600); }
.chat-bubble.bot .chat-sender { color: var(--success); }
.chat-bubble.specialist .chat-sender { color: var(--primary); }

/* ================================================
   CONVERSATIONS LAYOUT
   ================================================ */
.conversations-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    height: calc(100vh - 180px);
}

.conversation-list {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.conversation-list-header {
    padding: 0.85rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.conversation-list-items {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.conversation-item:hover {
    background: var(--gray-50);
}

.conversation-item.active {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.conversation-item .conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-item .conv-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-900);
}

.conversation-item .conv-preview {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.conversation-item .conv-time {
    font-size: 0.7rem;
    color: var(--gray-400);
}

.conversation-item .unread-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
    min-width: 1.2rem;
    text-align: center;
}

.chat-panel {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.chat-panel-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
}

.chat-panel-body {
    flex: 1;
    overflow-y: auto;
    background: #efeae2;
}

.chat-panel-footer {
    padding: 0.85rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
    background: var(--gray-50);
}

.chat-panel-footer input {
    flex: 1;
}

/* ================================================
   TABLES
   ================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    font-weight: 700;
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.data-table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.data-table tbody tr:nth-child(even) td {
    background: var(--gray-50);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
    background: var(--primary-bg);
}

.data-table .expandable {
    cursor: pointer;
}

.data-table .expandable:hover td {
    background: var(--primary-bg);
}

/* ================================================
   STAR RATING
   ================================================ */
.star-rating {
    display: inline-flex;
    gap: 0.15rem;
    direction: rtl;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--gray-300);
    transition: color var(--transition-fast), transform var(--transition-fast);
    line-height: 1;
}

.star-rating label:hover {
    transform: scale(1.15);
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #f59e0b;
}

/* ================================================
   FORMS
   ================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--gray-800);
    background: var(--card-bg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 106, 216, 0.12);
}

.form-control::placeholder {
    color: var(--gray-400);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2rem;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--detail);
    color: #0a2e1a;
    border: 0;
    box-shadow:
        0 0 0 1px var(--detail-2),
        0 1px 0 rgba(0,0,0,0.1),
        0 6px 20px -8px rgba(37, 211, 102, 0.55);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary:hover {
    background: var(--detail-warm);
    transform: translateY(-1px);
    box-shadow:
        0 0 0 1px var(--detail-2),
        0 2px 0 rgba(0,0,0,0.15),
        0 12px 28px -10px rgba(37, 211, 102, 0.6);
    color: #0a2e1a;
}

.btn-ghost-dark  { color: #e8ecf1; border: 1px solid rgba(255,255,255,0.18); background: transparent; }
.btn-ghost-light { color: var(--fg); border: 1px solid var(--line); background: transparent; }
.btn-ghost-dark:hover  { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.32); }
.btn-ghost-light:hover { background: rgba(0,0,0,0.03); border-color: #b6b0a3; }

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
    background: #15803d;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

/* ================================================
   TABS
   ================================================ */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0 0.5rem;
}

.tab-bar a,
.tab-bar button {
    padding: 0.85rem 1.5rem;
    color: var(--gray-500);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    text-decoration: none;
}

.tab-bar a:hover,
.tab-bar button:hover {
    color: var(--gray-700);
    text-decoration: none;
}

.tab-bar a.active,
.tab-bar button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ================================================
   BADGES & TAGS
   ================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pain { background: #fce7f3; color: #9d174d; }
.badge-desire { background: #e0e7ff; color: #3730a3; }
.badge-objection { background: #fef3c7; color: #92400e; }
.badge-excuse { background: #f3e8ff; color: #6b21a8; }

.badge-frequency {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

/* ================================================
   METRICS / COMPARISON
   ================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-compare {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

.metric-compare:hover {
    box-shadow: var(--shadow-sm);
}

.metric-compare .metric-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.metric-compare .metric-values {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.metric-compare .metric-current {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
}

.metric-compare .metric-previous {
    font-size: 0.85rem;
    color: var(--gray-400);
    text-decoration: line-through;
}

.metric-compare .metric-delta {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
}

.metric-delta.positive {
    color: var(--success);
    background: var(--success-bg);
}

.metric-delta.negative {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ================================================
   CHANGELOG / TIMELINE
   ================================================ */
.timeline {
    padding-left: 1.75rem;
    border-left: 2px solid var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    padding-left: 1.25rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.85rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--card-bg);
    box-shadow: 0 0 0 1px var(--gray-200);
}

.timeline-item .timeline-date {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.timeline-item .timeline-text {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

/* ================================================
   STATUS INDICATOR
   ================================================ */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    flex-shrink: 0;
}

.status-dot.online, .status-dot.success { background: var(--success); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }
.status-dot.offline, .status-dot.error { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }

/* ================================================
   SIDE PANEL (Slide from right)
   ================================================ */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 620px;
    max-width: 95vw;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-panel.open {
    transform: translateX(0);
}

.side-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.side-panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.side-panel-body {
    padding: 1.5rem;
}

.side-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 199;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.side-panel-overlay.open {
    display: block;
    opacity: 1;
}

/* ================================================
   CHARTS
   ================================================ */
.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* ================================================
   SUGGESTION CARDS
   ================================================ */
.suggestion-card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.85rem;
    transition: all var(--transition);
    border-left: 4px solid var(--primary);
}

.suggestion-card:hover {
    box-shadow: var(--shadow-sm);
}

.suggestion-card .suggestion-text {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.suggestion-card .suggestion-actions {
    display: flex;
    gap: 0.5rem;
}

/* ================================================
   ALERTS
   ================================================ */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(10, 106, 216, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(10, 106, 216, 0.1) 0%, transparent 70%);
    bottom: -250px;
    left: -200px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-card .login-logo .logo-img {
    max-width: 160px;
    filter: none;
    opacity: 1;
    margin-bottom: 1rem;
}

.login-card .login-logo h1 {
    font-size: 1.4rem;
    color: var(--gray-900);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-card .login-logo h1 span {
    color: var(--primary);
}

.login-card .login-logo p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.login-card .form-group {
    position: relative;
}

.login-card .form-group .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1rem;
    pointer-events: none;
}

.login-card .form-group.has-icon .form-control {
    padding-left: 2.5rem;
}

.login-card .form-control {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--gray-200);
    font-size: 0.95rem;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 106, 216, 0.1);
}

.login-card .btn-primary {
    padding: 0.85rem;
    font-size: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(10, 106, 216, 0.35);
}

.login-card .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(10, 106, 216, 0.45);
}

/* ================================================
   BOT PERFORMANCE METRICS
   ================================================ */
.bot-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.bot-metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bot-metric-item .metric-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.bot-metric-item .metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* ================================================
   TOP PAINS LIST
   ================================================ */
.pain-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.pain-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.pain-list-item:last-child {
    border-bottom: none;
}

.pain-list-item .pain-text {
    font-size: 0.9rem;
    color: var(--gray-700);
    flex: 1;
}

/* ================================================
   UTILITY CLASSES
   ================================================ */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ================================================
   LEAD MODAL (CRM-style tabbed view)
   ================================================ */
.lead-modal { padding: 1.25rem; }

/* Header */
.lm-header { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.lm-header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.lm-identity h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.15rem; }
.lm-company { font-size: 0.85rem; color: var(--gray-500); }
.lm-badges { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.lm-score { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.lm-score small { font-size: 0.7rem; font-weight: 400; color: var(--gray-400); }
.lm-score.score-cold { color: var(--gray-400); }
.lm-score.score-warm { color: var(--warning); }
.lm-score.score-hot { color: #128c7e; }
.lm-score.score-ready { color: var(--success); }
.lm-status { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 10px; background: var(--gray-100); color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.03em; }
.lm-status-qualified { background: var(--primary-bg); color: var(--primary); }
.lm-status-meeting_booked { background: rgba(249, 115, 22, 0.1); color: #128c7e; }
.lm-status-won { background: var(--success-bg); color: var(--success); }
.lm-status-lost { background: var(--danger-bg); color: var(--danger); }
.lm-dates { margin-top: 0.5rem; display: flex; gap: 1.5rem; }
.lm-dates span { font-size: 0.78rem; color: var(--gray-500); }
.lm-converted { color: var(--success) !important; font-weight: 500; }

/* Tabs */
.lm-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-100); margin-bottom: 1rem; }
.lm-tab { padding: 0.5rem 1rem; font-size: 0.82rem; font-weight: 500; color: var(--gray-500); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.lm-tab:hover { color: var(--gray-700); }
.lm-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.lm-tab-content { display: none; }
.lm-tab-content.active { display: block; }

/* Cards inside modal */
.lm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
.lm-card { background: var(--gray-50); border-radius: var(--radius); padding: 0.85rem; }
.lm-card-title { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.6rem; display: flex; justify-content: space-between; align-items: center; }
.lm-card-accent { background: var(--primary-bg); border-left: 3px solid var(--primary); }
.lm-card-pain { border-left: 3px solid var(--danger); }
.lm-card-desire { border-left: 3px solid var(--success); }

/* Rows */
.lm-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0; font-size: 0.82rem; border-bottom: 1px solid rgba(0,0,0,0.04); }
.lm-row:last-child { border-bottom: none; }
.lm-label { color: var(--gray-500); flex-shrink: 0; margin-right: 0.5rem; }
.lm-value { font-weight: 500; text-align: right; word-break: break-word; }
.lm-value a { color: var(--primary); text-decoration: none; }

/* Driver */
.lm-driver-badge { font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 4px; }
.lm-driver-badge.pain { background: var(--danger-bg); color: var(--danger); }
.lm-driver-badge.desire { background: var(--success-bg); color: var(--success); }
.lm-driver-text { font-size: 0.82rem; color: var(--gray-600); margin-top: 0.4rem; font-style: italic; }

/* SPICED items */
.lm-spiced-item { margin-bottom: 0.85rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--gray-100); }
.lm-spiced-item:last-child { border-bottom: none; margin-bottom: 0; }
.lm-spiced-top { display: flex; align-items: center; gap: 0.6rem; }
.lm-spiced-letter { width: 28px; height: 28px; border-radius: 6px; background: var(--primary); color: #fff; font-weight: 700; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lm-spiced-info { flex: 1; }
.lm-spiced-name { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.2rem; }
.lm-spiced-bar-wrap { height: 5px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.lm-spiced-bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.lm-spiced-score { font-size: 0.78rem; color: var(--gray-500); font-weight: 500; flex-shrink: 0; }
.lm-spiced-text { font-size: 0.82rem; color: var(--gray-700); margin-top: 0.4rem; padding: 0.5rem 0.75rem 0.5rem 2.4rem; font-style: normal; font-weight: 400; background: var(--gray-50); border-radius: 6px; line-height: 1.4; }
.lm-spiced-text.empty { color: var(--gray-400); font-style: italic; background: none; }

/* Score */
.lm-score-hero { text-align: center; padding: 1.5rem 0; }
.lm-score-circle { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem; border: 3px solid var(--gray-200); }
.lm-score-circle.score-cold { border-color: var(--gray-300); }
.lm-score-circle.score-warm { border-color: var(--warning); }
.lm-score-circle.score-hot { border-color: #128c7e; }
.lm-score-circle.score-ready { border-color: var(--success); }
.lm-score-num { font-size: 1.8rem; font-weight: 800; }
.lm-score-label { font-size: 0.85rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }
.lm-score-row { display: flex; justify-content: space-between; padding: 0.3rem 0; font-size: 0.82rem; border-bottom: 1px solid rgba(0,0,0,0.04); }
.lm-score-row:last-child { border-bottom: none; }
.lm-score-val { font-weight: 600; }
.lm-score-val.positive { color: var(--success); }
.lm-ai-reason { font-size: 0.78rem; color: var(--gray-500); font-style: italic; margin-top: 0.3rem; }

/* Quality tab */
.lm-bot-score { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.3rem; }
.lm-bot-score small { font-size: 0.8rem; font-weight: 400; color: var(--gray-400); }
.lm-bot-text { font-size: 0.8rem; color: var(--gray-500); font-style: italic; }
.lm-stars { display: flex; gap: 0.15rem; }
.lm-star { font-size: 1.4rem; color: var(--gray-300); cursor: pointer; transition: color 0.15s, transform 0.15s; }
.lm-star:hover, .lm-star.active { color: #f59e0b; }
.lm-star:hover { transform: scale(1.15); }

/* Actions */
.lm-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.lm-select { font-size: 0.82rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; max-width: 180px; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1280px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .kanban-column {
        flex: 0 0 260px;
    }

    .conversations-layout {
        grid-template-columns: 280px 1fr;
    }

    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }

    .conversations-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .side-panel {
        width: 100vw;
    }

    .login-card {
        margin: 1rem;
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-card .kpi-value {
        font-size: 1.75rem;
    }
}

/* ================================================
   HTMX INDICATORS
   ================================================ */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   BLOCKLIST TABLE
   ================================================ */
.blocklist-table td:last-child {
    text-align: right;
}

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-card,
.chart-card,
.card {
    animation: fadeIn 0.3s ease forwards;
}

.kpi-grid .kpi-card:nth-child(2) { animation-delay: 0.05s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: 0.1s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: 0.15s; }

/* ================================================
   SIDEBAR BACKGROUND SELECTOR
   ================================================ */
.bg-selector {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
    align-items: center;
    justify-content: center;
    margin-top: auto;
}

.bg-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.bg-option:hover {
    border-color: var(--primary-light);
    transform: scale(1.1);
}

.bg-option.active {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.bg-option-default {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ================================================
   UI POLISH: ENHANCED CHAT BUBBLES
   ================================================ */
.chat-bubble {
    max-width: 70%;
    padding: 0.5rem 0.75rem 0.35rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
}

.chat-bubble .chat-text {
    margin-bottom: 0.15rem;
}

.chat-bubble .chat-time {
    font-size: 0.65rem;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 0.1rem;
    display: inline-block;
    float: right;
    margin-left: 0.75rem;
    line-height: 1.6;
}

.chat-bubble.user {
    align-self: flex-start;
    background: #ffffff;
    color: var(--gray-800);
    border-radius: 4px 12px 12px 12px;
}

.chat-bubble.user::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #ffffff;
    border-left: 6px solid transparent;
}

.chat-bubble.bot {
    align-self: flex-end;
    background: #d9fdd3;
    color: var(--gray-800);
    border-radius: 12px 4px 12px 12px;
}

.chat-bubble.bot::before {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #d9fdd3;
    border-right: 6px solid transparent;
}

.chat-bubble.bot .chat-time {
    color: rgba(0, 100, 0, 0.45);
}

.chat-bubble.specialist {
    align-self: flex-end;
    background: #d1e7ff;
    color: var(--gray-800);
    border-radius: 12px 4px 12px 12px;
}

.chat-bubble.specialist::before {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #d1e7ff;
    border-right: 6px solid transparent;
}

.chat-bubble.specialist .chat-time {
    color: rgba(0, 50, 150, 0.45);
}

.chat-sender {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: 0.02em;
}

/* ================================================
   UI POLISH: ENHANCED LOGIN PAGE
   ================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #0c4a6e 70%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(10, 106, 216, 0.18) 0%, transparent 65%);
    top: -250px;
    right: -200px;
    animation: loginPulse1 8s ease-in-out infinite alternate;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.12) 0%, transparent 65%);
    bottom: -300px;
    left: -200px;
    animation: loginPulse2 10s ease-in-out infinite alternate;
}

@keyframes loginPulse1 {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.15); opacity: 1; }
}

@keyframes loginPulse2 {
    from { transform: scale(1.1); opacity: 0.7; }
    to { transform: scale(0.95); opacity: 1; }
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.05);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-card .login-logo .logo-img {
    max-width: 160px;
    filter: none;
    opacity: 1;
    margin-bottom: 1rem;
}

.login-card .login-logo h1 {
    font-size: 1.4rem;
    color: var(--gray-900);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-card .login-logo h1 span {
    color: var(--primary);
}

.login-card .login-logo p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.login-card .form-control {
    padding: 0.8rem 0.85rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--gray-200);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 106, 216, 0.1);
    background: #fafbff;
}

.login-card .btn-primary {
    padding: 0.85rem;
    font-size: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(10, 106, 216, 0.35);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    letter-spacing: 0.01em;
}

.login-card .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(10, 106, 216, 0.45);
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1e40af 100%);
}

/* ================================================
   UI POLISH: DASHBOARD KPI CARDS ENHANCED
   ================================================ */
.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:nth-child(1)::after { background: var(--primary); }
.kpi-card:nth-child(2)::after { background: var(--success); }
.kpi-card:nth-child(3)::after { background: var(--warning); }
.kpi-card:nth-child(4)::after { background: var(--orange); }

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* ================================================
   UI POLISH: CHART CARDS ENHANCED
   ================================================ */
.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    overflow: hidden;
}
.chart-card canvas {
    max-height: 300px !important;
    width: 100% !important;
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
}

.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ================================================
   UI POLISH: SIDE PANEL BODY PADDING & SECTIONS
   ================================================ */
.side-panel-body {
    padding: 1.5rem;
}

.side-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ================================================
   UI POLISH: CONVERSATIONS LIST ENHANCEMENTS
   ================================================ */
.conversation-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.conversation-item:hover {
    background: var(--gray-50);
}

.conversation-item.active {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

/* Chat panel footer polish */
.chat-panel-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
    background: var(--gray-50);
}

.chat-panel-footer input {
    flex: 1;
    border-radius: 20px;
    padding: 0.6rem 1rem;
}

/* ================================================
   UI POLISH: PAGE HEADER REFINEMENTS
   ================================================ */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.page-header h2 {
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.page-header p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ================================================
   UI POLISH: GLOBAL CARD HOVER CONSISTENCY
   ================================================ */
.card,
.metric-compare,
.suggestion-card {
    transition: all var(--transition);
}

.card:hover,
.metric-compare:hover {
    box-shadow: var(--shadow);
}

/* ================================================
   UI POLISH: LEAD MODAL SECTIONS SPACING
   ================================================ */
.lead-modal {
    padding: 1.5rem;
}

.lm-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.lm-card {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.lm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
}

.lm-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ============================================================
   Editorial typography (ADS4PROS Design System v2)
   ============================================================ */
.mono     { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -0.01em; }
.tabular  { font-variant-numeric: tabular-nums; }

.display          { font-weight: 400; letter-spacing: -0.03em;  line-height: 0.98; text-wrap: balance; }
.display-medium   { font-weight: 500; letter-spacing: -0.025em; line-height: 1.02; text-wrap: balance; }
.display-xl       { font-size: var(--font-display-xl); }
.display-lg       { font-size: var(--font-display-lg); }
.display-md       { font-size: var(--font-display-md); }
.display-sm       { font-size: var(--font-display-sm); }

.kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.kicker::before { content: ''; width: 28px; height: 1px; background: currentColor; opacity: 0.6; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 6px 10px;
  border: 1px solid rgba(37, 211, 102, 0.38);
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.05);
}

.label-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8695;
  display: block;
  margin-bottom: 6px;
}

.bg-gradient-brand          { background: linear-gradient(135deg, #01122c 0%, #0a3d7a 40%, #0a6ad8 100%); }
.bg-gradient-brand-radial   { background: radial-gradient(ellipse at 20% 80%, #0a6ad8 0%, #0a3d7a 40%, #01122c 100%); }
.bg-gradient-brand-subtle   { background: linear-gradient(160deg, #01122c 0%, #073060 50%, #0a3d7a 100%); }

.reveal    { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
