/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent horizontal scroll globally */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* =====================
   Design tokens
   ===================== */
:root {
    /* Core background & ink (paper-inspired) */
    --color-bg-page:       #F7F5F0;
    --color-bg-surface:    #FFFFFF;
    --color-bg-subtle:     #F3F4F6;

    --color-text-primary:  #111827;
    --color-text-secondary: #6B7280;
    --color-text-muted:    #9CA3AF;

    --color-border-subtle: #E5E7EB;
    --color-border-strong: #D1D5DB;

    /* Brand */
    --color-brand:         #1D4ED8;
    --color-brand-soft:    #DBEAFE;
    --color-brand-strong:  #1E40AF;

    /* Semantic */
    --color-success:       #16A34A;
    --color-success-soft:  #DCFCE7;
    --color-warning:       #F59E0B;
    --color-warning-soft:  #FEF3C7;
    --color-danger:        #DC2626;
    --color-danger-soft:   #FEE2E2;
    --color-info:          #0EA5E9;
    --color-info-soft:     #E0F2FE;

    /* Legacy aliases (for existing styles) */
    --primary-color: var(--color-brand);
    --primary-hover: var(--color-brand-strong);
    --secondary-color: var(--color-text-muted);
    --success-color: var(--color-success);
    --warning-color: var(--color-warning);
    --danger-color: var(--color-danger);
    --background: var(--color-bg-page);
    --surface: var(--color-bg-surface);
    --border: var(--color-border-subtle);
    --text-primary: var(--color-text-primary);
    --text-secondary: var(--color-text-secondary);

    /* Elevation & radii */
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-card: 10px;
    --radius-button: 8px;
    --radius-input: 8px;

    /* Typography */
    --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;

    --font-size-h1: 28px;
    --font-size-h2: 22px;
    --font-size-h3: 18px;
    --font-size-body: 14px;
    --font-size-caption: 12px;

    --line-height-tight: 1.2;
    --line-height-normal: 1.4;
    --line-height-relaxed: 1.6;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Typographic grid + layout (existing) */
    --grid-unit: 4px;         /* base spacing unit */
    --page-max-width: 960px;  /* desktop content width */

    /* App parchment background */
    --app-bg: #F7F5EF;

    /* Apple-style system colors */
    --color-primary: #2563eb;
    --color-primary-soft: rgba(37, 99, 235, 0.06);
    --color-green: #34c759;
    --color-green-soft: rgba(52, 199, 89, 0.08);
    --color-blue: #0a84ff;
    --color-gray-bg-soft: rgba(0, 0, 0, 0.03);
    --color-gray-icon: #c7c7cc;

    /* Apple-like tag palette */
    --tag-blue:   #0A84FF;
    --tag-indigo: #5856D6;
    --tag-purple: #AF52DE;
    --tag-pink:   #FF2D55;
    --tag-red:    #FF3B30;
    --tag-orange: #FF9500;
    --tag-gold:   #FFCC00;
    --tag-green:  #34C759;
    --tag-mint:   #00C7BE;
    --tag-teal:   #30B0C7;
    --tag-gray:   #8E8E93;
}

/* =====================
   Typography
   ===================== */
body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
  background-color: var(--app-bg);
    color: var(--color-text-primary);
}

/* Type utilities */
.heading-h1 {
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
}

.heading-h2 {
    font-size: 22px;
    line-height: 28px;
    font-weight: 600;
}

.heading-h3 {
    font-size: 18px;
    line-height: 24px;
    font-weight: 600;
}

