/* Import Google Font - MUST be first */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/**
 * Pipeline Dashboard Styles
 * Design: Clean Industrial - Professional B2B Sales Pipeline
 * Color Palette: Warm neutrals with forest green accents
 */

/* ============ VARIABLES ============ */
:root {
    /* Brand Colors */
    --pipeline-green: #3d6b4f;
    --pipeline-green-light: #5a8a6b;
    --pipeline-green-dark: #2d5039;
    --pipeline-green-bg: #f0f5f2;

    /* Neutral Palette */
    --pipeline-slate: #4a5568;
    --pipeline-slate-light: #718096;
    --pipeline-warm-gray: #f7f6f3;
    --pipeline-cream: #faf9f7;
    --pipeline-border: #e8e6e1;
    --pipeline-border-dark: #d4d0c8;

    /* Status Colors */
    --status-open: #3182ce;
    --status-open-bg: #ebf4ff;
    --status-won: #38a169;
    --status-won-bg: #f0fff4;
    --status-lost: #a0aec0;
    --status-lost-bg: #f7fafc;
    --status-pending: #d69e2e;
    --status-pending-bg: #fffff0;
    --status-warning: #ed8936;
    --status-warning-bg: #fffaf0;

    /* Typography */
    --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-focus: 0 0 0 3px rgba(61, 107, 79, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
}

/* ============ BASE CONTAINER ============ */
#pipeline-dashboard {
    font-family: var(--font-body);
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    color: var(--pipeline-slate);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============ LOADING STATE ============ */
.pipeline-loading {
    text-align: center;
    padding: 80px var(--space-lg);
    color: var(--pipeline-slate-light);
}

.pipeline-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--pipeline-border);
    border-top-color: var(--pipeline-green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto var(--space-lg);
}

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

.pipeline-error {
    background: #fef2f2;
    color: #991b1b;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid #fecaca;
}

.pipeline-empty {
    text-align: center;
    padding: 60px var(--space-lg);
    color: var(--pipeline-slate-light);
    font-size: 15px;
}

/* ============ HEADER & STATS ============ */
.pipeline-header {
    margin-bottom: var(--space-lg);
}

.pipeline-header h2 {
    margin: 0 0 var(--space-md) 0;
    color: var(--pipeline-slate);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
}

.pipeline-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--pipeline-slate-light);
    letter-spacing: 0;
}

.pipeline-stats {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.pipeline-stats .stat {
    background: var(--pipeline-cream);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    min-width: 100px;
    border: 1px solid var(--pipeline-border);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.pipeline-stats .stat:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.pipeline-stats .stat.warning {
    background: var(--status-warning-bg);
    border-color: #fbd38d;
}

.pipeline-stats .stat.success {
    background: var(--status-won-bg);
    border-color: #9ae6b4;
}

.pipeline-stats .stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--pipeline-slate);
    font-feature-settings: 'tnum' 1;
    letter-spacing: -0.02em;
}

.pipeline-stats .stat-label {
    display: block;
    font-size: 11px;
    color: var(--pipeline-slate-light);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ============ TREND CHART ============ */
.pipeline-trend-chart {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--pipeline-border);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    height: 280px;
}

.pipeline-trend-chart canvas {
    max-height: 240px;
}

/* Chart Mode Toggle */
.chart-mode-toggle {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--pipeline-border);
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: var(--space-sm);
}

.chart-mode-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 2px);
    transition: all 0.15s ease;
}

.chart-mode-btn:hover {
    color: var(--text-primary);
}

.chart-mode-btn.active {
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ============ VIEW TOGGLE TABS ============ */
/* Toolbar: toggle + add button side by side */
.pipeline-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    gap: var(--space-md);
}

.pipeline-view-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--pipeline-border);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.view-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--pipeline-slate-light);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
}

.view-btn:hover {
    color: var(--pipeline-slate);
    background: rgba(255,255,255,0.5);
}

.view-btn.active {
    background: #fff;
    color: var(--pipeline-green);
    box-shadow: var(--shadow-sm);
}

