/* Apple Design System */
:root {
    --color-bg: #f5f5f7;
    --color-surface: #ffffff;
    --color-surface-secondary: #fafafa;
    --color-text: #1d1d1f;
    --color-text-secondary: #86868b;
    --color-text-tertiary: #6e6e73;
    --color-border: #d2d2d7;
    --color-border-light: #e8e8ed;
    --color-accent: #0071e3;
    --color-accent-hover: #0077ed;
    --color-success: #34c759;
    --color-warning: #ff9f0a;
    --color-danger: #ff3b30;
    --color-blue: #007aff;
    --color-green: #34c759;
    --color-purple: #af52de;
    --color-orange: #ff9500;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.47059;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
}

.nav-logo {
    width: 24px;
    height: 24px;
    color: var(--color-accent);
}

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

.nav-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Main Layout */
.main {
    padding-top: 52px;
    min-height: 100vh;
}

.view {
    animation: fadeIn 0.4s ease;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 24px 40px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1d1d1f 0%, #434344 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 19px;
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* Setup Grid */
.setup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

@media (max-width: 768px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 32px;
    }
}

/* Setup Card */
.setup-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    transition: var(--transition);
}

.setup-card:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 0;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.card-icon.blue { background: var(--color-blue); }
.card-icon.green { background: var(--color-green); }
.card-icon.purple { background: var(--color-purple); }
.card-icon.orange { background: var(--color-orange); }
.card-icon.cyan { background: #00BCD4; }

.card-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title h3 {
    font-size: 17px;
    font-weight: 600;
}

.card-badge {
    font-size: 12px;
    padding: 3px 8px;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border-radius: 100px;
    font-weight: 500;
}

.card-badge.required {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
}

.card-body {
    padding: 20px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--color-surface-secondary);
}

.upload-area:hover {
    border-color: var(--color-accent);
    background: rgba(0, 113, 227, 0.02);
}

.upload-area.has-file {
    border-style: solid;
    border-color: var(--color-success);
    background: rgba(52, 199, 89, 0.05);
}

.upload-icon-large {
    width: 40px;
    height: 40px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.upload-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* File Preview */
.file-preview {
    margin-top: 12px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.file-info svg {
    width: 20px;
    height: 20px;
    color: var(--color-success);
}

.file-info span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.file-remove:hover {
    background: var(--color-border-light);
    color: var(--color-danger);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.file-item svg {
    width: 18px;
    height: 18px;
    color: var(--color-accent);
}

.file-item span {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .remove {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item .remove:hover {
    color: var(--color-danger);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.divider::before { margin-right: 12px; }
.divider::after { margin-left: 12px; }

/* Textarea */
.input-textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    background: var(--color-surface);
}

.input-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Weights & Prefs Summary */
.weights-summary,
.prefs-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.weights-summary span,
.prefs-summary span {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.link-btn {
    border: none;
    background: transparent;
    color: var(--color-accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.link-btn:hover {
    background: rgba(0, 113, 227, 0.1);
}

/* Weights Panel */
.weights-panel,
.prefs-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
    animation: slideDown 0.2s ease;
}

.weight-item {
    margin-bottom: 16px;
}

.weight-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.weight-label span {
    font-size: 14px;
    font-weight: 500;
}

.weight-value {
    color: var(--color-accent);
    font-weight: 600;
}

.weight-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 2px;
    outline: none;
    margin-bottom: 8px;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.veto-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.veto-check input {
    display: none;
}

.veto-check span {
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--color-bg);
    transition: var(--transition);
}

.veto-check input:checked + span {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
}

/* AI Panel */
.ai-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.ai-summary span {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.ai-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
    animation: slideDown 0.2s ease;
}

.ai-providers {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ai-provider-btn {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.ai-provider-btn:hover {
    border-color: var(--color-accent);
}

.ai-provider-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.ai-config-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ai-field input,
.ai-field select {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-surface);
}

.ai-field input:focus,
.ai-field select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.field-hint {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.ai-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

#aiStatusBadge.active {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-success);
}

.weights-total {
    text-align: center;
    padding: 12px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.weights-total.error {
    color: var(--color-danger);
    background: rgba(255, 59, 48, 0.05);
}

/* Prefs Panel */
.pref-row {
    margin-bottom: 16px;
}

.pref-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pref-field select,
.pref-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-surface);
    transition: var(--transition);
}

.pref-field select:focus,
.pref-field input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    flex: 1;
}

.range-inputs span {
    color: var(--color-text-secondary);
}

.veto-check-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.veto-check-inline input {
    width: 14px;
    height: 14px;
}

/* Setup Actions */
.setup-actions {
    display: flex;
    justify-content: center;
    padding: 20px 24px 60px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 980px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    transform: scale(1.02);
}

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

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 17px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

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

/* Results View */
.settings-bar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    padding: 16px 24px;
    position: sticky;
    top: 52px;
    z-index: 50;
}

.settings-bar-content {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--color-bg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition);
}

.settings-btn:hover {
    background: var(--color-border-light);
}

.settings-btn.secondary {
    margin-left: auto;
    background: transparent;
    color: var(--color-text-secondary);
}

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

/* Inline Panels */
.inline-panel {
    margin-top: 16px;
    padding: 20px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-md);
    animation: slideDown 0.2s ease;
}

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

.inline-panel-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--color-border-light);
}

.weight-sliders-compact {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .weight-sliders-compact {
        grid-template-columns: repeat(2, 1fr);
    }
}

.weight-slider-item {
    text-align: center;
}

.weight-slider-item label {
    display: block;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.weight-slider-item input {
    width: 100%;
    margin-bottom: 8px;
}

.weight-slider-item span {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-accent);
}