.text-body {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.text-body-strong {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.text-caption {
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
}

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

.overline-label {
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.details-label {
  font-size: 11px;
  color: var(--color-text-muted);
}

.details-value {
  font-size: 15px;
  color: var(--color-text-primary);
}

/* Tag chips */
.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
}
.tag--blue   { background-color: var(--tag-blue); }
.tag--indigo { background-color: var(--tag-indigo); }
.tag--purple { background-color: var(--tag-purple); }
.tag--pink   { background-color: var(--tag-pink); }
.tag--red    { background-color: var(--tag-red); }
.tag--orange { background-color: var(--tag-orange); }
.tag--gold   { background-color: var(--tag-gold); }
.tag--green  { background-color: var(--tag-green); }
.tag--mint   { background-color: var(--tag-mint); }
.tag--teal   { background-color: var(--tag-teal); }
.tag--gray   { background-color: var(--tag-gray); }

/* Subtle card levels */
.card-level-1 { background-color: #ffffff; }
.card-level-2 { background-color: #fbfaf7; }
.card-level-soft { background-color: #f9fafb; }

/* =====================
   Layout and spacing
   ===================== */
.app-shell {
    min-height: 100vh;
  background-color: var(--app-bg);
    color: var(--color-text-primary);
    display: flex;
    flex-direction: column;
}

.app-shell-main {
    flex: 1 1 auto;
    padding: 16px;
}

@media (min-width: 1024px) {
    .app-shell-main {
        padding: 24px 32px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Channel buttons */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.channel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 10px 8px;
  background-color: var(--channel-bg, #ffffff);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.channel-card:active {
  transform: scale(0.97);
}

.channel-card[aria-disabled="true"] {
  cursor: default;
  transform: none;
}

.channel-card-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: var(--channel-icon, #6b7280);
}

.channel-card-icon svg {
  width: 18px;
  height: 18px;
}

.channel-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--channel-text, #111827);
}

.channel-card--call.channel-card--available {
  --channel-bg: rgba(52, 199, 89, 0.10);
  --channel-icon: #34C759;
  --channel-text: #0A84FF;
}

.channel-card--message.channel-card--available {
  --channel-bg: rgba(10, 132, 255, 0.10);
  --channel-icon: #0A84FF;
  --channel-text: #0A84FF;
}

.channel-card--email.channel-card--available {
  --channel-bg: rgba(37, 99, 235, 0.08);
  --channel-icon: #2563EB;
  --channel-text: #2563EB;
}

.channel-card--website.channel-card--available {
  --channel-bg: rgba(15, 23, 42, 0.05);
  --channel-icon: #111827;
  --channel-text: #111827;
}

.channel-card--disabled {
  --channel-bg: rgba(0, 0, 0, 0.03);
  --channel-icon: #c7c7cc;
  --channel-text: #c7c7cc;
}

/* Tag color picker */
.tag-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.tag-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background-color: var(--tag-color-swatch-bg, #ddd);
}
.tag-color-swatch--selected {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

/* Social icons list */
.social-icon-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.social-icon-button {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background-color: #f3f4f6;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.social-icon-button:hover { background-color: #e5e7eb; }
.social-icon-button:focus-visible { outline: 2px solid var(--color-blue); outline-offset: 2px; }
.social-icon-button:active { transform: scale(0.94); }
.social-icon-image { width: 14px; height: 14px; display: block; }

/* =====================
   App header & navigation
   ===================== */
.app-header {
    background-color: var(--color-bg-page);
    border-bottom: 1px solid var(--color-border-subtle);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

@media (min-width: 768px) {
    .app-header-inner {
        padding: 16px 32px;
    }
}

.app-brand {
    display: flex;
    align-items: center;
}

.app-logo {
    height: 32px;
    width: auto;
    display: block;
}

@media (min-width: 1024px) {
    .app-logo {
        height: 36px;
    }
}

/* Top nav */
.app-nav {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.app-nav a,
.app-nav button {
    background: none;
    border: none;
    padding: 0 0 6px 0;
    margin: 0;
    font: inherit;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    text-decoration: none;
}

.app-nav a:hover,
.app-nav button:hover {
    color: var(--color-text-primary);
}

/* Active nav item */
.app-nav .nav-link.active,
.app-nav .is-active {
    color: var(--color-text-primary);
    font-weight: 500;
    border-bottom: 2px solid var(--color-brand);
}

/* Nav toggle state */
.nav-container.nav-open .app-nav {
    display: flex;
}

/* On small screens, let nav wrap under the logo */
@media (max-width: 600px) {
    .app-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .app-nav {
        gap: 16px;
    }
}

/* Responsive nav visibility */
@media (min-width: 768px) {
    .app-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        margin-top: 0;
        margin-left: auto;
    }

    /* Hide bottom nav on desktop */
    .mobile-nav.bottom-nav {
        display: none;
    }
}

@media (max-width: 1023px) {
    /* Hide top nav on mobile */
    .app-nav {
        display: none;
    }

    /* Show bottom nav as primary on mobile */
    .mobile-nav.bottom-nav {
        display: flex;
    }
}

.app-nav-toggle {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    border-radius: 9999px;
    padding: 6px 10px;
    font-size: 14px;
}

.app-nav-mobile {
    border-top: 1px solid var(--color-border-subtle);
    background-color: var(--color-bg-page);
    padding: 8px 16px;
}

.app-nav-mobile .nav-link {
    display: inline-block;
    margin-right: 12px;
    margin-bottom: 4px;
    font-size: 14px;
    text-decoration: none;
    color: var(--color-text-muted);
}

.app-nav-mobile .nav-link.active {
    color: var(--color-text-primary);
    font-weight: 500;
}

@media (min-width: 900px) {
    .app-nav-toggle {
        display: none;
    }
    .app-nav-mobile {
        display: none;
    }
    .app-nav {
        display: flex;
        align-items: center;
    }
}

/* Navigation */
.navbar {
    background-color: #f3f0e8;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
    height: 72px;
    display: flex;
    align-items: center;
    z-index: 30;
}

.nav-container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 2.5rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.nav-logo {
    height: 24px;
    width: auto;
    display: block;
}

.nav-logo.nav-logo-wordmark {
    height: 28px;
    width: auto;
    display: block;
}

.nav-brand-text {
    display: none;
}

.nav-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-menu .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #111827; /* dark slate/ink */
    padding-bottom: 0.4rem;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-menu .nav-link:hover {
    color: #1f2937;
}

.nav-menu .nav-link.active {
    color: #1f3b5c; /* deep navy */
}

.nav-menu .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-color: #1f3b5c;
    border-radius: 999px;
}

/* Pages */
.page {
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding-left: calc(var(--grid-unit) * 6);  /* 24px */
    padding-right: calc(var(--grid-unit) * 6);
    padding-top: calc(var(--grid-unit) * 8);   /* 32px */
    padding-bottom: calc(var(--grid-unit) * 8);
    display: none;
}

/* On mobile, add extra bottom padding for the fixed bottom nav */
@media (max-width: 1023px) {
    .page {
        padding-bottom: 92px; /* nav height (72px) + breathing room + safe area */
    }
}

.page.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Page title block with editorial subtitle */
.page-title-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.page-subtitle {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* =====================
   Responsive visibility helpers
   ===================== */

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Dashboard page header snapped to grid */
#dashboard-page .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: calc(var(--grid-unit) * 6); /* 24px below header */
}

#dashboard-page .page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.25;
}

#dashboard-page .page-header .btn-primary {
    padding-inline: calc(var(--grid-unit) * 6);  /* 24px */
    padding-block: calc(var(--grid-unit) * 2);   /* 8px */
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-button);
    font-size: var(--font-size-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 12px;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
    line-height: 1;
}

/* Project select with inline add button */
.project-select-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.project-select-row select {
    flex: 1 1 auto;
}

.project-select-row .btn {
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--color-brand-strong);
    border-color: var(--color-brand-strong);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-subtle);
}

.btn-secondary:hover {
    background: var(--color-bg-subtle);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Nav Toggle (mobile only) */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* ============================================
   Bottom Tab Bar: iOS-style navigation
   ============================================ */

.mobile-nav.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
}

/* Each tab item - icon + label stack */
.mobile-nav.bottom-nav .bottom-nav-item {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 4px;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease;
}

.mobile-nav.bottom-nav .bottom-nav-item:active {
    opacity: 0.7;
}

/* Tab icon - SF-style icons, larger for easier tapping */
.mobile-nav.bottom-nav .tab-icon {
    width: 28px;
    height: 28px;
    display: block;
    transition: transform 0.25s cubic-bezier(0.33, 1.55, 0.69, 1), filter 0.2s ease;
}

/* Tab label - slightly larger for readability */
.mobile-nav.bottom-nav .tab-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--color-text-muted, #6b7280);
    transition: color 0.15s ease, font-weight 0.15s ease;
}

/* Inactive state - muted/grayscale appearance */
.mobile-nav.bottom-nav .bottom-nav-item:not(.is-active) .tab-icon {
    filter: grayscale(100%) opacity(0.5);
}

.mobile-nav.bottom-nav .bottom-nav-item:not(.is-active) .tab-label {
    color: #9ca3af;
}

/* Active state - SF blue highlight */
.mobile-nav.bottom-nav .bottom-nav-item.is-active {
    position: relative;
}

/* Active icon: full color + slight scale pop */
.mobile-nav.bottom-nav .bottom-nav-item.is-active .tab-icon {
    filter: none;
    transform: scale(1.12);
}

/* Active label: SF blue */
.mobile-nav.bottom-nav .bottom-nav-item.is-active .tab-label {
    color: #007aff;
    font-weight: 600;
}

/* Subtle pill indicator under active tab */
.mobile-nav.bottom-nav .bottom-nav-item.is-active::before {
    content: "";
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 20px;
    border-radius: 9999px;
    background: rgba(0, 122, 255, 0.12);
    z-index: -1;
}

/* Contacts mobile toggles - now replaced by .contacts-toolbar */
.contacts-mobile-toggles {
    display: none; /* Legacy, replaced by .contacts-toolbar */
}

/* Segmented control (used for Filters / Quick Add) */
.segmented-control {
    display: flex;
    gap: var(--space-2);
}

.segmented-control .segmented-button {
    flex: 1;
    border-radius: 12px;
    border: 1px solid var(--color-border-subtle);
    background: var(--color-bg-surface);
    font-size: var(--font-size-body);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
}

.segmented-control .segmented-button[aria-pressed="true"] {
    background: var(--color-brand-soft);
    border-color: var(--color-brand);
    color: var(--color-brand-strong);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card.dashboard-link {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.stat-card.dashboard-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    background-color: rgba(148, 163, 184, 0.05);
}

.stat-card.dashboard-link:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
    background-color: rgba(148, 163, 184, 0.12);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

/* Recent Activity */
/* =====================
   Cards
   ===================== */
.card,
.dashboard-card {
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: var(--shadow-soft);
    padding: 16px;
    margin-bottom: 16px;
}

/* Dashboard sections and cards */
.dashboard-section {
    margin-bottom: var(--space-5);
}

/* Dashboard-specific spacing aligned to grid */
#dashboard-page .dashboard-section {
    margin-bottom: calc(var(--grid-unit) * 6); /* 24px between sections */
}

#dashboard-page .dashboard-card {
    padding: calc(var(--grid-unit) * 5) calc(var(--grid-unit) * 6); /* 20px x 24px */
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.dashboard-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

/* Metrics grid: simple, legible cards */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

/* Ensure existing stat cards look like quiet metrics in the dashboard */
.dashboard-metrics .stat-card {
    background-color: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    box-shadow: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Dashboard metrics aligned to grid */
#dashboard-page .dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(var(--grid-unit) * 4); /* 16px between stat cards */
}

#dashboard-page .dashboard-metrics .stat-card {
    padding: calc(var(--grid-unit) * 4); /* 16px inside metrics card */
    border-radius: 0.75rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-color);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.activity-type {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.activity-vendor {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Keep the recent activity list within a reasonable height on desktop */
.dashboard-activity-card .activity-list {
    max-height: 18rem;
    overflow-y: auto;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text-primary);
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.filter-select {
    min-width: 150px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Contacts Page Container - Centered max-width layout
   ───────────────────────────────────────────────────────────────────────── */

.contacts-page-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Contacts Page Header - Clean, iOS-style header
   ───────────────────────────────────────────────────────────────────────── */

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.contacts-header-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contacts-header-overline {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted, #9ca3af);
    font-weight: 500;
}

.contacts-header-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-primary, #111827);
    margin: 0;
    line-height: 1.2;
}

.contacts-header-subtitle {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
    margin: 0;
    line-height: 1.4;
}

/* Right-side Add button */
.contacts-header-actions {
    flex-shrink: 0;
}

.contacts-add-btn {
    padding-inline: 18px;
    padding-block: 8px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
}

/* Search bar row */
.contacts-search-row {
    margin-bottom: 10px;
}

.contacts-search {
    margin-bottom: 0;
}

.contacts-search-input {
    width: 100%;
    border-radius: 9999px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-text-primary, #111827);
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contacts-search-input::placeholder {
    color: var(--color-text-muted, #9ca3af);
}

.contacts-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Filters / Quick Add toolbar */
.contacts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.contacts-toolbar-btn {
    border-radius: 9999px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    background: #ffffff;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    color: var(--color-text-primary, #374151);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.contacts-toolbar-btn:hover {
    background: var(--color-bg-subtle, #f3f4f6);
    border-color: #d1d5db;
}

.contacts-toolbar-btn:active {
    background: #e5e7eb;
}

/* Mobile responsive header */
@media (max-width: 767px) {
    .contacts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .contacts-header-actions {
        align-self: stretch;
        width: 100%;
    }

    .contacts-add-btn {
        width: 100%;
        justify-content: center;
    }

    .contacts-header-title {
        font-size: 20px;
    }

    .contacts-search-input {
        padding: 11px 16px;
        font-size: 14px;
    }
}

/* Legacy search input styles (for backwards compatibility) */
.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Table */
.table-container {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: auto;
}

.contacts-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

.contacts-table thead {
    background: var(--background);
    border-bottom: 2px solid var(--border);
}

.contacts-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
}

.contacts-table thead.contacts-header th {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
}

.contacts-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 769px) {
    .contacts-table td {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
    }

    /* Zebra striping for readability */
    .contacts-table tbody tr:nth-child(even) {
        background-color: rgba(148, 163, 184, 0.03);
    }

    /* Status badge styling */
    .status-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.1rem 0.5rem;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 500;
    }

    .status-not-started {
        background: rgba(148, 163, 184, 0.15);
        color: #475569;
    }

    .status-in-progress {
        background: rgba(59, 130, 246, 0.15);
        color: #1d4ed8;
    }

    .status-responded {
        background: rgba(16, 185, 129, 0.15);
        color: #059669;
    }

    .status-signed-up {
        background: rgba(234, 179, 8, 0.15);
        color: #b45309;
    }

    /* Contact detail status dropdown */
    .status-select {
        padding: 0.25rem 0.5rem;
        border-radius: 999px;
        border: 1px solid var(--border);
        font-size: 0.85rem;
        background-color: #fff;
        color: var(--text-primary);
        outline: none;
    }

    .status-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
    }

    /* Email column truncation */
    .contacts-table td[data-col="email"] {
        max-width: 320px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Clickable contact links (email / phone) */
    .contact-link {
        color: inherit;
        text-decoration: underline;
        text-decoration-color: rgba(148, 163, 184, 0.7);
    }

    .contact-link:hover {
        text-decoration-color: var(--primary-color);
    }

    .contacts-table td[data-col="email"] a,
    .contacts-table td[data-col="phone"] a {
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .contacts-table tbody tr:hover {
        background-color: #f9fafb;
    }

    .contacts-table tbody tr:last-child td {
        border-bottom: none;
    }

    /* Sticky first column (vendor name) */
    .contacts-table th:first-child,
    .contacts-table td:first-child {
        position: sticky;
        left: 0;
        background: var(--surface);
        z-index: 6;
    }

    /* Column widths for better readability on small screens */
    .contacts-table td:nth-child(1) { min-width: 220px; }
    .contacts-table td:nth-child(2) { min-width: 160px; }
    .contacts-table td:nth-child(3) { min-width: 240px; }
    .contacts-table td:nth-child(4) { min-width: 140px; }
    .contacts-table td:nth-child(5) { min-width: 160px; }
    .contacts-table td:nth-child(6) { min-width: 140px; }
    .contacts-table td:nth-child(7) { min-width: 140px; }
    .contacts-table td:nth-child(8) { min-width: 220px; }
}

/* Hideable columns */
.hidden-column {
    display: none;
}

/* Generic hidden utility for dynamic views */
.hidden {
    display: none !important;
}

/* Filters: column chooser dropdown */
.filter-dropdown {
    position: relative;
}

.filter-dropdown summary {
    cursor: pointer;
    list-style: none;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-dropdown summary::-webkit-details-marker {
    display: none;
}

.filter-dropdown[open] .dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 0.5rem 1rem;
    z-index: 20;
}

.dropdown-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Bulk actions bar */
.bulk-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 0.5rem;
}

.bulk-left, .bulk-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.row-select-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Status Badge / Chips */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0  var(--space-2);
    min-height: 20px;
    border-radius: 9999px;
    font-size: var(--font-size-caption);
    font-weight: 600;
}

.status-not-started {
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
}

.status-in-progress {
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
}

.status-responded {
    background: var(--color-info-soft);
    color: var(--color-info);
}

.status-signed-up {
    background: var(--color-success-soft);
    color: var(--color-success);
}

/* Action Buttons in Table */
.action-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    margin-right: 0.25rem;
}

/* Contacts list: inline chips for channels + primary action */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.chip-channel {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #e2e8f0;
}

.chip-channel:hover {
    background: #e5edf6;
}

.chip-primary {
    background: #1f3b5c;
    color: #ffffff;
    border-color: #1f3b5c;
}

.chip-primary:hover {
    background: #173049;
}

.contact-card-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.contact-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Contact Detail */
.contact-detail {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.contact-header {
    padding: 2rem;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.contact-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.contact-company {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.contact-body {
    padding: 2rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.detail-value a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
    padding-left: 2rem;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--surface);
}

.timeline-content {
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.timeline-type {
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.timeline-notes {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Scripts Grid */
.scripts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.script-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

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

.script-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    margin-bottom: 0.75rem;
}

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

.script-subject {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.script-preview {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.script-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Upload */
.upload-container {
    background: var(--surface);
    padding: 3rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.upload-box {
    text-align: center;
    padding: 3rem;
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
}

.upload-help {
    margin-top: 1rem;
    color: var(--text-secondary);
}

.csv-format-help {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 0.5rem;
    text-align: left;
}

.csv-format-help h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.csv-format-help p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.upload-preview {
    margin-top: 2rem;
}

.upload-preview h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#preview-content {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    background: var(--background);
}

.upload-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

/* AI Buttons & CSV helper */
.btn-ai {
    background: #4361ee;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin: 4px 0;
}

.btn-ai:hover {
    background: #3453d3;
}

/* Buttons with leading icons (e.g., RocketReach) */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon {
    display: inline-block;
    height: 14px;
    width: auto;
}

.ai-csv-helper textarea {
    width: 100%;
    margin-top: 0.35rem;
    font-family: var(--font-mono, monospace);
}

/* Markdown output styling for AI modal */
.markdown-output {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    overflow-y: auto;
    max-height: 70vh;
}

.markdown-output h1,
.markdown-output h2,
.markdown-output h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-output pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

.markdown-output ul {
    margin-left: 1.2rem;
}
/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.analytics-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.analytics-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Projects */
.project-card {
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.project-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.project-card-summary {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.project-card-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.project-card-actions {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-status-badge {
    font-size: 0.7rem;
}

/* Contacts Quick Add */
.contacts-quick-add {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
}

.quick-add-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quick-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.quick-add-row input,
.quick-add-row select {
    flex: 1 1 0;
    min-width: 140px;
}

.quick-add-submit {
    white-space: nowrap;
}

/* =====================
   Contacts Rolodex (mobile)
   ===================== */

.contacts-rolodex {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Mobile Contact Card List - iOS-style polished cards
   ───────────────────────────────────────────────────────────────────────── */

.contact-card-list {
    background: #ffffff;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.9);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.contact-card-list:active {
    transform: scale(0.99);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Header row: Organization name + Status pill */
.contact-card-list .contact-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.contact-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status pill in card header */
.contact-card-status {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Status colors */
.contact-status-not-started {
    background: #f3f4f6;
    color: #6b7280;
}

.contact-status-in-progress {
    background: #e0edff;
    color: #1d4ed8;
}

.contact-status-responded {
    background: #dcfce7;
    color: #15803d;
}

.contact-status-signed-up,
.contact-status-converted {
    background: #fef9c3;
    color: #92400e;
}

.contact-status-closed,
.contact-status-lost {
    background: #fee2e2;
    color: #b91c1c;
}

/* Meta rows: Contact person + Project/Segment */
.contact-card-list .contact-card-meta {
    margin-bottom: 8px;
}

.contact-card-meta-primary {
    font-size: 13px;
    color: var(--color-text-primary, #111827);
    line-height: 1.4;
}

.contact-card-meta-secondary {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
    margin-top: 2px;
}

/* Footer row: Tags + Actions */
.contact-card-list .contact-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(226, 232, 240, 0.7);
}

/* Left side: project chip + tags */
.contact-card-list .contact-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

.contact-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 11px;
    background: #f0f4ff;
    color: #1d4ed8;
    font-weight: 500;
    white-space: nowrap;
}

/* Right side: action buttons */
.contact-card-list .contact-card-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    flex-shrink: 0;
}

/* Action chip buttons */
.action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 9999px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    background: #ffffff;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary, #374151);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.action-chip:hover,
.action-chip:active {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Primary action chip (Profile button) */
.action-chip-primary {
    background: #007aff;
    border-color: #007aff;
    color: #ffffff;
}

.action-chip-primary:hover,
.action-chip-primary:active {
    background: #0066d6;
    border-color: #0066d6;
}

/* ─────────────────────────────────────────────────────────────────────────
   Contact Cell - iOS-style compact list cells (replaces contact-card-list)
   ───────────────────────────────────────────────────────────────────────── */

.contact-cell {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

@media (min-width: 768px) {
    .contact-cell:hover {
        background: rgba(245, 247, 255, 0.4);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }
}

@media (max-width: 767px) {
    .contact-cell {
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 10px;
    }
}

.contact-cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.contact-cell-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-cell-status {
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Status colors */
.contact-status-not-started { background: #f4f4f6; color: #6b7280; }
.contact-status-in-progress { background: #e5efff; color: #1d4ed8; }
.contact-status-responded { background: #dcfce7; color: #15803d; }
.contact-status-signed-up { background: #fef9c3; color: #92400e; }

.contact-cell-meta {
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.contact-cell-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.contact-cell-tags {
    display: flex;
    gap: 6px;
}

.contact-tag {
    background: #eef3ff;
    color: #1d4ed8;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
}

.contact-cell-actions {
    display: flex;
    gap: 6px;
}

.contact-action-chip {
    background: #ffffff;
    padding: 4px 12px;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    color: #111827;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease;
}

.contact-action-chip:hover {
    background: #f3f4f6;
}

@media (max-width: 767px) {
    .contact-cell-title { font-size: 14px; }
    .contact-cell-meta { font-size: 12.5px; }
    .contact-action-chip { padding: 4px 10px; }
}

/* Legacy contact-card class (backwards compatibility) */
.contact-card {
    background: var(--color-bg-surface);
    border-radius: 0.75rem;
    border: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
}

.contact-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.contact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.contact-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.contact-card-company {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.contact-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.contact-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.contact-card-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.contact-card-tags {
    margin-top: 0.25rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   Contact Row - Structured list row layout (alternative to card)
   ───────────────────────────────────────────────────────────────────────── */

/* Wrapper for each contact row */
.contact-row-wrapper {
    padding: 10px 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.contact-row-wrapper:last-child {
    border-bottom: none;
}

.contact-row-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Header: name + status pill */
.contact-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.contact-row-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status pill for row layout */
.contact-row-status {
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 500;
    min-width: 74px;
    text-align: center;
    flex-shrink: 0;
}

/* Meta rows */
.contact-row-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-row-meta-primary {
    font-size: 13px;
    color: var(--color-text-primary, #111827);
    line-height: 1.4;
}

.contact-row-meta-secondary {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
}

/* Footer: tags + actions */
.contact-row-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.contact-row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

/* Project/tag chip for row layout */
.contact-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    background: #f3f4ff;
    color: #1d4ed8;
    font-weight: 500;
    white-space: nowrap;
}

/* Action chips for row layout */
.contact-row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    flex-shrink: 0;
}

.contact-action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    background: #ffffff;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary, #374151);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.contact-action-chip:hover,
.contact-action-chip:active {
    background: var(--color-bg-subtle, #f3f4f6);
    border-color: #d1d5db;
}

/* Primary action chip variant */
.contact-action-chip-primary {
    background: #007aff;
    border-color: #007aff;
    color: #ffffff;
}

.contact-action-chip-primary:hover,
.contact-action-chip-primary:active {
    background: #0066d6;
    border-color: #0066d6;
}

@media (max-width: 767px) {
    .contacts-rolodex {
        margin-top: 10px;
        gap: 10px;
    }

    .contact-card-list {
        padding: 12px;
    }

    .contact-card-list .contact-card-footer {
        flex-direction: row;
        align-items: center;
    }

    .contact-card-list .contact-card-actions {
        justify-content: flex-end;
    }

    .contact-card {
        padding: 0.85rem 0.9rem;
    }

    /* Row layout mobile tweaks */
    .contact-row-wrapper {
        padding: 8px 0;
    }

    .contact-row-footer {
        gap: 6px;
    }

    .contact-row-actions {
        justify-content: flex-end;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   Contact Modal (Apple-style bottom sheet on mobile, centered on desktop)
   ───────────────────────────────────────────────────────────────────────── */

/* Prevent horizontal scroll on body when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Modal overlay positioning */
.modal.contact-sheet {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    overflow: hidden;
}

.modal.contact-sheet.active {
    display: flex;
}

/* Modal backdrop */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Base modal content */
.contact-modal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px); /* Use dynamic viewport height for iOS */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    background: var(--color-bg-primary, #ffffff);
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .modal.contact-sheet {
        align-items: center;
    }
    .contact-modal-content {
        border-radius: 16px;
        max-height: 85vh;
        margin: 24px auto;
    }
}

/* Sticky header */
.contact-modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 48px;
}

.contact-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text-primary, #111827);
}

/* Scrollable form body */
.contact-form {
    flex: 1 1 auto;
    padding: 12px 16px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Prevent horizontal overflow in form */
.contact-form,
.contact-form * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Sticky actions footer */
.contact-modal-actions {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom)); /* iOS safe area */
    border-top: 1px solid var(--color-border-subtle, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: var(--color-bg-primary, #ffffff);
}

.contact-modal-actions-right {
    display: flex;
    gap: 8px;
}

/* Prevent iOS input zoom - minimum 16px font */
.contact-form input,
.contact-form select,
.contact-form textarea {
    font-size: 16px !important;
    width: 100%;
    box-sizing: border-box;
}

/* Form sections */
.contact-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-subtle, #f0f0f0);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.contact-section:last-of-type {
    border-bottom: none;
}

.contact-section-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 8px;
}

.contact-section-subtext {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
    margin: 0 0 8px 0;
}

/* Mobile-specific form spacing */
@media (max-width: 600px) {
    .contact-section {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }
    
    .contact-form {
        padding: 10px 14px 14px;
    }
    
    .contact-modal-header {
        padding: 10px 14px;
    }
    
    .contact-modal-actions {
        padding: 10px 14px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* Form grid */
.contact-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 600px) {
    .contact-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.form-group-full {
    grid-column: 1 / -1;
}

/* Form group spacing */
.form-group {
    width: 100%;
    min-width: 0; /* Allow flex/grid items to shrink */
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 4px;
}

.form-group .form-input {
    width: 100%;
    box-sizing: border-box;
}

/* Subsections (emails, phones) */
.contact-subsection {
    margin-top: 10px;
    margin-bottom: 8px;
}

.contact-subsection-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Multi-field rows (for multiple emails/phones) */
.multi-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.multi-field-input {
    flex: 1 1 auto;
    min-width: 0;
}

.multi-field-remove-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-danger, #b91c1c);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.multi-field-remove-btn:hover {
    background: rgba(185, 28, 28, 0.1);
}

/* Extra person cards */
.extra-contact-card {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    background: var(--color-bg-secondary, #f9fafb);
    margin-bottom: 8px;
}

.extra-contact-card .multi-field-row:last-of-type {
    margin-bottom: 0;
}

.extra-contact-card .multi-field-remove-btn.remove-person {
    width: auto;
    height: auto;
    padding: 4px 8px;
    font-size: 12px;
    margin-top: 6px;
    color: var(--color-danger, #b91c1c);
}

/* Advanced toggle */
.contact-advanced-toggle {
    margin: 8px 0;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: var(--color-brand, #1d4ed8);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.contact-advanced-toggle:hover {
    text-decoration: underline;
}

.contact-advanced-body.collapsed {
    display: none;
}

/* Multi-field rows (emails, phones) */
.multi-field-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.multi-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.multi-field-input {
    flex: 1 1 auto;
}

.multi-field-remove-btn {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #b91c1c;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
}

.multi-field-remove-btn:hover {
    opacity: 1;
}

/* Extra contact cards (other people) */
#extra-contacts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.extra-contact-card {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    background: #f9fafb;
}

.extra-contact-card .multi-field-row {
    margin-bottom: 6px;
}

.extra-contact-card .multi-field-row:last-child {
    margin-bottom: 0;
}

.extra-contact-remove-person {
    border: none;
    background: transparent;
    font-size: 12px;
    color: #b91c1c;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
}

.extra-contact-remove-person:hover {
    text-decoration: underline;
}

/* Org contact info lists */
#org-email-list,
#org-phone-list,
#primary-email-list,
#primary-phone-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

/* Prospect profile: extra people section */
.prospect-subsection-header {
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #6b7280);
}

.prospect-people-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prospect-person-row {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
}

.prospect-person-row:last-child {
    border-bottom: none;
}

.prospect-person-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
}

.prospect-person-role {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
}

.prospect-person-email,
.prospect-person-phone {
    font-size: 12px;
    color: var(--color-text-primary, #111827);
}

.prospect-person-email a,
.prospect-person-phone a {
    color: var(--color-brand, #1d4ed8);
    text-decoration: none;
}

.prospect-person-email a:hover,
.prospect-person-phone a:hover {
    text-decoration: underline;
}

.contact-essentials .overline-label,
.contact-advanced .overline-label {
    margin-bottom: 0.5rem;
}

.contact-advanced-toggle {
    display: inline-flex;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
    border: none;
    background: transparent;
    color: var(--color-brand-strong);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.contact-advanced.collapsed {
    display: none;
}

.contact-sheet-actions {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.contact-sheet-actions-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.contact-delete-btn {
    margin-right: auto;
}

.contact-sheet-save {
    width: 100%;
}

.contact-sheet-cancel {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 0.25rem 0;
}

.modal-large {
    max-width: 800px;
}

.modal-medium {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3,
.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.modal-close:hover {
    background: var(--background);
}

/* Form */
form {
    padding: 1.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-input);
    font-size: var(--font-size-body);
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-brand);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Pipeline board */
.pipeline-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(220px, 1fr));
    gap: 1rem;
    overflow-x: auto;
}

.pipeline-column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    min-width: 240px;
}

.pipeline-column-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.pipeline-column-body {
    padding: 0.75rem;
    overflow-y: auto;
    min-height: 200px;
}

.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: grab;
}

.pipeline-card:active {
    cursor: grabbing;
}

.pipeline-card .card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pipeline-card .card-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pipeline-drop-hover {
    outline: 2px dashed var(--primary-color);
    outline-offset: -6px;
}

/* Calendar */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
    overflow-x: auto;
}

.calendar-cell {
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.calendar-cell-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.25rem;
}

.calendar-item {
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.calendar-cell.today {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

.calendar-cell.has-items {
    background: rgba(59, 130, 246, 0.03);
}

.calendar-count-badge {
    background: var(--primary-color);
    color: #fff;
    border-radius: 999px;
    padding: 0 0.4rem;
    font-size: 0.65rem;
}

.calendar-list-section {
    margin-top: 1.5rem;
}

.calendar-list-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calendar-followup-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.calendar-followup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    cursor: pointer;
}

.calendar-followup-row:hover {
    background: rgba(148, 163, 184, 0.05);
}

.calendar-followup-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.calendar-followup-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.calendar-followup-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.calendar-followup-date {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 0.75rem;
    white-space: nowrap;
}

.timeline-delete-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
}

/* Tasks */
.tasks-section {
    margin-top: 1.5rem;
}

.tasks-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.task-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.task-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.task-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.task-controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.task-priority-low {
    border-left: 3px solid #22c55e;
}

.task-priority-medium {
    border-left: 3px solid #f59e0b;
}

.task-priority-high {
    border-left: 3px solid #ef4444;
}

.task-completed .task-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-overdue {
    border-color: rgba(239, 68, 68, 0.6);
}

.dashboard-tasks-widget {
    margin-top: 1.5rem;
}

.dashboard-task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.dashboard-task-item + .dashboard-task-item {
    margin-top: 0.3rem;
}

.calendar-task-item {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Calendar Day modal list & sections */
.calendar-day-section {
    margin-bottom: 1rem;
}

.calendar-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 260px;
    overflow-y: auto;
}

.calendar-day-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.calendar-day-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.calendar-day-name {
    font-weight: 500;
    color: var(--text-primary);
}

.calendar-day-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.calendar-day-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-day-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.calendar-day-add {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

/* Make calendar cells feel interactive */
.calendar-cell {
    cursor: pointer;
}

.calendar-cell:hover {
    background-color: rgba(148, 163, 184, 0.06);
}

/* Responsive breakpoints: mobile-first */

/* Tablet and up: side-by-side forms */
@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
    }

    .form-row .form-group {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Desktop: more columns */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .nav-menu {
        gap: 1.25rem;
        flex-wrap: wrap;   /* allow wrapping instead of cramped single line */
    }
}

/* Mobile styles */
@media (max-width: 767px) {
    .navbar {
        height: 64px;              /* slightly shorter on mobile */
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    }

    .nav-container {
        position: relative;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 0.75rem;
    }

    .nav-brand {
        margin-bottom: 0;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 0.4rem;
        flex-direction: column;
        gap: 0.25rem;
        background: var(--surface);
        border-radius: 0.5rem;
        padding: 0.5rem 0;
        box-shadow: var(--shadow-lg);
        z-index: 20;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-container.nav-open .nav-menu {
        display: flex;
    }

    .nav-menu .nav-link {
        padding: 0.6rem 1rem;
        display: block;
        width: 100%;
    }

    .nav-menu .nav-link:hover {
        background: var(--background);
    }

    /* Ensure content is not hidden behind bottom bar */
    .page {
        max-width: 100%;
        padding-left: var(--space-4);  /* 16px */
        padding-right: var(--space-4);
        padding-bottom: 88px; /* tab bar + breathing space */
    }

    /* Prevent horizontal scroll on small screens */
    html,
    body {
        overflow-x: hidden;
    }

    /* Slightly reduce side padding on the Contacts page container for mobile */
    #contacts-page.page {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Slightly reduce brand title size on mobile for better fit */
    .nav-logo.nav-logo-wordmark {
        height: 24px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        margin-top: 0.5rem;
    }

    .filters-bar > * {
        width: 100%;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .modal-content,
    .modal-large {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
    }

    /* Contact sheet overrides: behave like a bottom sheet at ~90vh */
    .modal.contact-sheet {
        align-items: flex-end;
    }

    .modal.contact-sheet .modal-content {
        height: auto;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal.contact-sheet .contact-sheet-form {
        max-height: calc(90vh - 60px);
        overflow-y: auto;
    }

    .btn {
        padding: 0.75rem 1.25rem;
    }

    .modal-actions .btn + .btn {
        margin-top: 0.5rem;
    }

    /* Stack section headers and action buttons vertically on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .page-header .header-actions,
    .page-header .btn {
        width: 100%;
    }

    .page-header .header-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-header .btn {
        justify-content: center;
    }

    /* Mobile visibility helpers */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* Calendar header tweaks */
    #calendar-page .page-header h2 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    #calendar-page .page-header .header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }

    /* Hide desktop-only Columns control on mobile */
    .columns-desktop-only {
        display: none !important;
    }

    /* On mobile, make export/advanced filters behave like accordions under their headers */
    .filter-dropdown[open] .dropdown-content {
        position: static;
        top: auto;
        left: auto;
        width: 100%;
        box-shadow: none;
        margin-top: 0.5rem;
        border-radius: 0.5rem;
        display: block;
    }

    /* Mobile-friendly layout for export/advanced filter content */
    #export-menu .dropdown-content,
    #advanced-filters .dropdown-content {
        grid-template-columns: 1fr !important;
    }

    .pipeline-board {
        display: flex;
        flex-direction: column;
        overflow-x: visible;
    }

    .pipeline-column {
        min-width: 100%;
    }

    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        overflow-x: visible;
    }

    .stat-card {
        padding: 1rem 1rem;
    }

    /* Make dashboard cards slightly tighter on mobile, aligned to grid */
    #dashboard-page .dashboard-card {
        padding: calc(var(--grid-unit) * 4.5) calc(var(--grid-unit) * 5); /* 18px x 20px */
        border-radius: 0.9rem;
    }

    #dashboard-page .dashboard-section {
        margin-bottom: calc(var(--grid-unit) * 6); /* keep vertical rhythm */
    }

    /* Metrics: 2 columns on mobile to avoid horizontal scroll and crowding */
    #dashboard-page .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #dashboard-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: calc(var(--grid-unit) * 3); /* 12px between title and button */
    }

    #dashboard-page .page-header .btn-primary {
        width: 100%;
        text-align: center;
    }

    /* Ensure dashboard page does not cause sideways scroll */
    #dashboard-page {
        overflow-x: hidden;
    }

    /* Hide the row-level View button in Actions column on mobile */
    .contacts-table td[data-col="actions"] .btn-view {
        display: none;
    }

    /* Hide only the row selection checkbox on mobile, keep the company/org cell visible */
    .contacts-table td[data-col="vendor"] .row-select {
        display: none;
    }

    /* Contacts mobile toggles bar - now using .contacts-toolbar instead */
    .contacts-mobile-toggles {
        display: none; /* Replaced by .contacts-toolbar */
    }

    /* Hide filters and quick add by default on mobile */
    .filters-bar,
    #contacts-quick-add {
        display: none;
    }

    /* Shown when toggled */
    .filters-bar.mobile-open {
        display: block;
        margin-bottom: 0.75rem;
    }

    #contacts-quick-add.mobile-open {
        display: block;
        margin-bottom: 0.75rem;
    }
}

/* Contact detail: AI / RocketReach assist toolbar */
.contact-assist-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* =====================
   Prospect Profile View
   ===================== */

#prospect-profile-view {
  padding: 16px 16px 80px;
  background-color: var(--color-bg-page);
  max-width: 720px;
  margin: 0 auto;
}

.prospect-card {
  background-color: #FFFFFF;
  border-radius: 14px;
  border: 1px solid #E5E7EB;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.prospect-workbench {
  padding: 20px;
}

.prospect-profile-header-card {
  padding: 16px;
}

.prospect-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.prospect-back-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
}

.prospect-back-link:hover {
  color: var(--color-text-primary);
}

.icon-button {
  border: none;
  background: transparent;
  border-radius: 9999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
}

.icon-button:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-primary);
}

.icon-16 {
  width: 16px;
  height: 16px;
}

.prospect-title {
  margin-top: 4px;
}

.prospect-subtitle {
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.prospect-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  line-height: 1.2;
  border: 1px solid var(--color-border-subtle);
  background: #F9FAFB;
  color: var(--color-text-muted);
}

.chip-status {
  border-color: var(--color-brand-soft);
  background: var(--color-brand-soft);
  color: var(--color-brand-strong);
}

/* AI Actions buttons in Prospect Profile */
.prospect-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Channels Grid */
.prospect-channels-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 400px) {
  .prospect-channels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.prospect-channel-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-bg-surface);
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  min-height: 64px;
  transition: all 0.15s ease;
}

.prospect-channel-btn:hover:not(.disabled) {
  color: var(--color-brand);
  border-color: var(--color-brand-soft);
  background-color: rgba(37, 99, 235, 0.04);
}

.prospect-channel-btn:active:not(.disabled) {
  transform: scale(0.97);
}

.prospect-channel-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.prospect-channel-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.prospect-channel-label {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
}

.channel-icon {
  width: 20px;
  height: 20px;
  display: block;
}

/* Legacy channels row (for backward compat) */
.prospect-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Messaging Channel Button Variants (Message, WhatsApp, Messenger)
   ───────────────────────────────────────────────────────────────────────── */

/* Unified Message button (iMessage on Apple, SMS elsewhere) - Blue tint on hover */
.prospect-channel-message:hover {
  color: #007aff;
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(0, 122, 255, 0.08);
}

.prospect-channel-message .prospect-channel-icon {
  stroke: currentColor;
}

/* WhatsApp - Green tint on hover */
.prospect-channel-whatsapp:hover {
  color: #25d366;
  border-color: rgba(37, 211, 102, 0.3);
  background: rgba(37, 211, 102, 0.08);
}

.prospect-channel-whatsapp .prospect-channel-icon {
  fill: currentColor;
  stroke: none;
}

/* Facebook Messenger - Blue/purple tint on hover */
.prospect-channel-messenger:hover {
  color: #0084ff;
  border-color: rgba(0, 132, 255, 0.3);
  background: rgba(0, 132, 255, 0.08);
}

.prospect-channel-messenger .prospect-channel-icon {
  fill: currentColor;
  stroke: none;
}

/* Ensure filled icons have consistent sizing */
.prospect-channel-whatsapp .prospect-channel-icon,
.prospect-channel-messenger .prospect-channel-icon {
  width: 20px;
  height: 20px;
}

.prospect-two-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prospect-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.prospect-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.prospect-section-title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.prospect-header-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.prospect-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-bg-surface);
}

.prospect-quick-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.prospect-quick-select {
  border: none;
  background: transparent;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-primary);
  padding: 0;
  min-width: 80px;
}

.prospect-quick-select:focus {
  outline: none;
}

.prospect-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 16px;
}

.prospect-detail-item-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.prospect-detail-item-value {
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-primary);
}

.prospect-detail-item-value a {
  color: var(--color-brand-strong);
  text-decoration: none;
}

.prospect-detail-item-value a:hover {
  text-decoration: underline;
}

/* ============================================
   Details Card - Grouped Layout
   ============================================ */

.details-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.details-card-header .overline-label {
  margin: 0;
}

.details-group {
  margin-bottom: 16px;
}

.details-group:last-child {
  margin-bottom: 0;
}

.details-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
}

.details-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.details-row:last-child {
  margin-bottom: 0;
}

.details-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 2px;
}

.details-value {
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text-primary, #111827);
  font-weight: 500;
  word-break: break-word;
}

.details-value a {
  color: var(--color-brand-strong, #1d4ed8);
  text-decoration: none;
}

.details-value a:hover {
  text-decoration: underline;
}

.details-value-muted {
  font-size: 14px;
  color: var(--color-text-muted, #9ca3af);
  font-weight: 400;
  font-style: italic;
}

.details-hidden {
  display: none;
}

@media (max-width: 767px) {
  .details-row {
    margin-bottom: 6px;
  }
  
  .details-group {
    margin-bottom: 12px;
  }
  
  .details-value {
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .details-rows-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 24px;
  }
}

/* ============================================
   Prospect Info Card - Info Rows
   ============================================ */

.info-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #6b7280);
}

.info-value {
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text-primary, #111827);
  font-weight: 500;
}

/* ============================================
   Contact Information Card
   ============================================ */

.contact-info-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-info-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-info-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
}

.contact-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--color-text-primary, #111827);
}

.contact-info-row.clickable {
  cursor: pointer;
  border-radius: 8px;
  margin: 0 -8px;
  padding: 8px;
  transition: background 0.12s ease;
}

.contact-info-row.clickable:hover {
  background: var(--color-bg-subtle, #f9fafb);
}

.contact-info-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-muted, #6b7280);
}

.contact-info-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text-primary, #111827);
}

.contact-info-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-info-sublabel {
  font-size: 11px;
  color: var(--color-text-muted, #6b7280);
}

.contact-info-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-muted, #9ca3af);
}

.contact-info-link {
  font-size: 13px;
  color: var(--color-brand-strong, #2563eb);
  text-decoration: none;
  padding-left: 28px;
}

.contact-info-link:hover {
  text-decoration: underline;
}

.contact-info-social-row {
  display: flex;
  gap: 8px;
}

.contact-info-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  background: var(--color-bg-surface, #fff);
  transition: all 0.12s ease;
}

.contact-info-social-btn:hover {
  border-color: var(--color-brand-soft, #bfdbfe);
  background: rgba(37, 99, 235, 0.04);
}

.contact-info-social-icon {
  width: 20px;
  height: 20px;
}

/* ============================================
   People Card - Person Cards
   ============================================ */

.people-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.person-card {
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  background: var(--color-bg-surface, #fff);
}

.person-card-primary {
  border-color: var(--color-brand-soft, #bfdbfe);
  background: rgba(37, 99, 235, 0.02);
}

.person-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.person-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-brand-soft, #dbeafe);
  color: var(--color-brand-strong, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

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

.person-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #111827);
  line-height: 1.3;
}

.person-role {
  font-size: 13px;
  color: var(--color-text-muted, #6b7280);
  margin-top: 2px;
}

.person-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-brand-soft, #dbeafe);
  color: var(--color-brand-strong, #2563eb);
  margin-top: 4px;
}

.person-contact-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-subtle, #e5e7eb);
}

.person-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--color-text-primary, #111827);
  font-size: 13px;
  transition: background 0.12s ease;
}

.person-contact-row:hover {
  background: var(--color-bg-subtle, #f9fafb);
}

.person-contact-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-muted, #6b7280);
}

.person-contact-icon-img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============================================
   Bottom Sheet Overlay
   ============================================ */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: background 0.2s ease;
}

.bottom-sheet-overlay.active {
  background: rgba(0, 0, 0, 0.4);
}

.bottom-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
}

.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
}

.bottom-sheet-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-primary, #111827);
}

