/*
 * timeline.css
 * Timeline keyframe animations and timeline UI components.
 * Contains: @keyframe definitions for all timeline animations,
 * timeline entry styles, connectors, icons, and interaction states.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   TIMELINE ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Keyframe definitions */
@keyframes tl-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tl-slide-in {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes tl-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes tl-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--pulse-color, var(--gray-200)); }
    50% { box-shadow: 0 0 0 5px var(--pulse-color, var(--gray-200)); }
}

@keyframes tl-dot-ping {
    0% { transform: scale(1); opacity: 1; }
    75%, 100% { transform: scale(1.8); opacity: 0; }
}

@keyframes tl-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 118, 117, 0); }
    50% { box-shadow: 0 0 12px 2px rgba(99, 118, 117, 0.15); }
}

@keyframes tl-attention-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

@keyframes tl-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Date Group Container */
.tl-date-group {
    position: relative;
    animation: tl-fade-in 0.3s ease-out backwards;
}

/* Stagger animation for date groups */
.tl-date-group:nth-child(1) { animation-delay: 0s; }
.tl-date-group:nth-child(2) { animation-delay: 0.05s; }
.tl-date-group:nth-child(3) { animation-delay: 0.1s; }
.tl-date-group:nth-child(4) { animation-delay: 0.15s; }
.tl-date-group:nth-child(5) { animation-delay: 0.2s; }

/* Add spacing between date groups for clearer separation */
.tl-date-group + .tl-date-group {
    margin-top: 6px;
}

/* Date Header - More prominent for quick time navigation */
.tl-date-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 10px 24px;
    position: sticky;
    top: 0;
    background: linear-gradient(to bottom, var(--gray-100) 0%, var(--gray-100) 90%, rgba(243,244,246,0) 100%);
    z-index: 10;
    margin-bottom: 4px;
}

/* Visual separator between date groups */
.tl-date-group + .tl-date-group .tl-date-header {
    border-top: 2px solid var(--gray-200);
    padding-top: 14px;
}

.tl-date-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* "Today" gets special emphasis */
.tl-date-header.tl-today .tl-date-text {
    color: var(--hawx-teal);
    font-size: 12px;
}

.tl-date-count {
    font-size: 10px;
    color: var(--gray-400);
    font-weight: 500;
    padding: 2px 8px;
    background: var(--gray-200);
    border-radius: 10px;
}

/* Timeline Item Base - With staggered animations */
.tl-item {
    display: flex;
    gap: 0;
    position: relative;
    margin-left: 0;
    transition: opacity 0.2s, transform 0.2s;
    animation: tl-slide-in 0.35s ease-out backwards;
}

/* Stagger items within each date group */
.tl-item:nth-child(2) { animation-delay: 0.05s; }
.tl-item:nth-child(3) { animation-delay: 0.1s; }
.tl-item:nth-child(4) { animation-delay: 0.15s; }
.tl-item:nth-child(5) { animation-delay: 0.2s; }
.tl-item:nth-child(6) { animation-delay: 0.25s; }

/* Edit Form Styles for Appointment Modal */
.pests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.pest-chip {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 11px;
    color: #4b5563;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.pest-chip:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}
.pest-chip.selected {
    background: #637675;
    color: #fff;
    border-color: #637675;
}
[data-theme="dark"] .pest-chip {
    background: #2d2d2d;
    border-color: #4a4a4a;
    color: #c0c0c0;
}
[data-theme="dark"] .pest-chip:hover {
    background: #3a3a3a;
    border-color: #666;
}
[data-theme="dark"] .pest-chip.selected {
    background: #637675;
    color: #fff;
    border-color: #637675;
}
.call-ahead-btns {
    display: flex;
    gap: 8px;
}
.ca-btn {
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.ca-btn.selected {
    background: #637675;
    color: #fff;
    border-color: #637675;
}
.adm-edit-form h4 {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 4px;
}
.mr-2 { margin-right: 8px; }

.tl-item:last-child .tl-spine::before {
    bottom: 50%;
}

/* Timeline Spine */
.tl-spine {
    width: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.tl-spine::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--gray-200);
    transform: translateX(-50%);
}

.tl-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-400);
    position: relative;
    z-index: 1;
    margin-top: 16px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--gray-200);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

/* Dot hover - bouncy scale */
.tl-item:hover .tl-dot {
    transform: scale(1.3);
}

/* Ping effect behind dots for recent/important items */
.tl-dot::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    z-index: -1;
}

/* Active ping animation for today's items */
.tl-today + .tl-item:first-of-type .tl-dot::before,
.tl-date-group:first-child .tl-item:first-child .tl-dot::before {
    animation: tl-dot-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    animation-delay: 1s;
}

/* Timeline Content - Enhanced with event-type backgrounds and animations */
.tl-content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 6px 0;
    margin-right: 8px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    border-left: 3px solid var(--gray-300);
}

.tl-content:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.tl-clickable {
    cursor: pointer;
}

.tl-clickable:hover .tl-content {
    border-color: var(--hawx-teal);
    background: var(--gray-50);
}

/* Subtle glow on focus for accessibility */
.tl-content:focus-within {
    box-shadow: 0 0 0 3px rgba(99, 118, 117, 0.15);
}

