/* Power Choosers CRM - Strategic CSS Foundation */

/* Modern Page Transitions - 2025 */
@view-transition {
  navigation: auto;
}

/* Custom fade transition styles */
::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation: fadeOut 0.3s ease-out;
}

::view-transition-new(root) {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* === Toolbar spacing fix (robust) === */
/* Ensure consistent spacing between email editor toolbar icons.
   This enforces gap and provides a fallback margin when flex gap isn't supported
   or if earlier rules inadvertently override spacing. */
.compose-editor .editor-toolbar,
.editor-toolbar {
    display: flex;
    align-items: center;
    column-gap: 10px; /* modern browsers */
    row-gap: 8px;
}

/* Fallback for environments without flex gap support */
@supports not (gap: 1rem) {
    .compose-editor .editor-toolbar .toolbar-btn + .toolbar-btn,
    .editor-toolbar .toolbar-btn + .toolbar-btn { margin-left: 10px; }
}

/* Apollo-inspired layout with consistent 25px spacing and grey theme */

/* === EMAIL VIEWER MODAL STYLING === */
.email-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-container); /* Solid background like compose editor */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* REMOVE BACKDROP BLUR - ensure no blurring effects */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.email-viewer-modal.show {
    opacity: 1;
    visibility: visible;
}

.email-viewer-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.email-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}

.email-viewer-title h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.email-viewer-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.email-viewer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.email-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* Increased from 32px */
    height: 40px; /* Increased from 32px */
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-item);
    color: var(--text-primary); /* Changed from text-secondary for better visibility */
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px; /* Ensure icons are visible */
}

.email-action-btn:hover {
    background: var(--grey-700);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.email-action-btn.starred {
    background: var(--yellow-subtle);
    color: white;
    border-color: var(--yellow-subtle);
}

.email-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card);
}

/* === EMAIL COMPOSE SECTION STYLING === */
.email-viewer-compose {
    display: none;
    flex: 1;
    background: var(--bg-card); /* Solid background - no transparency */
    border-top: 1px solid var(--border-light);
}

.email-viewer-compose.show {
    display: block;
}

.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}

.compose-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.compose-form {
    padding: 20px;
    background: var(--bg-card);
}

.compose-field {
    margin-bottom: 16px;
}

.compose-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.compose-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-item);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.compose-input:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.compose-body {
    min-height: 200px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-item);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.compose-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.compose-actions {
    display: flex;
    gap: 8px;
}

.compose-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-item);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compose-btn:hover {
    background: var(--grey-700);
    border-color: var(--border-medium);
}

.compose-btn.primary {
    background: var(--orange-subtle);
    color: white;
    border-color: var(--orange-subtle);
}

.compose-btn.primary:hover {
    background: #e67e22;
    border-color: #e67e22;
}

/* Ensure no blur effects on any email viewer elements */
.email-viewer-modal * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
}

/* === EMAIL CONTENT STYLING === */
.email-content {
    /* Ensure HTML emails render properly */
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* Reset to allow email styles to take precedence */
    all: initial;
    font-family: inherit;
    color: inherit;
    background: inherit;
}

/* CRITICAL: Preserve email HTML styling by avoiding global overrides */
.email-content * {
    max-width: 100%;
    box-sizing: border-box;
    /* Allow email styles to override global styles */
    font-family: inherit;
}

/* Preserve email formatting - minimal overrides only */
.email-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.email-content table {
    width: 100%;
    border-collapse: collapse;
}

/* REMOVED: Global link styling that was overriding email buttons */
/* .email-content a {
    color: var(--blue-subtle);
    text-decoration: underline;
} */

/* REMOVED: Global hover styling that was interfering with email buttons */
/* .email-content a:hover {
    color: var(--orange-primary);
} */

/* Ensure buttons and interactive elements work */
.email-content button {
    cursor: pointer;
}

/* Disabled: Preserve email background colors and styling
.email-content div,
.email-content span,
.email-content p { }
*/

/* Disabled: Preserve email button styling
.email-content a[style*="background"],
.email-content button[style*="background"] { }
*/

/* Disabled: Ensure email tables maintain their layout
.email-content table td,
.email-content table th { }
*/

/* === CSS VARIABLES === */
:root {
    /* Grey Color Scheme - Primary Theme */
    --grey-50: #f8f9fa;
    --grey-100: #f1f3f4;
    --grey-200: #e9ecef;
    --grey-300: #dee2e6;
    --grey-400: #ced4da;
    --grey-500: #adb5bd;
    --grey-600: #6c757d;
    --grey-700: #495057;
    --grey-750: #3e454d; /* between 700 and 800 for subtle darkening */
    --grey-775: #383f46; /* closer to 800 for near-match */
    --grey-780: #373d44; /* very close to 800 */
    --grey-790: #353b41; /* extremely close to 800 */
    --grey-800: #343a40;
    --grey-820: #2f353b; /* slightly darker than 800 for inner items */
    --grey-900: #212529;
    
    /* Subtle Company Colors */
    --orange-subtle: #ff6b35;
    --orange-primary: #ff6b35;
    --blue-subtle: #1e3a8a;
    --orange-muted: rgba(255, 107, 53, 0.1);
    --blue-muted: rgba(30, 58, 138, 0.1);
    /* Call outcome badges */
    --green-subtle: #28a745;
    --green-muted: rgba(40, 167, 69, 0.15);
    --red-subtle: #dc3545;
    --red-muted: rgba(220, 53, 69, 0.15);
    --yellow-subtle: #ffc107;
    --yellow-muted: rgba(255, 193, 7, 0.15);
    
    /* Additional color mappings for search components */
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-tertiary: var(--text-muted);
    --color-bg-primary: var(--bg-main);
    --color-bg-secondary: var(--bg-card);
    --color-bg-hover: var(--bg-hover);
    --color-primary: var(--orange-subtle);
    --color-border: var(--border-light);
    --color-border-light: var(--border-light);
    --color-border-strong: var(--border-medium);
    --color-success: var(--green-subtle);
    
    /* Background Colors - Two-tone system */
    --bg-main: var(--grey-780);   /* Main content slightly lighter than before */
    --bg-widget: var(--grey-800); /* Widget panel background (slightly darker) */
    --bg-container: var(--grey-775); /* Containers align with card tone for consistent system theme */
    --bg-card: var(--grey-775);   /* Section/card backgrounds slightly lighter */
    --bg-item: var(--grey-700);   /* Inner tiles (list items, action buttons) lighter than card */
    --bg-hover: var(--grey-700);  /* Hover states on dark */
    
    /* Text Colors */
    --text-primary: var(--grey-100);
    --text-secondary: var(--grey-300);
    --text-muted: var(--grey-400);
    --text-inverse: #ffffff;      /* For dark containers */
    
    /* Border Colors - subtle, consistent 1px (darker so less distracting) */
    --border-light: var(--grey-700);
    --border-medium: var(--grey-700);
    --border-dark: var(--grey-750);
    
    /* Spacing System - Critical 25px base */
    --spacing-base: 25px;         /* Primary spacing unit */
    --spacing-sm: 12px;           /* Small spacing */
    --spacing-md: 16px;           /* Medium spacing */
    --spacing-lg: 32px;           /* Large spacing */
    
    /* Layout Dimensions */
    --topbar-height: 70px;
    --sidebar-width: 60px;        /* Collapsed width */
    --sidebar-expanded: 240px;    /* Expanded width */
    --widget-panel-width: 320px;  /* Widget panel width for 3:1 ratio */
    
    /* Consistent Border Radius */
    --border-radius: 8px;         /* Consistent rounded corners */
    --border-radius-sm: 4px;      /* Small radius */
    --border-radius-lg: 12px;     /* Large radius */
    
    /* Shadows - slightly stronger for depth on dark UI */
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.28);
    
    /* Elevation System - use these everywhere */
    --elevation-topbar: var(--shadow-md);
    --elevation-page: var(--shadow-md);
    --elevation-card: var(--shadow-md);
    --elevation-card-hover: var(--shadow-lg);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CONSISTENT BASE FONT SIZE (align localhost and production)
   Lock root font size so rem-based typography renders the same everywhere. */
html { font-size: 14px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: 1rem; }

/* === GLOBAL BUTTON HOVER EFFECTS === */
/* Apply consistent hover effects to all interactive buttons and icons */
button:hover:not(:disabled),
.btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.rc-page-btn:hover:not(:disabled),
.rc-icon-btn:hover:not(:disabled),
.quick-action-btn:hover:not(:disabled),
.contact-quick-action-btn:hover:not(:disabled),
.qa-btn:hover:not(:disabled),
.widget-item:hover:not(:disabled),
.page-btn:hover:not(:disabled),
.pagination-btn:hover:not(:disabled),
.pagination-arrow:hover:not(:disabled),
.activity-pagination-btn:hover:not(:disabled),
.action-btn:hover:not(:disabled),
.health-entity-info:hover:not(:disabled),
.back-btn:hover:not(:disabled),
.call-btn:hover:not(:disabled),
.search-btn:hover:not(:disabled),
.filter-btn:hover:not(:disabled),
.email-action-btn:hover:not(:disabled),
.tracking-icon:hover:not(:disabled),
.gmail-badge:hover:not(:disabled),
.email-item-star:hover:not(:disabled),
.chip-clear:hover:not(:disabled),
.chip-suggest-item:hover:not(:disabled),
.chip-input:hover:not(:disabled),
.picker-page:hover:not(:disabled),
.task-item:hover:not(:disabled),
.news-item:hover:not(:disabled),
.lead-item:hover:not(:disabled),
.activity-item:hover:not(:disabled),
.contact-item:hover:not(:disabled),
.email-item:hover:not(:disabled) {
    background: var(--bg-hover) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
}

/* Special cases that need different hover colors */
.btn-primary:hover:not(:disabled),
.add-contact-cta:hover:not(:disabled) {
    background: var(--bg-hover) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
}

/* Orange buttons (call buttons, etc.) */
.call-btn:hover:not(:disabled) {
    background: #e55a2b !important;
    border-color: #d9481f !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
}

/* Compose editor paragraph spacing */
.body-input p {
  margin: 0 0 12px 0;
}
.body-input p:last-child {
  margin-bottom: 0;
}

/* === EMAIL EDITOR: AI BAR (slide-down) === */
.ai-bar {
    display: block;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-hover);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    position: relative;
    z-index: 50; /* ensure above compose-body and any closed toolbars */
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-bar.open {
    max-height: 480px;
    opacity: 1;
    padding: 16px;
    overflow: visible; /* allow chips to paint outside inner flow if needed */
    margin-bottom: 10px; /* ensure content below does not overlap */
    pointer-events: auto; /* Ensure the bar itself doesn't block clicks */
}
.ai-inner { display: flex; flex-direction: column; gap: 10px; max-height: none; overflow: visible; }
.ai-row { 
    display: flex; 
    gap: 8px; 
    align-items: stretch; 
    pointer-events: auto;
    position: relative;
    z-index: 1;
}
.ai-row.suggestions {
    /* Use a 3-column grid so 5 items render in exactly 2 rows (3 + 2) on desktop */
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.ai-suggestion {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--grey-300);
    border-radius: 6px;
    padding: 8px 12px; /* Increased padding for larger click area */
    cursor: pointer;
    pointer-events: auto !important; /* Ensure buttons are clickable */
    user-select: none; /* Prevent text selection */
    position: relative; /* Ensure proper stacking */
    z-index: 10; /* Ensure buttons are above other elements */
    display: inline-block; /* Base behavior inside grid cell */
    width: 100%; /* Fill grid cell width */
    text-align: left;
    white-space: normal; /* Allow long labels to wrap */
    touch-action: manipulation; /* Improve touch responsiveness */
    min-height: 32px; /* Ensure minimum clickable height */
    min-width: 0; /* Allow shrinking within grid to avoid extra rows */
    transition: all 0.2s ease; /* Smooth transitions */
}
.ai-suggestion:hover { 
    background: var(--grey-700); 
    color: var(--text-inverse); 
    border-color: var(--grey-600); 
}
.ai-suggestion:active {
    background: var(--grey-600);
    transform: translateY(1px);
}

/* Create larger hover area with pseudo-element */
.ai-suggestion::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    z-index: -1;
    pointer-events: none; /* do not intercept events over neighboring elements */
}
.ai-prompt { 
    width: 100%; 
    min-height: 68px; 
    background: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
    cursor: text;
    pointer-events: auto !important;
    position: relative;
    z-index: 5;
    box-sizing: border-box;
}

.ai-prompt:focus {
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
    background: var(--grey-600);
}

.ai-prompt::placeholder {
    color: var(--text-muted);
}
.ai-row.actions { 
    display: flex;
    align-items: center; 
    justify-content: center; /* Center the content */
    gap: 12px; /* Add gap between buttons */
    position: relative; /* For absolute positioning of status */
}
.ai-row .ai-status { 
    position: absolute;
    right: 0;
    color: var(--text-secondary); 
    font-size: 12px; 
}

/* AI Generate buttons styling */
.ai-row.actions .ai-generate {
    background: var(--grey-600);
    border: none; /* Remove border */
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: normal; /* Remove bold text */
    transition: var(--transition-fast);
    cursor: pointer;
    pointer-events: auto; /* Ensure buttons are clickable */
    user-select: none; /* Prevent text selection */
    position: relative; /* Ensure proper stacking */
    z-index: 10; /* Ensure buttons are above other elements */
}

.ai-row.actions .ai-generate:hover {
    background: var(--grey-500);
    color: var(--text-inverse);
}

.ai-row.actions .ai-generate:active {
    background: var(--grey-400);
    transform: translateY(1px);
}

/* === GLOBAL TABLE ROW ANIMATIONS === */
@keyframes rowFadeZoom {
  0% { 
    opacity: 0; 
    transform: scale(0.97) translateY(4px);
  }
  100% { 
    opacity: 1; 
    transform: scale(1) translateY(0);
  }
}

/* Apply to table rows ONLY when tbody gets fresh content (via .animating class) */
tbody.animating tr {
  animation: rowFadeZoom 0.28s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Stagger animation for multiple rows */
tbody.animating tr:nth-child(1) { animation-delay: 0ms; }
tbody.animating tr:nth-child(2) { animation-delay: 20ms; }
tbody.animating tr:nth-child(3) { animation-delay: 40ms; }
tbody.animating tr:nth-child(4) { animation-delay: 60ms; }
tbody.animating tr:nth-child(5) { animation-delay: 80ms; }
tbody.animating tr:nth-child(6) { animation-delay: 100ms; }
tbody.animating tr:nth-child(7) { animation-delay: 120ms; }
tbody.animating tr:nth-child(8) { animation-delay: 140ms; }
tbody.animating tr:nth-child(9) { animation-delay: 160ms; }
tbody.animating tr:nth-child(10) { animation-delay: 180ms; }
tbody.animating tr:nth-child(n+11) { animation-delay: 200ms; }

/* Disable animations for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  tbody tr {
    animation: none !important;
  }
}

/* === AI GENERATION LOADING + FADE-IN === */
@keyframes aiShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes aiFadeIn {
  0% { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Subject shimmer overlay while generating */
#compose-subject.is-loading {
  position: relative;
  color: transparent !important;
}
#compose-subject.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,165,0,0.18), rgba(255,255,255,0.08), rgba(255,165,0,0.18));
  background-size: 200% 100%;
  animation: aiShimmer 1.2s linear infinite;
  pointer-events: none;
}

/* Editor shimmer overlay while generating */
.body-input.is-loading { position: relative; }
.body-input.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,165,0,0.12), rgba(255,255,255,0.06), rgba(255,165,0,0.12));
  background-size: 200% 100%;
  animation: aiShimmer 1.2s linear infinite;
  pointer-events: none;
}

/* Fade-in effect once content arrives */
#compose-subject.fade-in,
.body-input.fade-in { animation: aiFadeIn 280ms ease-out; }

/* === Recipient suggestions dropdown === */
.recipient-row { position: relative; }
.recipient-suggestions {
    position: absolute;
    top: 100%;
    left: 60px; /* align with input after label width */
    right: 0;
    z-index: 999999; /* Extremely high z-index to ensure it's above everything including modals */
    background: #383f46 !important; /* Force solid background, no transparency */
    background-color: #383f46 !important; /* Ensure solid background, no transparency */
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* Stronger shadow for better visibility */
    margin-top: 6px;
    max-height: 280px;
    overflow-y: auto;
    opacity: 1 !important; /* Force full opacity */
    transform: translateZ(0); /* Create new stacking context */
    isolation: isolate; /* Create new stacking context */
}
.recipient-suggestions .suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    background: #383f46 !important; /* Solid background for each item */
    background-color: #383f46 !important; /* Ensure solid background, no transparency */
    opacity: 1 !important; /* Ensure full opacity */
}
.recipient-suggestions .suggestion-item:last-child { border-bottom: none; }
.recipient-suggestions .suggestion-item:hover { 
    background: var(--surface-hover) !important; 
    background-color: #495057 !important; /* Ensure solid hover background */
}
.recipient-suggestions .sugg-main { 
    font-weight: 600; 
    color: var(--text-primary) !important; 
    opacity: 1 !important;
}
.recipient-suggestions .sugg-sub { 
    font-size: 12px; 
    color: var(--text-secondary) !important; 
    margin-top: 2px; 
    opacity: 1 !important;
}
.recipient-suggestions .suggestion-empty { 
    padding: 10px; 
    color: var(--text-secondary) !important; 
    font-style: italic; 
    background: #383f46 !important;
    opacity: 1 !important;
}

/* HTML mode: show raw HTML and a subtle badge */
.body-input[data-mode="html"] {
    position: relative;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: pre-wrap;
}
.body-input[data-mode="html"]::before,
.body-input[data-mode="html"]:empty::before {
    content: 'HTML MODE';
    position: absolute;
    top: 8px;
    right: 12px;
    background: var(--orange-subtle);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.6px;
    border-radius: 999px;
    padding: 4px 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    pointer-events: none;
    text-transform: uppercase;
}

/* === VARIABLES POPOVER (anchored dropdown) === */
.vars-popover {
    position: fixed; /* positioned via JS near the toolbar button */
    background: var(--grey-800);
    color: var(--text-inverse);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    width: min(680px, calc(100vw - 16px));
    z-index: 120; /* above editors and dropdowns */
}
.vars-popover-inner {
    padding: var(--spacing-base);
    max-height: min(60vh, 520px);
    overflow: auto;
}
.vars-popover .vars-tabs { margin-bottom: var(--spacing-sm); }

/* === DELAY EDIT POPOVER === */
.delay-popover {
    position: fixed; /* positioned via JS under the Edit delay button */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    min-width: 300px;
    max-width: min(420px, calc(100vw - 16px));
    z-index: 120; /* above editors and dropdowns */
    --arrow-size: 10px; /* square size before rotation */
}
.delay-popover::before,
.delay-popover::after {
    content: "";
    position: absolute;
    width: var(--arrow-size);
    height: var(--arrow-size);
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    transform: rotate(45deg);
    pointer-events: none;
}
/* Border layer */
.delay-popover[data-placement="bottom"]::before {
    top: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
/* Fill layer */
.delay-popover[data-placement="bottom"]::after {
    top: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-card);
}
/* When placed above anchor */
.delay-popover[data-placement="top"]::before {
    bottom: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
.delay-popover[data-placement="top"]::after {
    bottom: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-card);
}
.delay-popover-inner {
    padding: var(--spacing-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}
.delay-header { font-weight: 600; color: var(--text-primary); }
.delay-options { display: flex; flex-direction: column; gap: 8px; }
.delay-options .radio-row { display: flex; align-items: center; gap: 8px; }
.delay-options .number-unit { display: flex; align-items: center; gap: 8px; }
.delay-popover input[type="radio"] { accent-color: var(--orange-subtle); }
.delay-popover input[type="number"] { width: 110px; }
.delay-popover input[disabled],
.delay-popover select[disabled] { opacity: 0.65; cursor: not-allowed; }
.delay-popover select {
    height: 34px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 0 8px;
    transition: var(--transition-fast);
}
.delay-popover select:focus {
    outline: none;
    border-color: var(--orange-subtle);
    background: var(--grey-600);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}
.delay-popover .input-dark {
    height: 34px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.delay-popover .input-dark::placeholder { color: var(--text-muted); }
.delay-popover .input-dark:hover { background: var(--grey-680, #545b62); }
.delay-popover .input-dark:focus {
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
    background: var(--grey-650, #5a6168);
}
.delay-popover .btn-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}
.delay-popover .btn-apply,
.delay-popover .btn-cancel {
    height: 32px;
    padding: 0 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    background: var(--bg-item);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), filter var(--transition-fast);
}
.delay-popover .btn-apply:hover,
.delay-popover .btn-cancel:hover { background: var(--grey-600); border-color: var(--grey-500); }
.delay-popover .btn-apply:focus-visible,
.delay-popover .btn-cancel:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }
.delay-popover .btn-apply {
    background: var(--orange-subtle);
    border-color: var(--orange-subtle);
    color: var(--text-inverse);
}
.delay-popover .btn-apply:hover { filter: brightness(0.95); }
.delay-popover .btn-apply:focus-visible { outline-color: var(--orange-muted); }

/* === DELETE CONFIRM POPOVER === */
.delete-popover {
    position: fixed; /* positioned via JS under the trash icon */
    background: var(--bg-container);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    min-width: 220px;
    max-width: 280px;
    z-index: 960; /* above bulk bar (850) and dropdowns, below modal overlay (1100) */
    --arrow-size: 10px; /* square size before rotation */
    animation: popIn 130ms ease-out;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.delete-popover.--hide {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}
.delete-popover::before,
.delete-popover::after {
    content: "";
    position: absolute;
    width: var(--arrow-size);
    height: var(--arrow-size);
    transform: rotate(45deg);
    pointer-events: none;
}
/* Border layer */
.delete-popover[data-placement="bottom"]::before {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    top: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
/* Fill layer */
.delete-popover[data-placement="bottom"]::after {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    top: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-container);
}
/* When placed above anchor */
.delete-popover[data-placement="top"]::before {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    bottom: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
.delete-popover[data-placement="top"]::after {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    bottom: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-container);
}

/* When placed to the left of anchor (arrow on right edge of popover) */
.delete-popover[data-placement="left"]::before {
    right: calc(-1 * var(--arrow-size) / 2 + 1px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--border-light);
}
.delete-popover[data-placement="left"]::after {
    right: calc(-1 * var(--arrow-size) / 2 + 2px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--bg-container);
}

/* When placed to the right of anchor (arrow on left edge of popover) */
.delete-popover[data-placement="right"]::before {
    left: calc(-1 * var(--arrow-size) / 2 + 1px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--border-light);
}
.delete-popover[data-placement="right"]::after {
    left: calc(-1 * var(--arrow-size) / 2 + 2px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--bg-container);
}
.delete-popover-inner {
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}
.delete-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.delete-popover .btn-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}
.delete-popover .btn-text {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.delete-popover .btn-text:hover { 
    background: var(--grey-700); 
    border-color: var(--border-light); 
    color: var(--text-inverse); 
}
.delete-popover .btn-text:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }
.delete-popover .btn-cancel {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.delete-popover .btn-cancel:hover { 
    background: var(--grey-700); 
    border-color: var(--border-light); 
    color: var(--text-inverse); 
}
.delete-popover .btn-cancel:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }
.delete-popover .btn-danger {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--border-radius-sm);
    background: var(--red-muted);
    color: var(--text-inverse);
    border: 1px solid var(--red-subtle);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: filter var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.delete-popover .btn-danger:hover { filter: brightness(1.05); }
.delete-popover .btn-danger:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

/* Keyboard focus: confirm button in Add Contact popover */
.add-contact-popover .btn-confirm:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* === STEP TYPE SELECTION MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-base);
    z-index: 1100;
}

.step-type-modal {
    width: 860px;
    max-width: calc(100% - 48px);
    background: var(--grey-800);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    color: var(--text-inverse);
}
.step-type-modal .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-base);
    border-bottom: 1px solid var(--border-light);
}
.step-type-modal .title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.step-type-modal .title {
    font-size: 1.1rem;
    font-weight: 600;
}
.step-type-modal .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
/* .step-type-modal .close-btn styles moved to standardized close button section above */
.step-type-modal .body {
    padding: var(--spacing-base);
    max-height: min(70vh, 720px);
    overflow: auto;
}

.step-type-category {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    margin-bottom: var(--spacing-base);
}
.step-type-category .cat-title {
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}
.step-type-category .cat-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -8px;
    margin-bottom: var(--spacing-md);
}
.step-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
}
/* Keep one-column layout for clarity */

.step-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 12px var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-fast);
}
.step-option:hover { background: var(--grey-700); }
.step-option:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
.step-option .icon { width: 22px; height: 22px; color: var(--grey-300); }
.step-option .label { font-weight: 500; color: var(--text-inverse); }

/* === CONTACTS MODAL (Sequence contacts list) === */
.contacts-modal .empty-text { color: var(--text-secondary); padding: var(--spacing-md) 0; }
.contacts-modal .contact-list { display: flex; flex-direction: column; gap: 6px; }
.contacts-modal .contact-row {
    display: flex;
    align-items: center;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 10px 12px;
}
.contacts-modal .contact-row .left { display: flex; align-items: center; gap: var(--spacing-md); }
.contacts-modal .contact-row .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grey-700);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}
.contacts-modal .contact-row .meta { display: flex; flex-direction: column; }
.contacts-modal .contact-row .name { font-weight: 600; color: var(--text-inverse); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.contacts-modal .contact-row .subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 1px; }

/* Contacts modal: selection + actions layout */
.contacts-modal .contact-row { gap: var(--spacing-md); justify-content: space-between; }
.contacts-modal .contact-row .row-select { margin-right: 6px; }
.contacts-modal .contact-row .actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.contacts-modal .contact-row .action-link { background: none; border: 0; color: var(--text-secondary); cursor: pointer; padding: 4px 6px; border-radius: var(--border-radius-sm); }
.contacts-modal .contact-row .action-link:hover { background: var(--grey-700); color: var(--text-inverse); }
.contacts-modal .contact-row .action-link.danger { color: var(--red-300); }
.contacts-modal .contact-row .action-link.danger:hover { background: var(--red-muted); color: var(--text-inverse); }

/* Add Contact Modal: orange focus ring and layout */
.add-contact-modal input:focus,
.add-contact-modal .focus-orange {
  outline: none !important;
  border-color: var(--orange-subtle) !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25) !important;
}
.add-contact-modal .form-row {
  display: flex;
  gap: 24px;
  margin-bottom: 18px;
}
.add-contact-modal label {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  font-size: 0.98em;
  color: var(--text-primary);
}
.add-contact-modal input {
  margin-top: 6px;
  height: 34px;
  padding: 6px 10px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-light);
  background: var(--bg-item);
  color: var(--text-primary);
  font-size: 0.98rem;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.add-contact-modal input::placeholder { color: var(--text-muted); }
.add-contact-modal .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}
.add-contact-modal .btn-primary,
.add-contact-modal .btn-secondary {
  min-width: 90px;
}
.add-contact-modal .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
/* .add-contact-modal .close-btn styles moved to standardized close button section above */
.add-contact-modal .title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-inverse);
}
.add-contact-modal.step-type-modal {
  width: min(520px, calc(100% - 48px));
}

/* Toolbar: select all */
.contacts-modal .contacts-toolbar { display: flex; align-items: center; justify-content: flex-start; margin-bottom: var(--spacing-sm); }
.contacts-modal .contacts-toolbar .sel-all { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); }

/* Bulk actions bar inside contacts modal */
.contacts-modal .bulk-actions-modal { position: sticky; top: 0; left: auto; transform: none; width: 100%; max-width: none; z-index: 5; margin-bottom: var(--spacing-sm); }

/* === SEQUENCE BUILDER === */
/* Contact Search Styles */
.contact-search-container {
    position: relative;
    width: 300px;
}


#contact-search-results,
.contact-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    z-index: 900; /* below modal overlay (1100) */
    max-height: 300px;
    overflow-y: auto;
    margin-top: 6px;
    animation: popIn 130ms ease-out;
}

.contact-results-list {
    padding: var(--spacing-sm);
}

.contact-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact-result:hover:not(.already-added) {
    background: var(--bg-hover);
}

.contact-result.already-added {
    opacity: 0.6;
    cursor: default;
}

/* subtle separators inside dropdown */
.contact-results-list .contact-result + .contact-result {
    border-top: 1px solid var(--border-dark);
}