/* ============ ADD ENTRY BUTTON ============ */
.add-entry-btn {
    padding: 10px 20px;
    background: var(--pipeline-green);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.add-entry-btn:hover {
    background: var(--pipeline-green-dark);
    box-shadow: var(--shadow-md);
}

/* ============ MODAL ============ */
.pipeline-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-lg);
    backdrop-filter: blur(2px);
}

.pipeline-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    font-family: var(--font-body);
}

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

.pipeline-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--pipeline-slate);
}

.pipeline-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--pipeline-slate-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.pipeline-modal-close:hover {
    background: var(--pipeline-warm-gray);
    color: var(--pipeline-slate);
}

.pipeline-modal-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.modal-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-form-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pipeline-slate);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-form-row label .required {
    color: #e53e3e;
}

.modal-form-row input,
.modal-form-row select,
.modal-form-row textarea {
    padding: 10px 12px;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--pipeline-slate);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: #fff;
}

.modal-form-row input:focus,
.modal-form-row select:focus,
.modal-form-row textarea:focus {
    outline: none;
    border-color: var(--pipeline-green);
    box-shadow: var(--shadow-focus);
}

.modal-form-row textarea {
    resize: vertical;
    min-height: 60px;
}

.modal-form-row-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.modal-form-error {
    background: #fff5f5;
    color: #c53030;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    border: 1px solid #fed7d7;
}

.pipeline-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--pipeline-border);
}

.modal-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--pipeline-slate-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-cancel-btn:hover {
    background: var(--pipeline-warm-gray);
    color: var(--pipeline-slate);
}