.bottom-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-subtle, #f3f4f6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted, #6b7280);
  transition: background 0.12s ease;
}

.bottom-sheet-close:hover {
  background: var(--color-border-subtle, #e5e7eb);
}

.bottom-sheet-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.bottom-sheet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.bottom-sheet-option:hover {
  background: var(--color-bg-subtle, #f9fafb);
}

.bottom-sheet-option:active {
  background: var(--color-border-subtle, #e5e7eb);
}

.bottom-sheet-option-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-muted, #6b7280);
}

.bottom-sheet-option-icon svg {
  width: 20px;
  height: 20px;
}

.bottom-sheet-option-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bottom-sheet-option-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary, #111827);
}

.bottom-sheet-option-label {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
}

.bottom-sheet-option-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-muted, #9ca3af);
}

body.sheet-open {
  overflow: hidden;
}

/* ============================================
   Channel Sheet (static HTML bottom sheet)
   ============================================ */

.channel-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.channel-sheet-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.channel-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 8px 16px 16px;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.18);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
}

.channel-sheet-overlay:not([hidden]) .channel-sheet {
  transform: translateY(0);
}

.channel-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  margin: 4px auto 12px;
}

.channel-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.channel-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.channel-sheet-close {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.12s ease;
}

.channel-sheet-close:hover {
  background: #f3f4f6;
}