/* Keyboard focus: highlight activatable contact rows */
.contact-result:focus { outline: none; }
.contact-result:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

.contact-info {
    flex: 1;
    min-width: 0;
    margin-right: 10px; /* breathing room from Add button */
}

.contact-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 0.8rem; /* much smaller title in dropdown */
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-details {
    font-size: 12px; /* slightly smaller subtext */
    color: var(--text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-action {
    margin-left: var(--spacing-sm);
}

.btn-add-contact {
    background: var(--orange-subtle);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-add-contact:hover {
    background: #e55a2b;
}

/* Keyboard focus: Add Contact button */
.btn-add-contact:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

.added-indicator {
    font-size: 12px;
    color: var(--green-subtle);
    font-weight: 500;
}

.search-loading, .search-empty, .search-error {
    padding: var(--spacing-md);
    text-align: center;
}

/* Themed scrollbars for dropdowns */
#contact-search-results::-webkit-scrollbar,
.contact-search-results::-webkit-scrollbar,
.preview-results::-webkit-scrollbar {
    width: 10px;
}
#contact-search-results::-webkit-scrollbar-track,
.contact-search-results::-webkit-scrollbar-track,
.preview-results::-webkit-scrollbar-track {
    background: var(--grey-780);
}
#contact-search-results::-webkit-scrollbar-thumb,
.contact-search-results::-webkit-scrollbar-thumb,
.preview-results::-webkit-scrollbar-thumb {
    background: var(--grey-600);
    border-radius: 10px;
    border: 2px solid var(--grey-780);
}
#contact-search-results,
.contact-search-results,
.preview-results {
    scrollbar-width: thin;                 /* Firefox */
    scrollbar-color: var(--grey-600) var(--grey-780);
}

/* === PREVIEW CONTACT PICKER DROPDOWN (inside step cards) === */
.preview-contact-picker { position: relative; }
.preview-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    z-index: 900; /* below modal overlay (1100) */
    max-height: 260px;
    overflow-y: auto;
    margin-top: 6px;
    padding: 4px 0;
    display: none;
}
.preview-results.open { display: block; }
.preview-result {
    padding: 8px 12px;
    cursor: pointer;
}
.preview-result:hover,
.preview-result[aria-selected="true"] { background: var(--bg-hover); }
.preview-result .title { color: var(--text-primary); font-weight: 500; font-size: 0.8rem; }
.preview-result .subtitle { color: var(--text-secondary); font-size: 12px; }

/* === ADD CONTACT POPOVER (ensure above dropdowns) === */
.add-contact-popover {
    position: fixed; /* anchored by JS */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    z-index: 960; /* above dropdowns, below modal overlay */
    animation: popIn 130ms ease-out;
    --arrow-size: 10px;
}

.add-contact-popover::before,
.add-contact-popover::after {
    content: "";
    position: absolute;
    width: var(--arrow-size);
    height: var(--arrow-size);
    transform: rotate(45deg);
    pointer-events: none;
}
/* Right of anchor (arrow on left edge) */
.add-contact-popover[data-placement="right"]::before {
    left: calc(-1 * var(--arrow-size) / 2 + 1px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--border-light);
}
.add-contact-popover[data-placement="right"]::after {
    left: calc(-1 * var(--arrow-size) / 2 + 2px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--bg-card);
}
/* Left of anchor (arrow on right edge) */
.add-contact-popover[data-placement="left"]::before {
    right: calc(-1 * var(--arrow-size) / 2 + 1px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--border-light);
}
.add-contact-popover[data-placement="left"]::after {
    right: calc(-1 * var(--arrow-size) / 2 + 2px);
    top: calc(var(--arrow-top, 20px) - (var(--arrow-size) / 2));
    background: var(--bg-card);
}
/* Bottom of anchor (arrow on top edge) - fallback */
.add-contact-popover[data-placement="bottom"]::before {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    top: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
.add-contact-popover[data-placement="bottom"]::after {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    top: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-card);
}
/* Top of anchor (arrow on bottom edge) - fallback */
.add-contact-popover[data-placement="top"]::before {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    bottom: calc(-1 * var(--arrow-size) / 2 + 1px);
    background: var(--border-light);
}
.add-contact-popover[data-placement="top"]::after {
    left: calc(var(--arrow-left, 20px) - (var(--arrow-size) / 2));
    bottom: calc(-1 * var(--arrow-size) / 2 + 2px);
    background: var(--bg-card);
}

/* === TASK POPOVER (contact detail page) === */
.task-popover {
    position: fixed; /* positioned via JS under the tasks button */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 120; /* above other elements */
    min-width: 320px;
    max-width: 400px;
    max-height: 70vh; /* Increased height to show full calendar */
    transform: translateY(-8px); opacity: 0; transition: transform 400ms ease, opacity 400ms ease;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Allow arrow to render outside top edge */
}

.task-popover.--show {
    transform: translateY(0); opacity: 1;
    /* Smooth transitions for size and position, preserving transform/opacity transitions */
    transition: transform 400ms ease, opacity 400ms ease, left 0.45s ease, top 0.45s ease, width 0.6s ease-out, max-width 0.6s ease-out, max-height 0.5s ease-out;
    will-change: left, top, width, max-width, max-height;
}

/* Do not widen when calendar opens; keep base width, still allows smooth transitions */
.task-popover.calendar-expanded { 
    max-width: 400px; 
    min-width: 320px; 
    max-height: 480px; /* Fixed height to stop at bottom of calendar widget */
}

.task-popover .arrow {
    position: absolute;
    top: -6px;
    left: 20px; /* default position, overridden by JS */
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border-light);
    transform: translateX(-50%);
    z-index: 200; /* Higher z-index to ensure visibility */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.task-popover .arrow::after {
    content: "";
    position: absolute;
    top: 1px;
    left: -5px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--bg-card);
    z-index: 201; /* Higher than the arrow itself */
}

.tp-inner {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Keep header fixed and body scrollable */
}

.tp-header {
    display: flex;
    align-items: flex-start; /* align title and close button to the top edge */
    justify-content: space-between;
    /* Increase bottom padding to match spacing above form elements */
    padding: 0 0 10px;
    /* Pull header up slightly to reduce top whitespace */
    margin-top: -5px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0; /* Prevent header from shrinking */
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 1;
}

.tp-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    padding-left: 0;
    line-height: 1.1; /* tighten vertical space to match top padding */
}

.tp-header .close-btn {
    /* Match notes widget close button exactly */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    background: var(--bg-item) !important;
    color: var(--grey-300) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    line-height: 1;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin-right: 0;
}

.tp-header .close-btn:hover {
    background: var(--grey-600) !important;
    color: var(--text-inverse) !important;
}

.tp-header .close-btn:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

.tp-body {
    /* Remove extra bottom spacing below the Create Task button and left/right gutters */
    padding: 0 0 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Allow flex item to shrink below content size */
}

.tp-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-base);
    margin-bottom: var(--spacing-base);
    padding: 0;
}

.tp-body .form-row:last-of-type {
    grid-template-columns: 1fr;
}

.tp-body label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.tp-body .input-dark {
    height: 36px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 0 10px;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.tp-body .input-dark:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.tp-body textarea.input-dark {
    height: auto;
    min-height: 80px;
    padding: 8px 10px;
    resize: vertical;
}

.tp-body select.input-dark {
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--spacing-base);
    padding: 0;
}

.tp-body .btn-primary {
    /* Set button to orange background */
    background: var(--orange-primary);
    color: var(--text-inverse);
    border: 1px solid var(--orange-primary);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tp-body .btn-primary:hover {
    filter: brightness(0.95);
}

.tp-body .btn-primary:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* Ensure scroll content sits flush with divider lines */
.tp-body form { margin: 0; padding: 0; }
.tp-body > *:first-child { margin-top: 0 !important; }
.tp-body > *:last-child { margin-bottom: 0 !important; }
.tp-body .form-actions { margin-bottom: 0; }

/* Reduce spacing between header and first form row */
.tp-body form .form-row:first-child { margin-top: 0 !important; }

/* === CALENDAR TOOLBAR === */
.calendar-toggle-btn {
    position: absolute;
    right: 8px;
    top: 65%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 20px;
}

.calendar-toggle-btn:hover {
    color: var(--text-primary);
    background: transparent;
    transform: translateY(-50%) !important;
}

/* === DROPDOWN TOGGLE BUTTONS === */
.dropdown-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 20px;
}

.dropdown-toggle-btn:hover {
    color: var(--text-primary);
    background: transparent;
    transform: translateY(-50%) !important;
}

.tp-body label {
    position: relative;
}

.calendar-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 0; /* closed state: no padding to avoid end-of-animation jump */
    margin-top: 0; /* avoid snap when closing; spacing applied only when open */
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out, margin 0.5s ease-out, padding 0.5s ease-out, transform 0.5s ease-out;
}

.calendar-toolbar.calendar-slide-in {
    max-height: 400px; /* Increased height to show full calendar */
    opacity: 1;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-base); /* open state adds padding smoothly */
    transform: translateY(0);
}

.calendar-toolbar.calendar-slide-out {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0; /* ensure padding collapses smoothly on close */
    transform: translateY(-10px);
}

/* === DROPDOWN TOOLBARS === */
.type-toolbar,
.priority-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 0; /* closed state: no padding to avoid end-of-animation jump */
    margin-top: 0; /* avoid snap when closing; spacing applied only when open */
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out, margin 0.5s ease-out, padding 0.5s ease-out, transform 0.5s ease-out;
}

.type-toolbar.dropdown-slide-in,
.priority-toolbar.dropdown-slide-in {
    max-height: 200px; /* Adjust based on content */
    opacity: 1;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-base); /* open state adds padding smoothly */
    transform: translateY(0);
}

.type-toolbar.dropdown-slide-out,
.priority-toolbar.dropdown-slide-out {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0; /* ensure padding collapses smoothly on close */
    transform: translateY(-10px);
}

/* === DROPDOWN GRIDS === */
.dropdown-grid {
    display: grid;
    gap: var(--spacing-sm);
}

.type-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.priority-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
}

.dropdown-option {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    text-align: center;
}

.dropdown-option:hover {
    background: var(--grey-800);
    border-color: var(--border-medium);
    color: var(--text-inverse);
}

.dropdown-option.selected {
    background: var(--orange-primary);
    border-color: var(--orange-primary);
    color: var(--text-inverse);
}

/* Task Popover Dropdown Options - Higher specificity to override JS styles */
.task-popover .dropdown-option {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    text-align: center;
}

.task-popover .dropdown-option:hover {
    background: var(--grey-800);
    border-color: var(--border-medium);
    color: var(--text-inverse);
}

.task-popover .dropdown-option.selected {
    background: var(--orange-primary);
    border-color: var(--orange-primary);
    color: var(--text-inverse);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.calendar-nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: var(--grey-600);
    border-color: var(--grey-500);
}

.calendar-month-year {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: var(--spacing-sm);
}

.calendar-weekday {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px 4px;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

.calendar-day:hover {
    background: var(--grey-600);
    border-color: var(--grey-500);
}

.calendar-day-selected {
    background: var(--orange-subtle) !important;
    color: var(--text-inverse) !important;
    border-color: var(--orange-subtle) !important;
    font-weight: 600;
}

.calendar-day-today {
    border-color: var(--orange-muted);
    font-weight: 500;
}

.calendar-day-empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day-empty:hover {
    background: transparent;
}

/* Task popover expansion animation - removed duplicate transition */

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--grey-600);
    border-top: 2px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-loading span {
    color: var(--text-secondary);
    font-size: 13px;
}

.empty-text, .error-text {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.empty-subtext, .error-subtext {
    color: var(--text-muted);
    font-size: 12px;
}

/* Global focus ring for small search inputs */
.search-input-small:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.builder-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Subtle animations for Sequence Builder */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
@keyframes popIn {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to   { opacity: 1; transform: none; }
}
@keyframes fadeSlideOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-4px) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
    .seq-title-actions,
    .seq-title-edit-row,
    .delete-popover { transition: none !important; animation: none !important; }
}

/* Sequence title display + inline edit */
.seq-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: fadeSlideIn 140ms ease-out;
}
.seq-title-text {
    font-size: 0.85rem;         /* match .label-desc */
    font-weight: 400;           /* match .label-desc */
    color: var(--text-secondary); /* match .label-desc */
}
.seq-title-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.seq-title-wrap:hover .seq-title-actions,
.seq-title-wrap:focus-within .seq-title-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}
.seq-title-wrap.actions-pinned .seq-title-actions {
    /* keep actions visible while delete popover is open */
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}
.seq-title-wrap.no-hover .seq-title-actions {
    /* force-hide actions briefly after cancel/save/close regardless of hover */
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(4px);
}
.seq-title-edit-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    animation: fadeSlideIn 160ms ease-out;
}

/* generic anim-out hook used by JS just before swapping views */
.seq-title-wrap.anim-out,
.seq-title-edit-row.anim-out {
    animation: fadeSlideOut 120ms ease-in forwards;
}
.seq-title-edit-row .seq-title-input {
    width: clamp(120px, 20vw, 180px);
    max-width: 100%;
    height: 30px;
    font-size: 0.95rem;
}

@media (max-width: 640px) {
    .seq-title-text { font-size: 1.1rem; }
}

.sequence-steps {
    display: flex;
    flex-direction: column;
    gap: 25px;             /* spacing between step items */
    padding-top: 0;        /* top spacing handled by .page-content padding */
    margin-top: 0;         /* avoid compounding with external gaps */
}

.step-item { position: relative; }

.delay-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin: 0 0 25px 0;
    width: 100%;
    position: relative; /* allow top connector to anchor above */
}

.delay-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 0;         /* top spacing now handled by .sequence-steps padding */
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-inverse);
    box-shadow: var(--elevation-card);
    align-self: center;
}
.delay-pill:hover { background: var(--grey-700); }
.delay-pill:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }
button.delay-pill { cursor: pointer; -webkit-appearance: none; appearance: none; }
.delay-pill .icon { color: var(--grey-300); display:inline-flex; }
.delay-pill .delay-label { color: var(--text-inverse); }
.delay-pill .icon-btn-sm {
    border: none;
    width: 24px;
    height: 24px;
    color: var(--grey-300);
}
.delay-pill .icon-btn-sm:hover { background: var(--grey-600); }
.delay-pill .icon-btn-sm:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

/* Re-introduce the in-step connector (pill to card) */
.sequence-steps .step-item .delay-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sequence-steps .step-item .delay-container .delay-connector {
    width: 2px;
    height: var(--connector-height);
    background: var(--border-light);
    border-radius: 1px;
    margin-top: 6px; /* breathing space under pill */
}

/* Old CSS connectors (hidden in favor of SVG overlay) */
.builder-content .add-step-row .between-steps,
.builder-content .add-step-row .between-steps::after,
.builder-content .sequence-steps .step-item .delay-container::before,
.builder-content .sequence-steps .step-item .delay-container::after { display: none !important; }

.add-step-container { margin-top: 0; }

.add-step-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0; /* rely on sequence-steps spacing control */
}

/* Use natural spacing; SVG overlay will visually connect elements */
.builder-content > .add-step-row {
    margin-top: 0 !important; /* rely on builder-content gap (25px) */
}

/* Clean up - remove all connector-related styles */
.builder-content .sequence-steps .step-item .delay-container .delay-connector,
.builder-content .add-step-row .delay-connector {
    display: none !important;
}

/* Remove legacy step-to-step arrows in builder context */
.builder-content .sequence-steps .step-item:not(:first-child) .delay-container::before,
.builder-content .sequence-steps .step-item:not(:first-child) .delay-container::after { display: none !important; }

.add-step-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
}

.step-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-base);
    /* Move divider to .step-body to avoid double line when collapsed */
    border-bottom: 0;
}
 .step-header .spacer { flex: 1 1 auto; }

/* Step status toggle (Active/Paused) */
.step-status-toggle { display: inline-flex; align-items: center; gap: 8px; margin-left: 0; }
.step-status-toggle .toggle-switch { margin: 0; }
.step-status-toggle .switch-text { color: var(--text-secondary); font-size: 0.85rem; }

/* Legacy switch styles (kept for compatibility) */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--grey-700);
    border: 1px solid var(--border-light);
    transition: background var(--transition-fast), border-color var(--transition-fast);
    display: inline-block;
}
.switch-track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-inverse);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    transition: transform var(--transition-fast);
}
.switch input:checked + .switch-track { background: var(--green-subtle); border-color: var(--green-subtle); }
.switch input:checked + .switch-track::after { transform: translate(18px, -50%); }

.collapse-btn,
.icon-btn-sm {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--grey-300);
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.collapse-btn:hover,
.icon-btn-sm:hover { background: var(--grey-600); border-color: var(--grey-500); color: var(--text-inverse); }
.collapse-btn:focus-visible,
.icon-btn-sm:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

.step-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
}

/* Inline icon + label + short description for automatic email steps */
.step-title .label-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.step-title .label-wrap .label-icon {
    display: inline-flex;
    color: var(--grey-300);
}
.step-title .label-wrap .label-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}
.step-title .label-wrap .label-desc {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    border: 1px solid var(--border-dark);
}
.badge-email { background: var(--blue-muted); color: var(--text-inverse); }
.badge-phone { background: var(--green-muted); color: var(--text-inverse); }
.badge-linkedin { background: #0077b5; color: var(--text-inverse); }
.badge-neutral { background: var(--grey-700); color: var(--text-inverse); }

.step-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}
.delay-label { color: var(--text-secondary); }

.step-body { padding: var(--spacing-base); border-top: 1px solid var(--border-light); }

/* Editor toolbar inside email step */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-item);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 6px;
    margin-bottom: 0; /* remove margin to bring compose input closer */
}

.editor-toolbar .toolbar-btn {
    background: none;
    border: 1px solid var(--grey-600);
    color: var(--grey-300);
    width: 30px;
    height: 30px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative; /* for separators */
}
.editor-toolbar .toolbar-btn:hover {
    background: var(--grey-700);
    color: var(--text-inverse);
    border-color: var(--grey-500);
}
.editor-toolbar .toolbar-btn:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
.editor-toolbar .toolbar-btn:active {
    transform: translateY(0.5px);
}
.editor-toolbar .toolbar-btn svg { 
    width: 16px !important; 
    height: 16px !important; 
    display: block; 
}
.editor-toolbar .toolbar-btn[data-action="formatting"] svg text {
    /* Center the rendered glyph vertically within the 22x22 viewbox */
    transform: translateY(2.5px);
}
/* Make sure clicks target the button, not the inner SVG or its paths */
.editor-toolbar .toolbar-btn svg,
.editor-toolbar .toolbar-btn svg * {
    pointer-events: none;
}

/* Inline tooltips on hover/focus using aria-label */
.editor-toolbar .toolbar-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translate(-50%, 4px);
    background: var(--grey-820);
    color: var(--text-inverse);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 20;
}
.editor-toolbar .toolbar-btn::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translate(-50%, 4px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--grey-820) transparent transparent transparent;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    z-index: 19;
}
.editor-toolbar .toolbar-btn:hover::after,
.editor-toolbar .toolbar-btn:focus-visible::after,
.editor-toolbar .toolbar-btn:hover::before,
.editor-toolbar .toolbar-btn:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Icon container (if present) */
.editor-toolbar .toolbar-btn .icon {
    display: inline-flex;
    color: var(--grey-300);
    font-size: 16px;
}

/* Hide verbose label inside the AI button to keep toolbar compact */
.editor-toolbar .toolbar-ai .label {
    display: none;
}

/* Style the AI button SVG icon */
.editor-toolbar .toolbar-ai svg {
    width: 16px !important;
    height: 16px !important;
    display: block;
}

/* Editor toolbar layout: even spacing + thin dividers between icons */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 12px; /* even spacing between all buttons */
}
/* No inter-button divider; each icon has its own 1px border */
/* Remove legacy group-specific separators to avoid duplicates */
.editor-toolbar .toolbar-btn[data-action="formatting"],
.editor-toolbar .toolbar-btn[data-action="attach"] {
    margin-right: 0;
    box-shadow: none;
}

/* Future toggle state */
.editor-toolbar .toolbar-btn.is-active {
    background: var(--grey-700);
    color: var(--text-inverse);
    border-color: var(--grey-600);
}

/* === EMAIL EDITOR: FORMATTING BAR === */
/* Slides down under the editor toolbar when the Formatting button is toggled */
.step-card .formatting-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-item);
    border: 0; /* no border when hidden to avoid extra gap */
    border-radius: var(--border-radius-sm);
    padding: 0; /* remove padding when hidden so height collapses fully */
    margin-bottom: 0; /* no extra gap when hidden */
    /* hidden by default; JS toggles .open */
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    overflow: hidden;
    pointer-events: none;
    transition: max-height var(--transition-smooth), opacity var(--transition-smooth), transform var(--transition-smooth);
    position: relative; /* anchor popovers */
    z-index: 1;
}

.step-card .formatting-bar.open {
    max-height: 200px; /* enough for one-row controls */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    border: 1px solid var(--border-light);
    padding: 6px;
    margin-bottom: var(--spacing-sm); /* even spacing below */
    /* Ensure popovers are not clipped when bar is open */
    overflow: visible;
}

.step-card .formatting-bar .fmt-group { position: relative; display: inline-flex; align-items: center; }

/* Buttons inside formatting bar */
.step-card .formatting-bar .fmt-btn {
    background: none;
    border: 1px solid var(--grey-600); /* match top toolbar buttons */
    color: var(--grey-300);
    height: 30px;
    min-width: 30px;
    padding: 0 8px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative; /* anchor custom tooltip */
}
.step-card .formatting-bar .fmt-btn:hover {
    background: var(--grey-700);
    color: var(--text-inverse);
    border-color: var(--grey-500); /* match top toolbar hover */
}
.step-card .formatting-bar .fmt-btn:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
.step-card .formatting-bar .fmt-btn:active { transform: translateY(0.5px); }

/* Inline tooltips on hover/focus using aria-label (match top toolbar style) */
.step-card .formatting-bar .fmt-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translate(-50%, 4px);
    background: var(--grey-820);
    color: var(--text-inverse);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 20;
}
.step-card .formatting-bar .fmt-btn::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translate(-50%, 4px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--grey-820) transparent transparent transparent;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    z-index: 19;
}
.step-card .formatting-bar .fmt-btn:hover::after,
.step-card .formatting-bar .fmt-btn:focus-visible::after,
.step-card .formatting-bar .fmt-btn:hover::before,
.step-card .formatting-bar .fmt-btn:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}
.step-card .formatting-bar .fmt-btn[aria-expanded="true"] {
    background: var(--grey-700);
    color: var(--text-inverse);
    border: 1px solid var(--grey-600);
}
.step-card .formatting-bar .fmt-btn[aria-expanded="true"]:hover {
    border-color: var(--grey-500);
}
/* Exception: Highlight button should only appear selected when a color is active,
   not merely when its popover is open. Hide the border/background if expanded
   but not pressed. */
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"][aria-expanded="true"]:not([aria-pressed="true"]) {
    background: none;
    border: none;
    color: var(--grey-300);
}
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"][aria-expanded="true"]:not([aria-pressed="true"]):hover {
    background: var(--grey-700);
    border: none;
    color: var(--text-inverse);
}
/* Active/toggled state for toggleable formatting controls (bold/italic/underline/lists) */
.step-card .formatting-bar .fmt-btn[aria-pressed="true"] {
    background: var(--grey-700);
    color: var(--text-inverse);
    border: 1px solid var(--grey-600); /* ensure a border appears when selected */
}
.step-card .formatting-bar .fmt-btn[aria-pressed="true"]:hover {
    border-color: var(--grey-500);
}
/* SVG icons inside formatting buttons */
.step-card .formatting-bar .fmt-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}
.step-card .formatting-bar .fmt-btn .ql-stroke {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}
.step-card .formatting-bar .fmt-btn .ql-stroke.ql-thin { stroke-width: 1; }
.step-card .formatting-bar .fmt-btn .ql-fill { fill: currentColor; }

/* === EMAIL EDITOR: LINK BAR === */
/* Slides down under the editor toolbar when the Link button is toggled */
.step-card .link-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-item);
    border: 0; /* no border when hidden to avoid extra gap */
    border-radius: var(--border-radius-sm);
    padding: 0; /* remove padding when hidden so height collapses fully */
    margin-bottom: 0; /* avoid stacking with toolbar when hidden */
    /* hidden by default; JS toggles .open */
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    overflow: hidden;
    pointer-events: none;
    transition: max-height var(--transition-smooth), opacity var(--transition-smooth), transform var(--transition-smooth);
}

.step-card .link-bar.open {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    border: 1px solid var(--border-light);
    padding: 6px;
    margin-bottom: var(--spacing-sm); /* spacing below when open */
    margin-top: 0; /* keep even spacing above (toolbar -> link bar) */
}

.step-card .link-bar .field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.step-card .link-bar .field .fmt-label { min-width: 0; }
.step-card .link-bar .actions { display: inline-flex; gap: 6px; margin-left: auto; }

/* Reuse button styling from formatting bar */
.step-card .formatting-bar .fmt-btn,
.step-card .link-bar .fmt-btn {
    background: none;
    border: 1px solid var(--grey-600); /* match top toolbar buttons */
    color: var(--grey-300);
    height: 30px;
    min-width: 30px;
    padding: 0 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.step-card .link-bar .fmt-btn:hover { background: var(--grey-700); color: var(--text-inverse); border-color: var(--grey-500); }

/* Inline formatting buttons: remove default border so selection stands out */
.step-card .formatting-bar .fmt-btn[data-fmt="bold"]:not([aria-pressed="true"]):not([aria-expanded="true"]),
.step-card .formatting-bar .fmt-btn[data-fmt="italic"]:not([aria-pressed="true"]):not([aria-expanded="true"]),
.step-card .formatting-bar .fmt-btn[data-fmt="underline"]:not([aria-pressed="true"]):not([aria-expanded="true"]),
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"]:not([aria-pressed="true"]):not([aria-expanded="true"]),
.step-card .formatting-bar .fmt-btn[data-fmt="ol"]:not([aria-pressed="true"]):not([aria-expanded="true"]),
.step-card .formatting-bar .fmt-btn[data-fmt="ul"]:not([aria-pressed="true"]):not([aria-expanded="true"]) {
    border: none;
    box-shadow: none;
}
/* Ensure highlight shows no border when popover is open but no color is active.
   Placed here (after the later base rule) so it wins in cascade. */
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"][aria-expanded="true"]:not([aria-pressed="true"]) {
    background: none;
    border: none;
    color: var(--grey-300);
}
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"][aria-expanded="true"]:not([aria-pressed="true"]):hover {
    background: var(--grey-700);
    border: none;
    color: var(--text-inverse);
}
.step-card .link-bar .fmt-btn:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

/* Future-proof: if any top toolbar buttons become toggleable */
.editor-toolbar .toolbar-btn[aria-pressed="true"] {
    background: var(--grey-700);
    color: var(--text-inverse);
    border-color: var(--grey-600);
}

/* Final fail-safe: Highlight button should NEVER show a border unless pressed */
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"]:not([aria-pressed="true"]) {
    border: none !important;
    background: none;
}
.step-card .formatting-bar .fmt-btn[data-fmt="highlight"]:not([aria-pressed="true"]):hover {
    background: var(--grey-700);
    color: var(--text-inverse);
    border: none !important;
}

/* Labels and glyphs */
.step-card .formatting-bar .fmt-label {
    color: var(--text-inverse);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    min-width: 90px;
    text-align: left;
}
.step-card .formatting-bar .fmt-glyph {
    color: var(--text-inverse);
    font-weight: 700;
    line-height: 1;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Popovers for font, size, highlight */
.step-card .formatting-bar .format-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--grey-820);
    color: var(--text-inverse);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 6px;
    min-width: 180px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 50;
}
.step-card .formatting-bar .format-popover.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.step-card .formatting-bar .format-popover .popover-item {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-inverse);
    padding: 6px 8px;
    border-radius: var(--border-radius-sm);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}
.step-card .formatting-bar .format-popover .popover-item:hover {
    background: var(--grey-700);
}
.step-card .formatting-bar .format-popover .popover-item:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* Font list can be a bit long */
.step-card .formatting-bar .font-popover { max-height: 240px; overflow: auto; }

