/**
 * Startrace Dashboard Styles
 * Modern Light Theme - Clean, Professional, Minimalist
 */

/* ==========================================================================
   CSS Variables & Theme
   ========================================================================== */

:root {
    /* Background Colors */
    --bg-body: #FFFFFF;
    --bg-sidebar: #F9FAFB;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F3F4F6;
    --bg-input: #FFFFFF;

    /* Border Colors */
    --border-subtle: #E5E7EB;
    --border-strong: #D1D5DB;

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;

    /* Brand Colors - Light Navy Blue */
    --brand-primary: #2C5E9E;
    --brand-hover: #1E4272;
    --brand-light: #EFF4F8;
    --brand-text: #FFFFFF;

    /* Semantic Colors */
    --success: #059669;
    --success-bg: #ECFDF5;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --error: #DC2626;
    --error-bg: #FEF2F2;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================================================
   App Layout
   ========================================================================== */

.app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 12px 32px 12px;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h1::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background: var(--brand-primary);
    border-radius: 4px;
}

.customer-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customer-item {
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

.customer-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.customer-item.active {
    background: white;
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.customer-item .name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.customer-item .slug {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-family: monospace;
}

.customer-item.active .name {
    color: var(--brand-primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.main-header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.main-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
    outline: none;
    white-space: nowrap;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--brand-primary);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--brand-primary);
    color: var(--brand-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: var(--brand-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-sidebar);
    border-color: var(--text-tertiary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

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

.btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: 0.85rem;
}

.btn-text {
    display: inline;
}

.btn-loading {
    display: none;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-sidebar);
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-sidebar);
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.status::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-awaiting_approval {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.status-awaiting_approval::before {
    background: var(--warning);
}

.status-execution_queued,
.status-processing {
    color: var(--brand-primary);
    background: var(--brand-light);
    border: 1px solid rgba(44, 94, 158, 0.15);
}

.status-execution_queued::before,
.status-processing::before {
    background: var(--brand-primary);
}

.status-completed {
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid rgba(5, 150, 105, 0.1);
}

.status-completed::before {
    background: var(--success);
}

.status-awaiting_lead_scoring {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.status-awaiting_lead_scoring::before {
    background: var(--warning);
}

.status-awaiting_account_scoring {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.status-awaiting_account_scoring::before {
    background: var(--warning);
}

.status-awaiting_outreach_calculation {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.status-awaiting_outreach_calculation::before {
    background: var(--warning);
}

.status-failed {
    color: var(--error);
    background: var(--error-bg);
    border: 1px solid rgba(220, 38, 38, 0.1);
}

.status-failed::before {
    background: var(--error);
}

/* ==========================================================================
   Stage Progress
   ========================================================================== */

.stage-progress-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.stage-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stage-progress-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.stage-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.stage-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stage-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.stage-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.stage-icon.pending {
    background: var(--bg-card);
    border: 2px solid var(--border-strong);
    color: var(--text-tertiary);
}

.stage-icon.running {
    background: var(--brand-light);
    border: 2px solid var(--brand-primary);
    color: var(--brand-primary);
    animation: pulse 1.5s infinite;
}

.stage-icon.completed {
    background: var(--success-bg);
    border: 2px solid var(--success);
    color: var(--success);
}

.stage-icon.failed {
    background: var(--error-bg);
    border: 2px solid var(--error);
    color: var(--error);
}

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

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

.stage-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    transform: scale(0.98);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-sidebar);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: var(--font-main);
    box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* Object Group Titles */
.object-field-group {
    margin-bottom: 24px;
}

.object-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 16px;
    margin: 16px 0 12px;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-primary);
}

.object-subgroup-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin: 16px 0 8px;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
    border-left: 2px solid var(--text-tertiary);
}

.object-field-content {
    padding-left: 8px;
}

/* Checkbox Styling */
.checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.checkbox-group label:hover {
    background: var(--bg-sidebar);
    border-color: var(--border-strong);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.checkbox-group label span {
    font-weight: 500;
    color: var(--text-primary);
}

/* ==========================================================================
   Company Components
   ========================================================================== */

.company-input-wrapper,
.csv-import-wrapper {
    display: flex;
    gap: 12px;
}

.company-input-wrapper input,
.csv-import-wrapper input {
    flex: 1;
}

.companies-section {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 32px;
    background: var(--bg-sidebar);
}

.companies-section-header h4 {
    margin: 0 0 16px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.company-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.company-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.company-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: white;
    border: 1px solid var(--border-subtle);
    padding: 2px;
}

.company-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--brand-primary);
    font-size: 1.2rem;
}

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

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

.company-card-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.company-card-linkedin a,
table a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
}