.channel-sheet-list {
  margin-top: 4px;
  overflow-y: auto;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.channel-sheet-option {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.12s ease;
}

.channel-sheet-option:last-child {
  border-bottom: none;
}

.channel-sheet-option:hover {
  background: #f9fafb;
}

.channel-sheet-option:active {
  background: #e5e7eb;
}

.channel-sheet-option-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #6b7280;
}

.channel-sheet-option-icon svg {
  width: 20px;
  height: 20px;
}

.channel-sheet-option-labels {
  flex: 1;
  min-width: 0;
}

.channel-sheet-option-main {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
}

.channel-sheet-option-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.channel-sheet-option-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #9ca3af;
}

/* ============================================
   Activity & Task List Improvements
   ============================================ */

.prospect-activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prospect-activity-item {
  display: flex;
  gap: 12px;
}

.prospect-activity-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-bg-subtle, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prospect-activity-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted, #6b7280);
}

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

.prospect-activity-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #111827);
}

.prospect-activity-meta {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
  margin-top: 2px;
}

.prospect-activity-notes {
  font-size: 13px;
  color: var(--color-text-secondary, #4b5563);
  margin-top: 4px;
  line-height: 1.4;
}

/* Task Groups */
.prospect-task-group {
  margin-bottom: 16px;
}

.prospect-task-group:last-child {
  margin-bottom: 0;
}

.prospect-task-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 8px;
}