/* Highlight swatches */
.step-card .formatting-bar .highlight-popover {
    min-width: auto;
    left: 50%;
    /* Keep horizontal centering in both closed/open states */
    transform: translate(-50%, -4px);
}
.step-card .formatting-bar .highlight-popover.open {
    transform: translate(-50%, 0);
}
.step-card .formatting-bar .highlight-popover .swatches { display: flex; gap: 8px; padding: 2px; justify-content: center; }
.step-card .formatting-bar .highlight-popover .swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    background: var(--sw, #ffd54f);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.step-card .formatting-bar .highlight-popover .swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}
.step-card .formatting-bar .highlight-popover .swatch:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
/* Visual for the 'No highlight' option */
.step-card .formatting-bar .highlight-popover .swatch[data-color="none"] {
    background: linear-gradient(45deg, transparent 46%, var(--grey-600) 48%, var(--grey-600) 52%, transparent 54%), var(--grey-800);
    border: 1px dashed var(--grey-600);
}

.step-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    align-items: center; /* keep tabs height stable even with picker */
}
.tab {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--grey-300);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}
.tab:hover { background: var(--grey-700); color: var(--text-inverse); }
.tab.active { background: var(--grey-700); color: var(--text-inverse); border-color: var(--grey-600); }
.tab:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

.form-row { margin-bottom: var(--spacing-md); }

/* In email editor, use smaller, even spacing between Subject and Toolbar */
.step-card .tab-panels .tab-panel[data-tab="editor"] > .form-row {
    margin-bottom: var(--spacing-sm);
}

.textarea-dark {
    width: 100%;
    min-height: 180px;
    background: var(--grey-700);
    border: 1px solid var(--grey-600);
    color: var(--text-inverse);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
    resize: vertical;
}
.step-card .body-input {
    /* Extra inline padding so numbers/cursors don't hug the border */
    padding-left: 14px;
    padding-right: 14px;
    /* Ensure ~25px space from editor bottom to its container bottom.
       Compensate for parent padding using CSS variables. */
    margin-bottom: max(0px, calc(25px - var(--spacing-base)));
}

/* Keep list markers comfortably inside the editor box */
.step-card .body-input ol,
  .step-card .body-input ul {
    padding-left: 1.25rem; /* indent bullets/numbers inside the padded box */
    margin-left: 0;
    list-style-position: outside; /* markers inside content box due to padding */
  }
  .textarea-dark::placeholder { color: var(--grey-400); }

  /* Notes widget: match textarea font to status/clock (use app sans stack) */
  .notes-textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  }
  .notes-textarea::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  }

  /* Standardized close button styles for all modals and widgets */
  .widget-card .notes-close,
  .widget-card .health-close,
  .widget-card .deal-close,
  .widget-card .lusha-close,
  .pc-modal__close,
  .close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; /* slightly larger hit area */
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    background: var(--bg-item);
    color: var(--grey-300);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    line-height: 1;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* better touch behavior */
  }
  .widget-card .notes-close:hover,
  .widget-card .health-close:hover,
  .widget-card .deal-close:hover,
  .widget-card .lusha-close:hover,
  .pc-modal__close:hover,
  .close-btn:hover {
    background: var(--grey-600);
    color: var(--text-inverse);
  }
  .widget-card .notes-close:focus-visible,
  .widget-card .health-close:focus-visible,
  .widget-card .deal-close:focus-visible,
  .widget-card .lusha-close:focus-visible,
  .pc-modal__close:focus-visible,
  .close-btn:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
  }

  /* Focus ring preference (orange glow) */
  .input-dark:focus,
  .textarea-dark:focus {
    outline: none;
    border-color: var(--orange-subtle);
    background: var(--grey-600);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.email-preview {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
}
.preview-subject { font-weight: 600; margin-bottom: var(--spacing-sm); color: var(--text-primary); }
.preview-body { color: var(--text-inverse); }

/* Preview Contact Picker (Email Preview tab) */
.preview-contact-picker {
    position: relative;
    max-width: 520px;
    margin-bottom: var(--spacing-md);
}
.preview-contact-picker .preview-contact-input {
    width: 100%;
}
.step-tabs .preview-contact-picker {
    margin-bottom: 0;
    margin-left: auto; /* push search to right in flex container */
}
.step-tabs .preview-contact-input {
    height: 30px; /* match tab height */
    padding: 0 10px;
}
.preview-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--grey-800);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    max-height: 240px;
    overflow: auto;
    display: none;
    z-index: 70;
}
.preview-results.open { display: block; }
.preview-result {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.preview-result:last-child { border-bottom: none; }
.preview-result .title { color: var(--text-inverse); font-weight: 500; }
.preview-result .subtitle { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.preview-result:hover,
.preview-result[aria-selected="true"] {
    background: var(--grey-700);
}
.preview-result[aria-selected="true"] {
    box-shadow: inset 2px 0 0 var(--orange-subtle);
}

/* === GLOBAL RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--grey-400);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--grey-500);
}

/* === UTILITY CLASSES === */
/* Force-hide an element irrespective of its default display */
.hidden {
    display: none !important;
}

/* === APP CONTAINER === */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Smaller height while loading to avoid excessive empty space */
.global-search-modal.is-loading {
    max-height: 240px;
}
.global-search-modal.is-loading .search-results-container {
    max-height: 200px;
}

/* === TOP BAR === */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--grey-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-base);
    box-shadow: var(--elevation-topbar);
    z-index: 1000;
}

/* === ENHANCED TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 10px);
    right: var(--spacing-base);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
    transition: all 0.3s ease;
    align-items: flex-end;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 400px;
    width: auto;
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-height: 0;
    overflow: hidden;
}

/* Toast type colors */
.toast.call {
    border-left: 4px solid var(--orange-subtle);
}

.toast.email {
    border-left: 4px solid var(--blue-subtle);
}

.toast.save {
    border-left: 4px solid var(--green-subtle);
}

.toast.error {
    border-left: 4px solid var(--red-subtle);
}

.toast.warning {
    border-left: 4px solid var(--yellow-subtle);
}

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

.toast.task {
    border-left: 4px solid var(--yellow-subtle);
}

.toast-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
    position: relative;
}

.toast.call .toast-icon {
    background: var(--orange-subtle);
}

.toast.email .toast-icon {
    background: var(--blue-subtle);
}

.toast.save .toast-icon {
    background: var(--green-subtle);
}

.toast.error .toast-icon {
    background: var(--red-subtle);
}

.toast.warning .toast-icon {
    background: var(--yellow-subtle);
}

.toast.info .toast-icon {
    background: var(--grey-500);
}

.toast.task .toast-icon {
    background: var(--yellow-subtle);
}

.toast-icon img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
    color: white;
    stroke: currentColor;
}

.toast-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-details {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.toast-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.toast-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.toast-btn.primary {
    background: var(--orange-subtle);
    border-color: var(--orange-subtle);
    color: white;
}

.toast-btn.primary:hover {
    background: #e55a2b;
    border-color: #e55a2b;
}

.toast-btn.danger {
    background: var(--red-subtle);
    border-color: var(--red-subtle);
    color: white;
}

.toast-btn.danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Call-specific toast styling */
.toast.call .toast-content {
    position: relative;
}

.call-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.call-btn {
    flex: 1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.call-btn.answer {
    background: var(--green-subtle);
    color: white;
}

.call-btn.answer:hover {
    background: #218838;
}

.call-btn.decline {
    background: var(--red-subtle);
    color: white;
}

.call-btn.decline:hover {
    background: #c82333;
}

.call-btn svg {
    width: 16px;
    height: 16px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.top-bar-center {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 400px;
    height: 40px;
    background: var(--bg-item);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 0 40px 0 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-input:hover {
    border-color: var(--grey-500);
    background: var(--bg-widget);
}

.search-input:focus {
    outline: none;
    border-color: var(--orange-subtle);
    background: var(--bg-widget);
    box-shadow: 0 0 0 3px rgba(255,145,0,0.1);
    transform: translateY(-1px);
}

.search-btn {
    position: absolute;
    right: 8px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--grey-400);
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.search-btn:hover {
    color: var(--text-inverse);
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.call-btn {
    background: var(--orange-subtle);
    border: 1px solid var(--orange-subtle);
    color: var(--text-inverse);
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
    line-height: 0; /* remove inline content vertical offset */
}

.call-btn:hover {
    background: #e55a2b;
    border-color: #d9481f;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure the phone icon is centered and sized consistently */
.call-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.icon-btn {
    position: relative;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--grey-400);
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-inverse);
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

/* Greyed out state for unprocessed calls - still clickable with hover effects */
.rc-icon-btn.not-processed {
    color: var(--grey-500);
    background: var(--bg-item);
    border-color: var(--border-light);
    opacity: 0.6;
}

.rc-icon-btn.not-processed:hover {
    color: var(--text-inverse);
    background: var(--bg-hover);
    border-color: var(--accent-color);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Processing state for CI requests */
.rc-icon-btn.processing {
    color: var(--orange-primary);
    background: var(--bg-item);
    border-color: var(--orange-primary);
    cursor: not-allowed;
}

.rc-icon-btn.processing:hover {
    color: var(--orange-primary);
    background: var(--bg-item);
    border-color: var(--orange-primary);
    transform: none;
    box-shadow: none;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
    display: none;
}

.notification-badge.has-notifications {
    display: block;
}

/* Notification Container */
.notification-container {
    position: relative;
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow: hidden;
}

/* Carat pointer pointing to notification bell */
.notification-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--bg-item);
    z-index: 1001;
}

.notification-dropdown::after {
    content: '';
    position: absolute;
    top: -9px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid var(--border-light);
    z-index: 1000;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--grey-600);
    background: var(--bg-item);
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.mark-all-read {
    background: none;
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.mark-all-read:hover {
    background: var(--bg-hover);
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: var(--bg-item);
    border-left: 3px solid var(--blue-primary);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 20px;
    width: 8px;
    height: 8px;
    background: var(--blue-primary);
    border-radius: 50%;
}

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.notification-icon.missed-call {
    background: var(--grey-600);
    color: white;
}

.notification-icon.new-lead {
    background: var(--grey-600);
    color: white;
}

.notification-icon.call-completed {
    background: var(--grey-600);
    color: white;
}

.notification-icon.system {
    background: var(--grey-600);
    color: white;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--grey-600);
    background: var(--bg-item);
    text-align: center;
}

.view-all-btn {
    background: none;
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.view-all-btn:hover {
    background: var(--bg-hover);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px auto;
    opacity: 0.5;
    color: var(--text-muted);
}

.notification-empty-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.notification-empty-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-container {
    margin-left: var(--spacing-sm);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    background: var(--blue-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-inverse);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.875rem;
}

.profile-avatar:hover {
    background: #1e40af;
    transform: scale(1.05);
}

/* === MAIN LAYOUT === */
.main-layout {
    display: flex;
    margin-top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--grey-800);
    border-right: 1px solid var(--grey-700);
    transition: width var(--transition-smooth);
    overflow: hidden;
    z-index: 100;
}

.sidebar:hover {
    width: var(--sidebar-expanded);
}

/* Also support JS-applied expanded class for hover intent */
.sidebar.expanded {
    width: var(--sidebar-expanded);
}

.sidebar-content {
    padding: var(--spacing-base) 0;
    height: 100%;
    /* No scrollbars when collapsed */
    overflow-y: hidden;
    overflow-x: hidden;
}

/* Enable scrolling only when expanded */
.sidebar.expanded .sidebar-content,
.sidebar:hover .sidebar-content {
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-base);
    color: var(--grey-400);
    text-decoration: none;
    transition: var(--transition-fast);
    white-space: nowrap;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
}

.nav-item:hover {
    background: var(--grey-700);
    color: var(--text-inverse);
}

.nav-item.active {
    background: var(--grey-700);
    color: var(--text-inverse);
    border-left-color: var(--orange-subtle);
}

.nav-item svg {
    min-width: 20px;
    margin-right: var(--spacing-md);
}

.nav-text {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sidebar:hover .nav-text {
    opacity: 1;
}

/* Collapsed state: center icons and hide labels */
.sidebar:not(.expanded):not(:hover) .nav-item {
    justify-content: center;
    padding: var(--spacing-md) 0; /* remove side padding so icons center */
}
.sidebar:not(.expanded):not(:hover) .nav-item svg {
    margin-right: 0;
}
.sidebar:not(.expanded):not(:hover) .nav-text {
    display: none;
}

/* Expanded state (via class or hover): show labels */
.sidebar.expanded .nav-text {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: var(--grey-700);
    margin: var(--spacing-base) var(--spacing-md);
}

/* Fine‑tune: Lists icon appears slightly right-shifted. Make it a bit larger and nudge left when collapsed */
.sidebar:not(.expanded):not(:hover) .nav-item[data-page="lists"] svg {
    width: 23px;
    height: 23px;
    transform: translateX(-2px);
}

/* === CONTENT AREA === */
.content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 3;
    background: var(--bg-main);
    overflow: hidden;
    position: relative;
}

/* === DASHBOARD (SCROLLABLE) === */
.dashboard-content {
    padding: var(--spacing-base);
    overflow-y: auto;
    height: 100%;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-base);
    margin-bottom: var(--spacing-base);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    text-align: center;
    box-shadow: var(--elevation-card);
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-card-hover);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-inverse);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-inverse);
    font-size: 0.875rem;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    margin-bottom: var(--spacing-base);
    box-shadow: var(--elevation-card);
}

/* Ensure bottom spacing on dashboard equals one base unit (25px) */
.dashboard-content .dashboard-card:last-child {
    margin-bottom: 0;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

/* === CONTAINER-BASED PAGES === */
.page {
    display: none;
    height: 100%;
}

.page.active {
    display: block;
}

.page-container {
    margin: var(--spacing-base);
    height: calc(100vh - var(--topbar-height) - (var(--spacing-base) * 2));
    background: var(--bg-container);
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-page);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-header {
    padding: var(--spacing-base);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-container);
}

/* Sequence Builder header layout: place title right of back arrow */
#sequence-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#sequence-builder-header .page-title-section {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* keep title next to back button */
    gap: var(--spacing-base);
}

/* Sequence Builder header actions ordering */
#sequence-builder-header .page-actions .contact-search-container { order: 0; }
#sequence-builder-header .page-actions #contacts-btn { order: 1; }
#sequence-builder-header .page-actions #add-step-btn { order: 2; }

/* Tighter, even spacing between search, Contacts, and Add Step */
#sequence-builder-header .page-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* bring search closer to Contacts */
}

/* Ensure the search input fills the 300px container to avoid extra internal gap */
#sequence-builder-header .contact-search-container .search-input-small {
    width: 300px;
}

.page-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.page-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.page-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-tabs {
    display: flex;
    gap: var(--spacing-sm);
}

.filter-tab {
    background: none;
    border: none;
    color: var(--grey-400);
    padding: 8px var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.875rem;
}

.filter-tab.active {
    background: var(--orange-subtle);
    color: var(--text-inverse);
}

.filter-tab:hover:not(.active) {
    background: var(--grey-700);
    color: var(--text-inverse);
}

.tab-count {
    margin-left: 6px;
    font-size: 0.75rem;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.search-input-small {
    width: 200px;
    height: 40px;
    background: var(--bg-item);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-input-small::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-input-small:hover {
    border-color: var(--grey-500);
    background: var(--bg-widget);
}

.search-input-small:focus {
    outline: none;
    border-color: var(--orange-subtle);
    background: var(--bg-widget);
    box-shadow: 0 0 0 3px rgba(255,145,0,0.1);
    transform: translateY(-1px);
}

.results-count {
    color: var(--grey-400);
    font-size: 0.875rem;
}

/* === PEOPLE PAGE: TOOLBAR & FILTERS === */
.people-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    position: relative;
}

.filter-panel {
    margin-top: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: var(--elevation-card);
    transition: all 0.3s ease;
    overflow: visible !important;
}

/* People page filters as dropdown overlay */
#people-page .page-header {
    position: relative;
}

/* Ensure dropdowns are not clipped by parents */
#people-page .page-header,
#people-page .people-toolbar,
#people-filters,
#people-filters .filter-grid,
#people-filters .filter-field {
    overflow: visible !important;
}

/* Ensure dropdowns are not clipped on Calls page as well */
#calls-page .page-header,
#calls-page .people-toolbar,
#calls-filters,
#calls-filters .filter-grid,
#calls-filters .filter-field {
    overflow: visible !important;
}

/* Ensure Calls header is positioning context for absolute panel */
#calls-page .page-header { position: relative; }

#people-filters {
    position: absolute;
    top: calc(100% - 17px);
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

/* Mirror filter panel animation/positioning for Calls page */
#calls-filters {
    position: absolute;
    top: calc(100% - 17px);
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

#people-filters.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#calls-filters.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.filter-tabs-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

/* View toggle button (People/Accounts) */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 2px;
}

.view-toggle .toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-toggle .toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.view-toggle .toggle-btn.active {
    background: var(--orange-subtle);
    color: var(--text-inverse);
}

.view-toggle .toggle-btn.active:hover {
    background: #e55a2b;
}

/* Filter tab styling (also used for toggle buttons) */
.filter-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.filter-tab.active {
    background: var(--orange-subtle);
    color: var(--text-inverse);
}

.filter-tab.active:hover {
    background: #e55a2b;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-md);
}

@media (max-width: 900px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .filter-grid { grid-template-columns: 1fr; }
}

/* Fix filter field layout - keep container but improve styling */
.filter-field {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    transition: all 0.3s ease !important;
}

/* Fix filter input fields - make chips appear inside the input field */
#people-filters .chip-input {
    /* Make the container look like an input field */
    background: var(--bg-item) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--border-radius) !important;
    padding: 8px 12px !important;
    min-height: 40px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 4px !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    z-index: 2 !important; /* base above table rows */
    line-height: 1.2 !important;
    /* Keep input field on same line as chips */
    align-content: flex-start !important;
    /* Center items vertically so caret/placeholder look centered */
    align-items: center !important;
    /* Prevent container from shrinking too much */
    min-width: 200px !important;
    width: 100% !important;
}

/* Duplicate the exact chip-input container styling for Calls filters */
#calls-filters .chip-input {
    background: var(--bg-item) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--border-radius) !important;
    padding: 8px 12px !important;
    min-height: 40px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 4px !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    z-index: 2 !important; /* base above table rows */
    line-height: 1.2 !important;
    align-content: flex-start !important;
    align-items: center !important;
    min-width: 200px !important;
    width: 100% !important;
}

#people-filters .chip-input:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#calls-filters .chip-input:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#people-filters .chip-input:focus-within {
    outline: none !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--orange-subtle) !important; /* match other inputs */
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25) !important; /* match other inputs */
    z-index: 10002 !important; /* raise above neighbors while focused */
}

#calls-filters .chip-input:focus-within {
    outline: none !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--orange-subtle) !important; /* match other inputs */
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25) !important; /* match other inputs */
    z-index: 10002 !important; /* raise above neighbors while focused */
}

/* Ensure the input field itself has no focus styling */
#people-filters .chip-input-field:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

#calls-filters .chip-input-field:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

#people-filters .chip-input-field {
    /* Make the input field blend into the container */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
    flex: 1 1 auto !important;
    min-width: 120px !important;
    max-width: none !important;
    outline: none !important;
    box-shadow: none !important;
    z-index: 2 !important;
    position: relative !important;
    line-height: 1.2 !important;
    height: auto !important;
    resize: none !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    /* Prevent input from wrapping to new line */
    flex-shrink: 0 !important;
    /* Browser autofill disabled via HTML autocomplete="off" attribute */
    /* Slight downward nudge to visually center caret/placeholder */
    padding-top: 2px !important;
}

#calls-filters .chip-input-field {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
    flex: 1 1 auto !important;
    min-width: 120px !important;
    max-width: none !important;
    outline: none !important;
    box-shadow: none !important;
    z-index: 2 !important;
    position: relative !important;
    line-height: 1.2 !important;
    height: auto !important;
    resize: none !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding-top: 2px !important;
}

#people-filters .chip-input-field::placeholder {
    color: var(--text-muted) !important;
}

#calls-filters .chip-input-field::placeholder {
    color: var(--text-muted) !important;
}

/* Hide placeholder when chips are present */
#people-filters .chip-input:has(.chip) .chip-input-field::placeholder {
    opacity: 0 !important;
}

#calls-filters .chip-input:has(.chip) .chip-input-field::placeholder {
    opacity: 0 !important;
}

/* Ensure input field stays on the same line as chips */
#people-filters .chip-input-field {
    flex-basis: auto !important;
    flex-grow: 1 !important;
    flex-shrink: 0 !important;
    width: auto !important;
    max-width: 200px !important;
    min-width: 80px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#calls-filters .chip-input-field {
    flex-basis: auto !important;
    flex-grow: 1 !important;
    flex-shrink: 0 !important;
    width: auto !important;
    max-width: 200px !important;
    min-width: 80px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Collapse the input when not active to remove empty second row */
#people-filters .chip-input.collapsed .chip-input-field {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}

#calls-filters .chip-input.collapsed .chip-input-field {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}

/* Style chips to appear inside the input field */
#people-filters .chip-list {
    /* Flatten wrapper so chips and input share the same flex row */
    display: contents !important;
}

#calls-filters .chip-list { display: contents !important; }

/* Ensure layout order: chips → input → clear */
#people-filters .chip-input .chip { order: 1 !important; }
#people-filters .chip-input .chip-input-field { order: 2 !important; flex: 1 1 60px !important; min-width: 60px !important; }
#people-filters .chip-input .chip-clear { order: 3 !important; flex: 0 0 auto !important; }

#calls-filters .chip-input .chip { order: 1 !important; }
#calls-filters .chip-input .chip-input-field { order: 2 !important; flex: 1 1 60px !important; min-width: 60px !important; }
#calls-filters .chip-input .chip-clear { order: 3 !important; flex: 0 0 auto !important; }

/* Override general chip styles for people filters */
#people-filters .chip-input .chip,
#people-filters .chip-list .chip,
.chip-input .chip {
    background: var(--orange-primary) !important;
    border: 1px solid var(--orange-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 2px 6px !important;
    font-size: 0.8rem !important;
    color: var(--text-inverse) !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    /* Chip animation styles - only for new chips */
    transform-origin: left center !important;
    transition: all 0.2s ease !important;
    /* Keep chips aligned with input text */
    vertical-align: baseline !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    overflow: hidden !important; /* allow width transition on remove */
}

#calls-filters .chip-input .chip,
#calls-filters .chip-list .chip {
    background: var(--orange-primary) !important;
    border: 1px solid var(--orange-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 2px 6px !important;
    font-size: 0.8rem !important;
    color: var(--text-inverse) !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    transform-origin: left center !important;
    transition: all 0.2s ease !important;
    vertical-align: baseline !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Chip slide-in animation - only for new chips */
#people-filters .chip-input .chip.chip-new,
#people-filters .chip-list .chip.chip-new,
.chip-input .chip.chip-new {
    animation: chipSlideIn 0.3s ease-out !important;
}

#calls-filters .chip-input .chip.chip-new,
#calls-filters .chip-list .chip.chip-new {
    animation: chipSlideIn 0.3s ease-out !important;
}

@keyframes chipSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateX(-10px);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05) translateX(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

/* Chip hover animation */
#people-filters .chip-input .chip:hover,
#people-filters .chip-list .chip:hover,
.chip-input .chip:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3) !important;
}

#calls-filters .chip-input .chip:hover,
#calls-filters .chip-list .chip:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3) !important;
}

/* Chip removal animation: smoothly collapse width so siblings slide over */
#people-filters .chip-input .chip.chip-removing,
#people-filters .chip-list .chip.chip-removing,
.chip-input .chip.chip-removing {
    animation: none !important;
    will-change: width, margin, padding, opacity, border-width !important;
    transition: width 180ms cubic-bezier(0.2, 0, 0, 1), margin 180ms cubic-bezier(0.2, 0, 0, 1), padding 180ms cubic-bezier(0.2, 0, 0, 1), opacity 140ms ease, border-width 180ms cubic-bezier(0.2, 0, 0, 1) !important;
    width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0 !important;
    border-width: 0 !important;
}

#calls-filters .chip-input .chip.chip-removing,
#calls-filters .chip-list .chip.chip-removing {
    animation: none !important;
    will-change: width, margin, padding, opacity, border-width !important;
    transition: width 180ms cubic-bezier(0.2, 0, 0, 1), margin 180ms cubic-bezier(0.2, 0, 0, 1), padding 180ms cubic-bezier(0.2, 0, 0, 1), opacity 140ms ease, border-width 180ms cubic-bezier(0.2, 0, 0, 1) !important;
    width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0 !important;
    border-width: 0 !important;
}

/* Override general chip-remove styles for people filters */
#people-filters .chip-input .chip-remove,
#people-filters .chip-list .chip-remove,
.chip-input .chip-remove {
    color: var(--text-inverse) !important;
    cursor: pointer !important;
    margin-left: 4px !important;
    opacity: 0.8 !important;
    background: none !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
}

#calls-filters .chip-input .chip-remove,
#calls-filters .chip-list .chip-remove {
    color: var(--text-inverse) !important;
    cursor: pointer !important;
    margin-left: 4px !important;
    opacity: 0.8 !important;
    background: none !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
}

#people-filters .chip-input .chip-remove:hover,
#people-filters .chip-list .chip-remove:hover,
.chip-input .chip-remove:hover {
    color: var(--text-inverse) !important;
    opacity: 1 !important;
}

#calls-filters .chip-input .chip-remove:hover,
#calls-filters .chip-list .chip-remove:hover {
    color: var(--text-inverse) !important;
    opacity: 1 !important;
}

/* Restore suggestion dropdowns */
#people-filters .chip-suggest {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    z-index: 10010 !important; /* higher than focused chip-input */
    max-height: 200px !important;
    overflow-y: auto !important;
    margin-top: 4px !important;
}

#calls-filters .chip-suggest {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    z-index: 10010 !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    margin-top: 4px !important;
}

#people-filters .chip-suggest-item {
    padding: 8px 12px !important;
    cursor: pointer !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

#calls-filters .chip-suggest-item { 
    padding: 8px 12px !important;
    cursor: pointer !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-light) !important; 
}

#people-filters .chip-suggest-item:hover {
    background: var(--bg-secondary) !important;
    color: var(--text-inverse) !important;
}

#calls-filters .chip-suggest-item:hover { 
    background: var(--bg-secondary) !important; 
    color: var(--text-inverse) !important; 
}

#people-filters .chip-suggest-item:last-child {
    border-bottom: none !important;
}

#calls-filters .chip-suggest-item:last-child { border-bottom: none !important; }

/* Style clear button to work with new layout */
#people-filters .chip-clear {
    background: none !important;
    border: none !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    font-size: 1.2rem !important;
    padding: 4px !important;
    border-radius: var(--border-radius-sm) !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

#calls-filters .chip-clear {
    background: none !important;
    border: none !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    font-size: 1.2rem !important;
    padding: 4px !important;
    border-radius: var(--border-radius-sm) !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

#people-filters .chip-clear:hover {
    background: var(--bg-secondary) !important;
    color: var(--text-inverse) !important;
}

#calls-filters .chip-clear:hover { 
    background: var(--bg-secondary) !important; 
    color: var(--text-inverse) !important; 
}

.filter-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-dark {
    width: 100%;
    height: 34px;
    background: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--border-radius);
    padding: 0 var(--spacing-sm);
    color: var(--text-inverse);
}

/* === CHIP INPUT (tokenized) === */
.chip-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 4px 34px 4px 6px; /* right space for clear button */
    background: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--border-radius);
    position: relative;
}
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
}
.chip-remove {
    background: none;
    border: none;
    color: var(--grey-300);
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    cursor: pointer;
}
.chip-remove:hover {
    background: var(--grey-700);
    color: var(--text-inverse);
}
.chip-input-field {
    flex: 1 1 120px;
    min-width: 120px;
    height: 24px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-inverse);
    font-size: 0.9rem;
}
.chip-input-field::placeholder { color: var(--grey-400); }

.chip-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--grey-700);
    border: 1px solid var(--grey-600);
    color: var(--grey-400);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}
.chip-clear:hover {
    background: var(--grey-600);
    color: var(--text-inverse);
}

.chip-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    max-height: 220px;
    overflow: auto;
    z-index: 15;
}
.chip-suggest .item {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    cursor: pointer;
}
.chip-suggest .item:hover {
    background: var(--grey-700);
    color: var(--text-inverse);
}

/* Force orange chips in people filters (placed after global .chip rules) */
#people-filters .chip,
#people-filters .chip-input .chip,
#people-filters .chip-list .chip {
    background: var(--orange-primary) !important;
    background-color: var(--orange-primary) !important;
    border: 1px solid var(--orange-primary) !important;
    color: var(--text-inverse) !important;
}

