* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* Compact header with stats inline */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.95);
    padding: 12px 24px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-row h1 {
    font-size: 1.4em;
    color: #333;
    margin: 0;
    text-shadow: none;
}

.stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    text-align: center;
    padding: 4px 16px;
    border-radius: 6px;
    background: #f8f9fa;
}

.stat-item .label {
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.stat-item .value {
    font-size: 1.3em;
    font-weight: bold;
}

.value.apply-count { color: #28a745; }
.value.nurture-count { color: #ffc107; }
.value.skip-count { color: #dc3545; }

/* Meta stats (last updated, new/removed) */
.stat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    padding: 4px 12px;
    background: #e9ecef;
    border-radius: 6px;
    white-space: nowrap;
}

.stat-meta .meta-text {
    color: #555;
}

.stat-meta .meta-new {
    color: #28a745;
    font-weight: bold;
}

.stat-meta .meta-removed {
    color: #dc3545;
    font-weight: bold;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: #dee2e6;
}

.group {
    margin-bottom: 40px;
}

.group-header {
    background: rgba(255,255,255,0.95);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-header .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.group-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-content {
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border-radius: 0 0 10px 10px;
    margin-top: -5px;
}

.group-content.collapsed {
    display: none;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.card.high {
    border-color: #28a745;
    background: linear-gradient(135deg, rgba(40,167,69,0.08) 0%, rgba(40,167,69,0.02) 100%);
}

.card.low {
    border-color: #dc3545;
    background: linear-gradient(135deg, rgba(220,53,69,0.08) 0%, rgba(220,53,69,0.02) 100%);
}

.card.medium {
    border-color: #ffc107;
    background: linear-gradient(135deg, rgba(255,193,7,0.08) 0%, rgba(255,193,7,0.02) 100%);
}

.card.expanded {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Compact card header - single line */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.card-title {
    font-size: 1.05em;
    font-weight: bold;
    color: #333;
    flex: 1;
    min-width: 0;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-title a:hover {
    text-decoration: underline;
}

.card-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.7em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.badge-high { background: #28a745; }
.badge-low { background: #dc3545; }
.badge-medium { background: #ffc107; color: #333; }

/* New job badge - red, after ID */
.new-badge {
    background-color: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.65em;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Note/Summary - prominent */
.card-note {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    line-height: 1.5;
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.08);
}

.card-note .note-label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 4px;
    display: block;
    font-size: 0.8em;
    text-transform: uppercase;
}

.card-note .note-content {
    color: #333;
}

/* Compact card info */
.card-info {
    margin-bottom: 8px;
    font-size: 0.85em;
    color: #555;
}

.card-info p {
    margin: 3px 0;
}

.info-row {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
}

.info-item {
    padding: 6px 10px;
    border-radius: 5px;
    background: #f8f9fa;
    flex: 0 1 auto;
}

.info-item .info-label {
    font-size: 0.7em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 3px;
    letter-spacing: 0.3px;
}

.info-item .info-value {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    background: #e9ecef;
    color: #495057;
    white-space: nowrap;
}

/* Description */
.card-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, margin-top 0.4s ease;
}

.card.expanded .card-description {
    max-height: 2000px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.card-description p {
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 1.5em;
}

.error {
    text-align: center;
    padding: 50px;
    color: #dc3545;
    font-size: 1.5em;
}

@media (max-width: 768px) {
    .header-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .info-item {
        min-width: 100%;
    }
}

/* ============================================================ */
/* STATUS BUTTONS — Added by Phase 4 refactoring                */
/* ============================================================ */

/* Status button row container */
.status-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #e0e0e0;
}

/* Status button base */
.status-btn {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #f0f0f0;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.status-btn:hover {
    transform: scale(1.1);
}

/* Status-specific colors */
.status-reject:hover, .status-reject.active {
    background: #dc3545;
    color: white;
    border-color: #c82333;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
}

.status-question:hover, .status-question.active {
    background: #ffc107;
    color: #333;
    border-color: #e0a800;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
}

.status-accept:hover, .status-accept.active {
    background: #28a745;
    color: white;
    border-color: #218838;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.4);
}

.status-applied:hover, .status-applied.active {
    background: #20c997;
    color: white;
    border-color: #1aa07d;
    box-shadow: 0 2px 6px rgba(32, 201, 151, 0.4);
}

/* Dimmed state for inactive buttons when one status is active */
.status-buttons.has-active .status-btn:not(.active) {
    opacity: 0.35;
}

/* Show Hidden toggle button */
.toggle-hidden-btn {
    padding: 6px 14px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    background: rgba(255,255,255,0.7);
    color: #555;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 10px;
}

.toggle-hidden-btn:hover {
    background: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.8);
}

.toggle-hidden-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ============================================================ */
/* CLIENT METRICS COLOR-CODING — Added by Phase 4                */
/* ============================================================ */

.card-client-metrics {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid #eee;
    font-size: 0.8em;
    flex-wrap: wrap;
}

.client-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.metric-label {
    color: #888;
    font-size: 0.75em;
}

.metric-value {
    font-weight: 600;
}

/* Client totalSpent colors */
.client-spent-red { color: #dc3545 !important; }
.client-spent-yellow { color: #ffc107 !important; }
.client-spent-green { color: #28a745 !important; }

/* Client totalReviews colors */
.client-reviews-red { color: #dc3545 !important; }
.client-reviews-yellow { color: #ffc107 !important; }
.client-reviews-blue { color: #007bff !important; }
.client-reviews-green { color: #28a745 !important; }

/* Client feedback colors */
.client-feedback-red { color: #dc3545 !important; }
.client-feedback-yellow { color: #ffc107 !important; }
.client-feedback-blue { color: #007bff !important; }
.client-feedback-green { color: #28a745 !important; }
.client-feedback-teal { color: #20c997 !important; }

/* Posted days colors */
.posted-days-green { color: #4caf50 !important; }
.posted-days-yellow { color: #fbc02d !important; }
.posted-days-orange { color: #ff9800 !important; }
.posted-days-red { color: #e53935 !important; }

/* ============================================================ */
/* RESPONSIVE BEHAVIOR                                           */
/* ============================================================ */

@media (max-width: 768px) {
    .status-buttons {
        gap: 4px;
        justify-content: center;
    }
    
    .status-btn {
        width: 32px;
        height: 32px;
        font-size: 15px;
    }
    
    .toggle-hidden-btn {
        margin-top: 8px;
        align-self: center;
    }
    
    .card-client-metrics {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .status-buttons {
        gap: 3px;
    }
    
    .status-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}

/* Card visibility when show-hidden is active */
body.show-hidden .card[data-status="rejected"],
body.show-hidden .card[data-status="applied"] {
    display: block;
}