/* Event-type specific backgrounds for quick visual scanning */
.tl-sms .tl-content {
    background: linear-gradient(to right, rgba(219, 234, 254, 0.3) 0%, #fff 100%);
    border-left-color: var(--info);
}

.tl-sms-out .tl-content {
    background: linear-gradient(to right, rgba(232, 238, 238, 0.5) 0%, #fff 100%);
    border-left-color: var(--hawx-teal);
}

.tl-note .tl-content {
    background: #fff;
    border-left-color: var(--gray-400);
}

.tl-payment-success .tl-content,
.tl-payment:not(.tl-payment-failed) .tl-content {
    background: linear-gradient(to right, rgba(234, 183, 73, 0.15) 0%, #fff 100%);
    border-left-color: var(--hawx-gold);
}

.tl-payment-failed .tl-content {
    background: linear-gradient(to right, rgba(255, 235, 238, 0.5) 0%, #fff 100%);
    border-left-color: var(--error);
    border-left-width: 4px;
}

.tl-call .tl-content {
    background: linear-gradient(to right, rgba(237, 233, 254, 0.3) 0%, #fff 100%);
    border-left-color: var(--purple);
}

.tl-subscription .tl-content {
    background: linear-gradient(to right, rgba(232, 245, 233, 0.4) 0%, #fff 100%);
    border-left-color: var(--hawx-teal);
}

.tl-subscription .tl-dot {
    background: var(--hawx-teal);
    box-shadow: 0 0 0 2px var(--hawx-teal-light);
}

.tl-scheduled .tl-content {
    background: linear-gradient(to right, rgba(227, 242, 253, 0.3) 0%, #fff 100%);
    border-left-color: var(--info);
}

.tl-appt-completed .tl-content {
    border-left-color: var(--success);
}

.tl-appt-warranty .tl-content {
    background: linear-gradient(to right, rgba(237, 233, 254, 0.3) 0%, #fff 100%);
    border-left-color: var(--purple);
}

.tl-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.tl-time {
    font-size: 10px;
    color: var(--gray-400);
    margin-left: auto;
    font-family: var(--mono);
}

.tl-author {
    font-size: 10px;
    color: var(--gray-600);
    font-weight: 500;
}

.tl-author::before {
    content: 'by ';
    color: var(--gray-400);
    font-weight: 400;
}

.tl-sep {
    color: var(--gray-300);
    font-size: 10px;
}

/* Type Badges - Larger and more scannable with hover effects */
.tl-type-badge {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.tl-type-badge:hover {
    transform: translateY(-1px);
}

.tl-type-sms,
.tl-type-sms-in {
    background: var(--info-bg);
    color: var(--info-dark);
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.tl-type-sms-out {
    background: var(--hawx-teal-light);
    color: var(--hawx-teal-dark);
    border: 1px solid rgba(99, 118, 117, 0.2);
}

.tl-type-email {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.tl-type-note {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.tl-type-subscription {
    background: var(--hawx-teal-light);
    color: var(--hawx-teal-dark);
    border: 1px solid rgba(99, 118, 117, 0.2);
}

.tl-type-payment {
    background: rgba(234, 183, 73, 0.15);
    color: var(--hawx-gold-dark);
    border: 1px solid rgba(234, 183, 73, 0.4);
}

/* Ticket/Invoice badges */
.tl-type-ticket {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.tl-type-ticket-paid {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tl-type-ticket-unpaid {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tl-type-ticket-partial {
    background: rgba(251, 146, 60, 0.12);
    color: #c2410c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.tl-type-payment-failed {
    background: var(--error-bg);
    color: var(--error-dark);
    border: 1px solid rgba(233, 102, 102, 0.3);
    font-weight: 700;
    animation: tl-attention-pulse 2s ease-in-out infinite;
}

.tl-type-scheduled {
    background: var(--info-bg);
    color: var(--info-dark);
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.tl-type-flag {
    background: var(--warning-bg);
    color: var(--warning-dark);
    border: 1px solid rgba(255, 152, 0, 0.3);
    animation: tl-attention-pulse 2.5s ease-in-out infinite;
}

.tl-type-call-in {
    background: var(--purple-bg);
    color: var(--purple);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

/* Tags with hover animation */
.tl-tag {
    padding: 2px 6px;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: 9px;
    color: var(--gray-500);
    transition: background 0.15s, transform 0.15s;
}

.tl-tag:hover {
    background: var(--gray-200);
    transform: scale(1.05);
}

.tl-tag-ai {
    background: var(--purple-bg);
    color: var(--purple);
}

/* Item Footer - Enhanced subscription links */
.tl-item-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
    font-size: 11px;
    color: var(--gray-500);
}

/* Quick Actions in Timeline Footer */
.tl-quick-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.tl-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
}

.tl-quick-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.tl-edit-btn:hover {
    background: var(--hawx-teal-light);
    border-color: var(--hawx-teal);
    color: var(--hawx-teal);
}

.tl-resched-btn:hover {
    background: var(--info-bg);
    border-color: var(--info);
    color: var(--info);
}

/* Appointment Status Badge in Timeline Header */
.tl-appt-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tl-appt-status.status-completed {
    background: var(--success-bg);
    color: var(--success);
}

.tl-appt-status.status-cancelled {
    background: var(--error-bg);
    color: var(--error);
}

.tl-appt-status.status-scheduled {
    background: var(--info-bg);
    color: var(--info);
}

.tl-appt-status.status-rescheduled {
    background: var(--warning-bg);
    color: var(--warning);
}

.tl-appt-status.status-default {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ============================================
   Enhanced Timeline Header Colors
   ============================================ */

/* Colored header strips for quick visual scanning */
.tl-content.tl-header-pending {
    border-top: 3px solid var(--info);
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-completed {
    border-top: 3px solid var(--success);
    background: linear-gradient(180deg, rgba(87, 201, 90, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-cancelled {
    border-top: 3px solid var(--error);
    background: linear-gradient(180deg, rgba(233, 102, 102, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-rescheduled {
    border-top: 3px solid var(--warning);
    background: linear-gradient(180deg, rgba(255, 152, 0, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-appointment {
    border-top: 3px solid var(--info);
}

.tl-content.tl-header-subscription {
    border-top: 3px solid var(--hawx-teal);
    background: linear-gradient(180deg, rgba(99, 118, 117, 0.06) 0%, #fff 40px);
}

.tl-content.tl-header-payment {
    border-top: 3px solid var(--hawx-gold);
    background: linear-gradient(180deg, rgba(234, 183, 73, 0.1) 0%, #fff 40px);
}

/* Ticket/Invoice header colors */
.tl-content.tl-header-ticket {
    border-top: 3px solid #6366f1;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-ticket-paid {
    border-top: 3px solid #22c55e;
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-ticket-unpaid {
    border-top: 3px solid #ef4444;
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-ticket-partial {
    border-top: 3px solid #fb923c;
    background: linear-gradient(180deg, rgba(251, 146, 60, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-note {
    border-top: 3px solid var(--gray-400);
}

.tl-content.tl-header-alert {
    border-top: 3px solid var(--error);
    background: linear-gradient(180deg, rgba(233, 102, 102, 0.06) 0%, #fff 40px);
}

.tl-content.tl-header-default {
    border-top: 3px solid var(--gray-300);
}

/* Flag header colors */
.tl-content.tl-header-flag {
    border-top: 3px solid var(--warning);
    background: linear-gradient(180deg, rgba(255, 152, 0, 0.08) 0%, #fff 40px);
}

.tl-content.tl-header-flag-removed {
    border-top: 3px solid var(--success);
    background: linear-gradient(180deg, rgba(87, 201, 90, 0.06) 0%, #fff 40px);
}

/* Call header colors */
.tl-content.tl-header-call-in {
    border-top: 3px solid var(--hawx-teal);
    background: linear-gradient(180deg, rgba(35, 179, 172, 0.06) 0%, #fff 40px);
}

.tl-content.tl-header-call-out {
    border-top: 3px solid var(--hawx-gold);
    background: linear-gradient(180deg, rgba(245, 198, 98, 0.08) 0%, #fff 40px);
}

/* SMS header colors */
.tl-content.tl-header-sms {
    border-top: 3px solid var(--info);
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.06) 0%, #fff 40px);
}

/* Email header colors */
.tl-content.tl-header-email {
    border-top: 3px solid #f59e0b;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, #fff 40px);
}

/* AI header colors */
.tl-content.tl-header-ai {
    border-top: 3px solid #8b5cf6;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, #fff 40px);
}

/* AI type badge */
.tl-type-ai {
    background: #f3e8ff;
    color: #7c3aed;
}

/* Reasoning header + badge */
.tl-reasoning .tl-dot { background: #6d28d9; }

.tl-content.tl-header-reasoning {
    border-top: 3px solid #6d28d9;
    background: linear-gradient(180deg, rgba(109, 40, 217, 0.07) 0%, #fff 40px);
}

.tl-type-reasoning {
    background: #ede9fe;
    color: #5b21b6;
}

/* Reasoning steps */
.tl-reasoning-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.tl-reasoning-step {
    display: flex;
    gap: 8px;
    font-size: 11px;
    line-height: 1.5;
    background: #fafaf9;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 7px 10px;
}

.tl-reasoning-step-num {
    flex-shrink: 0;
    font-weight: 700;
    color: #6d28d9;
    min-width: 16px;
}

.tl-reasoning-step-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

/* Pill loading state */
.pill-loading {
    opacity: 0.6;
    cursor: wait;
}

/* Dark mode */
[data-theme="dark"] .tl-content.tl-header-reasoning {
    background: linear-gradient(180deg, rgba(109, 40, 217, 0.15) 0%, var(--card-bg) 40px);
}

[data-theme="dark"] .tl-reasoning-step {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--gray-700, #374151);
}

[data-theme="dark"] .tl-reasoning-step-num {
    color: #a78bfa;
}

/* Call type badges */
.tl-type-call-in {
    background: var(--hawx-teal-light);
    color: var(--hawx-teal);
}

.tl-type-call-out {
    background: var(--hawx-gold-light);
    color: #92400e;
}

/* ============================================
   Call Timeline Item Styles
   ============================================ */

.tl-call {
    /* Base call item styling */
}

.tl-call .tl-dot {
    background: var(--hawx-teal);
}

.tl-call.tl-call-outbound .tl-dot {
    background: var(--hawx-gold);
}

/* Call info section */
.tl-call-info {
    margin-top: 8px;
}

.tl-call-disposition {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tl-call-disp-success {
    background: var(--success-bg);
    color: var(--success);
}

.tl-call-disp-voicemail {
    background: var(--info-bg);
    color: var(--info);
}

.tl-call-disp-missed {
    background: var(--warning-bg);
    color: #92400e;
}

.tl-call-disp-callback {
    background: #f3e8ff;
    color: #7c3aed;
}

.tl-call-disp-default {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Call metrics */
.tl-call-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--gray-700);
    padding: 6px 0;
}

.tl-call-metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tl-call-metric-label {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 10px;
    text-transform: uppercase;
}

/* Call details row */
.tl-call-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--gray-100);
    font-size: 11px;
    color: var(--gray-600);
}

.tl-call-detail {
    background: var(--gray-50);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Call AI Summary */
.tl-call-summary {
    margin-top: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.tl-call-summary-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.tl-call-summary-icon {
    font-size: 12px;
}

.tl-call-summary-label {
    font-size: 10px;
    font-weight: 600;
    color: #0369a1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-call-summary-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--gray-700);
}

/* ============================================
   AI Timeline Item Styles
   ============================================ */

.tl-ai .tl-dot {
    background: #8b5cf6;
}

/* AI info section */
.tl-ai-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tl-ai-source {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tl-ai-source-auto {
    background: #f3e8ff;
    color: #7c3aed;
}

.tl-ai-source-sms {
    background: var(--info-bg);
    color: var(--info);
}

.tl-ai-source-chat {
    background: #e0f2fe;
    color: #0369a1;
}

/* AI Tools */
.tl-ai-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tl-ai-tool {
    font-size: 9px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-family: 'Monaco', 'Consolas', monospace;
}

.tl-ai-tool-more {
    font-size: 9px;
    color: var(--gray-400);
    padding: 2px 6px;
}

/* AI Conversation */
.tl-ai-conversation {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tl-ai-message {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.tl-ai-user-msg {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.tl-ai-assistant-msg {
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
}

.tl-ai-msg-label {
    font-weight: 600;
    font-size: 11px;
    display: block;
    margin-bottom: 4px;
    color: var(--gray-500);
}

.tl-ai-user-msg .tl-ai-msg-label {
    color: var(--gray-600);
}

.tl-ai-assistant-msg .tl-ai-msg-label {
    color: #7c3aed;
}

.tl-ai-msg-text {
    color: var(--gray-700);
    word-break: break-word;
}

/* AI Tool Calls - Detailed View */
.tl-ai-tool-calls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
}

.tl-ai-tool-call {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12px;
}

.tl-ai-tool-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(253, 224, 71, 0.5);
}

.tl-ai-tool-icon {
    font-size: 14px;
}

.tl-ai-tool-name {
    font-weight: 700;
    font-size: 12px;
    color: #854d0e;
    letter-spacing: -0.2px;
}

.tl-ai-args {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: 'Monaco', 'Consolas', 'SF Mono', monospace;
    font-size: 11px;
}

.tl-ai-arg {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    line-height: 1.4;
}

.tl-ai-arg-key {
    font-weight: 600;
    color: #92400e;
    white-space: nowrap;
}

.tl-ai-arg-val {
    color: #1e3a5f;
    word-break: break-word;
}

.tl-ai-result {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.tl-ai-result-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.tl-ai-result-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.tl-ai-result-neutral {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* AI Reasoning - Expandable Section */
.tl-ai-reasoning-section {
    margin-top: 6px;
}

.tl-ai-reasoning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #6d28d9;
    background: none;
    border: 1px solid #ddd6fe;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tl-ai-reasoning-toggle:hover {
    background: #ede9fe;
}

.tl-ai-reasoning-content {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tl-ai-reasoning-step {
    display: flex;
    gap: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-primary);
    background: #fafaf9;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 7px 10px;
}

.tl-ai-reasoning-step-num {
    flex-shrink: 0;
    font-weight: 700;
    color: #7c3aed;
    min-width: 16px;
}

.tl-ai-reasoning-step-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.tl-ai-reasoning-empty,
.tl-ai-reasoning-error {
    font-size: 11px;
    color: var(--gray-400);
    font-style: italic;
    padding: 4px 0;
}

.tl-ai-reasoning-error {
    color: var(--danger, #dc2626);
}

[data-theme="dark"] .tl-ai-reasoning-toggle {
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .tl-ai-reasoning-toggle:hover {
    background: rgba(109, 40, 217, 0.2);
}

[data-theme="dark"] .tl-ai-reasoning-step {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--gray-700, #374151);
}

[data-theme="dark"] .tl-ai-reasoning-step-num {
    color: #a78bfa;
}

/* AI Tool Calls - Dark Mode */
[data-theme="dark"] .tl-ai-tool-call {
    background: linear-gradient(135deg, rgba(161, 98, 7, 0.25) 0%, rgba(120, 80, 20, 0.15) 100%);
    border-color: rgba(250, 204, 21, 0.35);
}

[data-theme="dark"] .tl-ai-tool-header {
    border-bottom-color: rgba(250, 204, 21, 0.25);
}

[data-theme="dark"] .tl-ai-tool-name {
    color: #fde047;
}

[data-theme="dark"] .tl-ai-args {
    color: var(--text-secondary);
}

[data-theme="dark"] .tl-ai-arg {
    background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .tl-ai-arg-key {
    color: #fcd34d;
}

[data-theme="dark"] .tl-ai-arg-val {
    color: #e0f2fe;
}

[data-theme="dark"] .tl-ai-result-success {
    background: rgba(22, 163, 74, 0.2);
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.3);
}

[data-theme="dark"] .tl-ai-result-error {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.3);
}

[data-theme="dark"] .tl-ai-result-neutral {
    background: rgba(71, 85, 105, 0.2);
    color: #cbd5e1;
    border-color: rgba(203, 213, 225, 0.3);
}

[data-theme="dark"] .tl-ai-user-msg {
    background: var(--gray-200);
    border-color: var(--border-color);
}

[data-theme="dark"] .tl-ai-assistant-msg {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(109, 40, 217, 0.1) 100%);
    border-color: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .tl-ai-msg-text {
    color: var(--text-primary);
}

/* ============================================
   SMS Timeline Styles (Twilio Direct)
   ============================================ */

/* SMS Info row */
.tl-sms-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tl-sms-direction {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tl-sms-inbound {
    background: #dbeafe;
    color: #1d4ed8;
}

.tl-sms-outbound {
    background: #f3e8ff;
    color: #7c3aed;
}

.tl-sms-status {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-600);
    text-transform: capitalize;
}

/* Phone info row */
.tl-sms-phones {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tl-sms-phone-label {
    font-weight: 600;
    color: var(--gray-600);
}

/* Message body */
.tl-sms-message {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.tl-sms-message.tl-sms-inbound {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px 12px 12px 2px;
}

.tl-sms-message.tl-sms-outbound {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #c4b5fd;
    border-radius: 12px 12px 2px 12px;
}

.tl-sms-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.tl-sms-body {
    flex: 1;
    color: var(--gray-800);
}

/* MMS Media Gallery */
.tl-sms-media-gallery {
    margin-top: 12px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 10px;
    border: 1px dashed var(--gray-300);
}

.tl-sms-media-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.tl-sms-media-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tl-sms-media-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tl-sms-media-link:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tl-sms-media-img {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 6px;
    background: var(--gray-200);
}

/* Error display */
.tl-sms-error {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* SMS Dark Mode */
[data-theme="dark"] .tl-sms-inbound {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .tl-sms-outbound {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

[data-theme="dark"] .tl-sms-direction.tl-sms-inbound {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .tl-sms-direction.tl-sms-outbound {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

[data-theme="dark"] .tl-sms-status {
    background: var(--gray-200);
    color: var(--text-secondary);
}

[data-theme="dark"] .tl-sms-phones {
    color: var(--text-muted);
}

[data-theme="dark"] .tl-sms-phone-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .tl-sms-message.tl-sms-inbound {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-color: rgba(147, 197, 253, 0.35);
}

[data-theme="dark"] .tl-sms-message.tl-sms-outbound {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(124, 58, 237, 0.1) 100%);
    border-color: rgba(196, 181, 253, 0.35);
}

[data-theme="dark"] .tl-sms-body {
    color: var(--text-primary);
}

[data-theme="dark"] .tl-sms-media-gallery {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

[data-theme="dark"] .tl-sms-media-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .tl-sms-media-img {
    background: var(--gray-300);
}

[data-theme="dark"] .tl-sms-error {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.3);
}

/* ============================================
   Note Category & Type Tags
   ============================================ */

.tl-note-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.tl-note-category {
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.tl-note-category.tl-note-cat-alert {
    background: var(--error-bg);
    color: var(--error);
    border-color: rgba(233, 102, 102, 0.3);
}

.tl-note-category.tl-note-cat-billing {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(87, 201, 90, 0.3);
}

.tl-note-category.tl-note-cat-service {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(33, 150, 243, 0.3);
}

.tl-note-category.tl-note-cat-sales {
    background: var(--purple-bg);
    color: var(--purple);
    border-color: rgba(124, 58, 237, 0.3);
}

.tl-note-type {
    font-size: 9px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--gray-50);
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
}

/* ============================================
   Enhanced Author Badge
   ============================================ */

.tl-author-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tl-author-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--hawx-teal);
    color: white;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.tl-author-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
}

/* ============================================
   Timeline Title & Description Classes
   ============================================ */

.tl-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-800);
    margin-bottom: 4px;
    line-height: 1.3;
}

.tl-description {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.5;
}

/* ============================================
   Note Visibility Indicators
   ============================================ */

.tl-note-visibility {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.tl-vis-icon {
    font-size: 11px;
    opacity: 0.7;
    cursor: help;
}

.tl-vis-icon:hover {
    opacity: 1;
}

.tl-vis-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-vis-tech {
    background: var(--hawx-orange, #F97316);
    color: white;
}

.tl-vis-customer {
    background: var(--hawx-teal, #14B8A6);
    color: white;
}

.tl-sub-link {
    color: var(--hawx-teal);
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.tl-sub-link:hover {
    text-decoration: none;
    background: var(--hawx-teal-light);
}

/* SMS Styling - Enhanced chat bubbles with animations */
.tl-sms .tl-dot { background: var(--info); box-shadow: 0 0 0 2px var(--info-bg); }
.tl-sms-out .tl-dot { background: var(--hawx-teal); box-shadow: 0 0 0 2px var(--hawx-teal-light); }

.tl-sms-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 12px;
    line-height: 1.5;
    max-width: 85%;
    position: relative;
    animation: tl-scale-in 0.3s ease-out backwards;
    animation-delay: 0.1s;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-sms-bubble:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tl-bubble-in {
    background: var(--info-bg);
    color: var(--gray-700);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(33, 150, 243, 0.15);
}

.tl-bubble-out {
    background: var(--hawx-teal-light);
    color: var(--gray-700);
    border-bottom-right-radius: 4px;
    margin-left: auto;
    border: 1px solid rgba(99, 118, 117, 0.15);
}

/* Note Styling - Enhanced for action items */
.tl-note .tl-dot { background: var(--gray-500); box-shadow: 0 0 0 2px var(--gray-200); }

.tl-note-content {
    font-size: 12px;
    line-height: 1.6;
    color: var(--gray-700);
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    border-left: 3px solid var(--gray-300);
}

/* Notes with action items get special treatment */
.tl-note-content:has(.tl-highlight-action) {
    border-left-color: var(--info);
    background: linear-gradient(to right, rgba(227, 242, 253, 0.3) 0%, var(--gray-50) 100%);
}

/* Highlighting in notes - More prominent with hover effects */
.tl-highlight-pest {
    background: var(--warning-bg);
    color: var(--warning-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid rgba(255, 152, 0, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
}

.tl-highlight-pest:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.2);
}

.tl-highlight-action {
    background: var(--info-bg);
    color: var(--info-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid rgba(33, 150, 243, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
}

.tl-highlight-action:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.2);
}

/* Additional highlight types for common action items */
.tl-highlight-urgent {
    background: var(--error-bg);
    color: var(--error-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid rgba(233, 102, 102, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
    animation: tl-attention-pulse 2s ease-in-out infinite;
}

.tl-highlight-urgent:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(233, 102, 102, 0.2);
    animation-play-state: paused;
}

.tl-highlight-positive {
    background: var(--success-bg);
    color: var(--success-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
}

.tl-highlight-positive:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(87, 201, 90, 0.2);
}

/* Copy Button - Enhanced animation */
.tl-copy-btn {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}

.tl-content:hover .tl-copy-btn {
    opacity: 1;
    transform: scale(1);
}

.tl-copy-btn:hover {
    background: var(--gray-200) !important;
    transform: scale(1.1) !important;
}

.tl-copy-btn:active {
    transform: scale(0.95) !important;
}

/* Appointment Styling - Enhanced visibility with animations */
.tl-appt .tl-dot { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }

.tl-appt-main {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: -10px -12px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
}

.tl-appt-main:hover {
    background: var(--gray-50);
}

.tl-appt-main:active {
    transform: scale(0.99);
}

.tl-appt-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--success-bg);
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(87, 201, 90, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-appt-main:hover .tl-appt-date-block {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(87, 201, 90, 0.2);
}

.tl-appt-warranty-block {
    background: var(--purple-bg);
    border-color: rgba(124, 58, 237, 0.3);
}

.tl-appt-main:hover .tl-appt-warranty-block {
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

.tl-appt-month {
    font-size: 9px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-appt-day {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.tl-appt-info {
    flex: 1;
    min-width: 0;
}

.tl-appt-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.tl-warranty-badge {
    padding: 3px 8px;
    background: var(--purple-bg);
    color: var(--purple);
    font-size: 9px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.tl-appt-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 3px;
}

.tl-appt-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.tl-appt-toggle {
    padding: 4px 8px;
    border: none;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 10px;
    color: var(--gray-500);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}

.tl-appt-toggle:hover {
    background: var(--gray-200);
}

.tl-appt-completed[data-expanded="true"] .tl-appt-toggle {
    transform: rotate(180deg);
}

/* Appointment Details - Animated expand/collapse */
.tl-appt-details {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    padding: 0 12px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-top: 0;
    transition: grid-template-rows 0.3s ease-out, opacity 0.25s ease-out, padding 0.3s, margin-top 0.3s;
    overflow: hidden;
}

.tl-appt-details > * {
    overflow: hidden;
}

.tl-appt-completed[data-expanded="true"] .tl-appt-details {
    grid-template-rows: 1fr;
    opacity: 1;
    padding: 12px;
    margin-top: 10px;
}

/* Stagger children animation when expanded */
.tl-appt-completed[data-expanded="true"] .tl-appt-detail-grid {
    animation: tl-fade-in 0.3s ease-out 0.1s backwards;
}

.tl-appt-completed[data-expanded="true"] .tl-appt-notes-section {
    animation: tl-fade-in 0.3s ease-out 0.15s backwards;
}

.tl-appt-completed[data-expanded="true"] .tl-appt-pests {
    animation: tl-fade-in 0.3s ease-out 0.2s backwards;
}

.tl-appt-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.tl-detail-item label {
    display: block;
    font-size: 9px;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.tl-detail-item span {
    font-size: 11px;
    color: var(--gray-700);
    font-weight: 500;
}

.tl-appt-notes-section {
    margin-bottom: 12px;
}

.tl-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.tl-notes-header label {
    font-size: 9px;
    color: var(--gray-400);
    text-transform: uppercase;
    font-weight: 600;
}

.tl-appt-notes {
    font-size: 12px;
    color: var(--gray-700);
    line-height: 1.6;
    padding: 10px 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.tl-appt-pests {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tl-appt-pests label {
    font-size: 9px;
    color: var(--gray-400);
    text-transform: uppercase;
}

.tl-pest-tag {
    padding: 2px 8px;
    background: var(--warning-bg);
    color: var(--warning-dark);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

/* Payment Styling - Enhanced for quick scanning with animations */
.tl-payment .tl-dot { background: var(--hawx-gold); box-shadow: 0 0 0 2px var(--warning-bg); }
.tl-payment-failed .tl-dot { 
    background: var(--error); 
    box-shadow: 0 0 0 3px var(--error-bg);
    animation: tl-dot-pulse 2s ease-in-out infinite;
    --pulse-color: var(--error-bg);
}

.tl-payment-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.tl-payment-amount {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--mono);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--success-bg);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-payment-amount:hover {
    transform: scale(1.05);
}

.tl-payment-amount.success { 
    color: var(--success-dark); 
    background: var(--success-bg);
}

.tl-payment-amount.success:hover {
    box-shadow: 0 2px 8px rgba(87, 201, 90, 0.3);
}

.tl-payment-amount.failed { 
    color: var(--error-dark); 
    text-decoration: line-through; 
    background: var(--error-bg);
}

.tl-payment-amount.failed:hover {
    box-shadow: 0 2px 8px rgba(233, 102, 102, 0.3);
}

.tl-payment-method {
    font-size: 11px;
    color: var(--gray-600);
    font-weight: 500;
}

.tl-payment-ref {
    font-size: 10px;
    color: var(--gray-400);
    font-family: var(--mono);
    transition: color 0.15s;
}

.tl-payment-ref:hover {
    color: var(--gray-600);
}

.tl-payment-reason {
    padding: 4px 10px;
    background: var(--error-bg);
    color: var(--error);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid var(--error);
    animation: tl-attention-pulse 2s ease-in-out infinite;
}

/* Scheduled Appointment - Make future dates prominent with animation */

#open-scheduler {
    display: none;
}

.tl-scheduled .tl-dot { background: var(--info); box-shadow: 0 0 0 2px var(--info-bg); }

.tl-scheduled-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 0;
}

.tl-scheduled-service {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
}

.tl-scheduled-arrow {
    color: var(--gray-400);
    font-size: 14px;
    transition: transform 0.3s;
}

.tl-scheduled-row:hover .tl-scheduled-arrow {
    transform: translateX(3px);
}

.tl-scheduled-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--info-dark);
    padding: 4px 12px;
    background: var(--info-bg);
    border-radius: 6px;
    border: 1px solid rgba(33, 150, 243, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-scheduled-date:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.tl-scheduled-time {
    font-size: 11px;
    color: var(--gray-500);
    font-family: var(--mono);
}

/* Call Styling - Enhanced for quick info scanning */
.tl-call .tl-dot { background: var(--purple); box-shadow: 0 0 0 2px var(--purple-bg); }

.tl-call-duration {
    font-size: 11px;
    font-family: var(--mono);
    color: var(--gray-600);
    padding: 3px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-weight: 500;
}

.tl-call-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.tl-call-agent {
    font-size: 11px;
    color: var(--gray-600);
    font-weight: 500;
}

.tl-call-reason {
    padding: 3px 10px;
    background: var(--purple-bg);
    color: var(--purple);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.tl-call-summary {
    font-size: 12px;
    color: var(--gray-700);
    line-height: 1.6;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    border-left: 3px solid var(--purple);
}

/* Flag Styling */
.tl-flag .tl-dot { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-bg); }

.tl-flag-content {
    margin-top: 4px;
}

.tl-flag-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Load More - Animated */
.tl-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 20px;
    margin-left: 24px;
    margin-top: 8px;
    border-top: 1px dashed var(--gray-200);
    animation: tl-fade-in 0.4s ease-out 0.3s backwards;
}

.tl-load-more .btn-ghost {
    padding: 8px 20px;
    font-size: 12px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.15s;
}

.tl-load-more .btn-ghost:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tl-load-more .btn-ghost:active {
    transform: translateY(0);
}

.tl-load-hint {
    font-size: 10px;
    color: var(--gray-400);
}

/* Empty State - Animated */
.tl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-400);
    margin-left: 24px;
    animation: tl-fade-in 0.5s ease-out;
}

.tl-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
    animation: tl-scale-in 0.4s ease-out 0.1s backwards;
}

.tl-empty-text {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.tl-empty-hint {
    font-size: 11px;
    color: var(--gray-400);
}

/* ─────────────────────────────────────────────────────────────────────────────
   OFFERS TAB
   ───────────────────────────────────────────────────────────────────────────── */
.offers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Offers list scrollbar */
.offers-list::-webkit-scrollbar {
    width: 6px;
}

.offer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}

.offer-unavailable {
    opacity: 0.6;
}

.offer-info {
    flex: 1;
}

.offer-name {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-700);
}

.offer-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
    margin-top: 2px;
}

.badge-available {
    background: var(--success-bg);
    color: var(--success);
}

.badge-unavailable {
    background: var(--gray-100);
    color: var(--gray-500);
}

.offer-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--hawx-teal);
}

.offer-unavailable .offer-price {
    color: var(--gray-400);
}

.offers-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9px;
    color: var(--gray-400);
    text-transform: uppercase;
    margin: 8px 0;
}

.offers-divider::before,
.offers-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* Subscription Offer Detail Modal */
.offer-detail-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-600);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--primary-50);
    border-radius: 6px;
}

.offer-detail-description {
    font-size: 13px;
    line-height: 1.6;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.offer-detail-description ul {
    margin: 0;
    padding-left: 20px;
}

.offer-detail-description li {
    margin-bottom: 6px;
}

.offer-detail-note {
    font-size: 12px;
    color: var(--gray-500);
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    border-left: 3px solid var(--warning-400);
}

.offer-detail-note p {
    margin: 0;
}

[data-theme="dark"] .offer-detail-price {
    background: var(--primary-900);
    color: var(--primary-300);
}

[data-theme="dark"] .offer-detail-description {
    color: var(--gray-300);
}

[data-theme="dark"] .offer-detail-description ul {
    color: var(--gray-300);
}

[data-theme="dark"] .offer-detail-description li {
    color: var(--gray-600);
}

[data-theme="dark"] .offer-detail-note {
    background: var(--gray-800);
    color: var(--gray-400);
    border-left-color: var(--warning-500);
}

[data-theme="dark"] .offer-detail-note p {
    color: var(--gray-400);
}

[data-theme="dark"] .offer-detail-note strong {
    color: var(--gray-300);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TEMPLATES TAB
   ───────────────────────────────────────────────────────────────────────────── */
.templates-bar {
    padding: 8px 10px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.template-category {
    margin-bottom: 16px;
}

.category-head {
    margin: 0 0 8px 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-200);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}

.template-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.template-item:hover {
    border-color: var(--hawx-teal);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.tpl-icon {
    font-size: 18px;
}

.tpl-name {
    font-size: 10px;
    font-weight: 500;
    color: var(--gray-600);
    text-align: center;
    line-height: 1.2;
}

/* ─── Templates tab two-section layout ─────────────────────── */

.tpl-section {
    margin-bottom: 20px;
}

.tpl-section-head {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 10px;
}

/* ─── Chat Templates tab overrides ──────────────────────────── */

#chat-templates-scroll .template-grid {
    grid-template-columns: 1fr 1fr;
}

#chat-templates-scroll .template-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    gap: 6px;
}

#chat-templates-scroll .tpl-name {
    font-size: 11px;
    text-align: left;
    flex: 1;
}

.tpl-badges {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.tpl-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
}

.tpl-badge-note {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.tpl-badge-vars {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Chat template modal */

.tpl-notes-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #5d4037;
    line-height: 1.5;
}

.tpl-notes-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.tpl-var-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 12px 0 14px;
}

#chat-tpl-vars .form-group-sm {
    margin-bottom: 10px;
}

#chat-tpl-vars .form-group-sm label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 4px;
    display: block;
}

#chat-tpl-vars .tpl-var-input,
#chat-tpl-vars .tpl-appt-select {
    width: 100%;
    font-size: 12px;
}

/* ─────────────────────────────────────────────────────────────────────────────
RETENTION TAB — Brief-style layout
───────────────────────────────────────────────────────────────────────────── */

/* ─── Two-column retention layout ──────────────────────────── */

#tab-retention .tab-scroll-area {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 16px;
    align-items: start;
}

#tab-retention .ret-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 800px) {
    #tab-retention .tab-scroll-area {
        grid-template-columns: 1fr;
    }
}

/* Base card */
.ret-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 0;
}

.ret-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ret-card-head h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}

.ret-card-icon {
    font-size: 16px;
    line-height: 1;
}

/* Identity card */
.ret-card-identity {
    border-left: 3px solid var(--hawx-teal);
}

.ret-identity-primary {
    margin-bottom: 8px;
}

.ret-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.ret-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    border-top: 1px solid var(--gray-100);
}

.ret-contact-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-400);
    min-width: 70px;
}

.ret-contact-name {
    font-weight: 500;
    color: var(--gray-700);
}

.ret-contact-detail {
    color: var(--gray-500);
    font-size: 12px;
}

.ret-no-contacts {
    color: var(--gray-400);
    font-size: 13px;
    font-style: italic;
}

/* Metrics grid */
.ret-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

.ret-card-metric {
    margin-bottom: 0;
}

.ret-metric-body {
    min-height: 48px;
}

.ret-metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.1;
}

.ret-metric-value.ret-value-warn {
    color: var(--warning);
}

.ret-metric-value.ret-value-positive {
    color: var(--success-dark);
}

.ret-metric-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.ret-metric-sublabel {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.ret-metric-loading {
    color: var(--gray-400);
    font-size: 12px;
    font-style: italic;
}

.ret-sub-contract {
    padding: 4px 0;
}

.ret-sub-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.ret-sub-divider {
    border: none;
    border-top: 1px solid var(--gray-100);
    margin: 8px 0;
}

.ret-ae-badge {
    display: inline-block;
    background: var(--warning-bg);
    color: var(--warning-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ret-etf-row {
    margin-top: 6px;
}

.ret-etf-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ret-etf-no-etf {
    background: var(--success-bg);
    color: var(--success-dark);
}

.ret-etf-applies {
    background: var(--error-bg);
    color: var(--error-dark);
}

/* Coupons */
.ret-coupon-breakdown {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-600);
    background: var(--highlight-amount);
    border: 1px solid var(--highlight-amount-border);
    border-radius: 6px;
    padding: 6px 8px;
}

.ret-coupon-arrow {
    color: var(--gray-400);
}

.ret-coupon-net {
    color: var(--highlight-amount-text);
}

/* Red notes */
.ret-card-red-notes {
    border-left: 3px solid var(--error);
}

.ret-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.ret-badge-red {
    background: var(--error-bg);
    color: var(--error-dark);
}

.ret-notes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ret-note-row {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--gray-50);
    border-left: 3px solid var(--gray-300);
}

.ret-note-row.ret-note-red {
    background: var(--error-bg);
    border-left-color: var(--error);
}

.ret-note-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
}

.ret-note-date {
    color: var(--gray-500);
    font-weight: 600;
}

.ret-note-employee {
    color: var(--gray-400);
}

.ret-note-text {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
}

/* AI Brief */
.ret-card-ai {
    border-left: 3px solid var(--purple);
}

.ret-refresh-btn {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--gray-500);
    transition: background 0.15s;
}

.ret-refresh-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.ret-refresh-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ret-ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: var(--gray-500);
    font-size: 13px;
}

.ret-ai-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.ret-ai-complaint {
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--purple-bg);
    border-radius: 8px;
}

.ret-ai-complaint-text {
    font-size: 14px;
    color: var(--gray-800);
    font-style: italic;
    line-height: 1.5;
}

.ret-category-group {
    margin-bottom: 4px;
}

.ret-talking-point {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 6px 0;
    border-top: 1px solid var(--gray-100);
}

.ret-talking-point:first-child {
    border-top: none;
}

.ret-point-icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1.4;
}

.ret-point-content {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.ret-point-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--hawx-teal-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.ret-point-text {
    font-size: 13px;
    color: var(--gray-800);
    line-height: 1.4;
}

/* Shared utilities */
.ret-empty-state {
    color: var(--gray-400);
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
}

.ret-fetch-error {
    color: var(--error);
    font-size: 13px;
    padding: 8px 0;
}

/* Dark mode */
[data-theme="dark"] .ret-card {
    background: var(--card-bg);
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .ret-note-row {
    background: rgba(255,255,255,0.04);
}

[data-theme="dark"] .ret-note-row.ret-note-red {
    background: rgba(233, 102, 102, 0.12);
}

[data-theme="dark"] .ret-ai-complaint {
    background: rgba(124, 58, 237, 0.12);
}

[data-theme="dark"] .ret-coupon-breakdown {
    background: rgba(234, 183, 73, 0.1);
    border-color: rgba(234, 183, 73, 0.2);
}

/* Collapses the inner Coupons/Saves grid (outer 2-col grid collapses at 800px above) */
@media (max-width: 480px) {
    .ret-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Per-subscription stat cards ───────────────────────────── */

.ret-card-sub {
    border-left: 3px solid var(--gray-200);
    padding: 12px;
    margin-bottom: 0;
}

.ret-sub-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}

.ret-sub-tag-active {
    background: var(--success-bg);
    color: var(--success-dark);
}

/* Two equal columns inside each subscription card */
.ret-sub-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ret-sub-metric-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 6px;
}

.ret-sub-metric-right {
    border-left: 1px solid var(--gray-100);
    padding-left: 16px;
}

/* ─── Retention live feed card ───────────────────────────────── */

.ret-card-live {
    border-left: 3px solid var(--success-dark);
}

@keyframes ret-slide-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ret-live-point {
    animation: ret-slide-in 0.3s ease forwards;
    border-left-color: var(--success-dark);
    transition: opacity 0.25s ease;
}

/* Point the agent has marked as handled — stays visible for reference */
.ret-live-point-done {
    opacity: 0.5;
    border-left-color: var(--success-dark);
    background: rgba(76, 175, 80, 0.08);
}

.ret-live-point-done .ret-point-text {
    text-decoration: line-through;
    text-decoration-color: var(--gray-400);
}

.ret-live-point-done .ret-live-badge {
    display: none;
}

.ret-live-point-done .ret-done-btn,
.ret-live-point-done .ret-decline-btn,
.ret-live-point-declined .ret-done-btn,
.ret-live-point-declined .ret-decline-btn {
    display: none;
}

/* "✓" mark-done button on each live point */
.ret-done-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    cursor: pointer;
    color: var(--gray-400);
    margin-left: auto;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.ret-done-btn:hover {
    background: var(--success-bg);
    color: var(--success-dark);
    border-color: var(--success-dark);
}

.ret-done-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* "✕" decline button on each live point */
.ret-decline-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    cursor: pointer;
    color: var(--gray-500);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.ret-decline-btn:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #ef4444;
}

.ret-decline-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Point the agent has declined — dulled and sent to bottom */
.ret-live-point-declined {
    opacity: 0.3;
    border-left-color: var(--gray-300);
}

.ret-live-point-declined .ret-live-badge {
    display: none;
}

.ret-live-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    margin-left: auto;
    letter-spacing: 0.02em;
}

/* Slots full — turns amber so agent knows to clear one */
.ret-live-count-full {
    color: var(--warning);
}

.ret-live-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--success-dark);
    margin-left: 6px;
    vertical-align: middle;
}

@keyframes ret-listening-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.ret-live-indicator {
    font-size: 11px;
    font-weight: 600;
    color: var(--success-dark);
    margin-left: 8px;
    animation: ret-listening-pulse 2s ease-in-out infinite;
}

[data-theme="dark"] .ret-live-point {
    background: rgba(76, 175, 80, 0.06);
}

[data-theme="dark"] .ret-live-point-done {
    background: rgba(76, 175, 80, 0.1);
}

/* Explore button on each AI brief talking point */
.ret-explore-btn {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--hawx-teal-dark, var(--hawx-teal));
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ret-explore-btn:hover {
    background: var(--gray-100);
    border-color: var(--hawx-teal);
}

.ret-explore-btn-active {
    background: var(--gray-100);
    border-color: var(--hawx-teal);
}

/* Expanded explore detail panel */
.ret-explore-panel {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-left: 3px solid var(--hawx-teal);
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--gray-700);
}

.ret-explore-loading {
    color: var(--gray-400);
    font-size: 12px;
    font-style: italic;
}

[data-theme="dark"] .ret-explore-panel {
    background: rgba(255, 255, 255, 0.04);
    color: var(--gray-300);
}

/* ─────────────────────────────────────────────────────────────────────────────
SUBSCRIPTIONS OVERLAY
────────────────────────────────────────────────────────────────────────────── */
.subs-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    z-index: 900;
}

.subs-overlay:not(.hidden) {
    display: flex;
}

body.no-scroll {
    overflow: hidden;
}

.subs-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

.subs-overlay-content {
    position: relative;
    width: min(1100px, 96vw);
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.subs-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--gray-50), #fff);
}

.subs-overlay-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800);
}

.subs-overlay-subtitle {
    font-size: 11px;
    color: var(--gray-500);
}

.subs-overlay-body {
    overflow-y: auto;
    padding: 10px 12px 14px 12px;
}

.subs-overlay .subs-overview {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -2px -2px 10px -2px;
}

@media (max-width: 768px) {
    .subs-overlay-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .subs-overlay-body {
        padding: 10px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
UTILITIES
───────────────────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE TWEAKS (Customer Tab)
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        font-size: 11px;
    }

    .tab-nav {
        padding: 0 6px;
        gap: 2px;
    }

    .tab-btn {
        font-size: 10px;
        padding: 7px 8px;
    }

    .customer-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ci-main h2 {
        font-size: 13px;
    }

    .alert-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .customer-two-col {
        flex-direction: column;
    }

    .cust-col-right {
        width: 100%;
    }

    .section-card,
    .contact-card,
    .auth-contacts-card,
    .customer-notes-card,
    .sub-card,
    .sub-key-info,
    .sub-billing-row,
    .sub-notes-section,
    .sub-section-card {
        padding: 10px;
    }

    .sub-two-col {
        grid-template-columns: 1fr;
    }

    .sched-subs-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .sub-three-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .sub-two-grid {
        grid-template-columns: 1fr;
    }

    .pay-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }

    .pay-balance-block {
        text-align: center;
    }

    .pay-info-block {
        justify-content: center;
    }

    .pay-actions-block {
        flex-direction: column;
        margin-left: 0;
        gap: 8px;
    }

    .pay-action-btn.pay-action-primary {
        width: 100%;
        justify-content: center;
    }

    .pay-actions-secondary {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   APPOINTMENT EDIT MODAL
   ───────────────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.appt-edit-content {
    width: 480px;
    max-width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--gray-50), #fff);
}

.modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 18px;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Appointment Edit Summary */
.appt-edit-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: var(--info-bg);
    border: 1px solid var(--info);
    border-radius: 8px;
    margin-bottom: 16px;
}

.appt-edit-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.appt-edit-meta {
    font-size: 11px;
    color: var(--info-dark);
}

/* Sections */
.appt-edit-section {
    margin-bottom: 16px;
}

.appt-edit-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

/* Pest Pills */
.pest-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pest-pill {
    padding: 5px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    background: #fff;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.pest-pill:hover {
    border-color: var(--hawx-teal);
    color: var(--hawx-teal);
}

.pest-pill.selected {
    background: var(--hawx-teal);
    border-color: var(--hawx-teal);
    color: #fff;
}

.pest-pill.addon {
    border-style: dashed;
}

.pest-pill.addon.selected {
    background: var(--purple);
    border-color: var(--purple);
    border-style: solid;
}

/* Textarea */
.appt-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s;
}

.appt-edit-textarea:focus {
    outline: none;
    border-color: var(--hawx-teal);
    box-shadow: var(--shadow-focus);
}

/* Toggle Options */
.appt-edit-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.appt-toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-label-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 22px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Call Ahead Options */
.call-ahead-options {
    display: flex;
    gap: 4px;
}

.call-ahead-btn {
    padding: 4px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    background: #fff;
    font-size: 10px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.call-ahead-btn:hover {
    border-color: var(--hawx-teal);
}

.call-ahead-btn.selected {
    background: var(--hawx-teal);
    border-color: var(--hawx-teal);
    color: #fff;
}

/* Edit button styling for pending cards */
.sched-btn-edit {
    min-width: 28px;
    background: var(--gray-100);
    border-color: var(--gray-200);
    padding: 3px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    color: var(--gray-600);
    font-size: 9px;
    font-weight: 500;
    transition: all 0.15s;
}

.sched-btn-edit:hover {
    background: var(--hawx-teal-light);
    border-color: var(--hawx-teal);
    color: var(--hawx-teal);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY CLASSES - Consistent Data Highlighting
   ───────────────────────────────────────────────────────────────────────────── */

/* Amount highlighting - for dollar values */
.amount {
    font-family: var(--mono);
    font-weight: 600;
}

.amount-lg {
    font-size: 16px;
    font-weight: 700;
}

.amount-highlight {
    padding: 2px 6px;
    background: var(--highlight-amount);
    border: 1px solid var(--highlight-amount-border);
    border-radius: 4px;
    color: var(--highlight-amount-text);
}

.amount-due {
    color: var(--warning-dark);
}

.amount-paid {
    color: var(--success-dark);
}

/* Date highlighting */
.date-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--highlight-date);
    border: 1px solid var(--highlight-date-border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--highlight-date-text);
}

.date-next {
    background: var(--highlight-next);
    border-color: var(--highlight-next-border);
    color: var(--highlight-next-text);
}

/* Text utilities */
.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-error {
    color: var(--error) !important;
}

.text-muted {
    color: var(--gray-400) !important;
}

.text-mono {
    font-family: var(--mono);
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Empty state indicator */
.empty {
    color: var(--gray-300);
    font-style: italic;
}