/* Also scope to page containers in case chips render outside #people-filters */
#people-page .chip,
#list-detail-filters .chip,
#calls-page .chip {
    background: var(--orange-primary) !important;
    background-color: var(--orange-primary) !important;
    border: 1px solid var(--orange-primary) !important;
    color: var(--text-inverse) !important;
}

.filter-field.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.filter-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Filter action buttons hover effects */
.filter-actions-row .btn-secondary:hover,
.filter-actions-row .btn-primary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--orange-subtle);
    color: var(--text-inverse);
    border: 1px solid var(--border-dark);
    margin-left: 6px;
}

.filter-icon {
    margin-right: 6px;
}

.page-content {
    flex: 1;
    padding: var(--spacing-base);
    overflow-y: auto;
}

/* Emails page: remove inner padding so the email layout touches container edges */
#emails-page .page-content {
    padding: 0;
}

/* === BUTTONS === */
.btn-primary {
    background: var(--grey-700);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    padding: 8px var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    background: var(--grey-600);
    border-color: var(--grey-500);
    transform: translateY(-1px);
}

/* Calls table: Add Contact CTA (global so it loads immediately) */
.add-contact-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-item);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}
.add-contact-cta:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.add-contact-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
}

/* Override for Create Task popover button to ensure orange wins over global */
.task-popover .btn-primary {
    background: var(--orange-primary) !important;
    border-color: var(--orange-primary) !important;
    color: var(--text-inverse) !important;
}
.task-popover .btn-primary:hover {
    filter: brightness(0.95);
    transform: none;
}

.btn-secondary {
    background: var(--grey-600);
    border: 1px solid var(--grey-500);
    color: var(--text-inverse);
    padding: 8px var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--grey-500);
}

.btn-success {
    background: #28a745;
    border: 1px solid #28a745;
    color: var(--text-inverse);
    padding: 6px var(--spacing-sm);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-success:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-text {
    background: none;
    border: none;
    color: var(--grey-400);
    padding: 6px var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.btn-text:hover {
    color: var(--text-inverse);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-text-bordered {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--grey-400);
    padding: 6px var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.btn-text-bordered:hover {
    color: var(--text-inverse);
    background: var(--grey-700);
    border-color: var(--grey-500);
}

/* === TABLE STYLES === */
.table-container {
    overflow: hidden; /* clip rounded corners; horizontal scroll handled by .table-scroll */
    overflow-x: hidden;
    position: relative; /* needed for popovers/modals anchored inside */
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    background: var(--bg-card);
}

/* Inner scroll area so only the table scrolls horizontally */
.table-scroll {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto; /* allow vertical scrolling for table rows */
    flex: 1 1 auto;
    min-height: 0; /* allow flexbox to shrink properly */
}

.data-table {
    /* Allow table to expand horizontally to fit content; container provides scroll */
    width: max-content;
    min-width: 100%;
    border-collapse: separate; /* allow rounded corners and vertical dividers */
    border-spacing: 0;
}

/* === QUICK ACTIONS (Accounts) === */
.qa-cell { min-width: 120px; }
.qa-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.qa-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: #ffffff; /* white icons */
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.qa-btn:hover { 
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.qa-btn svg { display:block; width: 14px; height: 14px; stroke: currentColor; fill: none; }

/* Keep all headers and cells on a single line */
.data-table th,
.data-table td {
    white-space: nowrap;
}

.data-table th {
    background: var(--grey-800);
    color: var(--text-inverse);
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--grey-700);
    border-right: 1px solid var(--grey-700); /* vertical divider */
}

/* Sticky header within the scroll container: fixed vertically, scrolls horizontally */
.table-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--grey-800); /* ensure header covers rows when stuck */
}

.data-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--grey-700);
    border-right: 1px solid var(--grey-700); /* vertical divider */
    color: var(--text-inverse);
}

/* remove last column right border to avoid double border at container edge */
.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

.data-table tr:hover {
    background: var(--grey-800);
}

/* Selected row highlight */
.data-table tr.row-selected {
    background: var(--grey-800);
}

/* Select column */
.data-table .col-select {
    width: 40px;
    text-align: center;
}

.data-table td.col-select {
    text-align: center;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

/* === TOGGLE SWITCH (compact, fits in col-select) === */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  vertical-align: middle;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--grey-700);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.toggle-slider:before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-inverse);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: left var(--transition-fast), transform var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--orange-subtle);
  border-color: var(--orange-subtle);
}
.toggle-switch input:checked + .toggle-slider:before {
  left: calc(100% - 2px - 14px);
}
.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px var(--orange-muted);
}

.row-select,
#select-all-contacts,
#select-all-accounts,
#select-all-lists,
#select-all-calls,
#select-all-tasks {
    width: 16px;
    height: 16px;
    accent-color: var(--orange-subtle);
}

/* Consistent focus ring for table checkboxes */
.data-table input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* === TABLE PAGINATION === */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

/* Provide outer bottom spacing like other pages (People, Accounts, Calls, Sequences) */
#tasks-page .page-container {
    padding-bottom: var(--spacing-base);
    overflow: visible;
}

/* === BULK SELECT POPOVER (step 1) === */
.bulk-select-popover {
    position: fixed;
    min-width: 320px;
    max-width: 420px;
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background-clip: padding-box; /* keep bg inside rounded border */
    clip-path: inset(0 round var(--border-radius)); /* hard-clip the corners */
    box-shadow: var(--elevation-card);
    overflow: hidden; /* ensure children respect rounded corners */
    z-index: 20;
}
.bulk-select-popover .option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}
.bulk-select-popover .hint { color: var(--text-secondary); font-size: 0.85rem; }
.bulk-select-popover input[type="number"],
.bulk-select-popover select {
    height: 30px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    padding: 0 8px;
    width: 90px;
}
/* Hover/placeholder to match other modal controls */
.bulk-select-popover input[type="number"]::placeholder { color: var(--text-muted); }
.bulk-select-popover input[type="number"]:hover,
.bulk-select-popover select:hover { background: var(--grey-680, #545b62); }
.bulk-select-popover .actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Backdrop used to capture outside clicks (kept visually transparent) */
.bulk-select-backdrop {
    position: fixed;
    inset: 0;
    background: transparent; /* no dimming for small popovers */
    z-index: 15; /* below popover (20) */
}

/* Inputs and controls inside the bulk select popover match modal focus styling */
.bulk-select-popover input[type="radio"] { accent-color: var(--orange-subtle); }
.bulk-select-popover input[type="number"],
.bulk-select-popover select { transition: var(--transition-fast); }
.bulk-select-popover input[type="number"]:focus,
.bulk-select-popover select:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
    background: var(--grey-650, #5a6168);
}
.bulk-select-popover input[disabled],
.bulk-select-popover select[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Buttons inside the popover follow app focus ring */
.bulk-select-popover .actions .btn-primary:focus-visible,
.bulk-select-popover .actions .btn-text:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* === BULK ACTIONS MODAL (step 2) === */
.bulk-actions-modal {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 12px; /* just below table header area */
    width: calc(100% - 24px);
    max-width: 1100px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--grey-800);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    z-index: 25;
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.bulk-actions-modal.--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.bulk-actions-modal .bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}
.bulk-actions-modal .spacer { flex: 1 1 auto; }
.bulk-actions-modal .muted { color: var(--text-secondary); }
.bulk-actions-modal .danger { background: var(--red-muted); border-color: var(--red-subtle); }

/* small pill buttons for bar actions */
.bulk-actions-modal .action-btn-sm {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.bulk-actions-modal .action-btn-sm:hover { background: var(--grey-700); }

/* Icons in action buttons */
.bulk-actions-modal .action-btn-sm .icon,
.bulk-actions-modal .action-btn-sm svg {
    width: 14px;
    height: 14px;
}
.bulk-actions-modal .action-btn-sm svg { fill: currentColor; }

.pagination-summary {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    padding: var(--spacing-md) var(--spacing-sm);
    color: var(--text-secondary);
}

/* When pagination is inside a table footer, reduce padding and push right */
.table-footer .table-pagination {
    margin-left: auto;
    padding: 0;
}

/* === PEOPLE PAGE TABLE LAYOUT (pin footer to bottom) === */
#people-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

/* In contact detail mode, remove bottom padding so content uses full height */
#people-page.contact-detail-mode .page-container {
    padding-bottom: 0;
}

#people-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

/* When showing contact details, make the content area scrollable so widgets stay inside the container */
#people-page.contact-detail-mode .page-content {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-bottom: var(--spacing-base); /* 25px bottom breathing room for last widget */
}

/* Remove extra space at bottom in contact detail mode */
#people-page.contact-detail-mode #contact-detail-view > *:last-child {
    margin-bottom: 0;
}

/* Account Detail: exact bottom spacing when scrolled to bottom */
#account-details-page .page-content {
    padding-bottom: 25px; /* ensure 25px space below last card */
}
#account-details-page #account-detail-view > *:last-child {
    margin-bottom: 0; /* avoid extra margin stacking below the last section */
}

#people-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
    /* Allow popovers anchored inside to render rounded corners and shadows */
    overflow: visible;
}

#people-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* === ACCOUNTS PAGE TABLE LAYOUT (pin footer to bottom) === */
#accounts-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

#accounts-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

#accounts-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
    /* Allow popovers anchored inside to render rounded corners and shadows */
    overflow: visible;
}

#accounts-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* === CALLS PAGE TABLE LAYOUT (pin footer to bottom) === */
#calls-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

#calls-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

#calls-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
}

#calls-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* === CALLS PAGE STYLES === */
/* Contact name styling - match People page base colors */
#calls-table .name-cell {
    color: var(--grey-400);
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition-fast);
}

#calls-table .name-cell:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

#calls-table .name-cell:focus {
    outline: none;
}

#calls-table .name-cell:focus-visible {
    outline: 2px solid var(--orange-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Contact name layout */
#calls-table .name-cell .name-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#calls-table .name-cell .avatar-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange-subtle);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

#calls-table .name-cell .name-text {
    display: inline-block;
}

/* Company name styling - match People page base colors */
#calls-table .company-link {
    color: var(--grey-400);
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

#calls-table .company-link:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

#calls-table .company-link:focus {
    outline: none;
}

#calls-table .company-link:focus-visible {
    outline: 2px solid var(--orange-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Company name layout */
#calls-table .company-link .company-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#calls-table .company-link .company-favicon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
}

#calls-table .company-link .company-name {
    display: inline-block;
}

/* === SEQUENCES PAGE TABLE LAYOUT (pin footer to bottom) === */
#sequences-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

#sequences-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

#sequences-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
}

#sequences-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* === LISTS PAGE TABLE LAYOUT (pin footer to bottom) === */
#lists-page .page-container {
    display: flex;
    flex-direction: column;
    /* Keep content visually inside the container */
    padding-bottom: 0;
    overflow: hidden; /* prevent page-content from spilling outside */
}

/* Lists page header positioning for filter panel */
#lists-page .page-header {
    position: relative;
}

/* Lists filter panel (like people page) */
#lists-filters {
    position: absolute;
    top: calc(100% - 17px);
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

#lists-filters.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#lists-page .page-content {
    /* Lists overview: host a dedicated inner grid; avoid grid here to prevent conflicts */
    display: block;
    /* Fixed 25px left/right margins - no scrollbar compensation */
    padding: 25px;
    /* Reserve space for the vertical scrollbar so the visible right margin stays 25px */
    scrollbar-gutter: stable;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    overflow-y: auto; /* confine scroll to the page content */
    overflow-x: hidden; /* avoid horizontal bleed */
}

/* Dedicated grid wrapper for lists overview */
#lists-page #lists-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-base);
    /* No internal padding; spacing is provided by .page-content */
    padding: 0;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
    /* Spacing is handled by #lists-page .page-content padding */
}

#lists-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
}

#lists-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* Ensure the list detail view itself is a flex column so its footer can pin to the bottom */
#lists-page #lists-detail {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Let the scroll area consume remaining space and scroll while footer stays pinned */
#lists-page #lists-detail .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    /* Ensure 25px spacing between the bottom of the scrollable table area and the pinned pagination/footer */
    padding-bottom: 25px;
}

/* === Lists page header layout: group back icon and title together === */
#lists-page .page-title-section {
    justify-content: flex-start; /* left-align children so title sits next to back button */
    align-items: center; /* vertically center icon and title */
    gap: var(--spacing-md); /* small gap between back icon and title */
}

#lists-page .page-title-section .page-actions {
    margin-left: auto; /* keep actions aligned to the right */
}

/* Ensure the title doesn't center itself */
#lists-page .page-title-section .page-title {
    margin: 0; /* no auto margins */
    text-align: left;
    flex: 0 0 auto; /* don't grow to center */
}

/* === List Detail page header layout: back icon + title grouped on left === */
#list-detail-page .page-title-section {
    justify-content: flex-start; /* title directly to the right of back button */
    align-items: center;
    gap: var(--spacing-md);
}

#list-detail-page .page-title-section .page-actions {
    margin-left: auto; /* keep Contacts button aligned to the right */
}

#list-detail-page .page-title-section .page-title {
    margin: 0;
    text-align: left;
    flex: 0 0 auto;
}

/* === LIST DETAIL PAGE TABLE LAYOUT (pin footer to bottom, match People page) === */
#list-detail-page .page-container {
    display: flex;
    flex-direction: column;
    /* No bottom padding here; gap is handled by .table-scroll padding */
    padding-bottom: 0;
    overflow: visible; /* allow inner shadows to render */
}

#list-detail-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

#list-detail-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
}

#list-detail-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing - mirror people page */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

#list-detail-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    /* Allow card box-shadow to render outside its bounds */
    overflow: visible;
}

#list-detail-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
    /* Allow popovers anchored inside to render rounded corners and shadows */
    overflow: visible;
}

#list-detail-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* List Detail table clickable names and companies - mirror people/accounts pages */
#list-detail-table .name-cell {
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-block;
}

#list-detail-table .name-cell:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

#list-detail-table .name-cell:focus {
    outline: none;
}

#list-detail-table .name-cell:focus-visible {
    outline: 2px solid var(--orange-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

#list-detail-table .company-link {
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    outline: none;
    transition: var(--transition-fast);
    display: inline-block;
}

#list-detail-table .company-link:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

#list-detail-table .company-link:focus {
    outline: none;
}

#list-detail-table .company-link:focus-visible {
    outline: 2px solid var(--orange-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* List Detail table: company favicon + name layout (mirror People table) */
#list-detail-table .company-link .company-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#list-detail-table .company-favicon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
}

#list-detail-table .company-name {
    display: inline-block;
}

/* Let the scroll area consume remaining space and scroll while footer stays pinned */
#list-detail-page .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    /* Ensure 25px spacing between the bottom of the scrollable table area and the pinned pagination/footer */
    padding-bottom: 25px;
}

/* Quick Actions (shared) */
.qa-cell { width: 120px; white-space: nowrap; }
.qa-actions { display: inline-flex; gap: 8px; align-items: center; }
.qa-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: var(--bg-item, #3a3f46);
  color: var(--text-inverse, #fff);
  border: 1px solid var(--border-light, #50555c);
  border-radius: 6px; cursor: pointer; line-height: 1;
  transition: all 0.2s ease;
}
.qa-btn:hover { 
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.qa-btn svg { display: block; }

/* === Lists toolbar: swap Quick Search and Filters toggle positions === */
#lists-page #lists-header-toolbar {
    display: flex; /* already via .people-toolbar, but ensure flex here */
}
#lists-page #lists-header-toolbar #lists-view-toggle { order: 0; }
#lists-page #lists-header-toolbar #toggle-lists-filters { order: 1; }
#lists-page #lists-header-toolbar #lists-switch-btn { order: 2; }
#lists-page #lists-header-toolbar #lists-quick-search { order: 3; }

/* Lists detail: prevent initial flicker while data loads */
#lists-page #lists-detail[data-loading] .table-container,
#lists-page #lists-detail[data-loading] .table-footer { visibility: hidden; }

/* Lists page: subtle orange focus ring for quick search and chip inputs */
#lists-page .search-input-small:focus,
#lists-page .search-input-small:focus-visible {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

#lists-page .chip-input:focus-within {
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

/* Center empty state and add horizontal padding so border doesn't hit screen edges */
#lists-page .table-container.--empty {
    justify-content: center; /* vertical center (main axis in column) */
    align-items: center;    /* horizontal center */
    padding-left: var(--spacing-base);
    padding-right: var(--spacing-base);
}

#lists-page .page-content.--empty .empty-state {
    max-width: 500px !important;
    width: 100% !important;
    text-align: center !important;
    z-index: 10 !important;
}

#lists-page #lists-grid.--empty {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: calc(100vh - 240px) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    position: relative !important;
}

/* Web Insights page layout/centering */
#insights-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    overflow: visible; /* allow shadows to render */
}

#insights-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
}

#insights-page .table-container .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
}

/* Center the empty state within the container */
#insights-page .table-container.--empty {
    justify-content: center; /* vertical center (main axis in column) */
    align-items: center;      /* horizontal center */
    padding-left: var(--spacing-base);
    padding-right: var(--spacing-base);
}

#insights-page .table-container.--empty .empty-state {
    align-self: center; /* prevent stretch */
    width: 100%;
    max-width: 820px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(var(--spacing-base) * 2);
    border: 1px dashed var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    min-height: 240px;
}
/* === Call Scripts Page === */
#call-scripts-page .call-scripts-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-base);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Position Call Scripts toolbar on the top-right of the header */
#call-scripts-page .page-header {
  display: flex;
  align-items: flex-start; /* align title and toolbar to the top edge */
}
#call-scripts-page .page-title-section {
  flex: 1 1 auto; /* title group takes remaining space on the left */
  display: flex;            /* stack title and search vertically */
  flex-direction: column;
  align-items: flex-start;  /* left-align the search bar under the title */
  gap: var(--spacing-xs);
}
#call-scripts-page #call-scripts-toolbar {
  margin-left: auto; /* push toolbar to the far right */
  margin-top: 0; /* ensure no extra gap above */
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Make Call Scripts toolbar buttons the same height as primary buttons */
#call-scripts-page #call-scripts-toolbar .action-btn {
  padding: 8px var(--spacing-md); /* match .btn-primary vertical padding */
  line-height: 1; /* consistent vertical rhythm */
  display: inline-flex;
  align-items: center;
}

/* 1px divider between Restart and Widgets */
#call-scripts-page #call-scripts-toolbar .toolbar-divider {
  width: 1px;
  height: 28px; /* visually matches button height */
  background: var(--border-light);
  border-radius: 1px;
  display: inline-block;
  align-self: center;
}

/* Widgets control (Call Scripts page) */
#call-scripts-page #call-scripts-toolbar .widgets-wrap {
  position: relative;
}
#call-scripts-page #call-scripts-toolbar .widgets-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; /* perfect square */
  height: 36px; /* perfect square */
  border-radius: var(--border-radius);
  background: var(--grey-700);
  border: 1px solid var(--border-light);
  color: var(--text-inverse);
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0; /* ensure perfect square */
}
#call-scripts-page #call-scripts-toolbar .widgets-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
#call-scripts-page #call-scripts-toolbar .widgets-btn svg { display: block; }

/* Drawer */
#call-scripts-page #call-scripts-toolbar .widgets-drawer {
  position: absolute;
  right: calc(100% + 8px); /* appear to the left of the button */
  top: 50%;
  /* Start slightly to the right and fade in so it slides left into place */
  transform: translate(10px, -50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--elevation-card);
  padding: 8px 10px;
  display: flex;            /* keep horizontal layout during animations */
  flex-direction: row;
  align-items: center;
  gap: 10px;
  z-index: 20;
  transition: transform 160ms ease, opacity 160ms ease, visibility 0s linear 160ms; /* delay visibility off so it doesn't flicker */
  --arrow-size: 8px; /* square size before rotation */
}

/* Pointed triangle pointing right */
#call-scripts-page #call-scripts-toolbar .widgets-drawer::before,
#call-scripts-page #call-scripts-toolbar .widgets-drawer::after {
  content: "";
  position: absolute;
  width: var(--arrow-size);
  height: var(--arrow-size);
  transform: rotate(45deg);
  pointer-events: none;
  right: calc(-1 * var(--arrow-size) / 2 + 1px);
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

/* Border layer */
#call-scripts-page #call-scripts-toolbar .widgets-drawer::before {
  background: var(--border-light);
}

/* Fill layer */
#call-scripts-page #call-scripts-toolbar .widgets-drawer::after {
  background: var(--bg-card);
  right: calc(-1 * var(--arrow-size) / 2 + 2px);
}

#call-scripts-page #call-scripts-toolbar .widgets-wrap.open .widgets-drawer {
  transform: translate(0, -50%);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

#call-scripts-page #call-scripts-toolbar .widget-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius);
  background: var(--bg-item);
  border: 1px solid var(--border-light);
  color: var(--text-inverse);
  cursor: pointer;
  transition: all 0.2s ease;
}
#call-scripts-page #call-scripts-toolbar .widget-item:hover { 
  background: var(--bg-secondary);
  border-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#call-scripts-page .script-display {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    min-height: 180px;
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 1.3rem;
    transition: height 0.3s ease, min-height 0.3s ease;
    overflow: hidden;
}

/* === Call Scripts: Contact Search === */
#call-scripts-page .contact-search-wrap {
  margin-top: var(--spacing-sm);
  align-self: flex-start; /* ensure it stays under/left of the title */
  max-width: 100%; /* Prevent horizontal overflow */
  overflow: visible; /* Allow suggestions to be visible outside container */
}
#call-scripts-page .contact-search-inner {
  position: relative;
  max-width: 420px;
  width: 100%; /* Make it responsive */
}
#call-scripts-page #call-scripts-contact-search {
  width: 100%;
  max-width: 100%; /* Prevent input from exceeding container */
  position: relative; /* Ensure input stays in place */
  z-index: 1; /* Lower than suggestions but above other content */
}
#call-scripts-page .search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: var(--elevation-card);
  padding: 6px;
  z-index: 1000; /* Higher z-index to ensure visibility */
  max-height: 200px; /* Limit height to show ~5 suggestions */
  overflow-y: auto; /* Enable scrolling for more suggestions */
  min-width: 100%; /* Ensure suggestions are at least as wide as input */
  transform: translateZ(0); /* Create new stacking context to prevent interference */
}
#call-scripts-page .search-suggestions[hidden] { display: none; }
#call-scripts-page .search-suggestions .suggestion-empty {
  padding: 8px 10px;
  color: var(--text-muted);
}
#call-scripts-page .search-suggestions .suggestion-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
#call-scripts-page .search-suggestions .suggestion-item:hover {
  background: var(--grey-700);
}
#call-scripts-page .search-suggestions .sugg-glyph {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange-subtle);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}
#call-scripts-page .search-suggestions .sugg-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0; /* Allow text to wrap/truncate */
}
#call-scripts-page .search-suggestions .sugg-name {
  font-size: 0.95rem;
  color: var(--text-inverse);
  font-weight: 500;
}
#call-scripts-page .search-suggestions .sugg-company {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
#call-scripts-page .search-suggestions .sugg-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
}


.live-insights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.live-insights-header h3 {
  margin: 0;
  color: var(--text-inverse);
  font-size: 1rem;
  font-weight: 600;
}

/* live-call-insights styles removed per request */

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

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-600);
}

.status-indicator.status-active {
  background: #10b981; /* Green for active */
  animation: pulse 2s infinite;
}

.status-indicator.sentiment-positive {
  background: #10b981; /* Green */
}

.status-indicator.sentiment-negative {
  background: #ef4444; /* Red */
}

.status-indicator.sentiment-neutral {
  background: #f59e0b; /* Yellow */
}

/* Non-active states override sentiment color */
.status-indicator.status-waiting {
  background: #f59e0b; /* Amber for waiting */
  animation: pulse 3s infinite;
}

.status-indicator.status-error {
  background: #ef4444; /* Red for offline/error */
  animation: none;
}

.status-indicator.status-inactive {
  background: var(--grey-600); /* Grey for inactive */
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.live-insights-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.live-transcript-section,
.live-tips-section {
  flex: 1;
}

.live-transcript-section h4,
.live-tips-section h4 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--text-inverse);
  font-size: 0.9rem;
  font-weight: 500;
}

.transcript-container,
.tips-container {
  background: var(--bg-main);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-sm);
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
}

.transcript-placeholder,
.tips-placeholder,
.transcript-loading,
.tips-loading {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--spacing-sm);
}

.transcript-content {
  font-size: 0.85rem;
  line-height: 1.4;
}

.transcript-line {
  margin-bottom: var(--spacing-xs);
  padding: 2px 0;
}

.transcript-line.agent {
  color: var(--text-inverse);
}

.transcript-line.customer {
  color: var(--text-secondary);
}

.transcript-line .speaker {
  font-weight: 600;
  margin-right: 8px;
}

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
  border-radius: var(--border-radius);
  border-left: 3px solid;
}

.tip-item.tip-info {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: #3b82f6;
}

.tip-item.tip-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
}

.tip-item.tip-success {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: #10b981;
}

.tip-item.tip-opportunity {
  background: rgba(139, 92, 246, 0.1);
  border-left-color: #8b5cf6;
}

.tip-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.tip-content {
  flex: 1;
}

.tip-message {
  color: var(--text-inverse);
  font-size: 0.85rem;
  line-height: 1.3;
  margin-bottom: 2px;
}

.tip-priority {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.7;
}

.tip-priority-high {
  color: #ef4444;
}

.tip-priority-medium {
  color: #f59e0b;
}

.tip-priority-low {
  color: var(--text-muted);
}

/* === Call Scripts: Layout without inner card === */
#call-scripts-page .page-container {
  display: flex;
  flex-direction: column;
  overflow: visible; /* Allow search suggestions to be visible */
  max-width: 100%; /* Ensure container doesn't exceed viewport */
}
#call-scripts-page .page-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md); /* keep global rhythm; responses will add explicit 25px margin */
  flex: 1 1 auto;
  min-height: 0; /* allow flex child to shrink */
  overflow: visible; /* Allow search suggestions to be visible */
  max-width: 100%; /* Ensure content doesn't exceed viewport */
}
#call-scripts-page #call-scripts-display {
  flex: 1 1 auto;
}
#call-scripts-page #call-scripts-responses {
  position: sticky;
  bottom: 0; /* rely on container padding for the 25px page bottom gap */
  background: var(--bg-container);
  border-top: none; /* remove dividing line between display and buttons */
  padding: 0; /* no inner padding so the element respects outer spacing only */
  margin-top: 1px; /* tightened spacing per request (reduced by 5px) */
  margin-bottom: 0; /* avoid compounding with natural page spacing */
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  width: 100%; /* match script display width */
}
#call-scripts-page #call-scripts-responses.full-width {
  display: block;
}

/* Full-width single action (Dial) should span the full container width */
#call-scripts-page #call-scripts-responses.full-width .dial-btn,
#call-scripts-page #call-scripts-responses.full-width .response-btn {
  width: 100%;
  display: block;
}

/* Ensure grid items naturally fill available width without extra gutters */
#call-scripts-page .response-buttons {
  padding-left: 0;
  padding-right: 0;
}

#call-scripts-page .response-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

#call-scripts-page .response-buttons.full-width {
    grid-template-columns: 1fr;
}

#call-scripts-page .response-btn,
#call-scripts-page .dial-btn {
    background: var(--bg-item);
    color: var(--text-inverse);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 12px var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.05rem;
}

#call-scripts-page .response-btn:hover,
#call-scripts-page .dial-btn:hover {
    background: var(--grey-700);
}

#call-scripts-page .dial-btn { font-weight: 600; }

.empty-title {
    color: var(--text-inverse);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}
.empty-desc {
    max-width: 640px;
    margin-bottom: var(--spacing-base);
}
.empty-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Create List Popover */
.create-list-popover {
    position: fixed; /* set by JS */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: var(--spacing-md);
    z-index: 1100; /* above top bar */
}

.create-list-popover .popover-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.create-list-popover .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.create-list-popover label {
    font-size: 12px;
    color: var(--text-muted);
}

.create-list-popover .input-dark {
    height: 36px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.create-list-popover .input-dark:focus {
    border-color: var(--border-medium);
}

.create-list-popover select.input-dark {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
                      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 28px;
}

.create-list-popover .actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}