.inline-panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.weight-total-inline {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.prefs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

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

.pref-inline label {
    display: block;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.pref-inline select,
.pref-inline input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* Results Section */
.results-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

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

.section-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.section-actions {
    display: flex;
    gap: 12px;
}

/* Top Candidates */
.top-candidates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.candidate-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    transition: var(--transition);
}

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

.candidate-card.rank-1 {
    border-color: var(--color-warning);
    background: linear-gradient(135deg, #fff 0%, #fffbf5 100%);
}

.candidate-rank {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-text);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.candidate-card.rank-1 .candidate-rank {
    background: var(--color-warning);
    color: var(--color-text);
}

.candidate-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.candidate-meta {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.candidate-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 16px;
}

.candidate-score-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--color-accent);
    letter-spacing: -0.02em;
}

.candidate-score-value.vetoed {
    color: var(--color-danger);
}

.candidate-score-label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.candidate-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag {
    padding: 4px 10px;
    background: var(--color-bg);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.tag.primary {
    background: rgba(0, 113, 227, 0.1);
    color: var(--color-accent);
}

.candidate-reason {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

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

.candidate-actions button {
    flex: 1;
}

/* Table */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: var(--color-surface-secondary);
    border-bottom: 1px solid var(--color-border-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.results-table td {
    padding: 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.results-table tr:hover td {
    background: var(--color-surface-secondary);
}

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

.score-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
}

.score-badge.high {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-success);
}

.score-badge.medium {
    background: rgba(255, 159, 10, 0.1);
    color: var(--color-warning);
}

.score-badge.low {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
}

.score-badge.vetoed {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
    text-decoration: line-through;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 200;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

/* Detail Sections in Modal */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

.detail-item {
    text-align: center;
    padding: 16px;
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.detail-item span {
    font-size: 17px;
    font-weight: 600;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}

.detail-veto {
    background: rgba(255, 59, 48, 0.05);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.detail-veto h4 {
    color: var(--color-danger);
    margin-bottom: 8px;
}

.detail-veto p {
    font-size: 14px;
    color: var(--color-danger);
}

/* Questions in Modal */
.questions-personalized {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05) 0%, rgba(0, 113, 227, 0.02) 100%);
    border: 1px solid rgba(0, 113, 227, 0.15);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.questions-personalized h4 {
    color: var(--color-accent);
    margin-bottom: 12px;
}

.questions-insight {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 113, 227, 0.1);
}

.question-category {
    margin-bottom: 16px;
}

.question-category:last-child {
    margin-bottom: 0;
}

.question-category h5 {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.question-list {
    list-style: none;
}

.question-list li {
    padding: 10px 0;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 1px solid var(--color-border-light);
}

.question-list li:last-child {
    border-bottom: none;
}

.question-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
}

.questions-general {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.questions-general-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--color-surface-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.questions-general-header:hover {
    background: var(--color-bg);
}

.questions-general-header h4 {
    margin: 0;
}

.questions-general-toggle {
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
}

.questions-general.expanded .questions-general-toggle {
    transform: rotate(180deg);
}

.questions-general-content {
    display: none;
    padding: 16px;
}

.questions-general.expanded .questions-general-content {
    display: block;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

/* Utility */
.hidden {
    display: none !important;
}

/* Table Analysis Rows */
.table-analysis {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.analysis-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.analysis-label {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.analysis-label.hl {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-success);
}

.analysis-label.wk {
    background: rgba(255, 159, 10, 0.1);
    color: var(--color-warning);
}

.analysis-label.rk {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
}

.analysis-row span:last-child {
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

/* Candidate Card Analysis Brief */
.candidate-analysis-brief {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.analysis-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.analysis-icon {
    flex-shrink: 0;
    font-size: 11px;
}

.analysis-item.highlight {
    color: var(--color-success);
}

.analysis-item.highlight .analysis-icon {
    color: var(--color-success);
}

.analysis-item.weakness {
    color: var(--color-warning);
}

.analysis-item.weakness .analysis-icon {
    color: var(--color-warning);
}

.analysis-item span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Detail Modal Analysis Cards */
.analysis-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 640px) {
    .analysis-cards {
        grid-template-columns: 1fr;
    }
}

.analysis-card {
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--color-border-light);
}

.analysis-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.analysis-card-icon {
    font-size: 14px;
}

.analysis-card-title {
    font-size: 13px;
    font-weight: 600;
}

.analysis-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.analysis-card-list li {
    font-size: 13px;
    line-height: 1.5;
    padding: 4px 0;
    padding-left: 14px;
    position: relative;
    color: var(--color-text-secondary);
}

.analysis-card-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.highlight-card {
    background: rgba(52, 199, 89, 0.04);
    border-color: rgba(52, 199, 89, 0.2);
}

.highlight-card .analysis-card-icon,
.highlight-card .analysis-card-title {
    color: var(--color-success);
}

.highlight-card .analysis-card-list li::before {
    background: var(--color-success);
}

.weakness-card {
    background: rgba(255, 159, 10, 0.04);
    border-color: rgba(255, 159, 10, 0.2);
}

.weakness-card .analysis-card-icon,
.weakness-card .analysis-card-title {
    color: var(--color-warning);
}

.weakness-card .analysis-card-list li::before {
    background: var(--color-warning);
}

.risk-card {
    background: rgba(255, 59, 48, 0.04);
    border-color: rgba(255, 59, 48, 0.2);
}

.risk-card .analysis-card-icon,
.risk-card .analysis-card-title {
    color: var(--color-danger);
}

.risk-card .analysis-card-list li::before {
    background: var(--color-danger);
}

/* Missing field tag */
.missing-tag {
    font-size: 10px;
    color: var(--color-text-tertiary);
    background: var(--color-bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 400;
    vertical-align: middle;
}