.task-group-overdue .prospect-task-group-label {
  color: #dc2626;
}

.task-group-today .prospect-task-group-label {
  color: var(--color-brand-strong, #2563eb);
}

.prospect-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prospect-task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--color-bg-subtle, #f9fafb);
}

.task-group-overdue .prospect-task-item {
  background: rgba(220, 38, 38, 0.06);
}

.task-group-today .prospect-task-item {
  background: rgba(37, 99, 235, 0.06);
}

.prospect-task-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-muted, #9ca3af);
  margin-top: 1px;
}

.task-group-overdue .prospect-task-checkbox {
  color: #dc2626;
}

.task-group-today .prospect-task-checkbox {
  color: var(--color-brand-strong, #2563eb);
}

.prospect-task-main {
  flex: 1;
  min-width: 0;
}

.prospect-task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary, #111827);
  line-height: 1.3;
}

.prospect-task-due {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
  margin-top: 2px;
}

.task-group-overdue .prospect-task-due {
  color: #dc2626;
}

.task-group-today .prospect-task-due {
  color: var(--color-brand-strong, #2563eb);
}

/* ============================================
   Contact Modal - Mobile Bottom Sheet
   ============================================ */

#contact-modal .modal-content {
  transition: transform 0.25s ease-out;
}

@media (max-width: 767px) {
  #contact-modal.active {
    align-items: flex-end;
  }
  
  #contact-modal .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    animation: slideUpSheet 0.25s ease-out;
  }
  
  @keyframes slideUpSheet {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}