/* Delete confirmation modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-modal);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-base) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.modal-body {
    padding: var(--spacing-lg);
    color: var(--text-inverse);
}

.modal-body p {
    margin: 0 0 var(--spacing-base) 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-actions {
    padding: var(--spacing-base) var(--spacing-lg) var(--spacing-lg) var(--spacing-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* === GENERIC APP MODAL (pc-modal) === */
.pc-modal[hidden] { display: none !important; }
.pc-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1300; /* above popovers and bulk bars */
}
.pc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(1.5px);
}
.pc-modal__dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 760px;
    max-width: calc(100vw - 40px);
    max-height: 78vh;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    color: var(--text-inverse);
    overflow: hidden; /* keep rounded corners on children */
    display: flex;
    flex-direction: column;
}

/* Modal form takes full height and manages body/footer layout */
.pc-modal__form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Allow flex child to shrink */
}
.pc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-base) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}
.pc-modal__header .card-title { margin: 0; font-size: 1.1rem; letter-spacing: 0.2px; }
/* .pc-modal__close styles moved to standardized close button section above */
.pc-modal__body { 
    padding: var(--spacing-lg); 
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Allow flex child to shrink */
}
.pc-modal__body label { display:block; margin-bottom: 6px; }
.pc-modal__body .help-text { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }
.pc-modal input[type="text"] {
    background: var(--bg-item);
    border: 2px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 14px;
    height: 40px;
    outline: none;
    transition: all 0.3s ease;
}
.pc-modal input[type="text"]::placeholder { color: var(--text-muted); font-size: 0.85rem; }
.pc-modal input[type="text"]:hover { border-color: var(--grey-500); background: var(--bg-widget); }
.pc-modal input[type="text"]:focus {
    border-color: var(--orange-subtle);
    background: var(--bg-widget);
    box-shadow: 0 0 0 3px rgba(255,145,0,0.1);
    transform: translateY(-1px);
}
.pc-modal input[type="checkbox"] {
    accent-color: var(--orange-subtle);
    width: 16px; height: 16px;
}
.pc-modal__footer {
    padding: var(--spacing-base) var(--spacing-lg) var(--spacing-lg) var(--spacing-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    flex-shrink: 0; /* Prevent footer from shrinking */
    border-top: 1px solid var(--border-light);
}
.pc-modal .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.pc-modal .form-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}
.pc-modal label { color: var(--text-secondary); font-size: 0.9rem; }
.pc-modal input[type="text"],
.pc-modal input[type="email"],
.pc-modal input[type="tel"],
.pc-modal input[type="url"] { width: 100%; }

@media (max-width: 560px) {
    .pc-modal__dialog { width: calc(100vw - 20px); }
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    padding: var(--spacing-sm) var(--spacing-base);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.btn-danger:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
}

.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: var(--spacing-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    color: var(--text-inverse);
    height: 160px; /* Fixed height to prevent vertical stretching */
}
.list-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list-card-title { 
    font-weight: 600; 
    font-size: 1rem; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-card-count { 
    color: var(--text-secondary); 
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-card-meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
}
.list-card-actions {
    margin-top: auto;
    display: flex;
    gap: var(--spacing-sm);
}

.table-pagination .page-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.table-pagination .page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-pagination .page-btn.active {
    background: var(--orange-muted);
    border-color: var(--orange-subtle);
}

.table-pagination .page-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.table-pagination .page-ellipsis {
    padding: 0 4px;
    opacity: 0.7;
}

/* === UNIFIED PAGINATION COMPONENT === */
.unified-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.pagination-arrow {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.pagination-arrow:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.pagination-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-arrow svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.pagination-current-container {
    position: relative;
}

.pagination-current {
    width: 40px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.pagination-current:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pagination-picker {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    display: none;
    z-index: 1000;
    /* Much larger hover zone for better responsiveness */
    padding: 20px;
    margin: -20px -20px 8px -20px;
}

/* Add invisible bridge to the trigger button for better hover continuity */
.pagination-picker::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 12px;
    background: transparent;
}

/* Add downward-pointing arrow to connect with the page number */
.pagination-picker::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--bg-card);
    /* Add subtle border/shadow to match container border */
    filter: drop-shadow(0 1px 0 var(--border-light));
    pointer-events: none;
    z-index: 2;
}

.pagination-picker.visible {
    display: block;
}

.pagination-picker-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 16px;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    /* Ensure content doesn't interfere with hover zone */
    position: relative;
    z-index: 1;
    /* Add slight delay for smoother interaction */
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pagination-picker-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: center;
}

.pagination-picker-pages {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 4px;
}

.picker-page {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    /* Add padding for easier clicking */
    padding: 2px;
    box-sizing: border-box;
}

.picker-page:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.picker-page.active {
    background: var(--orange-subtle);
    border-color: var(--orange-subtle);
    color: var(--text-inverse);
    font-weight: 600;
}

.picker-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    grid-column: span 5;
    margin: 4px 0;
}

/* === TASKS PAGE TABLE LAYOUT (pin footer to bottom) === */
#tasks-page .page-container {
    display: flex;
    flex-direction: column;
    /* Exact 25px bottom gap using base spacing */
    padding-bottom: var(--spacing-base);
    overflow: visible; /* allow inner shadows to render */
}

#tasks-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow children to flex properly */
    padding-bottom: 0; /* ensure table container touches bottom of page container */
    overflow: visible;
}

#tasks-page .table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    /* No extra external margin; page-container padding defines the gap */
    margin-bottom: 0;
    /* Match other pages: clip inner overflow, keep card shadow */
    overflow: hidden;
}

#tasks-page .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto; /* only table content scrolls */
}

#tasks-page .table-footer {
    margin-top: auto; /* push footer to bottom of table container */
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    /* Standard footer padding to match other pages */
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

.task-info {
    display: flex;
    flex-direction: column;
}

.task-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.task-subtitle {
    font-size: 0.75rem;
    color: var(--grey-400);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* === BADGES === */
.type-badge, .priority-badge, .status-badge {
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: lowercase;
}

.type-badge.call {
    background: var(--blue-muted);
    color: var(--blue-subtle);
}

.type-badge.email {
    background: var(--blue-muted);
    color: var(--blue-subtle);
}

.type-badge.follow-up {
    background: var(--yellow-muted);
    color: var(--yellow-subtle);
}

.type-badge.demo {
    background: var(--green-muted);
    color: var(--green-subtle);
}

.type-badge.linkedin-connect,
.type-badge.linkedin-message,
.type-badge.linkedin-view,
.type-badge.linkedin-interact {
    background: #0077b5;
    color: var(--text-inverse);
}

.priority-badge.low {
    background: var(--grey-700);
    color: var(--grey-200);
}

.priority-badge.medium {
    background: var(--yellow-muted);
    color: var(--yellow-subtle);
}

.priority-badge.high {
    background: var(--red-muted);
    color: var(--red-subtle);
}

.status-badge.completed {
    background: var(--green-muted);
    color: var(--green-subtle);
}

.status-badge.pending {
    background: var(--yellow-muted);
    color: var(--yellow-subtle);
}

/* === WIDGET PANEL === */
.widget-panel {
    flex: 1;
    width: var(--widget-panel-width);
    background: var(--bg-widget);
    border-left: 1px solid var(--border-light);
    overflow-y: auto;
    /* Prevent scroll position jumps when widgets expand/collapse */
    overflow-anchor: none;
}

.widget-content {
    padding: var(--spacing-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: var(--elevation-card);
}

/* === PHONE WIDGET === */
.phone-card {
  /* Use the same bottom padding as other widgets to avoid double spacing */
  padding-bottom: var(--spacing-base);
  /* Smooth height transitions when mini-scripts expand/collapse */
  transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* During live calls, slightly reduce bottom padding to avoid a double-gap feeling */
.phone-card.in-call { padding-bottom: var(--spacing-sm); }

/* Subtle pulse when a call is placed */
.phone-card.placing-call {
  animation: pc-pulse 850ms ease-out 1;
}
@keyframes pc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.25); border-color: var(--border-light); }
  35% { box-shadow: 0 8px 28px rgba(255, 107, 53, 0.25), 0 0 0 6px rgba(255, 107, 53, 0.08); border-color: var(--orange-muted); }
  100% { box-shadow: var(--elevation-card); border-color: var(--border-light); }
}

/* Phone widget mount animation helper */
.phone-anim {
  will-change: height, opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  .phone-anim { will-change: auto; }
}

.phone-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-display {
  font-size: 20px;
  text-align: center;
  padding: 10px;
  letter-spacing: 1px;
}

.mic-status {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 16px;
}

.mic-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-500);
}

.mic-status.ok { color: var(--green-400, #10b981); }
.mic-status.ok .status-dot { background: var(--green-400, #10b981); }
.mic-status.warn { color: var(--amber-400, #f59e0b); }
.mic-status.warn .status-dot { background: var(--amber-400, #f59e0b); }
.mic-status.error { color: var(--red-400, #ef4444); }
.mic-status.error .status-dot { background: var(--red-400, #ef4444); }
.mic-status.checking { color: var(--text-secondary); }

.dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dial-key {
  padding: 10px 0;
  border-radius: 10px;
  background: var(--bg-item);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  box-shadow: var(--elevation-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.dial-key:hover {
  background: var(--grey-600);
  transform: translateY(-1px);
}

.dial-key:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.dial-digit { font-size: 18px; line-height: 1; }
.dial-letters { font-size: 10px; opacity: 0.7; }

.dial-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dial-actions { padding-bottom: 0; }
.phone-card.in-call .dial-actions { padding-bottom: 0; }
.dial-actions .call-btn-start {
  flex: 1;
  min-width: 0;
}
.dial-actions .scripts-toggle {
  flex: 0 0 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0;
}
.dial-actions .scripts-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* Dial pad micro-interactions */
.dialpad .dial-key {
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.dialpad .dial-key:active {
  transform: translateY(1px) scale(0.98);
}
.dialpad .dial-key.dtmf-flash {
  background: linear-gradient(180deg, var(--grey-600), var(--grey-700));
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25) inset;
  border-color: var(--orange-muted);
}

/* Notes widget structure */
.widget-card-header {
    display: flex;
    align-items: center; /* center items vertically for even top/bottom padding */
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px; /* reduce gap between header and subtitle */
    padding: 0; /* align with Notes widget */
}
.widget-card-header .widget-title { margin: 0; }

/* Phone widget title container */
.phone-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.my-number-info {
    font-size: inherit;
    color: var(--text-primary);
    font-weight: inherit;
    white-space: nowrap;
}
/* Keep Energy News header on one line by preventing wrap */
.widget-card-header .news-time { white-space: nowrap; }
.notes-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Notes-specific padding to give breathing room for header X and footer buttons */
/* Base padding for all widget cards to keep header/subtitle breathing room */
.widget-card { 
    padding: var(--spacing-md) var(--spacing-base) var(--spacing-base) var(--spacing-base); 
}
/* Deal Calculator: stronger 25px space on all sides to match Energy Health Check */
.deal-card.widget-card { padding: var(--spacing-md) var(--spacing-base); }
/* Energy Health Check: ensure 25px bottom space under Reset */
.health-card.widget-card { padding-bottom: var(--spacing-base); }
/* Ensure header sits exactly at the top padding without extra offset */
.deal-card .widget-card-header { margin-top: 0; padding-top: 0; }
/* Deal Calculator: ensure 25px outer padding (matches Energy Health Check) */
/* removed per revert request */

.notes-footer {
  margin-top: var(--spacing-sm, 8px);
}

/* Notes widget mount animation helper */
.notes-anim {
  will-change: height, opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  .notes-anim { will-change: auto; }
}

/* Notes widget: orange focus ring on textarea */
.widget-card .notes-textarea:focus,
.widget-card .focus-orange {
  outline: none !important;
  border-color: var(--orange-subtle) !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25) !important;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
}

.action-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === DASHBOARD WIDGETS === */
/* Ensure dashboard widgets have proper margins matching Deal Calculator and Energy Health Check */
.widget-panel .widget-card {
    padding: var(--spacing-md) var(--spacing-base) var(--spacing-base) var(--spacing-base);
}

/* Override bottom padding specifically for the phone card during live calls
   to avoid a double-gap under the Hang Up button when inside .widget-panel */
.widget-panel .phone-card.in-call {
    padding-bottom: var(--spacing-sm);
}

/* === WIDGET LISTS === */
.tasks-list, .news-list, .leads-list, .activities-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Today's Tasks Pagination */
.tasks-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
}

.pagination-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    width: auto;
    height: auto;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pagination-btn.active {
    background: var(--bg-item);
    border-color: var(--border-light);
}

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

.pagination-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.task-item.empty-state {
    opacity: 0.7;
}

.task-item.empty-state .task-name {
    font-style: italic;
}

.task-item, .news-item, .lead-item, .activity-item {
    padding: var(--spacing-sm);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

/* Ensure last items in widget lists have proper bottom spacing */
.tasks-list:last-child .task-item:last-child,
.news-list:last-child .news-item:last-child,
.leads-list:last-child .lead-item:last-child,
.activities-list:last-child .activity-item:last-child {
    margin-bottom: 0; /* Remove any extra margin from last items */
}

/* Ensure anchor-based news items render like cards */
.news-item {
    display: block;
    color: inherit;
    text-decoration: none;
}

.task-item:hover, .news-item:hover, .lead-item:hover, .activity-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.task-name, .news-title, .lead-name {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.task-time, .news-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === PRICE WIDGET === */
.price-display {
    text-align: center;
    margin-bottom: 0; /* Ensure no extra margin at bottom */
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--orange-subtle);
}

.price-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.price-change {
    font-size: 0.875rem;
    font-weight: 600;
}

.price-change.positive {
    color: #28a745;
}

.price-change.negative {
    color: #dc3545;
}

/* === ACTIVITY LAYOUT === */
.activity-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* === ACTIVITY ENTITY AVATARS === */
.activity-entity-avatar {
    flex-shrink: 0;
    margin-right: var(--spacing-xs);
}

.activity-entity-avatar-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    /* Removed border as requested */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.activity-entity-avatar-circle.contact-avatar {
    background: var(--orange-subtle);
    color: white;
}

.activity-entity-avatar-circle.company-avatar {
    background: var(--grey-600);
    color: var(--text-primary);
    padding: 2px;
}

.activity-entity-avatar-circle.default-avatar {
    background: var(--grey-500);
    color: var(--text-secondary);
}

.activity-entity-avatar-circle svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    fill: none;
}

/* === ACTIVITY ICONS (MOVED TO RIGHT) === */
.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto; /* Push to right side */
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

/* Activity type specific colors - consistent white icons with white borders */
.activity-icon--call {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.activity-icon--email {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.activity-icon--note {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.activity-icon--task {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.activity-icon--sequence {
    background: transparent;
    border: 1px solid white;
    color: white;
}

.activity-item:hover .activity-icon {
    background: var(--grey-700);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.activity-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 0.9rem;
    line-height: 1.2;
}

.activity-entity {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 4px;
    font-weight: 500;
}

.activity-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

.activity-time {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* === DEALS BOARD (KANBAN) === */
#deals-page .page-container {
    display: flex;
    flex-direction: column;
    padding-bottom: var(--spacing-base);
    overflow: visible;
}

#deals-page .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* allow inner flex children to size properly */
    padding-bottom: 0;
    overflow: visible;
}

/* Outer wrapper that scrolls horizontally */
.board-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: var(--spacing-base);
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;                 /* ensure inner board stretches full height */
    height: clamp(420px, calc(100vh - 320px), 72vh); /* fixed visual height to preserve bottom spacing */
}

/* The lane strip */
.deals-board {
    display: flex;
    gap: var(--spacing-base);
    min-height: 320px;
    align-items: stretch;          /* make columns equal height */
}

.deal-column {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    min-width: 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    height: 100%;                  /* Global Search Modal Styles */
}

/* Ensure any element with [hidden] is never displayed */
[hidden] {
  display: none !important;
}

.global-search-modal {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    background: #3a3f47;
    border: 1px solid #4a5058;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    max-height: 500px;
    overflow: hidden;
}

.search-modal-content {
  padding: 0 !important;
  margin: 0 !important;

    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-results-container {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    width: 100%;
    box-sizing: border-box;
    padding-right: 0;
}

/* When showing empty state, disable scrolling and center content */
.search-results-container.showing-empty {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When container is showing empty state, remove padding from search-empty */
.search-results-container.showing-empty .search-empty {
    padding: 80px 40px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    min-height: 120px;
    color: var(--color-text-secondary);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results {
    padding: 0;
}

.search-category {
    background: var(--bg-item);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    overflow: hidden; /* keep rounded corners on inner elements */
    margin: var(--spacing-sm);
}

/* extra bottom space after last category */
.search-category:last-child {
    margin-bottom: var(--spacing-sm);
}

.category-header {
    padding: 12px 20px;
    background: transparent; /* match light grey container */
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-results {
    padding: 0;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border-light);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-result-item.clickable {
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.clickable:hover {
    background: var(--color-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.result-main {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 4px 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-actions {
    display: flex;
    gap: 4px;
    margin-left: 12px;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.search-result-item:hover .result-actions {
    opacity: 1;
}

.result-action-btn {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 6px;
    font-size: 11px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.result-action-btn.icon-btn {
    padding: 4px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-primary);
}

.result-action-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.result-action-btn.icon-btn svg {
    color: var(--color-text-secondary);
    transition: color 0.15s ease;
    stroke-width: 2;
}

.result-action-btn.icon-btn:hover svg {
    color: white;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
    font-size: 16px;
}

.empty-subtext {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Deals Board Styles */
.board-container {
    height: clamp(420px, calc(100vh - 320px), 72vh);
    overflow-x: auto;
    overflow-y: hidden;
}

.deals-board {
    display: flex;
    gap: 25px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 25px 25px 25px;
}

.board-stage {
    min-width: 300px;
    width: 300px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 200px);
}

.stage-header {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    border-radius: 8px 8px 0 0;
}

.stage-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 4px 0;
    font-size: 14px;
}

.stage-count {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.stage-cards {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deal-card {
    background: transparent; /* let inner body provide the surface */
    border: none;            /* only inner body shows a border */
    border-radius: 6px;
    padding: 6px;            /* tighter spacing around the inner body */
    cursor: default; /* not draggable widget */
    transition: all 0.2s ease;
}

.deal-card:hover {
    border-color: var(--color-border); /* keep consistent, no highlight */
    box-shadow: none; /* remove phantom outer shadow */
}

.deal-card:focus,
.deal-card:focus-visible {
    outline: none;
    box-shadow: none;
}

.deal-card.dragging {
    opacity: 0.9;
    cursor: grabbing;
    background: transparent; /* keep outer transparent while dragging */
    border: 1px solid var(--color-primary); /* clear drag outline */
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* New class names used by scripts/pages/deals.js */
.deal-column-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--bg-item);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deal-column-title {
    font-weight: 600;
    color: var(--color-text-primary);
}

.deal-count {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.deal-list {
    padding: 12px;           /* reduce inner padding of the list */
    flex: 1;
    overflow-y: auto;
    display: flex;           /* control spacing via gap */
    flex-direction: column;
    gap: 8px;                /* tighter space between cards */
}

.drop-target-highlight {
    background: rgba(59, 130, 246, 0.1);
    outline: 2px dashed var(--color-primary);
    outline-offset: -6px;
    border-radius: 6px;
}

.deal-card-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
    font-size: 14px;
}

.deal-card-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0 0 8px 0;
}

.deal-card-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

/* Unified inner body container with border, shadow, darker background */
.deal-card-body {
    background: var(--color-bg-secondary); /* darker than card */
    /* Stronger, always-visible 1px outline with safe fallbacks */
    border: 1px solid var(--color-border-strong, var(--color-border, rgba(255,255,255,0.16)));
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); /* single shadow only */
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
}

/* === Client Management Dashboard === */
.client-dashboard {
    padding: var(--spacing-base);
    overflow-y: auto;
    height: 100%;
}

.dashboard-section {
    margin-bottom: var(--spacing-lg);
}

.dashboard-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-light);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--elevation-card);
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-card-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--orange-subtle);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-inverse);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--grey-400);
    font-weight: 400;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    transition: var(--transition-fast);
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-card-hover);
}

.card-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-container);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-action {
    color: var(--grey-400);
    cursor: pointer;
    transition: var(--transition-fast);
}

.card-action:hover {
    color: var(--text-inverse);
}

.card-content {
    padding: var(--spacing-md);
}

/* Metric Rows */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--grey-400);
    font-size: 0.875rem;
    font-weight: 400;
}

.metric-value {
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Health Metrics */
.health-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.health-metric {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-container);
    border-radius: var(--border-radius-sm);
}

.health-score {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-inverse);
}

.health-score.excellent {
    background: var(--green-subtle);
}

.health-score.good {
    background: var(--blue-subtle);
}

.health-score.warning {
    background: var(--yellow-subtle);
}

.health-label {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.health-count {
    color: var(--grey-400);
    font-size: 0.875rem;
}

/* Communication Stats */
.communication-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comm-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-container);
    border-radius: var(--border-radius-sm);
}

.comm-icon {
    width: 36px;
    height: 36px;
    background: var(--orange-subtle);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.comm-details {
    flex: 1;
}

.comm-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-inverse);
    margin-bottom: 2px;
}

.comm-label {
    font-size: 0.75rem;
    color: var(--grey-400);
    font-weight: 400;
}

/* Segmentation Chart */
.segmentation-chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.segment-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.segment-bar {
    width: 60px;
    height: 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.segment-bar.enterprise {
    background: var(--green-subtle);
    width: 80px;
}

.segment-bar.midmarket {
    background: var(--blue-subtle);
    width: 100px;
}

.segment-bar.smb {
    background: var(--yellow-subtle);
    width: 60px;
}

.segment-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.segment-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.segment-value {
    color: var(--grey-400);
    font-size: 0.875rem;
    font-weight: 400;
}

/* === Enhanced Widget Styling === */

/* Widget Card Base Styling */
.health-card,
.deal-card {
    background: linear-gradient(135deg, var(--bg-widget), var(--bg-container));
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.health-card:hover,
.deal-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

/* Widget Headers */
.health-card .widget-title,
.deal-card .widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.health-subtitle,
.deal-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 4px 0 16px 0; /* minimal gap between title and subtitle */
    line-height: 1.5;
}

/* Entity Info Display */
.health-entity-info {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.health-entity-info:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.health-entity-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    transition: color 0.2s ease;
}

.health-entity-info:hover .health-entity-name {
    color: var(--accent-color);
}

.health-entity-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.health-entity-info:hover .health-entity-type {
    background: var(--accent-color);
    color: white;
    letter-spacing: 0.5px;
}

/* Section Pills with Enhanced Styling */
.health-section-pill,
.deal-section-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.health-section-pill.active,
.deal-section-pill.active {
    background: var(--orange-subtle);
    border-color: var(--orange-subtle);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(255,145,0,0.2);
}

.health-section-pill.completed,
.deal-section-pill.completed {
    background: #10b981;
    border-color: #10b981;
    color: var(--text-inverse);
}

.health-section-icon,
.deal-section-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-widget);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.health-section-pill.active .health-section-icon,
.deal-section-pill.active .deal-section-icon {
    background: rgba(255,255,255,0.2);
    color: var(--text-inverse);
}

.health-section-pill.completed .health-section-icon,
.deal-section-pill.completed .deal-section-icon {
    background: rgba(255,255,255,0.2);
    color: var(--text-inverse);
}

/* === STANDARDIZED INPUT FIELD STYLES === */
/* Base input styling - applies to all input fields across the site */
.input-standard,
.health-form-input,
.deal-form-input,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="password"],
select,
textarea {
    height: 40px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid var(--border-light);
    background: var(--bg-item);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

/* Textarea specific adjustments */
textarea.input-standard,
textarea {
    height: auto;
    min-height: 80px;
    resize: vertical;
    line-height: 1.4;
}

/* Select specific adjustments */
select.input-standard,
select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), 
                      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

select.input-standard option,
select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

/* === STANDARDIZED HOVER AND FOCUS EFFECTS === */
/* Hover effects for all input fields */
.input-standard:hover,
.health-form-input:hover,
.deal-form-input:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
    border-color: var(--grey-500);
    background: var(--bg-widget);
}

/* Focus effects for all input fields */
.input-standard:focus,
.health-form-input:focus,
.deal-form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--orange-subtle);
    background: var(--bg-widget);
    box-shadow: 0 0 0 3px rgba(255,145,0,0.1);
    transform: translateY(-1px);
}

/* Placeholder styling for all input fields */
.input-standard::placeholder,
.health-form-input::placeholder,
.deal-form-input::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
input[type="tel"]::placeholder,
input[type="url"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
}

/* Keep dark background when browser autofill or suggestions are applied */
.input-standard:-webkit-autofill,
.input-standard:-webkit-autofill:hover,
.input-standard:-webkit-autofill:focus,
.health-form-input:-webkit-autofill,
.health-form-input:-webkit-autofill:hover,
.health-form-input:-webkit-autofill:focus,
.deal-form-input:-webkit-autofill,
.deal-form-input:-webkit-autofill:hover,
.deal-form-input:-webkit-autofill:focus,
input[type="text"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus,
input[type="email"]:-webkit-autofill,
input[type="email"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:focus,
input[type="number"]:-webkit-autofill,
input[type="number"]:-webkit-autofill:hover,
input[type="number"]:-webkit-autofill:focus,
input[type="search"]:-webkit-autofill,
input[type="search"]:-webkit-autofill:hover,
input[type="search"]:-webkit-autofill:focus,
input[type="tel"]:-webkit-autofill,
input[type="tel"]:-webkit-autofill:hover,
input[type="tel"]:-webkit-autofill:focus,
input[type="url"]:-webkit-autofill,
input[type="url"]:-webkit-autofill:hover,
input[type="url"]:-webkit-autofill:focus,
input[type="password"]:-webkit-autofill,
input[type="password"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-widget) inset !important;
            box-shadow: 0 0 0px 1000px var(--bg-widget) inset !important;
    border-color: var(--border-light) !important;
}

/* Firefox autofill */
.input-standard:-moz-autofill,
.health-form-input:-moz-autofill,
.deal-form-input:-moz-autofill,
input[type="text"]:-moz-autofill,
input[type="email"]:-moz-autofill,
input[type="number"]:-moz-autofill,
input[type="search"]:-moz-autofill,
input[type="tel"]:-moz-autofill,
input[type="url"]:-moz-autofill,
input[type="password"]:-moz-autofill {
    box-shadow: 0 0 0px 1000px var(--bg-widget) inset;
    -moz-text-fill-color: var(--text-primary);
}

/* Remove number spinners for all number inputs */
.input-standard[type="number"],
.health-form-input[type="number"],
.deal-form-input[type="number"],
input[type="number"] { 
    -moz-appearance: textfield; 
    appearance: textfield; 
}

.input-standard[type="number"]::-webkit-outer-spin-button,
.input-standard[type="number"]::-webkit-inner-spin-button,
.health-form-input[type="number"]::-webkit-outer-spin-button,
.health-form-input[type="number"]::-webkit-inner-spin-button,
.deal-form-input[type="number"]::-webkit-outer-spin-button,
.deal-form-input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

/* Input Labels */
.health-input-label,
.deal-input-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input Groups */
.health-input-group,
.deal-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

/* Enhanced Button Styling */
.health-calculate-btn,
.deal-calculate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 160px;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--orange-subtle), #e67e22);
    color: var(--text-inverse);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255,145,0,0.3);
    cursor: pointer;
}

.health-calculate-btn:hover,
.deal-calculate-btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,145,0,0.4);
    filter: brightness(1.1);
}

.health-calculate-btn:active,
.deal-calculate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255,145,0,0.3);
}

.health-calculate-btn:disabled,
.deal-calculate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Reset Button Styling */
.health-reset-btn,
.deal-reset-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--grey-600);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.health-reset-btn:hover,
.deal-reset-btn:hover { 
    background: var(--grey-700); 
    color: var(--text-inverse);
    border-color: var(--grey-500);
    transform: translateY(-1px);
}

/* Widget body: no extra padding; sections control spacing */
.health-card .health-body,
.deal-card .deal-body { 
    padding: 0; /* single source of side spacing from .widget-card padding */
    transition: height 0.35s cubic-bezier(0.4,0,0.2,1);
    will-change: height;
}

/* Form Sections Container - Clean slate with identical inner gutter */
.health-form-sections { padding: 0; margin: 0; }
.deal-form-sections { padding: 0; margin: 0; }