.modal-submit-btn {
    padding: 10px 24px;
    background: var(--pipeline-green);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-submit-btn:hover {
    background: var(--pipeline-green-dark);
}

.modal-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.view-icon {
    font-size: 14px;
}

/* ============ FILTER PILLS ============ */
.pipeline-filters {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 7px 14px;
    border: 1px solid var(--pipeline-border);
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--pipeline-slate-light);
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.filter-btn:hover {
    border-color: var(--pipeline-green-light);
    color: var(--pipeline-green);
}

.filter-btn.active {
    background: var(--pipeline-green);
    color: #fff;
    border-color: var(--pipeline-green);
}

.pipeline-time-note {
    font-size: 12px;
    color: var(--pipeline-slate-light);
    margin-bottom: var(--space-md);
    font-style: italic;
}

/* ============ CARD BASE STYLES ============ */
.person-card,
.job-card,
.project-card {
    background: #fff;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    margin-bottom: var(--space-sm);
}

.person-card:hover,
.job-card:hover,
.project-card:hover {
    border-color: var(--pipeline-border-dark);
    box-shadow: var(--shadow-md);
}

.person-card.needs-info,
.job-card.needs-info,
.project-card.needs-info {
    border-left: 3px solid var(--status-warning);
}

.person-card.has-won,
.job-card.success,
.project-card.success {
    border-left: 3px solid var(--status-won);
}

.job-card.lost,
.project-card.lost {
    border-left: 3px solid var(--status-lost);
    opacity: 0.75;
}

.person-card.expanded,
.job-card.expanded,
.project-card.expanded {
    border-color: var(--pipeline-green-light);
    box-shadow: var(--shadow-md);
}

/* ============ CARD HEADERS ============ */
.person-header,
.job-card-header,
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px var(--space-md);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.person-header:hover,
.job-card-header:hover,
.project-card-header:hover {
    background: var(--pipeline-warm-gray);
}

.person-header-left,
.job-card-left,
.project-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.person-header-right,
.job-card-right,
.project-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Card header text elements */
.person-name,
.job-service,
.project-service {
    font-weight: 600;
    color: var(--pipeline-slate);
    font-size: 14px;
}

.person-jobs-count,
.job-contact,
.person-date,
.job-date {
    color: var(--pipeline-slate-light);
    font-size: 13px;
}

.person-attribution {
    font-size: 12px;
    color: var(--pipeline-green);
    background: var(--pipeline-green-bg);
    padding: 2px 8px;
    border-radius: 10px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auto-detected from call transcript */
.person-attribution.auto-detected {
    color: #3182ce;
    background: #ebf8ff;
    font-style: italic;
}

/* CallRail tracking source */
.person-attribution.callrail-source {
    color: var(--pipeline-slate);
    background: var(--pipeline-warm-gray);
}

/* Value display */
.person-value,
.job-value,
.project-value {
    font-weight: 600;
    color: var(--pipeline-green);
    font-size: 13px;
    font-feature-settings: 'tnum' 1;
}

/* Category tags */
.job-category-tag {
    background: var(--pipeline-warm-gray);
    color: var(--pipeline-slate);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Status badges */
.deal-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.deal-badge.warning {
    background: var(--status-warning-bg);
    color: #c05621;
}

.job-status,
.job-row-status,
.project-status-quick {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
    font-weight: 500;
}

.job-status.open,
.job-row-status.open,
.project-status-quick.open {
    background: var(--status-open-bg);
    color: var(--status-open);
}

.job-status.won,
.job-row-status.won,
.project-status-quick.won {
    background: var(--status-won-bg);
    color: var(--status-won);
}

.job-status.lost,
.job-row-status.lost,
.project-status-quick.lost {
    background: var(--status-lost-bg);
    color: var(--status-lost);
}

.job-status.pending,
.job-row-status.pending,
.project-status-quick.pending {
    background: var(--status-pending-bg);
    color: var(--status-pending);
}

/* Expand icons */
.person-expand-icon,
.job-card-expand-icon,
.project-expand-icon,
.job-expand-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pipeline-warm-gray);
    border-radius: 50%;
    font-size: 14px;
    color: var(--pipeline-slate-light);
    transition: all var(--transition-fast);
}

.person-card.expanded .person-expand-icon,
.job-card.expanded .job-card-expand-icon {
    background: var(--pipeline-green-bg);
    color: var(--pipeline-green);
}

/* Status summary in person cards */
.person-status-summary {
    display: flex;
    gap: 4px;
}

.status-count {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.status-count.won {
    background: var(--status-won-bg);
    color: var(--status-won);
}

.status-count.pending {
    background: var(--status-pending-bg);
    color: var(--status-pending);
}

.status-count.open {
    background: var(--status-open-bg);
    color: var(--status-open);
}

/* ============ CARD DETAILS CONTAINER ============ */
.person-details,
.job-card-details,
.project-details {
    border-top: 1px solid var(--pipeline-border);
    padding: var(--space-lg);
    background: linear-gradient(180deg, var(--pipeline-warm-gray) 0%, #f3f2ef 100%);
    position: relative;
    /* Smooth expand animation */
    animation: slideReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
}

/* Inset shadow for depth */
.person-details::before,
.job-card-details::before,
.project-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0.04) 0%, transparent 100%);
    pointer-events: none;
}

@keyframes slideReveal {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ DATA SECTIONS (Client vs Job level) ============ */
.data-section {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--pipeline-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.data-section:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
}

.data-section:last-child {
    margin-bottom: 0;
}

/* Client level section - slate accent */
.data-section.client-level {
    border-left: none;
    border-top: 3px solid var(--pipeline-slate-light);
}

.data-section.client-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(113, 128, 150, 0.04) 0%, transparent 100%);
    pointer-events: none;
}

/* Job level section - green accent */
.data-section.job-level {
    border-left: none;
    border-top: 3px solid var(--pipeline-green);
}

.data-section.job-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(61, 107, 79, 0.04) 0%, transparent 100%);
    pointer-events: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--pipeline-border);
    position: relative;
}