.company-card-linkedin a:hover,
table a:hover {
    text-decoration: underline;
    color: var(--brand-hover);
}

/* Company List Items (Compact) */
.company-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.company-list-item .company-logo,
.company-list-item .company-logo-placeholder {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

.company-remove-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    transition: var(--transition);
}

.company-remove-btn:hover {
    color: var(--error);
    background: var(--error-bg);
}

.company-count {
    background: var(--brand-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    margin-left: 8px;
    font-weight: 600;
}

/* ==========================================================================
   CSV Import
   ========================================================================== */

.csv-import-progress {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.progress-bar {
    height: 6px;
    background: var(--bg-sidebar);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--brand-primary);
    transition: width 0.3s ease;
}

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

.progress-errors {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--error);
    font-family: monospace;
    background: var(--error-bg);
    padding: 8px;
    border-radius: 4px;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-tertiary);
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    color: var(--border-strong);
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.clickable {
    cursor: pointer;
    color: var(--brand-primary);
    font-weight: 500;
}

.clickable:hover {
    text-decoration: underline;
    color: var(--brand-hover);
}

.spinner {
    animation: spin 1s linear infinite;
}

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

.loading {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

/* ==========================================================================
   Collapsible Sections
   ========================================================================== */

.collapsible-section {
    margin-top: 32px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--warning-bg);
    cursor: pointer;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: #FEF3C7;
}

.collapsible-header h4 {
    color: #92400E;
    font-size: 0.95rem;
    font-weight: 600;
}

.collapsible-content {
    display: none;
    background: white;
}

.collapsible-section.open .collapsible-content {
    display: block;
}

.duplicate-info {
    padding: 16px 24px;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Custom Checkboxes
   ========================================================================== */

.staged-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    transition: all 0.2s;
}

.staged-checkbox:checked {
    background: var(--success);
    border-color: var(--success);
}

.staged-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.staged-checkbox:hover {
    border-color: var(--text-secondary);
}

/* Resolution Text Colors */
.resolution-success {
    color: var(--success);
    font-weight: 600;
}

.resolution-failed {
    color: var(--error);
    font-weight: 600;
}

.resolution-approved {
    color: var(--text-primary);
}

/* Duplicate Badge */
.duplicates-badge {
    background: var(--warning-bg);
    color: #B45309;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #FCD34D;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.duplicates-badge:hover {
    background: #FEF3C7;
    transform: translateY(-1px);
}

.duplicates-badge .count {
    font-weight: 700;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ==========================================================================
   Tab Navigation
   ========================================================================== */

.tab-nav {
    display: flex;
    gap: 0;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-right: 24px;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-family: var(--font-main);
}

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

.tab-btn.active {
    background: white;
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Play Editor
   ========================================================================== */

.edit-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.edit-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    font-family: var(--font-main);
}

.edit-tab:hover {
    color: var(--text-primary);
}

.edit-tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.edit-tab-content {
    display: none;
}

.edit-tab-content.active {
    display: block;
}

/* ==========================================================================
   Field Sections
   ========================================================================== */

.field-section {
    margin-bottom: 32px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.field-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-sidebar);
    cursor: pointer;
    user-select: none;
}