/* Advanced fields container (legacy) */
.contact-advanced-section.collapsed {
  display: none;
}

/* Save/Cancel button row (legacy - see main .contact-modal-actions above) */
.contact-modal-actions-legacy {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-subtle, #e5e7eb);
}

.contact-modal-error {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
}

/* Inline field validation */
.contact-input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2) !important;
}

.contact-input-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2) !important;
}

.contact-error-msg {
  font-size: 11px;
  color: #b91c1c;
  margin-top: 2px;
  line-height: 1.4;
}

/* Save button loading state */
.btn-saving {
  opacity: 0.7;
  pointer-events: none;
}

.btn-saving::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

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

.prospect-activity-list,
.prospect-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prospect-activity-item,
.prospect-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.prospect-activity-icon,
.prospect-task-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--color-text-muted);
}

.prospect-activity-main,
.prospect-task-main {
  flex: 1;
}

.prospect-activity-meta,
.prospect-task-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-muted);
}

.prospect-card .empty-state {
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-muted);
  padding: 8px 0;
}

.prospect-empty-title {
  font-weight: 600;
}

.prospect-empty-sub {
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-muted);
}

/* AI enrichment card */
.ai-provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.ai-provider-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

/* Enrichment header row with refresh button */
.prospect-enrich-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.enrich-refresh-btn {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.enrich-refresh-btn:hover {
  background: var(--color-bg-subtle, #f3f4f6);
}

.enrich-refresh-icon {
  width: 16px;
  height: 16px;
  display: block;
  opacity: 0.6;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.enrich-refresh-btn:hover .enrich-refresh-icon {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(0, 122, 255, 0.4));
}

.ai-provider-buttons {
  display: inline-flex;
  gap: 8px;
}

.ai-provider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-surface);
  padding: 4px;
  cursor: pointer;
  transition:
    background 120ms ease-out,
    border-color 120ms ease-out,
    box-shadow 120ms ease-out,
    transform 80ms ease-out;
}