/* Clean slate for inner groups to avoid hidden padding diffs */
.health-section-header, .deal-section-header,
.health-inputs, .deal-inputs { padding: 0; margin: 0; }

/* Form Sections - Clean slate with consistent padding */
.health-form-section,
.deal-form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 16px; /* content buffer so inputs don't touch border */
    margin: var(--spacing-sm) 0; /* revert to single source of left/right via card padding */
    transition: all 0.3s ease;
}

/* Health CTA block: show button alone (no border/background) */
#health-section-cta {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0; /* full-width like adjacent sections and reset button */
    margin: var(--spacing-sm) 0; /* align vertical rhythm with sections */
}
#health-section-cta .health-calculate-btn {
    width: 100%;
    box-sizing: border-box;
}

/* Health reset button: full width to match CTA */
.health-button-group .health-reset-btn {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 20px;
}

/* Deal Calculator: ensure extra bottom breathing room inside orange border */
.deal-form-section { padding: 12px 16px 18px; }

/* Deal Calculator buttons: full width and identical sizing */
.deal-button-group { flex-direction: column; }
.deal-calculate-btn, .deal-reset-btn { width: 100%; box-sizing: border-box; }
.deal-reset-btn { padding: 12px 20px; }

/* Trim extra space at the edges to avoid double margins */
.health-form-section:first-child,
.deal-form-section:first-child { margin-top: 0; }
.health-form-section:last-child,
.deal-form-section:last-child { margin-bottom: 0; }

/* === LUSHA WIDGET === */
.lusha-card {
    /* Use standard widget card padding */
    padding: var(--spacing-md) var(--spacing-base) var(--spacing-base) var(--spacing-base);
    display: flex;
    flex-direction: column;
}

.lusha-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
}

.lusha-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
    min-height: 0; /* allow children to define scroll */
}

.lusha-search-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.lusha-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lusha-input-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.lusha-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-item);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.lusha-form-input:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.lusha-form-input::placeholder {
    color: var(--text-muted);
}

.lusha-button-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.lusha-search-btn {
    flex: 1;
    padding: 12px 20px;
    background: var(--orange-subtle);
    color: var(--text-inverse);
    border: 1px solid var(--orange-subtle);
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.lusha-search-btn:hover:not(:disabled) {
    background: #e55a2b;
    border-color: #d9481f;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lusha-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.lusha-reset-btn {
    padding: 12px 20px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.lusha-reset-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading state */
.lusha-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    text-align: center;
}

.lusha-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.lusha-loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Results section */
.lusha-results {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.lusha-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-light);
}

.lusha-results-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.lusha-results-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lusha-contacts-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.lusha-contact-item {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    transition: var(--transition-fast);
}

.lusha-contact-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lusha-contact-header {
    margin-bottom: var(--spacing-sm);
}

.lusha-contact-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 2px;
}

.lusha-contact-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lusha-contact-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.lusha-contact-detail {
    display: flex;
    gap: 8px;
    font-size: 0.9rem;
}

.lusha-detail-label {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
}

.lusha-detail-value {
    color: var(--text-primary);
    flex: 1;
}

.lusha-contact-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.lusha-action-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.lusha-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lusha-no-results {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-secondary);
}

.lusha-no-results p {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.9rem;
}

.lusha-no-results p:last-child {
    margin-bottom: 0;
}

/* Animation helper */
.lusha-anim {
    will-change: height, opacity, transform;
}

@media (prefers-reduced-motion: reduce) {
    .lusha-anim { will-change: auto; }
}

/* Lusha tabs */
.lusha-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}
.lusha-tab {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.lusha-tab:hover { background: var(--bg-hover); border-color: var(--accent-color); }
.lusha-tab.active { background: var(--grey-700); color: var(--text-inverse); border-color: var(--grey-600); }

.lusha-panels { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lusha-panel { flex: 1; min-height: 0; overflow: auto; display: none; }
.lusha-panel.active { display: block; }

.health-form-section.active,
.deal-form-section.active {
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 1px rgba(255,145,0,0.2);
}

/* Deal Calculator: enforce 25px gap below the last orange container */
.deal-form-sections .deal-form-section:last-child { margin-bottom: calc(var(--spacing-base) - var(--spacing-md)); }

.health-form-section.completed,
.deal-form-section.completed {
    border-color: #10b981;
    background: rgba(16,185,129,0.05);
}

/* Results Styling */
.health-results,
.deal-results {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-item));
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
    animation: fadeInUp 0.5s ease-out;
}

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

/* Loading Spinner */
.health-loading,
.deal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.health-spinner,
.deal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.health-loading-text,
.deal-loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Deal Calculator Specific */
.deal-summary-box {
    background: linear-gradient(135deg, var(--bg-item), var(--bg-card));
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.deal-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.deal-result-item {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.deal-result-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.deal-result-value.deal-total {
    color: var(--orange-subtle);
    font-size: 1.4rem;
}

.deal-result-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Health Check Specific */
.health-usage-display {
    background: linear-gradient(135deg, var(--bg-item), var(--bg-card));
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

/* Inline SVG icon styling for Health widget */
.health-icon {
    width: 16px;
    height: 16px;
    fill: #ffffff;
    display: inline-block;
    vertical-align: -2px;
}

.health-usage-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Results layout & aesthetics */
.health-main-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    border-radius: 10px;
    color: var(--text-inverse);
    margin-bottom: 16px;
}
.health-main-result.savings {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}
.health-main-result.increase {
    background: linear-gradient(135deg, #ef4444, #f97316);
}
.health-main-result.neutral {
    background: linear-gradient(135deg, var(--grey-700), var(--grey-600));
}
.health-result-amount {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}
.health-result-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.health-details-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.health-detail-item {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    width: 100%;
}
.health-detail-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
}
.health-detail-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.15;
    margin: 0;
}

.health-analysis-box {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}
.health-analysis-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 8px;
}
.health-analysis-text { color: var(--text-secondary); line-height: 1.5; }

/* no responsive overrides needed; list is stacked vertically by design */

.health-usage-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.health-usage-details {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

.health-input-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    border: 1px solid;
    transition: all 0.3s ease;
}

.health-input-feedback.hidden {
    display: none;
}

.health-input-feedback.feedback-danger {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}

.health-input-feedback.feedback-warning {
    background: rgba(245,158,11,0.1);
    color: #f59e0b;
    border-color: rgba(245,158,11,0.3);
}

.health-input-feedback.feedback-success {
    background: rgba(16,185,129,0.1);
    color: #10b981;
    border-color: rgba(16,185,129,0.3);
}

.health-input-feedback.feedback-info {
    background: rgba(30,64,175,0.1);
    color: #1e40af;
    border-color: rgba(30,64,175,0.3);
}

/* Button Groups */
.health-button-group,
.deal-button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Commission Type Styling */
.deal-commission-type {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.deal-commission-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.deal-radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.deal-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: var(--bg-widget);
    border: 1px solid var(--border-light);
    flex: 1;
    justify-content: flex-start;
}

.deal-radio-label:hover {
    background: var(--bg-hover);
    border-color: var(--grey-500);
}

.deal-radio-label input[type="radio"] {
    margin: 0;
    accent-color: var(--orange-subtle);
}

.deal-radio-label input[type="radio"]:checked + .deal-radio-text {
    color: var(--orange-subtle);
    font-weight: 600;
}

.deal-radio-text {
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

/* Input Notes */
.deal-input-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 4px;
    line-height: 1.3;
}

/* Summary Box Styling */
.deal-summary-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.deal-summary-content {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Ready Text Styling */
.health-ready-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    font-style: italic;
    margin: 8px 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .health-card .health-body,
    .deal-card .deal-body {
        padding: 12px 16px;
    }
    
    .health-form-section,
    .deal-form-section {
        padding: 12px;
    }
    
    .health-calculate-btn,
    .deal-calculate-btn {
        min-width: 100%;
    }
    
    .health-button-group,
    .deal-button-group {
        flex-direction: column;
    }
    
    .deal-radio-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .deal-radio-label {
        justify-content: center;
    }
}

/* Remove gaps between lines inside the body */
.deal-card-body .deal-card-title,
.deal-card-body .deal-card-subtitle,
.deal-card-body .deal-card-meta {
    margin: 0;           /* no extra spacing between lines */
    padding: 0;          /* ensure tight stack */
    border: none;        /* undo previous border style */
    background: none;
}

/* Red dotted insertion marker for drop position (full rectangle) */
.deal-drop-placeholder {
    border: 2px dotted #ff4d4f;
    height: 60px; /* JS syncs this to the dragged card's height */
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    pointer-events: none;
    background: transparent;
}

/* Custom drag ghost container (different color than its list container) */
.deal-card-ghost {
    position: absolute;
    top: -10000px; /* keep offscreen */
    left: -10000px;
    padding: 12px;
    border-radius: 6px;
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-primary);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    color: var(--color-text-primary);
    pointer-events: none;
    z-index: 9999;
}

.deal-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
    font-size: 14px;
}

.deal-company {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0 0 8px 0;
}

.deal-value {
    font-weight: 600;
    color: var(--color-success);
    font-size: 14px;
    margin: 0 0 8px 0;
}

.deal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.stage-cards.drag-over {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
}

/* === CONTACT DETAIL STYLES === */
.contact-detail {
    display: contents; /* flatten wrapper: children render directly in parent flow */
}
.contact-detail-container {
    height: 100%;
    overflow-y: auto;
    background: var(--bg-container);
    border: 1px solid var(--border-light);
    border-top: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: var(--spacing-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

/* Avoid double bottom spacing inside contact detail flow */
.contact-detail-container > .page-content {
    padding-bottom: 0;
}

/* Remove the nested page-header styles since header is now at root level */

.contact-header-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.contact-header-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.avatar-circle-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange-subtle);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Account header favicon (fallback to initials avatar if image fails) */
.contact-header-profile .avatar-favicon {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
    background: var(--bg-item, #3a3f46);
    padding: 4px;
    box-sizing: border-box;
    object-fit: cover;
}

.contact-header-text {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.contact-page-title {
    margin: 0;
    font-size: 1.5rem;
}

.contact-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.linkedin-header-btn {
    margin-left: var(--spacing-sm);
}

.contact-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Icon-only square back button */
.back-btn--icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;           /* remove text padding */
    gap: 0;               /* no gap since icon-only */
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-btn--icon svg {
    width: 18px;
    height: 18px;
}

/* Page title row for inline back button and title */
.page-title-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.contact-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.contact-profile-section {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    max-width: 100%;
}

.contact-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--orange-subtle);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.contact-basic-info {
    flex: 1;
}

.contact-name {
font-size: 1.75rem;
font-weight: 600;
color: var(--text-primary);
}

/* Overrides: dropdown and preview picker use compact title size */
#contact-search-results .contact-name,
.contact-search-results .contact-name,
.contact-result .contact-name { 
font-size: 0.82rem; 
line-height: 1.2; 
}

.preview-results .title { 
font-size: 0.82rem; 
}

/* Compact Add button inside search dropdown */
#contact-search-results .btn-add-contact,
.contact-search-results .btn-add-contact {
padding: 2px 10px;
font-size: 11px;
}

/* Ensure action area doesn't shrink or overlap */
.contact-result .contact-action { flex: 0 0 auto; }

.contact-title-company {
font-size: 1rem;
color: var(--text-secondary);
margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.contact-quick-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.quick-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    background: var(--bg-item);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-details-grid {
    margin-bottom: var(--spacing-xl);
}

.contact-info-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-base);
    box-shadow: var(--elevation-card);
    max-width: 100%;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-md) 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Account Detail: links inside info values */
#account-detail-view .info-value a,
#account-detail-view .info-value-wrap a {
    color: var(--text-primary);
    text-decoration: none;
    outline: none;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast), text-underline-offset var(--transition-fast), text-decoration-thickness var(--transition-fast), text-shadow var(--transition-fast);
}
#account-detail-view .info-value a:visited,
#account-detail-view .info-value-wrap a:visited {
    color: var(--text-primary); /* avoid default visited purple */
}
#account-detail-view .info-value a:hover,
#account-detail-view .info-value-wrap a:hover {
    color: var(--text-inverse);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}
#account-detail-view .info-value a:focus,
#account-detail-view .info-value-wrap a:focus { outline: none; }
#account-detail-view .info-value a:focus-visible,
#account-detail-view .info-value-wrap a:focus-visible {
    color: var(--text-inverse);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}

.info-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* Hover-edit and copy actions for contact info */
.info-value-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding-right: 64px; /* space for action buttons */
}
.info-value-text {
    cursor: pointer; /* click-to-copy */
}
#contact-detail-view .info-value-wrap { max-width: 100%; display: flex; width: 100%; padding-right: 0; align-items: center; min-height: 24px; }
#account-detail-view .info-value-wrap { max-width: 100%; display: flex; width: 100%; padding-right: 0; align-items: center; min-height: 24px; }
#contact-detail-view .info-value .info-value-text,
#account-detail-view .info-value .info-value-text,
#account-detail-view .info-value-wrap .info-value-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal; /* override parent break-word */
    min-width: 0;       /* allow flex shrink */
    flex: 1 1 auto;     /* occupy available space next to actions */
}
/* Keep consistent line height to avoid vertical jump on hover */
#contact-detail-view .info-value { line-height: 24px; }
#account-detail-view .info-value-wrap { line-height: 24px; }
/* Keep edit input and Save/Cancel on the same line for account details */
#account-detail-view .info-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0; /* allow children to shrink inside grid cell */
}
#account-detail-view .info-input-wrap .info-edit-input {

/* Email Status Indicator */
.email-status-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: #10b981; /* green-500 */
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    padding: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.email-status-indicator svg {
    width: 12px;
    height: 12px;
    stroke: #10b981;
    fill: none;
}

.email-status-indicator:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* Phone Field Dropdown */
.phone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--elevation-card);
    z-index: 1000;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.phone-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

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

.phone-dropdown-item:hover {
    background: var(--grey-800);
}

.phone-dropdown-item.selected {
    background: var(--primary-700);
    color: white;
}

.phone-dropdown-item .phone-type {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.phone-dropdown-item .phone-number {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.phone-dropdown-item.selected .phone-number {
    color: rgba(255, 255, 255, 0.9);
}

.phone-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

/* === CSV LIST ASSIGNMENT DROPDOWN === */
.csv-list-dropdown-wrap {
    position: relative;
    width: 100%;
}

.csv-list-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-fast);
    height: 42px;
}

.csv-list-trigger:hover {
    background: var(--grey-680, #545b62);
    border-color: var(--border-medium);
}

.csv-list-trigger:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.csv-list-trigger .dropdown-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.csv-list-trigger.open .dropdown-arrow {
    transform: rotate(180deg);
}

.csv-list-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--elevation-card);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    animation: csvDropdownFadeIn 0.2s ease;
}

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

.csv-list-dropdown[hidden] {
    display: none;
}

.csv-list-items {
    display: flex;
    flex-direction: column;
}

.csv-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.15s ease;
    color: var(--text-primary);
}

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

.csv-list-item:hover {
    background: var(--grey-800);
}

.csv-list-item.selected {
    background: var(--primary-700);
    color: white;
}

.csv-list-item.create-new {
    border-bottom: 2px solid var(--border-medium);
    font-weight: 600;
    color: var(--orange-primary);
}

.csv-list-item.create-new:hover {
    background: var(--orange-subtle);
    color: white;
}

.csv-list-item .list-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.csv-list-item .list-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.csv-list-item.selected .list-count {
    color: rgba(255, 255, 255, 0.8);
}

.csv-list-item.create-new .list-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

/* Create List Form */
.csv-list-create-form {
    display: none !important;
}

.csv-list-create-form.expanded {
    display: block !important;
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    animation: formSlideIn 0.3s ease-out forwards;
}

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

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

.csv-list-create-form .form-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.csv-list-create-form .input-dark {
    width: 100%;
    height: 36px;
    background: var(--bg-item);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    margin-bottom: 10px;
    transition: var(--transition-fast);
}

.csv-list-create-form .input-dark:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.csv-list-create-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.csv-list-create-form .btn-secondary,
.csv-list-create-form .btn-primary {
    padding: 6px 12px;
    font-size: 0.85rem;
    height: 32px;
    border-radius: var(--border-radius-sm);
}

/* Account Contacts Section */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    cursor: pointer;
}

.contact-item:hover {
    background: var(--grey-800);
    border-color: var(--border-medium);
}

.contact-avatar {
    flex-shrink: 0;
}

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

/* Force contact name size in account contacts section */
#account-contacts-list .contact-item .contact-name,
.contacts-list .contact-item .contact-name,
.contact-info .contact-name {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-details span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contact-title {
    font-weight: 500;
}

.contact-email {
    color: var(--primary-400);
}

.contact-phone {
    color: var(--text-secondary);
}

.contact-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.contact-quick-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.contact-quick-action-btn:hover {
    background: var(--grey-700);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.contact-quick-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.contacts-placeholder {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-style: italic;
}
    width: auto; /* override global width:100% to keep actions inline */
    flex: 1 1 0%; /* allow input to shrink so actions never wrap */
    min-width: 0;
}
#account-detail-view .info-input-wrap .info-actions {
    display: inline-flex;
    margin-left: 6px;
    flex: 0 0 auto; /* prevent wrapping */
    white-space: nowrap;
}
#account-detail-view .info-value-wrap.editing .info-actions {
    display: inline-flex; /* ensure visible while editing */
}
/* In contact and account detail, show actions to the right without overlapping text */
#contact-detail-view .info-actions,
#account-detail-view .info-actions {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    margin-left: 6px;
    display: none; /* do not reserve space until hover */
}
#contact-detail-view .info-value-wrap:hover .info-actions,
#contact-detail-view .info-value-wrap:focus-within .info-actions,
#account-detail-view .info-value-wrap:hover .info-actions,
#account-detail-view .info-value-wrap:focus-within .info-actions {
    display: inline-flex;
}

/* Keep account detail grid stable to avoid vertical reflow when side panel toggles */
#account-detail-view .info-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  #account-detail-view .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #account-detail-view .info-grid { grid-template-columns: 1fr; }
}
/* Full-width row (e.g., Short Description) */
#account-detail-view .info-row--full { grid-column: 1 / -1; }

/* Contact detail service addresses should use same 4-column grid as account detail */
#contact-service-addresses-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  #contact-service-addresses-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #contact-service-addresses-grid { grid-template-columns: 1fr; }
}
/* Multiline value display */
#account-detail-view .info-value-wrap--multiline { align-items: flex-start; }
#account-detail-view .info-value-wrap .info-value-text--multiline {
    white-space: pre-wrap; /* preserve newlines */
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.4;
}
/* Multiline edit layout */
#account-detail-view .info-input-wrap--multiline { display: flex; align-items: flex-start; gap: 6px; width: 100%; }
#account-detail-view .info-input-wrap--multiline .info-edit-textarea { flex: 1 1 auto; min-height: 96px; }
#account-detail-view .info-input-wrap--multiline .info-actions {
  position: static; /* override absolute */
  transform: none;
  top: auto; right: auto;
  margin-top: 0;
  flex: 0 0 auto;
}
.info-actions {
    position: absolute;
    right: 8px;
    top: 50%; transform: translateY(-50%);
    display: inline-flex;
    gap: 6px;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast, 120ms) ease;
}
.info-value-wrap:hover .info-actions,
.info-value-wrap.editing .info-actions {
    opacity: 1;
    pointer-events: auto;
}

/* Compact icon button style */
.icon-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    cursor: pointer;
    box-sizing: border-box; /* keep total size 24x24 including border */
    transition: background var(--transition-fast, 120ms), color var(--transition-fast, 120ms), border-color var(--transition-fast, 120ms), box-shadow var(--transition-fast, 120ms);
}
.icon-btn-sm:hover {
    background: var(--grey-600);
    color: var(--text-inverse);
    border-color: var(--grey-500);
    box-shadow: none;
}
.icon-btn-sm svg { pointer-events: none; }

/* Editing input */
.info-edit-input {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--border-medium);
    background: var(--bg-item);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    /* Keep input the same visual height as static row (24px) */
    box-sizing: border-box;
    height: 24px;
    line-height: 24px;
    padding: 0 8px;
    outline: none;
}
.info-edit-input:focus {
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.contact-activity-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin: 0 0 var(--spacing-base);
    box-shadow: var(--elevation-card);
    max-width: 100%;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.activity-timeline {
    min-height: 120px;
    position: relative;
}

.activity-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.activity-pagination-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.activity-pagination-btn:hover:not(:disabled) {
    background: var(--grey-700);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.activity-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.activity-pagination-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.activity-pagination-btn.page-btn {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    width: auto;
    height: auto;
    min-width: 32px;
    min-height: 32px;
}

.activity-pagination-btn.page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.activity-pagination-btn.page-btn.active {
    background: var(--bg-item);
    border-color: var(--border-light);
}

.activity-pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    text-align: center;
}

.activity-placeholder .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.placeholder-icon {
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

.placeholder-text {
    font-size: 0.9rem;
}

/* Make contact names clickable in people table */
#people-table .name-cell {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    text-decoration: none;
    outline: none;
    transition: var(--transition-fast);
}

#people-table .name-cell:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Keyboard focus: mirror hover without rectangle */
#people-table .name-cell:focus {
    outline: none;
}
#people-table .name-cell:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* People table: name cell layout with initials avatar */
#people-table .name-cell .name-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
#people-table .name-cell .avatar-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange-subtle);
    color: #fff;
    display: grid;
    place-items: center; /* ensures optical centering for 1–2 letters */
    line-height: 1;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
#people-table .name-cell .name-text {
    display: inline-block;
}

/* Make phone numbers clickable in people table */
#people-table .phone-cell {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    transition: var(--transition-fast);
}

#people-table .phone-cell:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Keyboard focus: mirror hover without rectangle */
#people-table .phone-cell:focus {
    outline: none;
}
#people-table .phone-cell:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Make phone numbers clickable in accounts table (mirror people table) */
#accounts-table .phone-cell,
#accounts-table .click-to-call {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    transition: var(--transition-fast);
}

#accounts-table .phone-cell:hover,
#accounts-table .click-to-call:hover {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Keyboard focus: mirror hover without rectangle */
#accounts-table .phone-cell:focus,
#accounts-table .click-to-call:focus {
    outline: none;
}
#accounts-table .phone-cell:focus-visible,
#accounts-table .click-to-call:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Drag and Drop Styling for Table Headers */
th.dragging {
    opacity: 0.6;
    transform: rotate(2deg);
    z-index: 1000;
    position: relative;
    background: var(--bg-widget) !important;
    border: 2px solid var(--orange-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: none;
}

th.drag-target {
    position: relative;
    transition: all 0.2s ease;
}

th.drag-over {
    background: var(--orange-subtle) !important;
    border-left: 3px solid var(--orange-primary) !important;
    border-right: 3px solid var(--orange-primary) !important;
    position: relative;
    z-index: 999;
}

th.drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--orange-primary) 2px, 
        var(--orange-primary) calc(100% - 2px), 
        transparent 100%);
    opacity: 0.3;
    z-index: -1;
}

th.drag-over::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    pointer-events: none;
}

/* Accounts table drag and drop styling */
#accounts-table th.dragging {
    opacity: 0.6;
    transform: rotate(2deg);
    z-index: 1000;
    position: relative;
    background: var(--bg-widget) !important;
    border: 2px solid var(--orange-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: none;
}

#accounts-table th.drag-target {
    position: relative;
    transition: all 0.2s ease;
}

#accounts-table th.drag-over {
    background: var(--orange-subtle) !important;
    border-left: 3px solid var(--orange-primary) !important;
    border-right: 3px solid var(--orange-primary) !important;
    position: relative;
    z-index: 999;
}

#accounts-table th.drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--orange-primary) 2px, 
        var(--orange-primary) calc(100% - 2px), 
        transparent 100%);
    opacity: 0.3;
    z-index: -1;
}

/* List Detail table drag and drop styling */
#list-detail-table th.dragging {
    opacity: 0.6;
    transform: rotate(2deg);
    z-index: 1000;
    position: relative;
    background: var(--bg-widget) !important;
    border: 2px solid var(--orange-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: none;
}

#list-detail-table th.drag-target {
    position: relative;
    transition: all 0.2s ease;
}

#list-detail-table th.drag-over {
    background: var(--orange-subtle) !important;
    border-left: 3px solid var(--orange-primary) !important;
    border-right: 3px solid var(--orange-primary) !important;
    position: relative;
    z-index: 999;
}

#list-detail-table th.drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--orange-primary) 2px, 
        var(--orange-primary) calc(100% - 2px), 
        transparent 100%);
    opacity: 0.3;
    z-index: -1;
}

#list-detail-table th.drag-over::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    pointer-events: none;
}

#accounts-table th.drag-over::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    pointer-events: none;
}

/* People table: company favicon + name */
#people-table td .company-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#people-table td .company-favicon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
}
#people-table td .company-name {
    display: inline-block;
}

/* Accounts table: make account names behave like People names (subtle brighten, no underline) */
#accounts-table .acct-link {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    text-decoration: none;
    outline: none;
    transition: var(--transition-fast);
    display: inline-block;
}
#accounts-table .acct-link:hover {
    color: var(--text-inverse);
    text-decoration: none;
}
#accounts-table .acct-link:focus { outline: none; }
#accounts-table .acct-link:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Accounts table: company favicon + name layout (mirror People table) */
#accounts-table .name-cell .company-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#accounts-table .name-cell .company-favicon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
}
#accounts-table .name-cell .name-text {
    display: inline-block;
}

/* People table: make company names clickable with subtle brighten (match contact hover) */
#people-table .company-link {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    text-decoration: none;
    outline: none;
    transition: var(--transition-fast);
    display: inline-block;
}
#people-table .company-link:hover {
    color: var(--text-inverse);
    text-decoration: none;
}
#people-table .company-link:focus { outline: none; }
#people-table .company-link:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Contact Detail header: company link subtle hover (match People/Accounts) */
#contact-detail-header .company-link {
    cursor: pointer;
    color: var(--grey-400);
    font-weight: 400;
    text-decoration: none;
    outline: none;
    transition: var(--transition-fast);
}
#contact-detail-header .company-link:hover {
    color: var(--text-inverse);
    text-decoration: none;
}
#contact-detail-header .company-link:focus { outline: none; }
#contact-detail-header .company-link:focus-visible {
    color: var(--text-inverse);
    text-decoration: none;
}

/* Contact Detail header: square, centered Widgets icon button - match scripts page styling */
#contact-detail-header #open-widgets {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;   /* match quick-action icon size */
    height: 36px;  /* enforce perfect square */
    padding: 0;    /* remove default button padding */
    line-height: 0; /* prevent baseline offset */
    box-sizing: border-box; /* include border in total size */
    border-radius: var(--border-radius);
    vertical-align: middle;
    background: var(--grey-700);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    cursor: pointer;
    transition: var(--transition-fast);
}

/* Account Detail header uses the same .contact-title-row animation rules as Contact Detail */
#contact-detail-header #open-widgets svg {
    width: 18px;
    height: 18px;
    display: block; /* avoid inline SVG baseline spacing */
    pointer-events: none;
}

/* Hover effect matching scripts page */
#contact-detail-header #open-widgets:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Widgets drawer container and slide-out behavior */
#contact-detail-header .widgets-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
#contact-detail-header .widgets-drawer {
    position: absolute;
    top: 50%;
    right: calc(100% + 8px); /* appear to the left of the button */
    /* Start slightly to the right and fade in so it slides left into place */
    transform: translate(10px, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
  z-index: 20;
  transition: transform 160ms ease, opacity 160ms ease, visibility 0s linear 160ms; /* delay visibility off so it doesn't flicker */
  --arrow-size: 8px; /* square size before rotation */
}

/* Pointed triangle pointing right */
#contact-detail-header .widgets-drawer::before,
#contact-detail-header .widgets-drawer::after {
  content: "";
  position: absolute;
  width: var(--arrow-size);
  height: var(--arrow-size);
  transform: rotate(45deg);
  pointer-events: none;
  right: calc(-1 * var(--arrow-size) / 2 + 1px);
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

/* Border layer */
#contact-detail-header .widgets-drawer::before {
  background: var(--border-light);
}

/* Fill layer */
#contact-detail-header .widgets-drawer::after {
  background: var(--bg-card);
  right: calc(-1 * var(--arrow-size) / 2 + 2px);
}

#contact-detail-header .widgets-wrap.open .widgets-drawer {
    transform: translate(0, -50%);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 180ms ease, opacity 180ms ease;
}