.field-section-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.field-section-header .count {
    background: var(--brand-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.field-section-toggle {
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.field-section.open .field-section-toggle {
    transform: rotate(180deg);
}

.field-section-body {
    display: none;
    padding: 20px;
    background: white;
}

.field-section.open .field-section-body {
    display: block;
}

/* ==========================================================================
   Array Fields
   ========================================================================== */

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

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

.array-field-header label {
    font-weight: 500;
    color: var(--text-primary);
}

.array-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.array-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.array-item input,
.array-item textarea {
    flex: 1;
}

.array-item-remove {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.array-item-remove:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* ==========================================================================
   Criterion Cards
   ========================================================================== */

.criterion-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.criterion-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-sidebar);
    cursor: pointer;
}

.criterion-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.criterion-id {
    background: var(--brand-primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.criterion-card-body {
    display: none;
    padding: 16px;
}

.criterion-card.open .criterion-card-body {
    display: block;
}

/* ==========================================================================
   Persona Cards
   ========================================================================== */

.persona-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.persona-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-sidebar);
    cursor: pointer;
}

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

.persona-card-body {
    display: none;
    padding: 16px;
}

.persona-card.open .persona-card-body {
    display: block;
}

/* ==========================================================================
   YAML Editor
   ========================================================================== */

.yaml-textarea {
    width: 100%;
    min-height: 400px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    resize: vertical;
    background: #1e1e1e;
    color: #d4d4d4;
}

.yaml-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* ==========================================================================
   Tag Input
   ========================================================================== */

.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    min-height: 44px;
    background: white;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--brand-light);
    color: var(--brand-primary);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.85rem;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.7;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 100px;
    font-size: 0.9rem;
}

/* Play Slug Badge */
.play-slug {
    font-family: monospace;
    background: var(--bg-sidebar);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Leads Section
   ========================================================================== */

.leads-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--border-subtle);
}

.leads-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

/* Leads Summary Stats */
.leads-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.leads-stat {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.leads-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 4px;
}

.leads-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Leads Filters */
.leads-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
}

.leads-filter-group select,
.leads-filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

.leads-filter-group select:focus,
.leads-filter-group input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.leads-filter-checkbox {
    display: flex;
    align-items: center;
}

.leads-filter-checkbox .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    user-select: none;
}

.leads-filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-primary);
}

/* Account Groups */
.account-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-group {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
}

.account-group.expanded {
    border-color: var(--brand-primary);
}

.account-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    background: var(--bg-card);
    transition: background 0.15s ease;
}

.account-group-header:hover {
    background: var(--bg-card-hover);
}

.account-group-toggle {
    font-size: 12px;
    color: var(--text-secondary);
    width: 16px;
    flex-shrink: 0;
}

.account-group-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.account-group-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.account-leads-count {
    color: var(--text-secondary);
}

.account-top-count {
    color: var(--success);
    font-weight: 500;
}

.account-group-score {
    flex-shrink: 0;
}

.account-leads {
    border-top: 1px solid var(--border-subtle);
    padding: 0;
    background: var(--bg-body);
}

/* Horizontal scroll container for leads table */
.leads-table-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.account-leads .leads-table {
    margin: 0;
    border: none;
    border-radius: 0;
}

.account-leads .leads-table thead th {
    background: var(--bg-sidebar);
    font-size: 0.8rem;
    padding: 10px 12px;
}

.account-leads .leads-table tbody td {
    padding: 10px 12px;
}

/* Leads Table */
.leads-table-container {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

.leads-table th {
    background: var(--bg-sidebar);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.leads-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.leads-table th.sortable:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.leads-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    vertical-align: middle;
    white-space: nowrap;
}

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

.leads-table tr:hover td {
    background: var(--bg-sidebar);
}

.leads-table tr.expanded td {
    background: var(--brand-light);
}

/* Lead Name with LinkedIn Icon */
.lead-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.linkedin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #0077B5;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
}

.linkedin-icon:hover {
    background: #005582;
}

/* Score Badge */
.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.85rem;
}

.score-badge.score-high {
    background: var(--success-bg);
    color: var(--success);
}