.ai-provider-btn:hover {
  background: var(--color-bg-subtle);
}

.ai-provider-btn.is-active {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-brand) 25%, transparent);
}

.ai-provider-icon {
  width: 18px;
  height: 18px;
  display: block;
}

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

.ai-enrich-result {
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  font-size: 13px;
  line-height: 1.5;
  width: 100%;
  overflow: visible;
}

.ai-enrich-result pre {
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Shared layout for AI action buttons */
.ai-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 14px;
  padding-block: 8px;
}

/* Icons inside AI buttons */
.ai-action-icon,
.ai-intel-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
}

.ai-refresh-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
}

@media (max-width: 767px) {
  .prospect-header-actions {
    gap: 6px;
  }

  .ai-action-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .ai-enrich-header {
    justify-content: flex-start;
  }
}

.ai-enrich-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
}

/* AI & Enrichment card layout improvements */
.ai-actions-group,
.ai-enrich-group {
  margin-bottom: 16px;
}

.ai-actions-group:last-child,
.ai-enrich-group:last-child {
  margin-bottom: 0;
}

.ai-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 8px;
}

.ai-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Perplexity button - black background with white icon/text */
.btn-perplexity {
  background-color: #111827;
  color: #ffffff;
  border-color: #111827;
  transition: background-color 150ms ease, border-color 150ms ease, transform 80ms ease;
}

.btn-perplexity:hover {
  background-color: #020617;
  border-color: #020617;
}

.btn-perplexity:active {
  background-color: #0d0d0d;
  transform: scale(0.98);
}

.btn-perplexity:focus-visible {
  outline: 2px solid var(--color-brand, #1d4ed8);
  outline-offset: 2px;
}

.btn-perplexity .ai-action-icon {
  filter: brightness(0) invert(1);
}

/* ─────────────────────────────────────────────────────────────────────────
   AI Tools Card (Apple + IBM hybrid styling)
   ───────────────────────────────────────────────────────────────────────── */

.ai-tools-card {
  /* Inherits from .card */
}

/* AI subsections */
.ai-subsection {
  margin-top: 12px;
}

.ai-subsection:first-of-type {
  margin-top: 0;
}

/* AI subtitle labels */
.ai-subtitle {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted, #6B7280);
  margin-bottom: 8px;
}

/* OpenAI Actions header icon */
.ai-openai-subtitle .ai-subtitle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.ai-openai-subtitle .ai-subtitle-icon-img {
  width: 16px;
  height: 16px;
  display: block;
}

/* AI Actions row */
.ai-actions-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Prospect Intelligence header with refresh */
.ai-intel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-intel-header .ai-subtitle {
  margin-bottom: 0;
}

/* Refresh button */
.ai-intel-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-brand, #6366F1);
  transition: background-color 150ms ease, transform 80ms ease;
}

.ai-intel-refresh-btn:hover {
  background-color: var(--color-bg-subtle, #F3F4F6);
}

.ai-intel-refresh-btn:active {
  transform: scale(0.92);
}

/* Intelligence button row */
.ai-intel-button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Stack buttons on narrow screens */
@media (max-width: 480px) {
  .ai-actions-row,
  .ai-intel-button-row {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Shared AI Button Base (for actions + intel)
   ───────────────────────────────────────────────────────────────────────── */

.btn-ai,
.btn-intel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 150ms ease, border-color 150ms ease, transform 80ms ease;
}

.btn-ai .btn-icon,
.btn-intel .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-ai .btn-icon svg,
.btn-intel .btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-ai .btn-label,
.btn-intel .btn-label {
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────
   AI Actions Button Styles
   ───────────────────────────────────────────────────────────────────────── */

/* Primary action (Outreach) - solid blue */
.btn-ai-primary {
  background-color: #345CFF;
  color: #FFFFFF;
}

.btn-ai-primary:hover {
  background-color: #2952e0;
}

.btn-ai-primary:active {
  background-color: #2147c7;
  transform: scale(0.98);
}

.btn-ai-primary:focus-visible {
  outline: 2px solid #345CFF;
  outline-offset: 2px;
}

/* Secondary AI action (Company Research) - white pill with gray border */
.btn-ai-secondary {
  background-color: #FFFFFF;
  color: #111827;
  border-color: #D1D5DB;
}

.btn-ai-secondary:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
}

.btn-ai-secondary:active {
  background-color: #F3F4F6;
  transform: scale(0.98);
}

.btn-ai-secondary:focus-visible {
  outline: 2px solid var(--color-brand, #1d4ed8);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Prospect Intelligence Button Styles
   ───────────────────────────────────────────────────────────────────────── */

/* Primary intel (Complete Insight) - deep navy */
.btn-intel-primary {
  background-color: #0F172A;
  color: #FFFFFF;
}

.btn-intel-primary:hover {
  background-color: #1E293B;
}

.btn-intel-primary:active {
  background-color: #334155;
  transform: scale(0.98);
}

.btn-intel-primary:focus-visible {
  outline: 2px solid var(--color-brand, #1d4ed8);
  outline-offset: 2px;
}

/* Secondary intel (Full Insight) - white pill with subtle border */
.btn-intel-secondary {
  background-color: #FFFFFF;
  color: #111827;
  border-color: #D1D5DB;
}

.btn-intel-secondary:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
}

.btn-intel-secondary:active {
  background-color: #F3F4F6;
  transform: scale(0.98);
}

.btn-intel-secondary:focus-visible {
  outline: 2px solid var(--color-brand, #1d4ed8);
  outline-offset: 2px;
}

/* Active state for AI buttons */
.btn-ai.is-active,
.btn-intel.is-active {
  box-shadow: 0 0 0 2px var(--color-brand, #2563eb);
}

.btn-ai-primary.is-active,
.btn-intel-primary.is-active {
  box-shadow: 0 0 0 2px #60a5fa;
}

/* ─────────────────────────────────────────────────────────────────────────
   AI Intel Description
   ───────────────────────────────────────────────────────────────────────── */

.ai-intel-description {
  margin-top: 10px;
  padding: 12px 14px;
  background-color: var(--color-bg-subtle, #F7F9FC);
  border-radius: 12px;
  font-size: 13px;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.5;
}

.ai-provider-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 9999px;
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  background: #ffffff;
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
}

.ai-provider-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.ai-section {
  margin-top: 8px;
}

.ai-section-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
}

.ai-label {
  font-weight: 500;
  margin-right: 4px;
}

.ai-value {
  margin-right: 8px;
}

.ai-copy-btn {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 9999px;
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  background: #ffffff;
  cursor: pointer;
}

.ai-copy-btn:hover {
  background: var(--color-bg-subtle, #f3f4f6);
}

.ai-person {
  padding: 4px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.ai-person-header {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ai-person-name {
  font-weight: 600;
}

.ai-person-role {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
}

/* Deep enrich structured rendering styles */
.ai-section-card {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-bg-surface, #ffffff);
  border: 1px solid var(--color-border-subtle, #e5e7eb);
}

.ai-engine-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #6b7280);
  margin-bottom: 4px;
}

.ai-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 12px;
}

.ai-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, #6b7280);
}

.ai-detail-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.ai-confidence-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-confidence-high {
  background: #dcfce7;
  color: #166534;
}

.ai-confidence-medium {
  background: #fef9c3;
  color: #92400e;
}

.ai-confidence-low {
  background: #fee2e2;
  color: #b91c1c;
}

.ai-contact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-contact-item {
  border-radius: 6px;
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  padding: 6px 8px;
  font-size: 12px;
}

.ai-contact-header {
  font-weight: 600;
  margin-bottom: 2px;
}

.ai-contact-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  background: #eef2ff;
  color: #3730a3;
  margin-bottom: 4px;
}

.ai-contact-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-bullet-list {
  padding-left: 16px;
  margin: 4px 0;
  font-size: 12px;
}

.ai-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: var(--color-brand-soft, #dbeafe);
  color: var(--color-brand, #1d4ed8);
}

.ai-person-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.ai-notes {
  margin: 2px 0 0;
  font-size: 12px;
}

.ai-muted {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
}

/* ============================================
   AI Research Text Display (Perplexity/Grok)
   ============================================ */

.ai-research-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}

.ai-engine-icon {
  font-size: 14px;
}

.ai-copy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.ai-copy-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-copy-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 150ms ease;
}

.ai-copy-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.ai-copy-chip:active {
  transform: scale(0.95);
}

/* ─────────────────────────────────────────────────────────────────────────
   Quick Copy - Missing field chips with emojis and SVG icons
   ───────────────────────────────────────────────────────────────────────── */

.quick-copy-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6b7280);
  margin-top: 8px;
  margin-bottom: 4px;
}

.quick-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.quick-copy-chip {
  border-radius: 9999px;
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  background: #ffffff;
  font-size: 14px;
  padding: 4px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.quick-copy-chip:hover {
  background: var(--color-bg-subtle, #f3f4f6);
  border-color: #d1d5db;
}

.quick-copy-chip:active {
  transform: scale(0.95);
}

.quick-copy-chip.copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.quick-copy-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.ai-research-text {
  padding: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: #1e293b;
  width: 100%;
  overflow: visible;
}

/* Mobile responsive AI output */
@media (max-width: 480px) {
  .ai-enrich-result {
    padding: 10px;
    font-size: 14px;
    line-height: 1.5;
  }
  
  .ai-research-text {
    padding: 12px;
    font-size: 15px;
    line-height: 1.45;
  }
}

.ai-research-heading {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e2e8f0;
}

.ai-research-heading:first-child {
  margin-top: 0;
}

.ai-research-subheading {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin: 14px 0 8px;
}

.ai-research-para {
  margin: 0 0 12px;
}

.ai-research-bullet {
  padding-left: 8px;
  margin: 4px 0;
  position: relative;
}

.ai-link {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
}

.ai-link:hover {
  text-decoration: underline;
}

.ai-email {
  color: #059669;
}

.ai-copy-all-btn {
  align-self: flex-start;
  margin-top: 4px;
}

/* Loading state */
.ai-research-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
}

.ai-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

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

/* Error state */
.ai-research-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  gap: 8px;
  color: #dc2626;
}

.ai-error-icon {
  font-size: 24px;
  margin: 0;
}

/* Active button state for research tabs */
.ai-action-btn.is-active {
  box-shadow: 0 0 0 2px var(--color-brand, #2563eb);
}

.btn-perplexity.is-active {
  box-shadow: 0 0 0 2px #2563eb;
}

.prospect-phone-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prospect-phone-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.prospect-phone-text {
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-primary);
}

.prospect-phone-text[href] {
  color: var(--color-brand-strong);
  text-decoration: none;
}

.prospect-phone-text[href]:hover {
  text-decoration: underline;
}

.prospect-phone-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-muted);
}