/* Widget icon buttons inside drawer - match scripts page styling */
#contact-detail-header .widgets-drawer .widget-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    cursor: pointer;
    transition: all 0.2s ease;
}
#contact-detail-header .widgets-drawer .widget-item:hover { 
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
#contact-detail-header .widgets-drawer .widget-item:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
#contact-detail-header .widgets-drawer .widget-item svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

/* Contact Detail header: qa-btn hover effects */
#contact-detail-header .qa-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Standardized hover effects for primary buttons (Add Contact/Account buttons) */
.btn-primary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Account Detail header: same styling as contact detail - match scripts page styling */
#account-detail-header #open-widgets {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;   /* match quick-action icon size */
    height: 36px;  /* enforce perfect square */
    padding: 0;    /* remove default button padding */
    line-height: 0; /* prevent baseline offset */
    box-sizing: border-box; /* include border in total size */
    border-radius: var(--border-radius);
    vertical-align: middle;
    background: var(--grey-700);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    cursor: pointer;
    transition: var(--transition-fast);
}
#account-detail-header #open-widgets svg {
    width: 18px;
    height: 18px;
    display: block; /* avoid inline SVG baseline spacing */
    pointer-events: none;
}

/* Hover effect matching scripts page */
#account-detail-header #open-widgets:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Widgets drawer container and slide-out behavior */
#account-detail-header .widgets-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
#account-detail-header .widgets-drawer {
    position: absolute;
    top: 50%;
    right: calc(100% + 8px); /* appear to the left of the button */
    /* Start slightly to the right and fade in so it slides left into place */
    transform: translate(10px, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    padding: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
  z-index: 20;
  transition: transform 160ms ease, opacity 160ms ease, visibility 0s linear 160ms; /* delay visibility off so it doesn't flicker */
  --arrow-size: 8px; /* square size before rotation */
}

/* Pointed triangle pointing right */
#account-detail-header .widgets-drawer::before,
#account-detail-header .widgets-drawer::after {
  content: "";
  position: absolute;
  width: var(--arrow-size);
  height: var(--arrow-size);
  transform: rotate(45deg);
  pointer-events: none;
  right: calc(-1 * var(--arrow-size) / 2 + 1px);
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

/* Border layer */
#account-detail-header .widgets-drawer::before {
  background: var(--border-light);
}

/* Fill layer */
#account-detail-header .widgets-drawer::after {
  background: var(--bg-card);
  right: calc(-1 * var(--arrow-size) / 2 + 2px);
}

#account-detail-header .widgets-wrap.open .widgets-drawer {
    transform: translate(0, -50%);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 180ms ease, opacity 180ms ease;
}

/* Widget icon buttons inside drawer - match scripts page styling */
#account-detail-header .widgets-drawer .widget-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    color: var(--text-inverse);
    cursor: pointer;
    transition: all 0.2s ease;
}
#account-detail-header .widgets-drawer .widget-item:hover { 
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
#account-detail-header .widgets-drawer .widget-item:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
#account-detail-header .widgets-drawer .widget-item svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

/* Account Detail header: qa-btn hover effects */
#account-detail-header .qa-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* People table: company favicon + name layout (mirror Accounts table) */
#people-table .company-cell__wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#people-table .company-favicon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
}
#people-table .company-name {
    display: inline-block;
}

/* Global favicon styling - consistent rounded edges */
.company-favicon {
    border-radius: 6px !important;
    object-fit: cover;
}

/* Enhanced favicon container styling */
.company-favicon-container {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 28px;
}

.company-favicon-container .company-favicon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

.company-favicon-container .company-favicon-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fallback favicon styling */
.company-favicon.company-favicon--fallback {
    padding: 0; /* Remove padding for SVG icon */
    color: var(--text-primary); /* Ensure icon color is visible */
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-favicon.company-favicon--fallback svg {
    width: 20px; /* Adjust SVG size within the 28px circle */
    height: 20px;
    display: block;
}

/* Favicon container states */
.company-favicon-container.favicon-loaded .company-favicon-fallback {
    display: none;
}

.company-favicon-container.favicon-failed .company-favicon {
    display: none;
}

.company-favicon-container.favicon-failed .company-favicon-fallback {
    display: flex;
}

/* === SMOOTH ICON ANIMATIONS === */
/* Fade-in with scale-up for all icons - GPU accelerated */

/* Company favicons - initial hidden state */
.company-favicon,
.company-favicon-header {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    will-change: opacity, transform;
}

/* Company favicons - loaded/visible state */
.company-favicon.icon-loaded,
.company-favicon-header.icon-loaded {
    opacity: 1;
    transform: scale(1);
}

/* Contact avatar circles - initial hidden state */
.contact-avatar .avatar-circle,
.name-cell__wrap .avatar-circle,
.activity-entity-avatar-circle,
.avatar-initials {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    will-change: opacity, transform;
}

/* Contact avatar circles - visible state */
.contact-avatar .avatar-circle.icon-loaded,
.name-cell__wrap .avatar-circle.icon-loaded,
.activity-entity-avatar-circle.icon-loaded,
.avatar-initials.icon-loaded {
    opacity: 1;
    transform: scale(1);
}

/* SVG icons in buttons and UI elements */
.qa-btn svg,
.action-btn svg,
.toolbar-btn svg,
.search-btn svg,
.call-btn svg,
.pc-modal__close svg,
.nav-item svg,
button svg,
.toast-icon svg {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    will-change: opacity, transform;
}

/* SVG icons - loaded state */
.qa-btn svg.icon-loaded,
.action-btn svg.icon-loaded,
.toolbar-btn svg.icon-loaded,
.search-btn svg.icon-loaded,
.call-btn svg.icon-loaded,
.pc-modal__close svg.icon-loaded,
.nav-item svg.icon-loaded,
button svg.icon-loaded,
.toast-icon svg.icon-loaded {
    opacity: 1;
    transform: scale(1);
}

/* Logo in top bar */
.logo {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    will-change: opacity, transform;
}

.logo.icon-loaded {
    opacity: 1;
    transform: scale(1);
}

/* Fallback icons (building SVG for companies) */
.company-favicon--fallback {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    will-change: opacity, transform;
}

.company-favicon--fallback.icon-loaded {
    opacity: 1;
    transform: scale(1);
}

/* === VARIABLES MODAL === */
.vars-modal {
    width: 720px;
    max-width: calc(100% - 48px);
    background: var(--grey-800);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
    color: var(--text-inverse);
}
.vars-modal .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-base);
    border-bottom: 1px solid var(--border-light);
}
.vars-modal .title-wrap { display: flex; flex-direction: column; gap: 2px; }
.vars-modal .title { font-size: 1.05rem; font-weight: 600; }
.vars-modal .subtitle { color: var(--text-secondary); font-size: 0.9rem; }
/* .vars-modal .close-btn styles moved to standardized close button section above */
.vars-modal .body { padding: var(--spacing-base); max-height: min(70vh, 640px); overflow: auto; }

.vars-tabs { display: flex; gap: 8px; margin-bottom: var(--spacing-md); }
.vars-tab {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--grey-300);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}
.vars-tab:hover { background: var(--grey-700); color: var(--text-inverse); }
.vars-tab.active { background: var(--grey-700); color: var(--text-inverse); border-color: var(--grey-600); }
.vars-tab:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }

.vars-panels { display: block; }
.vars-panel { margin-top: 0; }
.vars-panel[aria-hidden="true"] { display: none; }

.var-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.var-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text-inverse);
    cursor: pointer;
    transition: var(--transition-fast);
}
.var-item:hover { background: var(--grey-700); }
.var-item:focus-visible { outline: 2px solid var(--orange-muted); outline-offset: 2px; }
.var-item-label { font-weight: 500; }
.var-item-token { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; color: var(--grey-300); }

/* Inline variable chip used in rich editor */
.var-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 15px;
    line-height: 1;
    color: var(--text-inverse);
    background: var(--orange-subtle);
    border: 1px solid rgba(255, 107, 53, 0.35);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.12);
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
}

.var-chip:hover {
    background: #e55a2b; /* matches call button hover */
}

/* Highlighted question block used in Call Scripts */
.script-highlight {
    display: inline-block;           /* keep inline with sentence */
    margin: 0 2px;                   /* tiny breathing room */
    padding: 2px 6px;                /* light padding to hint emphasis */
    border-radius: 8px;              /* subtle pill */
    background: rgba(255, 107, 53, 0.06); /* same hue, lighter */
    border: 1px solid rgba(255, 107, 53, 0.25); /* thinner, lighter border */
    box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.08); /* very subtle inner ring */
    color: var(--text-primary);
    font-weight: 600;
}
.script-highlight em {
    font-style: italic;
    color: var(--text-primary);
}

/* HTML editor badge and container */
.html-editor-wrap { position: relative; }
.html-editor-wrap .textarea-dark { padding-top: 26px; }
.html-mode-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    color: var(--text-inverse);
    background: var(--yellow-muted);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    pointer-events: none;
}

/* === PHONE CALL STEP: SKIP SETTINGS === */
/* Scoped to phone-call step so other checkboxes remain unchanged */
.step-card[data-type="phone-call"] .form-row { margin-top: 8px; }
.step-card[data-type="phone-call"] .fmt-label {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
}
.step-card[data-type="phone-call"] .checkbox-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0;
}
.step-card[data-type="phone-call"] .checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    cursor: pointer;
}
.step-card[data-type="phone-call"] .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--orange-subtle);
    cursor: pointer;
}
.step-card[data-type="phone-call"] .checkbox-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
/* number input next to skip checkbox */
.step-card[data-type="phone-call"] .checkbox-row .call-skip-after-days {
    width: 82px; /* fits 3 digits comfortably */
    text-align: center;
    padding: 6px 8px;
}
.step-card[data-type="phone-call"] .checkbox-row .call-skip-after-days:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* LinkedIn task checkbox styling - match phone call styling */
.step-card[data-type="li-connect"] .checkbox-row,
.step-card[data-type="li-message"] .checkbox-row,
.step-card[data-type="li-view-profile"] .checkbox-row,
.step-card[data-type="li-interact-post"] .checkbox-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0;
}
.step-card[data-type="li-connect"] .checkbox-row label,
.step-card[data-type="li-message"] .checkbox-row label,
.step-card[data-type="li-view-profile"] .checkbox-row label,
.step-card[data-type="li-interact-post"] .checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    cursor: pointer;
}
.step-card[data-type="li-connect"] .checkbox-row input[type="checkbox"],
.step-card[data-type="li-message"] .checkbox-row input[type="checkbox"],
.step-card[data-type="li-view-profile"] .checkbox-row input[type="checkbox"],
.step-card[data-type="li-interact-post"] .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--orange-subtle); /* Match other checkboxes */
    cursor: pointer;
}
.step-card[data-type="li-connect"] .checkbox-row input[type="checkbox"]:focus-visible,
.step-card[data-type="li-message"] .checkbox-row input[type="checkbox"]:focus-visible,
.step-card[data-type="li-view-profile"] .checkbox-row input[type="checkbox"]:focus-visible,
.step-card[data-type="li-interact-post"] .checkbox-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}
/* number input next to LinkedIn skip checkbox */
.step-card[data-type="li-connect"] .checkbox-row .linkedin-skip-after-days,
.step-card[data-type="li-message"] .checkbox-row .linkedin-skip-after-days,
.step-card[data-type="li-view-profile"] .checkbox-row .linkedin-skip-after-days,
.step-card[data-type="li-interact-post"] .checkbox-row .linkedin-skip-after-days {
    width: 82px; /* fits 3 digits comfortably */
    text-align: center;
    padding: 6px 8px;
}
.step-card[data-type="li-connect"] .checkbox-row .linkedin-skip-after-days:disabled,
.step-card[data-type="li-message"] .checkbox-row .linkedin-skip-after-days:disabled,
.step-card[data-type="li-view-profile"] .checkbox-row .linkedin-skip-after-days:disabled,
.step-card[data-type="li-interact-post"] .checkbox-row .linkedin-skip-after-days:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* phone call note textarea placeholder styling */
.step-card[data-type="phone-call"] .call-note::placeholder {
    color: var(--grey-400);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* LinkedIn task note textarea styling - match phone call styling */
.step-card[data-type="li-connect"] .linkedin-note::placeholder,
.step-card[data-type="li-message"] .linkedin-note::placeholder,
.step-card[data-type="li-view-profile"] .linkedin-note::placeholder,
.step-card[data-type="li-interact-post"] .linkedin-note::placeholder {
    color: var(--grey-400);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === DRAG AND DROP FOR SEQUENCE STEPS === */
.step-item {
    position: relative;
    cursor: default; /* keep normal cursor until drag actually starts */
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.step-item:active {
    cursor: default;
}

.step-card {
    cursor: default; /* avoid hand cursor over email editor before drag */
}

.step-card:active {
    cursor: default;
}

.step-item.dragging {
    opacity: 0.7;
    transform: rotate(2deg);
    z-index: 1000;
    pointer-events: none;
}

.step-item.drag-ghost {
    opacity: 0.3;
}

/* Drop zone indicator */
.step-drop-indicator {
    height: 4px;
    background: #ff4d4f;
    border-radius: 2px;
    margin: 8px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.step-drop-indicator.active {
    opacity: 1;
}

/* Red dotted placeholder showing drop position */
.step-drop-placeholder {
    border: 2px dotted #ff4d4f;
    border-radius: 8px;
    margin: 12px 0;
    background: rgba(255, 77, 79, 0.05);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff4d4f;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.step-drop-placeholder.active {
    opacity: 1;
}

.step-drop-placeholder::after {
    content: "Drop step here";
}

/* Disable text selection during drag */
body.dragging-steps, body.dragging-steps * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
}

/* Global: orange checkmark for selectable row checkboxes */
input.row-select[type="checkbox"] {
    accent-color: var(--orange-subtle);
}
input.row-select[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange-muted);
    outline-offset: 2px;
}

/* === EMAIL INTERFACE STYLES === */

/* Email Layout */
.email-layout {
    display: flex;
    height: 100%;
    gap: 1px;
    background: var(--border-light);
    margin: 0;
    padding: 0;
}

.email-sidebar {
    width: 250px;
    background: var(--bg-card);
    border-radius: 0;
    padding: var(--spacing-md) 0 var(--spacing-md) var(--spacing-sm);
    overflow-y: auto;
    flex-shrink: 0;
    transition: var(--transition-smooth);
    margin: 0;
    border-right: 1px solid var(--border-light);
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.email-sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    transform: translateX(-100%);
}

/* Custom scrollbar for webkit browsers */
.email-sidebar::-webkit-scrollbar {
    width: 6px;
}

.email-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.email-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.email-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* === CONTACTS MODAL STYLES === */
.contacts-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.contacts-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90vw;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--elevation-modal);
}

.contacts-modal .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.contacts-modal .title-wrap {
    flex: 1;
}

.contacts-modal .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.contacts-modal .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* .contacts-modal .close-btn styles moved to standardized close button section above */

.contacts-modal .modal-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.contacts-modal .search-section {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.contacts-modal .contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    cursor: pointer;
}

.contact-item:hover {
    background: var(--bg-hover);
}

.contact-checkbox {
    flex-shrink: 0;
}

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

.contact-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.contact-details {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: var(--spacing-sm);
}

.contact-details .company::after {
    content: '•';
    margin-left: var(--spacing-sm);
    color: var(--text-tertiary);
}

.contacts-modal .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.contacts-modal .empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--spacing-xl);
    font-style: italic;
}

/* Search input small variant */
.search-input-small {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-fast);
    width: 100%;
    max-width: 300px;
}

.search-input-small:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px var(--orange-muted);
}

.search-input-small::placeholder {
    color: var(--text-tertiary);
}

.email-main {
    flex: 1;
    background: var(--bg-card);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0; /* allow inner flex children to scroll */
    margin: 0;
}

/* Email Toolbar */
.email-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.email-view-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Email Folders */
.email-folders {
    margin-bottom: var(--spacing-lg);
}

.folder-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: 2px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.folder-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.folder-item.active {
    background: var(--bg-item);
    color: var(--text-primary);
    box-shadow: var(--elevation-card);
}

.folder-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.folder-item span:first-of-type {
    flex: 1;
}

.folder-count {
    background: var(--grey-600);
    color: var(--text-inverse);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.folder-item.active .folder-count {
    background: var(--orange-subtle);
}

/* Email Labels */
.email-labels {
    border-top: 1px solid var(--border-light);
    padding-top: var(--spacing-md);
}

.labels-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.label-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
    font-size: 13px;
}

.label-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.label-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Email List Header */
.email-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-container);
    border-radius: 0;
    margin: 0;
}

.email-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.email-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--orange-subtle);
}

.email-sort {
    color: var(--text-muted);
    font-size: 13px;
}

.email-count {
    font-weight: 500;
}

/* Email List */
.email-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Email Viewer Modal */
.email-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.email-viewer-modal.show {
    opacity: 1;
    visibility: visible;
}

.email-viewer-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.email-viewer-modal.show .email-viewer-content {
    transform: scale(1) translateY(0);
}

.email-viewer-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.email-viewer-title h2 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.email-viewer-meta {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.email-viewer-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.email-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.email-action-btn.starred {
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.email-viewer-body {
    padding: var(--spacing-lg);
    flex: 1;
    overflow-y: auto;
}

.email-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
}

.email-content img {
    max-width: 100%;
    height: auto;
}

/* Email Viewer Compose Section */
.email-viewer-compose {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.compose-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
}

.compose-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.compose-form {
    padding: var(--spacing-lg);
}

.compose-field {
    margin-bottom: var(--spacing-md);
}

.compose-field label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.compose-input {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.compose-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.compose-editor {
    margin-bottom: var(--spacing-lg);
}

.compose-editor .editor-toolbar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: var(--spacing-sm);
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.compose-editor .editor-content {
    min-height: 200px;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    outline: none;
}

.compose-editor .editor-content:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.compose-editor .editor-content:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.compose-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .email-viewer-content {
        width: 95%;
        max-height: 95%;
    }
    
    .email-viewer-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .email-viewer-actions {
        justify-content: center;
        margin-top: var(--spacing-md);
    }
}

.email-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-card);
}

.email-item:hover {
    background: var(--bg-hover);
}

.email-item.unread {
    background: var(--bg-item);
    font-weight: 600;
}

.email-item.selected {
    background: var(--bg-hover);
    border-left: 3px solid var(--orange-subtle);
}

.email-item-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--orange-subtle);
}

.email-item-star {
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.email-item-star:hover,
.email-item-star.starred {
    color: var(--yellow-subtle);
}

.email-item-sender {
    min-width: 180px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item.unread .email-item-sender {
    font-weight: 600;
}

.email-item-content {
    flex: 1;
    min-width: 0;
}

.email-item-subject {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item.unread .email-item-subject {
    font-weight: 600;
}

.email-item-preview {
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 80px;
}

.email-item-time {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* Email Tracking Icons */
.email-tracking-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tracking-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tracking-icon.opened {
    background-color: var(--orange-subtle);
    color: white;
}

.tracking-icon.not-opened {
    background-color: var(--grey-400);
    color: var(--grey-600);
}

.tracking-icon.replied {
    background-color: var(--orange-subtle);
    color: white;
}

.tracking-icon.not-replied {
    background-color: var(--grey-400);
    color: var(--grey-600);
}

.tracking-icon svg {
    width: 12px;
    height: 12px;
}

.tracking-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--orange-subtle);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
}

.tracking-icon:hover {
    transform: scale(1.1);
}

/* Gmail API Badge */
.gmail-badge {
    background-color: #ea4335;
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: var(--transition-fast);
}

.gmail-badge:hover {
    background-color: #d33b2c;
    transform: scale(1.05);
}

.tracking-icon.opened:hover,
.tracking-icon.replied:hover {
    background-color: var(--orange-subtle);
    opacity: 0.8;
}

.email-item-labels {
    display: flex;
    gap: 4px;
}

.email-label-chip {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.email-attachment-icon {
    color: var(--text-muted);
    font-size: 12px;
}

/* Loading and Empty States */
.email-loading,
.email-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg) * 2;
    text-align: center;
    color: var(--text-muted);
    flex: 1;
    min-height: 200px;
}

.email-loading {
    gap: var(--spacing-md);
}

.email-empty {
    gap: var(--spacing-md);
}

.email-empty svg {
    opacity: 0.5;
    margin-bottom: var(--spacing-md);
}

.email-empty h3 {
    color: var(--text-secondary);
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.email-empty p {
    margin: 0;
    font-size: 14px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Styles for Email Interface */
.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-icon-sm {
    background: none;
    border: none;
    padding: 4px;
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Email Authentication Prompt */
.email-auth-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing-lg) * 2);
    text-align: center;
    color: var(--text-muted);
    gap: var(--spacing-md);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.03));
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--elevation-card);
}

.email-auth-prompt svg {
    opacity: 0.6;
    margin-bottom: 8px;
}

.email-auth-prompt h3 {
    color: var(--text-secondary);
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.email-auth-prompt p {
    margin: 0;
    font-size: 14px;
    max-width: 400px;
}

.email-auth-prompt .btn-primary {
    margin-top: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 160px;
    justify-content: center;
}

.email-auth-prompt .btn-secondary {
    min-width: 160px;
}

/* Gmail Sign-in Button - styled like Deal Calculator button */
.gmail-signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 160px;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--orange-subtle), #e67e22);
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none; /* remove glow */
}

.gmail-signin-btn:hover { 
    transform: translateY(-2px);
    box-shadow: none; /* remove glow */
    filter: brightness(1.1);
}

.gmail-signin-btn:active {
    transform: translateY(0);
    box-shadow: none; /* remove glow */
}

.gmail-signin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Gmail Compose Button - styled like Gmail Sign-in button */
.gmail-compose-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 120px;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--orange-subtle), #e67e22);
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none; /* remove glow */
}

.gmail-compose-btn:hover { 
    transform: translateY(-2px);
    box-shadow: none;
    filter: brightness(1.1);
}

.gmail-compose-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.gmail-compose-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Email Search Controls - search input and toggle button side by side */
.email-search-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Email Sort Controls - refresh button and email count side by side */
.email-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Gmail-style Compose Window */
.compose-window {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 600px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: visible; /* allow editor popovers to render outside */
    will-change: transform, height;
    min-height: 0; /* allow internal flex children to scroll */
}

.compose-window.open {
    transform: translateY(0);
}

.compose-window.minimized {
    height: 60px;
    transform: translateY(calc(100% - 60px));
}

.compose-window.maximized {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    right: 20px;
    bottom: 20px;
    border-radius: 8px;
}

.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.compose-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.compose-controls {
    display: flex;
    gap: 4px;
}

.compose-control-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background-color 0.2s;
}

.compose-control-btn:hover {
    background: var(--surface-hover);
}

.compose-control-btn:active {
    background: var(--border-light);
}

.compose-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Allow dropdowns to extend beyond this container */
    min-height: 0; /* critical for child scroll areas */
}

.compose-recipients {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    z-index: 1001; /* Ensure it's above the compose window */
    isolation: isolate; /* Create new stacking context */
}

.recipient-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.recipient-row:last-child {
    margin-bottom: 0;
}

.recipient-label {
    width: 60px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.recipient-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 4px 0;
    color: var(--text-primary);
    background: transparent;
}

.recipient-input::placeholder {
    color: var(--text-tertiary);
}

.recipient-actions {
    margin-top: 8px;
}

.recipient-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
}

.recipient-toggle:hover {
    text-decoration: underline;
}

.compose-subject {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light);
}

.subject-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 0;
    color: var(--text-primary);
    background: transparent;
    line-height: 1.4;
    height: 24px;
    display: flex;
    align-items: center;
}

.subject-input::placeholder {
    color: var(--text-tertiary);
}

.compose-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Enable scrolling to contain AI panel expansion */
    overflow-x: visible; /* Allow dropdowns to extend horizontally */
    min-height: 0; /* allow children to define scrollable area */
    padding: 0 20px; /* Add horizontal padding to match loading animation width */
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px !important; /* enforce spacing */
    column-gap: 10px !important; /* explicit column gap */
    row-gap: 8px; /* vertical wrap spacing */
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light) !important; /* divider below toolbar */
    background: var(--surface-hover);
    position: relative;
    z-index: 10;
}

@supports not (gap: 1rem) {
    .editor-toolbar .toolbar-btn + .toolbar-btn { margin-left: 10px; }
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
}

.toolbar-btn::after,
.toolbar-btn::before {
    opacity: 0;
    transition: opacity 0.2s;
}

.toolbar-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.toolbar-btn.active {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

.toolbar-btn .icon {
    font-size: 16px;
}

.toolbar-btn .label {
    font-weight: 500;
}

.formatting-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* align to left like editor toolbar */
    gap: 8px;
    padding: 0 16px; /* keep horizontal padding to avoid horizontal shift */
    border-bottom: none;
    background: transparent; /* avoid grey seam when closed */
    position: relative;
    z-index: 10;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, transform 0.3s ease-out;
}

.formatting-bar.open {
    max-height: 60px;
    opacity: 1;
    transform: translateY(0);
    padding: 8px 16px; /* keep same padding as closed to avoid lateral shift */
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border-light); /* dividing line below formatting bar */
    overflow: visible; /* allow dropdowns to extend beyond bar */
}


.fmt-group {
    position: relative;
}

.fmt-btn {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.fmt-btn::after,
.fmt-btn::before {
    opacity: 0;
    transition: opacity 0.2s;
}

.fmt-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.fmt-btn[aria-pressed="true"] {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

/* Tooltip styles for formatting buttons */
.fmt-btn[title]:hover::after,
.toolbar-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1004;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    margin-bottom: 4px;
    opacity: 1;
    pointer-events: none;
}

.fmt-btn[title]:hover::before,
.toolbar-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--border-light);
    z-index: 1004;
    margin-bottom: -1px;
    opacity: 1;
    pointer-events: none;
}

.fmt-label {
    font-weight: 500;
}

.fmt-glyph {
    font-weight: bold;
    font-size: 14px;
}

/* SVG icons inside formatting buttons (matching sequence builder) */
.fmt-btn svg { width: 16px; height: 16px; display: block; }

/* Force override inline SVG sizing in compose and sequence builder */
.compose-window svg[width][height],
.step-card svg[width][height] {
    width: 20px !important;
    height: 20px !important;
}

/* Specific override for formatting bar SVGs */
.formatting-bar svg[width][height],
.fmt-btn svg[width][height] {
    width: 16px !important;
    height: 16px !important;
}

/* Toolbar SVG sizing with flexbox constraints */
.editor-toolbar svg,
.toolbar-btn svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* Compose window control SVGs */
.compose-control-btn svg {
    width: 16px !important;
    height: 16px !important;
}

.fmt-btn .ql-stroke {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.75;
}

.fmt-btn .ql-stroke.ql-thin {
    stroke-width: 1;
}

.fmt-btn .ql-fill {
    fill: currentColor;
}

.format-popover {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1200; /* ensure above compose body */
    display: none;
    min-width: 120px;
}

.format-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border-light);
}

.format-popover::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--bg-card);
}

.format-popover.open {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.popover-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.popover-item:hover {
    background: var(--surface-hover);
}

.color-swatches {
    display: flex;
    gap: 6px;
    padding: 8px;
    justify-content: center;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-light);
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.link-bar {
    display: block;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-hover);
    max-height: 0;
    overflow: hidden; /* Hide content when closed to prevent overlay */
    opacity: 0;
    position: relative; /* Ensure proper positioning context */
    z-index: 10; /* Above editor content when open */
    pointer-events: none; /* Non-interactive while closed */
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-bar.open {
    max-height: 200px;
    opacity: 1;
    padding: 16px;
    overflow: visible; /* Ensure content is visible when open */
    pointer-events: auto; /* Interactive when open */
}

.link-bar .field {
    margin-bottom: 12px;
}

.link-bar .field:last-child {
    margin-bottom: 0;
}

.link-bar .fmt-label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.link-bar .input-dark {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.link-bar .actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.link-bar .fmt-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.link-bar .fmt-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* === EMAIL EDITOR: VARIABLES BAR === */
.variables-bar {
    display: block;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-raised);
    max-height: 0;
    opacity: 0;
    overflow: hidden; /* Hide content when closed to prevent overlay */
    position: relative; /* Ensure proper positioning context */
    z-index: 10; /* Ensure it's above other content */
    transform: translateY(0); /* Remove negative transform that causes clipping */
    pointer-events: none; /* Non-interactive while closed */
    transition: max-height var(--transition-smooth), opacity var(--transition-smooth), transform var(--transition-smooth),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.variables-bar.open { 
    max-height: 280px; 
    opacity: 1; 
    transform: translateY(0); 
    padding: 16px; 
    overflow: visible; /* Ensure content is visible when open */
    pointer-events: auto; /* Interactive when open */
}

/* Responsive columns for AI suggestions */
@media (max-width: 900px) {
  .ai-row.suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ai-row.suggestions { grid-template-columns: 1fr; }
}
.variables-bar .vars-tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.variables-bar .vars-tab {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--grey-300);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}
.variables-bar .vars-tab:hover { background: var(--grey-700); color: var(--text-inverse); }
.variables-bar .vars-tab.active { background: var(--grey-700); color: var(--text-inverse); border-color: var(--grey-600); }
.variables-bar .vars-panels { display: block; }
.variables-bar .vars-panel.hidden { display: none; }
.variables-bar .var-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.variables-bar .var-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-item);
    color: var(--text-primary);
    text-align: left;
    transition: var(--transition-fast);
}
.variables-bar .var-item:hover { background: var(--surface-hover); border-color: var(--grey-500); }
.variables-bar .var-item .var-item-token { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; color: var(--grey-300); }
.variables-bar .fmt-btn { margin-left: auto; }