.score-badge.score-medium {
    background: var(--warning-bg);
    color: var(--warning);
}

.score-badge.score-low {
    background: var(--bg-sidebar);
    color: var(--text-tertiary);
}

/* Top Lead Badge */
.top-lead-badge {
    display: inline-block;
    background: var(--brand-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Persona Badge */
.persona-badge {
    display: inline-block;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Expand Button */
.btn-expand {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
}

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

/* Fetch Button (for missing email/phone) */
.btn-fetch {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-main);
    transition: var(--transition);
    white-space: nowrap;
}

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

/* Lead Details Row */
.lead-details-row td {
    padding: 0 !important;
    background: var(--bg-sidebar) !important;
}

.lead-details {
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.lead-detail-section {
    background: white;
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-subtle);
}

.lead-detail-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 8px 0;
}

.lead-detail-section p {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
}

/* Leads Pagination */
.leads-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-subtle);
    margin-top: -1px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

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

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-size select {
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: white;
}

/* Leads Empty State */
.leads-empty,
.leads-error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
}

.leads-error {
    color: var(--error);
    background: var(--error-bg);
}

.leads-error button {
    margin-top: 16px;
}

/* ==========================================================================
   Toggle Switch
   ========================================================================== */

.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--border-strong);
    border-radius: 24px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--brand-primary);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--brand-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ==========================================================================
   Account Scores Section
   ========================================================================== */

.account-scores-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--border-subtle);
}

.account-scores-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

/* Account Scores Summary Stats */
.account-scores-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.account-scores-stat {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.account-scores-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 4px;
}

.account-scores-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Account Scores Filters */
.account-scores-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
}

.account-scores-filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white;
    min-width: 200px;
}

.account-scores-filter-group input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* Account Scores List */
.account-scores-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Account Score Card */
.account-score-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
}

.account-score-card.expanded {
    border-color: var(--brand-primary);
}

.account-score-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    background: var(--bg-card);
    transition: background 0.15s ease;
}

.account-score-card-header:hover {
    background: var(--bg-card-hover);
}

.account-score-card-toggle {
    font-size: 12px;
    color: var(--text-secondary);
    width: 16px;
    flex-shrink: 0;
}

.account-score-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.account-score-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.criteria-met-badge {
    background: var(--success-bg);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
}

.avg-lead-score {
    color: var(--text-tertiary);
}

.account-score-card-score {
    flex-shrink: 0;
}

.account-score-card-body {
    border-top: 1px solid var(--border-subtle);
    padding: 20px;
    background: var(--bg-sidebar);
}

/* Account Detail Section (collapsible) */
.account-detail-section {
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.account-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
}

.account-detail-header:hover {
    background: var(--bg-card-hover);
}

.account-detail-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.account-detail-toggle {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.account-detail-section.collapsed .account-detail-toggle {
    transform: rotate(-90deg);
}

.account-detail-content {
    padding: 16px;
}

.account-detail-section.collapsed .account-detail-content {
    display: none;
}

.account-detail-content p {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

/* Signals Section */
.signals-section {
    margin-top: 16px;
}

.signals-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.signals-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.signals-table th {
    background: var(--bg-sidebar);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

.signals-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    vertical-align: top;
}

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

.signals-table tr:hover td {
    background: var(--bg-card-hover);
}

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

.signal-type {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.signal-weight {
    color: var(--text-secondary);
    font-weight: 500;
}

.signal-evidence {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Evaluation Badges */
.evaluation-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.evaluation-badge.evaluation-met {
    background: var(--success-bg);
    color: var(--success);
}

.evaluation-badge.evaluation-not-met {
    background: var(--error-bg);
    color: var(--error);
}

.evaluation-badge.evaluation-uncertain {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Account Scores Empty/Error States */
.account-scores-empty,
.account-scores-error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
}

.account-scores-error {
    color: var(--error);
    background: var(--error-bg);
}

.account-scores-error button {
    margin-top: 16px;
}

.signals-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}