.overline {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
}

.prospect-workbench {
  padding: 20px;
}

@media (min-width: 768px) {
  #prospect-profile-view {
    padding: 24px;
  }

  .prospect-two-column {
    flex-direction: row;
    align-items: flex-start;
  }

  .prospect-two-column > .prospect-card {
    flex: 1;
  }

  .prospect-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* On wider screens, show channel labels next to icons */
  .prospect-channel-label {
    display: inline;
  }

  .prospect-workbench {
    padding: 24px;
  }
}

/* Contact Detail Header */
.contact-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #ffffff;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
  margin-bottom: 1.5rem;
}

.cdh-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cdh-company {
  font-size: 1.3rem;
  font-weight: 600;
  color: #111827;
}

.cdh-person {
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
}

.cdh-pills {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.cdh-pill {
  background: #eef2f7;
  color: #1f3b5c;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.75rem;
  font-weight: 500;
}

.cdh-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.cdh-channels {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: right;
}

.cdh-channel {
  font-size: 0.75rem;
  color: #1f3b5c;
}

/* Make status in header feel like the same badge system */
#cdh-status {
  background: #eef2f7;
  color: #1f3b5c;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Mobile version */
@media (max-width: 768px) {
  .contact-detail-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
  }

  .cdh-right {
    align-items: flex-start;
  }

  .cdh-channels {
    text-align: left;
  }
}

/* Prospect profile channel bar */
.prospect-profile {
  /* page-level helper, mainly for semantics; existing .page styles still apply */
}

.prospect-header {
  margin-bottom: 1rem;
}

.prospect-channels {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.prospect-channels .cdh-channel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  background: #f3f4f6;
  color: #111827;
}

.prospect-channels .cdh-channel a:hover {
  background: #e5e7eb;
}

@media (max-width: 767px) {
  .prospect-header {
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
  }

  .prospect-channels {
    margin-top: 0.35rem;
    padding-top: 0.4rem;
    gap: 0.4rem;
  }
}

.contact-assist-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.2;
    border-radius: 9999px;
    border: 1px solid transparent;
}

/* Icon inside RocketReach / assist buttons */
.contact-assist-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

/* Label text inside assist buttons */
.contact-assist-label {
    white-space: nowrap;
}

/* AI Outreach: primary, strongest CTA */
#ai-outreach-script.contact-assist-btn {
    background-color: var(--primary-color, #2563eb);
    color: #ffffff;
    border-color: var(--primary-color, #2563eb);
}

#ai-outreach-script.contact-assist-btn:hover {
    background-color: #1d4ed8;
}

/* AI Company Research: softer blue secondary */
#ai-company-research.contact-assist-btn {
    background-color: #e0ecff;
    color: var(--primary-color, #2563eb);
    border-color: #bfdbfe;
}

#ai-company-research.contact-assist-btn:hover {
    background-color: #d0e2ff;
}

/* RocketReach buttons: white / purple accent using the RR icon */
#rr-enrich-contact.contact-assist-btn-rr,
#rr-enrich-company.contact-assist-btn-rr {
    background-color: #f3e8ff;
    color: #6d28d9;
    border-color: #c4b5fd;
}

#rr-enrich-contact.contact-assist-btn-rr:hover,
#rr-enrich-company.contact-assist-btn-rr:hover {
    background-color: #e9d5ff;
    border-color: #7c3aed;
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.15);
}

/* Optional: differentiate contact vs company slightly */
#rr-enrich-contact.contact-assist-btn-rr {
    background-color: #f5f3ff;
}

#rr-enrich-company.contact-assist-btn-rr {
    background-color: #ffffff;
}

/* Mobile adjustments: keep toolbar compact and scrollable if needed */
@media (max-width: 768px) {
    .contact-assist-toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 0.25rem;
        margin-bottom: 0.75rem;
    }

    .contact-assist-btn {
        flex: 0 0 auto;
    }
}

/* ===================== CONTACTS LIST - DESKTOP ===================== */

.contacts-table tbody tr:hover {
  background-color: #f9fafb;
}

.contacts-table td {
  padding: 0.5rem 0.75rem;
}

/* ===================== CONTACTS LIST - MOBILE ====================== */

@media (max-width: 768px) {
  /* Allow contacts table to shrink to viewport width */
  #contacts-page .table-container {
    overflow-x: visible;
    box-shadow: none;
    border: none;
    background: transparent;
  }

  #contacts-page .contacts-table {
    min-width: 0;
    width: 100%;
  }

  /* Never allow sideways scroll on contacts */
  html,
  body {
    overflow-x: hidden;
  }

  /* Hide the table header on mobile */
  .contacts-table thead {
    display: none;
  }

  /* Each contact row becomes a compact card */
  .contacts-table tbody tr {
    display: block;
    margin: 0 0 0.9rem 0;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
  }

  .contacts-table tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.1rem 0;
    font-size: 0.85rem;
  }

  /* Small label on the left: uses data-label from each cell */
  .contacts-table tbody tr td::before {
    content: attr(data-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.65rem;
    color: var(--text-secondary);
    flex: 0 0 auto;
    margin-right: 0.5rem;
  }

  /* Primary line: Company / Organization */
  .contacts-table td[data-col="vendor"] {
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: 0.15rem;
    display: block;
  }

  /* Hide the "Company / Organization" label inside the cell */
  .contacts-table td[data-col="vendor"]::before {
    display: none;
  }

  /* Hide the checkbox itself but keep name + pill */
  .contacts-table td[data-col="vendor"] .row-select {
    display: none;
  }

  /*
    Status row: small pill aligned under main content
  */
  .contacts-table td[data-col="status"] {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.2rem;
  }

  .contacts-table td[data-col="status"] span {
    font-size: 0.72rem;
  }

  /* Tighten contacts page padding on mobile */
  #contacts-page.page {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