/* Section icon indicators */
.section-header::before {
    content: '';
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.data-section.client-level .section-header::before {
    content: '👤';
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-section.job-level .section-header::before {
    content: '📋';
    background: linear-gradient(135deg, var(--pipeline-green-bg) 0%, #d4e7db 100%);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--pipeline-slate);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-hint {
    font-size: 12px;
    color: var(--pipeline-slate-light);
    font-style: normal;
    background: var(--pipeline-warm-gray);
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
}

.client-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: var(--space-sm);
    font-size: 13px;
    color: var(--pipeline-slate);
}

.client-info-row span strong {
    color: var(--pipeline-slate);
    font-weight: 500;
}

/* ============ FORMS ============ */
.attribution-form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.attribution-form-inline .form-row {
    flex: 1;
    min-width: 180px;
}

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

.form-row label {
    font-size: 11px;
    font-weight: 600;
    color: var(--pipeline-slate);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-row-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* Input base styles */
.attribution-form-inline input,
.attribution-form-inline select,
.job-form input,
.job-form select,
.job-form textarea,
.job-row-form input,
.job-row-form select,
.job-row-form textarea,
.client-contact-form input,
.client-contact-form select {
    padding: 11px 14px;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(180deg, #fff 0%, #fafaf9 100%);
    color: var(--pipeline-slate);
    transition: all var(--transition-fast);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.attribution-form-inline input:hover,
.attribution-form-inline select:hover,
.job-form input:hover,
.job-form select:hover,
.job-form textarea:hover,
.job-row-form input:hover,
.job-row-form select:hover,
.job-row-form textarea:hover,
.client-contact-form input:hover,
.client-contact-form select:hover {
    border-color: var(--pipeline-border-dark);
    background: #fff;
}

.attribution-form-inline input:focus,
.attribution-form-inline select:focus,
.job-form input:focus,
.job-form select:focus,
.job-form textarea:focus,
.job-row-form input:focus,
.job-row-form select:focus,
.job-row-form textarea:focus,
.client-contact-form input:focus,
.client-contact-form select:focus {
    outline: none;
    border-color: var(--pipeline-green);
    box-shadow: var(--shadow-focus), inset 0 1px 2px rgba(0,0,0,0.02);
    background: #fff;
}

/* Placeholder styling */
.attribution-form-inline input::placeholder,
.job-form input::placeholder,
.job-form textarea::placeholder,
.job-row-form input::placeholder,
.job-row-form textarea::placeholder,
.client-contact-form input::placeholder {
    color: var(--pipeline-slate-light);
    opacity: 0.6;
}

.job-form textarea,
.job-row-form textarea {
    min-height: 70px;
    resize: vertical;
    line-height: 1.5;
}

.job-form,
.job-row-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--pipeline-border);
}

/* ============ BUTTONS ============ */
.client-save-btn,
.job-save-btn,
.row-save-btn {
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Subtle shine effect on buttons */
.client-save-btn::before,
.job-save-btn::before,
.row-save-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    pointer-events: none;
}

.client-save-btn {
    background: linear-gradient(180deg, var(--pipeline-slate) 0%, #3d4a5c 100%);
    color: #fff;
}

.client-save-btn:hover {
    background: linear-gradient(180deg, var(--pipeline-slate-light) 0%, var(--pipeline-slate) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.client-save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.job-save-btn,
.row-save-btn {
    background: linear-gradient(180deg, var(--pipeline-green) 0%, var(--pipeline-green-dark) 100%);
    color: #fff;
}

.job-save-btn:hover,
.row-save-btn:hover {
    background: linear-gradient(180deg, var(--pipeline-green-light) 0%, var(--pipeline-green) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(61, 107, 79, 0.25);
}

.job-save-btn:active,
.row-save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.client-save-btn:disabled,
.job-save-btn:disabled,
.row-save-btn:disabled {
    background: var(--pipeline-border-dark);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.client-save-btn.success,
.job-save-btn.success,
.row-save-btn.success {
    background: linear-gradient(180deg, var(--status-won) 0%, #2f855a 100%);
    animation: successPulse 0.4s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.client-save-btn.error,
.job-save-btn.error,
.row-save-btn.error {
    background: linear-gradient(180deg, #e53e3e 0%, #c53030 100%);
    animation: errorShake 0.4s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.last-updated {
    font-size: 11px;
    color: var(--pipeline-slate-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.last-updated::before {
    content: '✓';
    color: var(--status-won);
    font-size: 12px;
}

/* ============ JOBS LIST WITHIN PERSON CARD ============ */
.jobs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.job-row {
    background: #fff;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.job-row:hover {
    border-color: var(--pipeline-border-dark);
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.job-row.expanded {
    border-color: var(--pipeline-green-light);
    box-shadow: 0 4px 12px rgba(61, 107, 79, 0.1);
}

.job-row.won {
    border-left: 4px solid var(--status-won);
    background: linear-gradient(90deg, rgba(56, 161, 105, 0.03) 0%, transparent 20%);
}

.job-row.pending {
    border-left: 4px solid var(--status-pending);
    background: linear-gradient(90deg, rgba(214, 158, 46, 0.03) 0%, transparent 20%);
}

.job-row.lost {
    border-left: 4px solid var(--status-lost);
    opacity: 0.7;
}

.job-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.job-row-header:hover {
    background: linear-gradient(180deg, var(--pipeline-warm-gray) 0%, transparent 100%);
}

.job-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.job-row-service {
    font-weight: 600;
    color: var(--pipeline-slate);
    font-size: 14px;
}

.job-row-category {
    background: linear-gradient(135deg, var(--pipeline-warm-gray) 0%, #f0efec 100%);
    color: var(--pipeline-slate-light);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.job-row-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.job-row-value {
    color: var(--pipeline-green);
    font-weight: 600;
    font-size: 13px;
    font-feature-settings: 'tnum' 1;
}

.job-row-expand,
.job-expand-icon {
    font-size: 12px;
    color: var(--pipeline-slate-light);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pipeline-warm-gray);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.job-row.expanded .job-row-expand,
.job-row.expanded .job-expand-icon {
    background: var(--pipeline-green-bg);
    color: var(--pipeline-green);
    transform: rotate(90deg);
}

.job-row-details {
    border-top: 1px solid var(--pipeline-border);
    padding: var(--space-lg);
    background: linear-gradient(180deg, #fafaf9 0%, #f5f4f2 100%);
    animation: slideReveal 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.job-row-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(180deg, rgba(0,0,0,0.03) 0%, transparent 100%);
    pointer-events: none;
}

.job-row-form .form-row-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

/* Visual grouping for related fields */
.job-row-form .form-row-group + .form-row-group {
    padding-top: var(--space-md);
    border-top: 1px dashed var(--pipeline-border);
    margin-top: var(--space-sm);
}

/* ============ CATEGORY VIEW ============ */
.category-summary {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--pipeline-cream);
    border-radius: var(--radius-lg);
    border: 1px solid var(--pipeline-border);
}

.summary-stat {
    text-align: center;
}

.summary-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--pipeline-slate);
    font-feature-settings: 'tnum' 1;
}

.summary-label {
    font-size: 11px;
    color: var(--pipeline-slate-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.category-card {
    background: #fff;
    border: 1px solid var(--pipeline-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.category-card:hover {
    border-color: var(--pipeline-green-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.category-name {
    font-weight: 600;
    color: var(--pipeline-slate);
    font-size: 14px;
}

.category-count {
    font-size: 12px;
    color: var(--pipeline-slate-light);
}

.category-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--pipeline-green);
    margin-bottom: var(--space-sm);
    font-feature-settings: 'tnum' 1;
}

.category-bar {
    height: 5px;
    background: var(--pipeline-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.category-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pipeline-green), var(--pipeline-green-light));
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.category-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--pipeline-slate-light);
}

/* ============ DRILLDOWN LIST ============ */
.project-list-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--pipeline-border);
}

.project-list-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--pipeline-slate);
    flex: 1;
}

.project-count {
    font-size: 13px;
    color: var(--pipeline-slate-light);
}

.back-btn {
    padding: 8px 14px;
    border: 1px solid var(--pipeline-border);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--pipeline-slate);
    transition: all var(--transition-fast);
    font-family: var(--font-body);
    font-weight: 500;
}

.back-btn:hover {
    border-color: var(--pipeline-green);
    color: var(--pipeline-green);
    background: var(--pipeline-green-bg);
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ============ PEOPLE & JOBS CONTAINERS ============ */
.pipeline-people,
.pipeline-jobs {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ============ MOBILE RESPONSIVE ============ */
@media (max-width: 768px) {
    #pipeline-dashboard {
        padding: var(--space-md);
    }

    .pipeline-stats {
        gap: var(--space-xs);
    }

    .pipeline-stats .stat {
        padding: var(--space-sm) var(--space-md);
        min-width: 80px;
    }

    .pipeline-stats .stat-value {
        font-size: 18px;
    }

    .pipeline-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .pipeline-view-toggle {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .add-entry-btn {
        width: 100%;
        text-align: center;
    }

    .view-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Modal responsive */
    .pipeline-modal-overlay {
        padding: var(--space-md);
    }

    .modal-form-row-group {
        grid-template-columns: 1fr;
    }

    /* Card headers */
    .person-header,
    .job-card-header,
    .project-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .person-header-right,
    .job-card-right,
    .project-header-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Forms */
    .form-row-group,
    .job-row-form .form-row-group {
        grid-template-columns: 1fr;
    }

    .attribution-form-inline {
        flex-direction: column;
    }

    .attribution-form-inline .form-row {
        width: 100%;
    }

    .attribution-form-inline .client-save-btn {
        width: 100%;
    }

    .client-info-row {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Job rows */
    .job-row-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .job-row-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Category grid */
    .category-grid {
        grid-template-columns: 1fr;
    }

    .category-summary {
        flex-direction: column;
        gap: var(--space-md);
    }

    /* Drilldown */
    .project-list-header {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .project-list-header h3 {
        width: 100%;
        order: 2;
    }

    .back-btn {
        order: 1;
    }

    .project-count {
        order: 3;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.person-card,
.job-card,
.category-card {
    animation: fadeIn var(--transition-slow) ease-out;
}

/* Staggered animation for cards */
.pipeline-people .person-card:nth-child(1),
.pipeline-jobs .job-card:nth-child(1),
.category-grid .category-card:nth-child(1) { animation-delay: 0ms; }
.pipeline-people .person-card:nth-child(2),
.pipeline-jobs .job-card:nth-child(2),
.category-grid .category-card:nth-child(2) { animation-delay: 30ms; }
.pipeline-people .person-card:nth-child(3),
.pipeline-jobs .job-card:nth-child(3),
.category-grid .category-card:nth-child(3) { animation-delay: 60ms; }
.pipeline-people .person-card:nth-child(4),
.pipeline-jobs .job-card:nth-child(4),
.category-grid .category-card:nth-child(4) { animation-delay: 90ms; }
.pipeline-people .person-card:nth-child(5),
.pipeline-jobs .job-card:nth-child(5),
.category-grid .category-card:nth-child(5) { animation-delay: 120ms; }

/* ============ CLIENT CONTACT FORM ============ */
.client-contact-form {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px dashed var(--pipeline-border);
    position: relative;
}

.client-contact-form .form-row-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.from-callrail {
    font-size: 10px;
    font-weight: 500;
    color: var(--pipeline-slate-light);
    background: var(--pipeline-warm-gray);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.readonly-info {
    padding-top: var(--space-md);
    color: var(--pipeline-slate-light);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    background: var(--pipeline-warm-gray);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
}

.readonly-info span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.readonly-info span strong {
    font-weight: 600;
    color: var(--pipeline-slate);
}

/* Mobile adjustments for contact form */
@media (max-width: 768px) {
    .client-contact-form .form-row-group {
        grid-template-columns: 1fr;
    }
}

/* ============ EXPANDED CARD POLISH ============ */
/* Add subtle animation for section icons */
.data-section.client-level .section-header::before,
.data-section.job-level .section-header::before {
    animation: iconBounce 0.4s ease 0.2s;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Stagger animation for nested job rows */
.jobs-list .job-row:nth-child(1) { animation-delay: 0ms; }
.jobs-list .job-row:nth-child(2) { animation-delay: 50ms; }
.jobs-list .job-row:nth-child(3) { animation-delay: 100ms; }
.jobs-list .job-row:nth-child(4) { animation-delay: 150ms; }
.jobs-list .job-row:nth-child(5) { animation-delay: 200ms; }

/* Add fadeIn animation to job rows */
.jobs-list .job-row {
    animation: fadeIn var(--transition-slow) ease-out backwards;
}