.compose-body {
    flex: 1 1 auto;
    min-height: 0; /* critical: let this area shrink and become scrollable */
    max-height: 100%;
    padding: 0 16px 16px 16px; /* move compose text up by 5px */
    margin-top: 10px; /* reduce gap above to bring placeholder up */
    overflow-y: auto; /* enable vertical scrolling for long content */
    overflow-x: visible; /* keep horizontal overflow visible for popovers */
    position: relative; /* create stacking context below popovers */
    z-index: 0;
    -webkit-overflow-scrolling: touch; /* smooth on iOS */
}

.body-input {
    width: 100%;
    /* Let content drive height; container scrolls */
    min-height: 220px;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 1.4; /* allow proper line spacing for lists */
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    background: transparent;
}

.compose-preview {
    width: 100%;
    min-height: 220px;
    padding: 8px 0;
}

.body-input:empty:before {
    content: attr(placeholder);
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Override placeholder in HTML mode (make badge visible even when empty) */
.compose-body .body-input[data-mode="html"]:empty:before {
    content: 'HTML MODE';
    position: absolute;
    top: 8px;
    right: 12px;
    background: var(--orange-subtle);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.6px;
    border-radius: 999px;
    padding: 4px 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    pointer-events: none;
    text-transform: uppercase;
}

/* Lists inside the editor */
.compose-body ul,
.compose-body ol {
    margin: 0 0 0 20px;
    padding-left: 20px;
}

.compose-body li {
    margin: 4px 0;
}

.compose-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--surface-hover);
    position: relative;
    z-index: 100; /* Ensure footer stays above AI panel (z-index: 50) */
}

.compose-actions {
    display: flex;
    gap: 8px;
}

.compose-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--orange-subtle), #e67e22);
    color: var(--text-inverse);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none; /* remove glow */
}

.compose-send-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    box-shadow: none;
    transform: translateY(-1px);
}

.compose-send-btn:active {
    background: linear-gradient(135deg, #d35400, #c0392b);
    transform: translateY(0);
    box-shadow: none;
}


/* Responsive adjustments for compose window */
@media (max-width: 768px) {
    .compose-window {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    
    .compose-window.maximized {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .toolbar-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .compose-formatting {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .format-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Responsive Design for Email Interface */
@media (max-width: 1024px) {
    .email-sidebar {
        width: 200px;
    }
    
    .email-item-sender {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .email-layout {
        flex-direction: column;
    }
    
    .email-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .email-sidebar.collapsed {
        height: 0;
        padding: 0;
    }
    
    .folder-item {
        padding: var(--spacing-sm);
    }
    
    .email-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .email-item-meta {
        align-self: flex-end;
        flex-direction: row;
        align-items: center;
    }
}


/* List Card Styling */
.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 180px; /* Ensure consistent card height */
}

.list-card:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.list-card-header {
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.list-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
    word-wrap: break-word;
    margin-right: var(--spacing-sm);
}

.list-card-count {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    flex-shrink: 0;
}

.list-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.list-card-meta .meta {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.list-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: auto; /* Push actions to bottom */
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-light);
}

.list-card-actions .btn-secondary,
.list-card-actions .btn-text {
    flex: 1;
    text-align: center;
    font-size: 13px;
    padding: 8px 12px;
}

.list-card-actions .btn-secondary {
    background: var(--orange-subtle);
    color: white;
    border: none;
    font-weight: 500;
}

.list-card-actions .btn-secondary:hover {
    background: #e55a2b;
    transform: none;
}

.list-card-actions .btn-text {
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
}

.list-card-actions .btn-text:hover {
    color: var(--text-primary);
    background: var(--bg-item);
    border-color: var(--text-secondary);
}

/* === CRM-WIDE BUTTON CONSISTENCY RULE === */
/* All buttons throughout the CRM should have rounded corners for consistency */
.btn-secondary,
.btn-text,
.btn-primary,
.page-btn,
.pagination-arrow,
.qa-btn,
.contact-quick-action-btn,
.unified-pagination button,
.activity-pagination-btn {
    border-radius: var(--border-radius-sm) !important;
}

/* Empty state positioning in grid */
#lists-page #lists-grid #lists-empty-state {
    grid-column: 1 / -1; /* Span all columns */
    justify-self: center;
    max-width: 500px;
    margin: var(--spacing-lg) 0;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1200px) {
    #lists-page #lists-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-input {
        width: 300px;
    }
}

@media (max-width: 768px) {
    #lists-page #lists-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }
    
    .list-card {
        min-height: auto;
    }
    
    .content-area {
        flex-direction: column;
    }
    
    .widget-panel {
        flex: none;
        height: 300px;
    }
    
    .stat-cards {
        grid-template-columns: 1fr;
    }
}

/* === GLOBAL CUSTOM TOOLTIP === */
.pc-tooltip {
  position: fixed; /* positioned by JS */
  z-index: 10000;
  background: var(--grey-900);
  color: var(--text-inverse);
  border: 1px solid var(--border-dark);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--elevation-card);
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  max-width: min(320px, calc(100vw - 16px));
  opacity: 0;               /* JS toggles to 1 */
  visibility: hidden;       /* JS toggles to visible */
  pointer-events: none;     /* never capture mouse */
  white-space: nowrap;
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  --arrow-size: 8px;
}

.pc-tooltip.visible { visibility: visible; }

/* Override browser validation tooltip styling to match global theme */
input:invalid:not(:focus):not(:placeholder-shown) {
  border-color: var(--border-dark) !important;
}

/* Custom validation tooltip styling - override browser default */
input:invalid:not(:focus):not(:placeholder-shown)::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--grey-900);
  color: var(--text-inverse);
  border: 1px solid var(--border-dark);
  border-radius: var(--border-radius-sm);
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  box-shadow: var(--elevation-card);
  white-space: nowrap;
  z-index: 10000;
  margin-bottom: 4px;
  opacity: 1;
  pointer-events: none;
}

/* Tooltip arrow (uses same border/fill layering pattern as popovers) */
.pc-tooltip::before,
.pc-tooltip::after {
  content: "";
  position: absolute;
  width: var(--arrow-size);
  height: var(--arrow-size);
  transform: rotate(45deg);
  pointer-events: none;
}

/* When placed above the anchor (arrow on bottom edge of tooltip) */
.pc-tooltip[data-placement="top"]::before {
  bottom: calc(-1 * var(--arrow-size) / 2 + 1px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--border-dark);
}
.pc-tooltip[data-placement="top"]::after {
  bottom: calc(-1 * var(--arrow-size) / 2 + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--grey-900);
}

/* When placed below the anchor (arrow on top edge of tooltip) */
.pc-tooltip[data-placement="bottom"]::before {
  top: calc(-1 * var(--arrow-size) / 2 + 1px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--border-dark);
}
.pc-tooltip[data-placement="bottom"]::after {
  top: calc(-1 * var(--arrow-size) / 2 + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--grey-900);
}

/* === CONTACT TITLE INLINE ACTIONS === */
.contact-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-title-row .title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;              /* prevent layout jump */
  max-width: 0;                  /* collapsed by default */
  opacity: 0;
  transform: translateX(-4px);
  transition: max-width var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.contact-title-row:hover .title-actions,
.contact-title-row:focus-within .title-actions {
  max-width: 160px;              /* enough room for 3 small icon buttons */
  opacity: 1;
  transform: translateX(0);
}

/* Name input focus ring aligns with app accent preference */
input.contact-name-input.input-dark:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--orange-muted);
}

/* === CSV IMPORT MODAL STYLES === */

/* CRITICAL: Force contact name size in account details page */
div[id="account-contacts-list"] .contact-item .contact-name {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

/* Larger modal dialog for CSV import */
.csv-import-modal {
    max-width: 800px;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
}

/* Step indicator */
.csv-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-base);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.csv-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    opacity: 0.5;
    transition: opacity var(--transition-smooth);
}

.csv-step.active {
    opacity: 1;
}

.csv-step.completed {
    opacity: 0.8;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-item);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    border: 2px solid var(--border-light);
    transition: all var(--transition-smooth);
}

.csv-step.active .step-number {
    background: var(--orange-subtle);
    color: white;
    border-color: var(--orange-subtle);
}

.csv-step.completed .step-number {
    background: var(--green-subtle);
    color: white;
    border-color: var(--green-subtle);
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.csv-step.active .step-label {
    color: var(--text-primary);
}

/* Step content containers */
.csv-step-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.csv-step-content[hidden] {
    display: none;
}

/* Upload section */
.csv-upload-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.upload-type-selector h4 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.type-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-base);
}

.type-option {
    display: block;
    cursor: pointer;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-item);
    transition: all var(--transition-fast);
    position: relative;
}

.type-option:hover {
    border-color: var(--orange-subtle);
    box-shadow: var(--shadow-sm);
}

.type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.type-option input[type="radio"]:checked + .option-content {
    border-color: var(--orange-subtle);
}

.type-option:has(input[type="radio"]:checked) {
    border-color: var(--orange-subtle);
    background: var(--orange-muted);
}

.option-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
}

.option-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.option-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Drop zone */
.csv-drop-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-align: center;
    background: var(--bg-item);
    transition: all var(--transition-fast);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csv-drop-zone.dragover {
    border-color: var(--orange-subtle);
    background: var(--orange-muted);
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.upload-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.upload-text h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.upload-text p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--orange-subtle);
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    padding: 0;
}

.btn-link:hover {
    color: var(--orange-subtle);
    text-decoration: none;
}

.file-requirements {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* File info display */
.csv-file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    gap: var(--spacing-md);
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-stats {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Field mapping section */
.csv-mapping-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.mapping-header h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.mapping-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.csv-preview h5,
.field-mapping h5,
.review-data h5 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-table {
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    overflow: auto;
    max-height: 200px;
    overflow-x: auto;
    overflow-y: auto;
}

.preview-table table {
    min-width: 100%;
    width: max-content;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.preview-table th,
.preview-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    white-space: nowrap;
    min-width: 100px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-primary);
    height: 28px;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.85rem;
}

.preview-table td {
    color: var(--text-secondary);
    height: 24px;
    vertical-align: middle;
    font-size: 0.8rem;
}

.preview-table th:last-child,
.preview-table td:last-child {
    border-right: none;
}

/* Field mapping list */
.mapping-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-height: 300px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    min-height: 28px;
    max-height: 32px;
}

.mapping-source {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.mapping-arrow {
    color: var(--text-muted);
    font-weight: 600;
}

.mapping-target {
    flex: 1;
}

.mapping-target select {
    width: 100%;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    height: 22px;
    font-size: 0.8rem;
}

.mapping-target select:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

/* Mapping options */
.mapping-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    /* Hide native box; we render a custom checkmark square */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

/* Review section */
.csv-review-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

/* Contact Merge Dialog */
.merge-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.merge-contact {
    padding: var(--spacing-md);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.merge-contact h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.contact-preview {
    color: var(--text-secondary);
    line-height: 1.5;
}

.similarity-info {
    padding: var(--spacing-sm);
    background: var(--orange-muted);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin: var(--spacing-md) 0;
}

.review-header h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.review-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.review-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.summary-item {
    text-align: center;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--orange-subtle);
    margin-bottom: 4px;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress bar */
.import-progress {
    padding: var(--spacing-md);
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.progress-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-stats {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-subtle), var(--green-subtle));
    width: 0%;
    transition: width var(--transition-smooth);
    border-radius: 4px;
}

/* Import results */
.import-results {
    padding: var(--spacing-md);
    background: var(--green-muted);
    border: 1px solid var(--green-subtle);
    border-radius: var(--border-radius);
}

.results-summary {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Modal body scrolling for long content */
.csv-import-modal .pc-modal__body {
    max-height: calc(80vh - 200px);
    overflow-y: auto;
}

/* Focus styles for accessibility */
.csv-import-modal input:focus,
.csv-import-modal select:focus,
.csv-import-modal button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .csv-import-modal {
        max-width: calc(100vw - 16px);
        margin: 8px;
    }
    
    .type-options {
        grid-template-columns: 1fr;
    }
    
    .csv-steps-indicator {
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }
    
    .step-number {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    .mapping-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }
    
    .mapping-arrow {
        text-align: center;
        transform: rotate(90deg);
    }
}

/* === MODAL INPUT FIELD IMPROVEMENTS === */
/* Ensure consistent sizing for all modal input fields */
.pc-modal .input-dark {
    width: 100%;
    min-width: 200px;
    height: 42px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

/* Form row layout improvements */
.pc-modal .form-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.pc-modal .form-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.pc-modal .form-row label input {
    flex: 1;
}

/* Ensure equal width columns in form rows */
.pc-modal .form-row label:first-child,
.pc-modal .form-row label:last-child {
    flex: 1 1 50%;
}


/* Modal footer button styling improvements */
.pc-modal .pc-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-base);
    border-top: 1px solid var(--border-light);
    background: var(--bg-container);
}

.pc-modal .pc-modal__footer .btn-primary {
    min-width: 120px;
    height: 40px;
    padding: 0 var(--spacing-md);
    font-weight: 500;
}

.pc-modal .pc-modal__footer .btn-text {
    min-width: 80px;
    height: 40px;
    padding: 0 var(--spacing-md);
}

/* === SETTINGS PAGE STYLES (SCOPED TO #settings-page) === */
#settings-page .settings-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

#settings-page .settings-section {
    background: var(--bg-container);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#settings-page .settings-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    margin: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

#settings-page .settings-section-title svg {
    color: var(--orange-primary);
}

#settings-page .settings-content {
    padding: var(--spacing-lg);
}

#settings-page .section-desc {
    margin: -8px var(--spacing-lg) var(--spacing-md) var(--spacing-lg);
    color: var(--text-secondary);
    font-size: 0.92rem;
}

#settings-page .settings-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

#settings-page .settings-group {
    margin-bottom: var(--spacing-xl);
}

#settings-page .settings-group:last-child {
    margin-bottom: 0;
}

#settings-page .settings-group-title {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: var(--spacing-xs);
}

#settings-page .settings-field {
    margin-bottom: var(--spacing-md);
}

#settings-page .settings-field:last-child {
    margin-bottom: 0;
}

#settings-page .settings-field label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

#settings-page .settings-textarea {
    width: 100%;
    min-height: 80px;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: var(--transition-fast);
}

#settings-page .settings-textarea:focus {
    outline: none;
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px var(--orange-muted);
}

#settings-page .settings-select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-fast);
}

#settings-page .settings-select:focus {
    outline: none;
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px var(--orange-muted);
}

/* Image upload area */
#settings-page .image-upload-area {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

#settings-page .image-upload-area .btn-secondary {
    width: auto;
    max-width: 200px;
    align-self: flex-start;
}

#settings-page .image-preview {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

#settings-page .image-preview img {
    border-radius: var(--border-radius);
}

/* Phone numbers list */
#settings-page .phone-numbers-list {
    margin-bottom: var(--spacing-md);
}

#settings-page .phone-number-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
}

#settings-page .phone-number-item:last-child {
    margin-bottom: 0;
}

#settings-page .phone-number-item.empty-state {
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

#settings-page .phone-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#settings-page .phone-number {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

#settings-page .phone-label {
    color: var(--text-secondary);
    font-size: 14px;
}

#settings-page .phone-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* Checkbox styling - SCOPED TO SETTINGS PAGE ONLY */
#settings-page .checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-weight: 400;
    color: var(--text-primary);
}

#settings-page .checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

#settings-page .checkmark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    background: var(--grey-700);
    border: 1px solid var(--grey-700);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
    transition: var(--transition-fast);
}

#settings-page .checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--orange-primary);
    border-color: var(--orange-primary);
}

#settings-page .checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Button styling for settings */
#settings-page .btn-small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 12px;
    height: auto;
    min-height: 28px;
}

#settings-page .btn-danger {
    background: var(--red-subtle);
    border-color: var(--red-subtle);
    color: white;
}

#settings-page .btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    color: white;
}

/* Save button state */
#settings-page #save-settings-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#settings-page #save-settings-btn:disabled:hover {
    background: var(--orange-primary);
    border-color: var(--orange-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #settings-page .settings-content {
        padding: var(--spacing-md);
    }

    #settings-page .phone-number-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    #settings-page .phone-actions {
        align-self: flex-end;
    }
}

/* Email authentication styles */
.email-auth-prompt,
.email-auth-error {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
    padding: var(--spacing-xl);
}

.email-auth-prompt h3,
.email-auth-error h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.email-auth-prompt p,
.email-auth-error p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.5;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* CI processing button spinner (consistent across Account/Contact pages) */
.ci-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    border: 2px solid var(--grey-600);
    border-top-color: var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

/* Ensure rc-icon-btn keeps fixed square bounds so spinner doesn't stretch */
.rc-icon-btn.processing {
    width: 28px;
    height: 28px;
    padding: 0;
}

/* Google Maps Widget Styles */
/* .maps-card inherits from .widget-card - no additional styles needed */

/* Maps widget mount animation helper */
.maps-anim {
  will-change: height, opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  .maps-anim { will-change: auto; }
}

.maps-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* .maps-search-container inherits from parent - no additional styles needed */

.search-input-wrap {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    position: relative;
}

.search-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-base);
    padding-right: 40px; /* Make room for the search icon */
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--orange-subtle);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.25);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: var(--spacing-xs);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    color: var(--text-primary);
    background: none;
}

.maps-container {
    height: 400px;
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.maps-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--orange-subtle);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-sm);
}

.maps-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    padding: var(--spacing-base);
}

.maps-info-window {
    color: #333;
    font-size: 0.9rem;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.maps-info-window h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.maps-info-window p {
    margin: 0 0 6px 0;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.maps-info-window .address {
    color: #555;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.maps-info-window .rating {
    color: #e67e22;
    font-weight: 500;
    margin-bottom: 6px;
}

.maps-info-window .price {
    color: #27ae60;
    font-weight: 500;
    margin-bottom: 6px;
}

.maps-info-window .types {
    color: #7f8c8d;
    font-size: 0.75rem;
    font-style: italic;
    margin-bottom: 8px;
}

.maps-info-window .phone,
.maps-info-window .website,
.maps-info-window .hours {
    margin-bottom: 4px;
}

.maps-info-window .phone a,
.maps-info-window .website a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

.maps-info-window .phone a:hover,
.maps-info-window .website a:hover {
    text-decoration: underline;
}

.maps-info-window .call-link {
    background: #34a853;
    color: white !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-block;
    margin-left: 4px;
    transition: background-color 0.2s ease;
}

.maps-info-window .call-link:hover {
    background: #2d8f47;
    text-decoration: none !important;
}

.maps-info-window .status {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #ecf0f1;
}

.place-photo {
    margin-bottom: 8px;
}

.place-photo img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* Maps widget header alignment: center icon vertically with title text */
.widget-card .widget-title svg {
    vertical-align: middle;
    margin-right: 6px;
    display: inline-block;
    transform: translateY(-1px); /* subtle nudge for optical centering */
}

/* Use same close button styles as notes widget */
/* .widget-card .maps-close inherits from .notes-close - no additional styles needed */


/* Responsive Design */
@media (max-width: 768px) {
    #maps-widget .widget-panel {
        width: 95vw;
        height: 90vh;
        margin: var(--spacing-sm);
    }
    
    #maps-widget .widget-header {
        padding: var(--spacing-sm);
    }
    
    #maps-widget .widget-content {
        padding: var(--spacing-sm);
    }
    
    #maps-widget .search-input-wrap {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    #maps-widget .search-btn {
        width: 100%;
    }
}

/* ========================================
   EMAIL SIGNATURE EDITOR DISPLAY
   ======================================== */

/* 
 * Make signature text white in the editor for visibility on dark backgrounds
 * CSS only affects the contenteditable editor display - doesn't affect sent emails
 * Recipients will still see the original dark text color
 */

/* Target signature in contenteditable editor only */
[contenteditable="true"] [data-signature="true"],
[contenteditable="true"] [data-signature="true"] * {
    color: #ffffff !important;
}

/* Make links in signature visible with light blue color */
[contenteditable="true"] [data-signature="true"] a {
    color: #60a5fa !important;
    text-decoration: underline;
}

/* Also target signatures by style pattern (fallback for older signatures without data-signature attribute) */
[contenteditable="true"] div[style*="margin-top: 20px"][style*="padding-top: 20px"][style*="border-top: 1px solid"],
[contenteditable="true"] div[style*="margin-top: 20px"][style*="padding-top: 20px"][style*="border-top: 1px solid"] * {
    color: #ffffff !important;
}

[contenteditable="true"] div[style*="margin-top: 20px"][style*="padding-top: 20px"][style*="border-top: 1px solid"] a {
    color: #60a5fa !important;
    text-decoration: underline;
}

/* Ensure signature images remain visible */
[contenteditable="true"] [data-signature="true"] img {
    opacity: 1;
    filter: none;
}




/* Service Address Styles */
.service-address-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.service-address-input-row input {
    flex: 1;
}

#service-addresses-container,
#edit-service-addresses-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.remove-service-address-btn {
    background: var(--grey-600);
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.remove-service-address-btn:hover {
    background: var(--grey-700);
}

.remove-service-address-btn:active {
    transform: scale(0.95);
}

/* ========================================
   GOOGLE LOGIN OVERLAY & CRM CONTENT WRAPPER
   ======================================== */

/* CRM content wrapper - ensures proper layout after login */
#crm-content {
    display: none; /* Hidden by default until authenticated */
    /* Don't set any sizing - just be a transparent wrapper */
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    /* Base dark grey */
    background-color: #1a1a1a;
    
    /* Static dot grid pattern */
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.08) 1px, transparent 0);
    background-size: 40px 40px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
}

/* Animated orange cloud glows */
.login-overlay::before,
.login-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: -1;
}

/* First orange cloud (top-left moving) - FASTER & MORE VISIBLE */
.login-overlay::before {
    width: 700px;
    height: 700px;
    top: -250px;
    left: -250px;
    background: radial-gradient(
        circle,
        rgba(255, 120, 40, 0.30) 0%,
        rgba(255, 160, 80, 0.20) 40%,
        transparent 70%
    );
    animation: cloud-drift-1 8s ease-in-out infinite;
}

/* Second orange cloud (bottom-right moving) - FASTER & MORE VISIBLE */
.login-overlay::after {
    width: 600px;
    height: 600px;
    bottom: -200px;
    right: -200px;
    background: radial-gradient(
        circle,
        rgba(255, 180, 100, 0.25) 0%,
        rgba(255, 140, 60, 0.18) 40%,
        transparent 70%
    );
    animation: cloud-drift-2 10s ease-in-out infinite;
}

/* Cloud animation 1 - DRAMATIC drift with bigger movement */
@keyframes cloud-drift-1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.7;
    }
    25% {
        transform: translate(120px, 80px) scale(1.2);
        opacity: 0.9;
    }
    50% {
        transform: translate(80px, 150px) scale(1.1);
        opacity: 0.6;
    }
    75% {
        transform: translate(-50px, 100px) scale(1.25);
        opacity: 0.8;
    }
}

/* Cloud animation 2 - DRAMATIC opposite drift */
@keyframes cloud-drift-2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    30% {
        transform: translate(-100px, -60px) scale(1.15);
        opacity: 0.8;
    }
    60% {
        transform: translate(-140px, 80px) scale(1.25);
        opacity: 0.5;
    }
    80% {
        transform: translate(60px, -100px) scale(1.1);
        opacity: 0.75;
    }
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    
    /* Enhanced shadow to pop against textured background */
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 2px rgba(255, 120, 40, 0.1);
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 12px;
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    background: white !important;
    color: #1f1f1f !important;
    border: 1px solid #dadce0 !important;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-signin-btn:hover {
    background: white !important;
    color: #1f1f1f !important;
    transform: scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid #dadce0 !important;
}

.google-signin-btn:active {
    background: white !important;
    transform: scale(0.98) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.google-signin-btn svg {
    flex-shrink: 0;
}

.login-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 14px;
    line-height: 1.5;
}

.login-footer {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ========================================
   PROFILE PICTURE & DROPDOWN
   ======================================== */

.profile-container {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: opacity 0.2s ease;
}

.profile-btn:hover {
    opacity: 0.8;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 2px solid var(--border-light);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    width: 280px;
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown[hidden] {
    display: none;
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-item);
}

.profile-pic-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
}

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

.profile-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-email {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-light);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.profile-dropdown-item:hover {
    background: var(--bg-item-hover);
}

.profile-dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ========================================
   BULK ASSIGNMENT UI
   ======================================== */

/* Quick Dropdown */
.bulk-assign-dropdown {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    z-index: 1000;
    overflow: hidden;
}

.bulk-assign-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.bulk-assign-options {
    max-height: 300px;
    overflow-y: auto;
}

.bulk-assign-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.bulk-assign-option:hover {
    background: var(--bg-item-hover);
}

.team-avatar,
.team-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-avatar {
    object-fit: cover;
}

.team-avatar-fallback {
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.team-name {
    flex: 1;
    font-size: 14px;
}

.admin-badge {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--orange-primary);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.bulk-assign-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-light);
}

.bulk-assign-advanced {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-assign-advanced:hover {
    background: var(--bg-item-hover);
    border-color: var(--orange-primary);
}

/* Advanced Modal */
.bulk-assign-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.bulk-assign-modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.bulk-assign-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.bulk-assign-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.bulk-assign-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-assign-modal-close:hover {
    background: var(--bg-item-hover);
    color: var(--text-primary);
}

.bulk-assign-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.bulk-assign-search {
    margin-bottom: 16px;
}

.bulk-assign-search input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.bulk-assign-search input:focus {
    outline: none;
    border-color: var(--orange-primary);
}

.bulk-assign-team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bulk-assign-team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.bulk-assign-team-member:hover {
    border-color: var(--orange-primary);
    background: var(--bg-item-hover);
}

.team-avatar-large,
.team-avatar-large-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-avatar-large {
    object-fit: cover;
}

.team-avatar-large-fallback {
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
}

.team-member-info {
    flex: 1;
}

.team-member-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.team-member-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.bulk-assign-select-btn {
    padding: 8px 16px;
    background: var(--orange-primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-assign-select-btn:hover {
    background: var(--orange-hover);
    transform: translateY(-1px);
}

.bulk-assign-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
}

/* ========================================
   EMPLOYEE WELCOME SCREEN
   ======================================== */

.employee-welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.employee-welcome-overlay.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.employee-welcome-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    max-width: 550px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    padding: 16px;
    background: var(--orange-subtle);
    border-radius: 50%;
    color: var(--orange-primary);
}

.welcome-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.welcome-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
}

.welcome-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    text-align: left;
}

.welcome-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: left;
}

.welcome-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.welcome-list li svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--orange-primary);
}

.welcome-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    background: var(--bg-item);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: left;
}

.welcome-tip svg {
    flex-shrink: 0;
    color: var(--orange-primary);
    margin-top: 2px;
}

.welcome-tip span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.welcome-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--orange-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-btn:hover {
    background: var(--orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 120, 40, 0.3);
}

/* ========================================
   ASSIGNED TO COLUMN
   ======================================== */

.assigned-to-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.assigned-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.assigned-avatar-fallback {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--orange-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.assigned-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.assigned-you {
    color: var(--orange-primary);
    font-weight: 500;
}
