/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-bg: #eff6ff;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #ca8a04;
    --warning-bg: #fefce8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --border: #e2e8f0;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --content-max: 1800px;
}

/* Flickum bicus */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-bg: #1e3a5f;
    --success: #22c55e;
    --success-bg: #14532d;
    --warning: #eab308;
    --warning-bg: #422006;
    --danger: #ef4444;
    --danger-bg: #450a0a;
    --border: #334155;
    --border-focus: #60a5fa;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

@media (min-width: 1200px) {
    .container {
        padding: 1.5rem 2.5rem;
    }
}

@media (min-width: 1600px) {
    .container {
        padding: 1.5rem 3rem;
    }
}

/* Header - Compact top bar */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.app-version {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* Tabs - Inline with header on large screens */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--radius);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.user-name {
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

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

.tab.active {
    color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.tab.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.tab.disabled:hover {
    color: var(--text-muted);
    background: transparent;
}

.tab-content {
    display: none;
}

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

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.status {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
}

.status.connected {
    background: var(--success-bg);
    color: var(--success);
}

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

/* Panels */
.panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfc 0%, #f6f8fa 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.panel-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.panel-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Project viewers (presence) indicator */
.project-viewers {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    background: var(--bg-accent);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    margin-left: auto;
}

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

.project-viewers .viewers-list {
    color: var(--accent);
    font-weight: 500;
}

.panel-body {
    padding: 1rem;
}

/* Legacy card support */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Staffing Layout */
.staffing-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1200px) {
    .staffing-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .staffing-form-panel {
        width: 520px;
        flex-shrink: 0;
        position: sticky;
        top: 1rem;
    }

    .staffing-results-panel {
        flex: 1;
        min-width: 0;
    }
}

.staffing-form-panel {
    overflow: hidden;
}

.staffing-form-panel form {
    padding: 1rem;
}

.staffing-results-panel .panel {
    margin-bottom: 1rem;
}

#roles-results-container {
    padding: 0.75rem;
    transition: opacity 0.2s;
}

#roles-results-container.refreshing {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

#roles-results-container.refreshing::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

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

.results-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
}

.results-placeholder.hidden {
    display: none;
}

/* Form styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

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

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

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.5625rem;
}

.date-display {
    display: block;
    padding: 0.5rem 0.625rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

@media (min-width: 480px) {
    .form-row.compact {
        grid-template-columns: 1.5fr 1fr 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

input, select {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
    color: var(--text-primary);
    font-size: 0.8125rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

input::placeholder {
    color: var(--text-muted);
}

/* Availability Calendar */
.date-picker-wrapper {
    position: relative;
}

.availability-calendar {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.75rem;
    min-width: 280px;
    animation: calendarFadeIn 0.15s ease-out;
}

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

.availability-calendar.hidden {
    display: none;
}

.cal-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.cal-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.cal-nav {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.cal-nav:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.5rem;
}

.cal-weekdays span {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0.25rem;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
}

.cal-day:not(.empty):not(.past):hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.cal-day.empty {
    cursor: default;
}

.cal-day.past {
    color: var(--text-muted);
    opacity: 0.4;
    cursor: not-allowed;
}

.cal-day.weekend {
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.cal-day.has-forecast {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.cal-day.selected {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.cal-day.best {
    box-shadow: 0 0 0 2px gold, 0 2px 8px rgba(255, 215, 0, 0.4);
}

.cal-day.best::after {
    content: '★';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.625rem;
    color: gold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.cal-legend {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.cal-hint {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* Inflection points (tetris fit dates) */
.cal-day.inflection {
    box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.6);
}

.cal-inflection {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.5rem;
    color: #6366f1;
    text-shadow: 0 0 2px white;
}

.legend-dot.inflection-dot {
    background: transparent;
    border: 2px solid #6366f1;
    width: 8px;
    height: 8px;
}

/* Recommended dates section */
.cal-recommendations {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.cal-rec-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cal-rec-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.75rem;
}

.cal-rec-item:hover {
    background: var(--bg-hover);
}

.cal-rec-item.is-inflection {
    background: rgba(99, 102, 241, 0.08);
}

.cal-rec-item.is-inflection:hover {
    background: rgba(99, 102, 241, 0.15);
}

.cal-rec-date {
    font-weight: 500;
    min-width: 90px;
    color: var(--text);
}

.cal-rec-item.is-inflection .cal-rec-date {
    color: #6366f1;
}

.cal-rec-score {
    font-size: 0.625rem;
    font-weight: 600;
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    min-width: 32px;
    text-align: center;
}

.cal-rec-reason {
    color: var(--text-muted);
    font-size: 0.6875rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Roles section */
.roles-section {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

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

.roles-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.role-row.allocated {
    background: var(--success-bg);
    border-color: var(--success);
}

.role-row-main {
    display: grid;
    grid-template-columns: 1fr 70px 70px 44px 28px;
    gap: 0.375rem;
    align-items: center;
}

.role-allocated-badge {
    font-size: 0.6875rem;
    color: var(--success);
    font-weight: 500;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.role-row select,
.role-row input {
    height: 30px;
    font-size: 0.75rem;
    padding: 0 0.375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
}

.role-row .location-select {
    font-size: 1rem;
    text-align: center;
    padding: 0 0.25rem;
}

.role-row input {
    text-align: center;
}

.role-row .rate-input {
    text-align: right;
    padding-right: 0.25rem;
}

/* Read-only fields from Ruddr */
.role-row input.from-ruddr {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    border-style: dashed;
}

.role-row input.from-ruddr:focus {
    outline: none;
    border-color: var(--border);
}

.role-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.role-select-wrap select {
    flex: 1;
    min-width: 0;
}

.role-rate {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.role-row .remove-role-btn {
    margin: 0;
}

.remove-role-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-role-btn:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Existing Team Section */
.existing-team {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--success-bg);
    border-radius: var(--radius);
    border: 1px solid var(--success);
    border-left: 3px solid var(--success);
}

.existing-team.hidden {
    display: none;
}

.existing-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}

.existing-team-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.existing-team-count {
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    background: var(--success);
    color: white;
    font-weight: 600;
}

.existing-team-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.existing-member-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.existing-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.existing-member-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.existing-member-role {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.existing-member-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
    flex-shrink: 0;
}

.existing-member-hours {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.existing-member-dates {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.existing-member-rate {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* Project Summary */
.project-summary {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.project-summary.hidden {
    display: none;
}

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

.summary-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.summary-grid {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.summary-row {
    display: table-row;
    font-size: 0.8125rem;
}

.summary-row > span {
    display: table-cell;
    padding: 0.375rem 0.5rem;
}

.summary-row.header-row {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

.summary-row.header-row > span {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    text-align: right;
}

.summary-row.header-row > span:first-child {
    text-align: left;
}

.summary-row .row-label {
    color: var(--text-secondary);
    font-weight: 500;
    width: 70px;
}

.summary-row .hours-val,
.summary-row .revenue-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    width: 90px;
}

.summary-row.variance-row > span {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

.summary-row.variance-row .hours-val,
.summary-row.variance-row .revenue-val {
    font-weight: 600;
}

.summary-row .positive {
    color: var(--success);
}

.summary-row .negative {
    color: var(--danger);
}

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

.summary-margin {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.summary-margin:empty {
    display: none;
}

.summary-margin .margin-value {
    font-weight: 600;
    font-size: 0.875rem;
}

.summary-margin .margin-value.good {
    color: var(--success);
}

.summary-margin .margin-value.warning {
    color: var(--warning);
}

.summary-margin .margin-value.bad {
    color: var(--danger);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.btn.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

.btn.text {
    background: transparent;
    color: var(--accent);
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

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

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

.btn.primary:hover {
    background: var(--accent-light);
}

.btn.primary:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

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

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

/* Team Scenarios */
.scenario {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
}

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

.scenario-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent);
}

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

.scenario-team {
    margin: 0.75rem 0;
}

.team-assignment {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.assignment-role {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 140px;
    font-size: 0.875rem;
}

.assignment-person {
    flex: 1;
}

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

.assignment-person-title {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.assignment-fit {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
}

.assignment-fit.high, .fit-score.high, .high {
    background: var(--success-bg);
    color: var(--success);
}

.assignment-fit.medium, .fit-score.medium, .medium {
    background: var(--warning-bg);
    color: var(--warning);
}

.assignment-fit.low, .fit-score.low, .low {
    background: var(--danger-bg);
    color: var(--danger);
}

.scenario-warnings {
    font-size: 0.8125rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.trade-off {
    color: var(--warning);
    margin-bottom: 0.375rem;
    padding: 0.25rem 0;
}

.risk {
    color: var(--danger);
    margin-bottom: 0.375rem;
    padding: 0.25rem 0;
}

.unfilled {
    color: var(--danger);
    font-weight: 500;
}

/* Role Results */
.role-results {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.role-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background 0.15s;
}

.role-results-header:hover {
    background: var(--bg-hover);
}

.role-results.has-selection {
    border-color: var(--success);
}

.role-results.has-selection .role-results-header {
    background: var(--success-bg);
}

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

.selected-indicator {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--success);
    margin-left: auto;
    margin-right: 1rem;
    padding: 0.25rem 0.5rem;
    background: rgba(22, 163, 74, 0.1);
    border-radius: var(--radius);
}

.role-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.role-candidates {
    background: var(--bg-secondary);
    padding: 0.75rem;
}

.role-candidates.collapsed {
    display: none;
}

/* Compact Candidates */
.cand {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.1s;
}

.cand:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.cand.selected {
    background: var(--success-bg);
    border-color: var(--success);
}

.cand:last-child {
    margin-bottom: 0;
}

.cand-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cand-score {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
    vertical-align: super;
    line-height: 1;
}

.cand-score.high {
    background: var(--success);
    color: white;
}

.cand-score.medium {
    background: var(--warning);
    color: white;
}

.cand-score.low {
    background: var(--danger);
    color: white;
}

.cand-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.cand-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.cand-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.25rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    vertical-align: middle;
}

.cand-info-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.cand-info-btn svg {
    width: 14px;
    height: 14px;
}

.cand-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cand-stats {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.margin-indicator {
    font-weight: 500;
    padding: 0.0625rem 0.25rem;
    border-radius: 3px;
    font-size: 0.625rem;
}

.margin-indicator.high {
    background: rgba(22, 163, 74, 0.15);
    color: var(--success);
}

.margin-indicator.medium {
    background: rgba(202, 138, 4, 0.15);
    color: var(--warning);
}

.margin-indicator.low {
    background: rgba(220, 38, 38, 0.15);
    color: var(--danger);
}

.margin-indicator.unknown {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    font-style: italic;
}

.cand-btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.1s;
}

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

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

/* Per-selection allocate over holidays/time off toggle */
.alloc-over-off-toggle {
    display: none;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.cand.selected .alloc-over-off-toggle {
    display: inline-flex;
}

.alloc-over-off-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.alloc-over-off-toggle input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    cursor: pointer;
}

.alloc-over-off-toggle input[type="checkbox"]:checked + span {
    color: var(--accent);
}

.cand-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-left: 2.75rem;
}

.tag {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.tag.positive {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.tag.negative {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

/* Collapsible cards */
.card.collapsible .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
    padding: 0.25rem 0;
}

.card.collapsible .card-header:hover {
    opacity: 0.8;
}

.card.collapsible .card-header h2 {
    margin-bottom: 0;
}

.toggle-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.toggle-icon.expanded {
    transform: rotate(90deg);
}

.card-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Role Matrix */
.matrix-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.matrix-search {
    flex: 0 0 auto;
}

.matrix-search input {
    width: 220px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.matrix-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.matrix-search input::placeholder {
    color: var(--text-muted);
}

.matrix-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-item {
    white-space: nowrap;
}

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

.stat-filtered {
    color: var(--accent);
    font-weight: 500;
}

.matrix-wrapper {
    overflow: auto;
    max-height: calc(100vh - 320px);
    margin-top: 0.5rem;
}

.role-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.role-matrix th,
.role-matrix td {
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.role-matrix th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    background: var(--bg-tertiary);
}

/* Group header row (Cloud, Data, Software, General) */
.role-matrix .group-header-row th {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    padding: 0.625rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.role-matrix .group-header {
    border-left: 3px solid var(--bg-secondary);
}

.role-matrix .group-header.cap-cloud {
    border-left: none;
}

/* Border between capability groups */
.role-matrix .group-first {
    border-left: 3px solid var(--bg-secondary);
}

/* Level header row (Eng, Sr, Arch, PM, EM, Prin) */
.role-matrix .level-header-row th {
    position: sticky;
    top: 40px;
    z-index: 10;
    border-bottom: 2px solid var(--border);
    padding: 0.5rem 0.375rem;
    text-align: center;
    font-size: 0.75rem;
}

.role-matrix th.member-header {
    text-align: left;
    padding-left: 0.75rem;
    vertical-align: middle;
    min-width: 180px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 12;
    background: var(--bg-tertiary);
}

.role-matrix th.role-header {
    padding: 0.375rem;
    width: 70px;
    min-width: 70px;
}

.role-matrix th.role-header .role-name {
    display: block;
    font-weight: 500;
}

.role-matrix th.role-header .role-count {
    display: block;
    font-size: 0.5625rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Capability color coding */
.role-matrix .cap-cloud {
    background: #e0f2fe;
}
.role-matrix th.cap-cloud {
    background: #bae6fd;
    color: #0369a1;
}
.role-matrix .cap-cloud.is-checked {
    background: #7dd3fc;
}

.role-matrix .cap-data {
    background: #fae8ff;
}
.role-matrix th.cap-data {
    background: #f0abfc;
    color: #86198f;
}
.role-matrix .cap-data.is-checked {
    background: #e879f9;
}

.role-matrix .cap-software {
    background: #dcfce7;
}
.role-matrix th.cap-software {
    background: #86efac;
    color: #166534;
}
.role-matrix .cap-software.is-checked {
    background: #4ade80;
}

.role-matrix .cap-general {
    background: #f1f5f9;
}
.role-matrix th.cap-general {
    background: #e2e8f0;
    color: #475569;
}
.role-matrix .cap-general.is-checked {
    background: #cbd5e1;
}

.role-matrix td.member-cell {
    text-align: left;
    padding-left: 0.75rem;
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.role-matrix td.member-cell::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 180px;
}

.member-name-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.member-location {
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

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

.member-title {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.member-role-count {
    font-size: 0.625rem;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    margin-top: 0.125rem;
    width: fit-content;
}

.role-matrix tbody tr:hover {
    background: var(--bg-tertiary);
}

.role-matrix tbody tr:hover td.member-cell {
    background: var(--bg-tertiary);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.checkbox-wrapper input.matrix-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    transition: all 0.15s;
    position: relative;
}

.checkbox-wrapper:hover .checkbox-custom {
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

.checkbox-wrapper input:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-wrapper input:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper input:focus + .checkbox-custom {
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.role-matrix td.check-cell {
    padding: 0.375rem;
    width: 70px;
    min-width: 70px;
    text-align: center;
}

/* is-checked colors now handled by .cap-* classes */

.role-matrix tbody tr.no-roles {
    opacity: 0.6;
}

.role-matrix tbody tr.no-roles:hover {
    opacity: 1;
}

.role-matrix .empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Status indicator in matrix */
.member-status {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 0.375rem;
    vertical-align: middle;
}

.member-status.configured {
    background: var(--success);
}

.member-status.default {
    background: var(--text-muted);
    opacity: 0.5;
}

.btn.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn.danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

.btn.sync {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn.sync:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.btn.sync:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.btn.sync svg {
    width: 14px;
    height: 14px;
}

/* Sync Preview Modal */
.sync-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.sync-preview-modal.hidden {
    display: none;
}

.sync-preview-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

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

.sync-preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.sync-preview-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.sync-preview-close:hover {
    color: var(--text-primary);
}

.sync-preview-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.sync-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.sync-summary-item {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius);
    text-align: center;
}

.sync-summary-item .count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sync-summary-item .label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.sync-summary-item.create .count { color: var(--success); }
.sync-summary-item.update .count { color: var(--accent); }
.sync-summary-item.delete .count { color: var(--danger); }
.sync-summary-item.unchanged .count { color: var(--text-muted); }

.sync-section {
    margin-bottom: 1rem;
}

.sync-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sync-section-title .badge {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.625rem;
}

.sync-allocation-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.sync-allocation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 0.8125rem;
}

.sync-allocation .member {
    font-weight: 500;
    min-width: 120px;
}

.sync-allocation .role {
    color: var(--text-secondary);
    min-width: 100px;
}

.sync-allocation .dates {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sync-allocation .hours {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.sync-errors, .sync-warnings {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius);
}

.sync-errors {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
}

.sync-warnings {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
}

.sync-errors .title, .sync-warnings .title {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}

.sync-errors .title { color: var(--danger); }
.sync-warnings .title { color: var(--warning); }

.sync-error-item, .sync-warning-item {
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.sync-preview-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Projects List */
.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.project-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.project-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--border) 0%, var(--border) 100%);
    transition: background 0.2s;
}

.project-item:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.project-item:hover::before {
    background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
}

.project-item.has-roles::before {
    background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
}

.project-item.has-allocations::before {
    background: linear-gradient(90deg, var(--success) 0%, #4ade80 100%);
}

.project-item.urgent::before {
    background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%);
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Card Header */
.project-card-header {
    padding: 1rem 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    flex: 1;
}

.project-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.project-client {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.project-client::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.5;
}

/* Project Refresh Button */
.project-refresh-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.project-item:hover .project-refresh-btn {
    opacity: 0.6;
}

.project-refresh-btn:hover {
    opacity: 1 !important;
    color: var(--accent);
    background: var(--bg-tertiary);
}

.project-refresh-btn:disabled {
    cursor: not-allowed;
}

.project-refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

.project-refresh-btn.refresh-success {
    color: var(--success);
    opacity: 1 !important;
}

.project-refresh-btn.refresh-success svg {
    animation: none;
}

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

.project-badges {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.project-status {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.project-status.tentative {
    background: var(--warning-bg);
    color: var(--warning);
}

.project-status.not_started {
    background: var(--accent-bg);
    color: var(--accent);
}

/* Timeline Section */
.project-timeline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.timeline-icon {
    font-size: 0.875rem;
    opacity: 0.6;
}

.timeline-dates {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
}

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

.timeline-arrow {
    color: var(--text-muted);
    font-size: 0.625rem;
}

.timeline-duration {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
}

.urgency-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 600;
    margin-left: auto;
}

.urgency-badge.starting-soon {
    background: var(--warning-bg);
    color: var(--warning);
}

.urgency-badge.starting-now {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    animation: pulse-urgency 1.5s ease-in-out infinite;
}

@keyframes pulse-urgency {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Card Body */
.project-card-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

/* Roles Section */
.project-roles {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.roles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.roles-count {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.role-tag {
    font-size: 0.6875rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.role-tag:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.role-rate {
    font-size: 0.625rem;
    color: var(--text-muted);
    font-weight: 400;
}

.role-hours {
    font-size: 0.5625rem;
    padding: 0.0625rem 0.25rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

/* Role Assignment Display */
.roles-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.role-assignment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    transition: all 0.15s;
}

.role-assignment:hover {
    border-color: var(--accent);
}

.role-assignment.filled {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.03));
    border-color: rgba(34, 197, 94, 0.25);
}

.role-assignment.filled:hover {
    border-color: var(--success);
}

.role-assignment.unfilled {
    background: var(--bg-tertiary);
    border-style: dashed;
    border-color: rgba(245, 158, 11, 0.3);
}

.role-assignment.more {
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.6875rem;
    border-style: dashed;
}

.role-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    flex: 1;
}

.role-status-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.5rem;
}

.role-assignment.filled .role-status-icon {
    background: var(--success);
    color: white;
}

.role-assignment.unfilled .role-status-icon {
    background: transparent;
    border: 1.5px dashed var(--warning);
    color: var(--warning);
}

.role-name {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.6875rem;
}

.role-location-tag {
    font-size: 0.5625rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.0625rem 0.25rem;
    border-radius: 3px;
    margin-left: 0.25rem;
}

.role-assignment.filled .role-name {
    color: var(--success);
}

.role-assignment.unfilled .role-name {
    color: var(--text-muted);
}

.assigned-member {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text);
    font-weight: 500;
    flex-shrink: 0;
}

.member-avatar.small {
    width: 18px;
    height: 18px;
    font-size: 0.5rem;
}

.more-members {
    font-size: 0.5625rem;
    padding: 0.125rem 0.3rem;
    border-radius: 4px;
    background: var(--success);
    color: white;
    font-weight: 600;
}

.unfilled-slot {
    color: var(--warning);
    font-size: 0.6875rem;
    font-weight: 500;
}

/* Planned (Draft) State - saved locally but not in Ruddr */
.role-assignment.planned {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.03));
    border-color: rgba(245, 158, 11, 0.35);
    border-style: dashed;
}

.role-assignment.planned:hover {
    border-color: var(--warning);
}

.role-assignment.planned .role-status-icon {
    background: transparent;
    border: 1.5px solid var(--warning);
    color: var(--warning);
    font-size: 0.625rem;
}

.role-assignment.planned .role-name {
    color: var(--warning);
}

.assigned-member.planned {
    color: var(--warning);
}

.member-avatar.small.planned {
    border: 1.5px dashed var(--warning);
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.plan-badge {
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px dashed rgba(245, 158, 11, 0.4);
}

.progress-bar.has-planned {
    position: relative;
}

.progress-fill.planned {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(245, 158, 11, 0.25);
    border-radius: inherit;
    z-index: 0;
}

.progress-bar .progress-fill:not(.planned) {
    position: relative;
    z-index: 1;
}

/* Budget Section */
.project-budget {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.budget-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.budget-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.budget-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.budget-value.hours {
    color: var(--accent);
}

.budget-value.revenue {
    color: var(--success);
}

.budget-value.margin {
    font-weight: 600;
}

.budget-value.margin.high {
    color: var(--success);
}

.budget-value.margin.medium {
    color: var(--warning);
}

.budget-value.margin.low {
    color: var(--danger);
}

/* Staffing Section */
.project-staffing {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staffing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.staffing-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.staffing-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    width: 60px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, #4ade80 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

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

.staffing-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.member-tag {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    background: var(--success-bg);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--success);
    border: 1px solid transparent;
    transition: all 0.15s;
}

.member-tag:hover {
    border-color: var(--success);
}

.member-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
}

.member-hours {
    font-size: 0.5625rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Card Footer */
.project-card-footer {
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.billing-badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.billing-badge.tm {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8;
    border-color: #93c5fd;
}

.billing-badge.fixed {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    border-color: #fcd34d;
}

.select-hint {
    font-size: 0.625rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s;
}

.project-item:hover .select-hint {
    opacity: 1;
    transform: translateX(0);
}

.select-hint-icon {
    font-size: 0.75rem;
}

/* Empty state for roles */
.no-roles-placeholder {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.5rem 0;
}

/* Legacy support */
.project-info {
    display: contents;
}

.project-actions {
    display: none;
}

.requirements-badge {
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
}

.form-option {
    margin: 0.75rem 0;
    padding: 0.5rem 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.toggle-text {
    user-select: none;
}

.toggle-label.small {
    font-size: 0.75rem;
    gap: 0.375rem;
}

.toggle-label.small input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

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

.form-actions .btn {
    padding: 0.625rem 1rem;
    white-space: nowrap;
}

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

/* Loading states — no display override to avoid breaking .hidden and tab visibility */
.loading:not(.btn) {
    color: var(--text-muted);
    padding: 2rem 1rem;
    text-align: center;
}

.loading:not(.btn)::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto 0.75rem;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Skeleton loader bars */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 180px;
    border-radius: var(--radius-lg);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border: 1px solid var(--border);
}

.skeleton-row {
    height: 48px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

/* Button loading spinner */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Inline spinner (for within text or small areas) */
.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 0.375rem;
}

/* Refreshing overlay on containers */
.refreshing {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.15s;
}

.refreshing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    z-index: 10;
}

/* Checkbox saving state */
.check-cell.saving {
    opacity: 0.5;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    header h1 {
        font-size: 1rem;
    }

    .tabs {
        order: 3;
        width: 100%;
        justify-content: stretch;
    }

    .tab {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.75rem;
    }

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

    .role-row-main {
        grid-template-columns: 1fr 60px 60px 40px 28px;
        gap: 0.375rem;
    }

    .cand-main {
        flex-wrap: wrap;
    }

    .cand-stats {
        width: 100%;
        margin-top: 0.25rem;
    }

    .tl-header-label,
    .tl-person {
        flex: 0 0 140px;
    }

    .tl-week {
        flex: 0 0 40px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .role-row-main {
        grid-template-columns: 1fr 50px 50px 28px;
    }

    .role-row-main .location-select {
        display: none;
    }

    .cand-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
}

/* ========== Modern Timeline ========== */

.tl-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.tl-header {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tl-header-label {
    flex: 0 0 240px;
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    align-items: flex-end;
}

.tl-header-grid {
    flex: 1;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
}

.tl-months {
    display: flex;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding-top: 0.5rem;
}

.tl-month-cell {
    flex: 0 0 56px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0;
}

.tl-month-cell:not(.show) {
    color: transparent;
}

.tl-days {
    display: flex;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    padding: 0.375rem 0;
}

.tl-day-cell {
    flex: 0 0 56px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
}

.tl-day-cell.current {
    color: var(--accent);
    font-weight: 700;
}

.tl-body {
    max-height: 480px;
    overflow-y: auto;
    position: relative;
    background:
        repeating-linear-gradient(
            to right,
            transparent 0,
            transparent 53px,
            rgba(148, 163, 184, 0.25) 53px,
            rgba(148, 163, 184, 0.25) 54px
        );
    background-position: 240px 0;
}

.tl-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    transition: background 0.15s;
}

.tl-row:hover {
    background: rgba(241, 245, 249, 0.5);
}

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

.tl-person {
    flex: 0 0 240px;
    padding: 0.625rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.tl-person-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tl-role-tag {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 0.1875rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tl-person-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tl-fit {
    font-size: 0.5625rem;
    font-weight: 700;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    margin-left: 0.25rem;
    vertical-align: super;
    line-height: 1;
}

.tl-fit.high {
    background: var(--success);
    color: white;
}

.tl-fit.medium {
    background: var(--warning);
    color: white;
}

.tl-fit.low {
    background: var(--danger);
    color: white;
}

.tl-budget {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tl-budget-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tl-budget-item.ok {
    color: var(--success);
}

.tl-budget-item.warn {
    color: var(--warning);
    font-weight: 600;
}

.tl-budget-pct {
    font-size: 0.625rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.0625rem 0.25rem;
    border-radius: 3px;
}

.tl-weeks {
    flex: 1;
    display: flex;
    overflow-x: auto;
    padding: 0.375rem 0;
    gap: 0;
}

.tl-week {
    flex: 0 0 54px;
    height: 46px;
    border-radius: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, box-shadow 0.15s;
}

.tl-week:hover {
    transform: scale(1.08);
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Fast tooltip (positioned by JS) */
.tl-tooltip {
    position: fixed;
    padding: 0.625rem 0.875rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.75rem;
    line-height: 1.5;
    border-radius: 8px;
    z-index: 9999;
    pointer-events: none;
    min-width: 160px;
    max-width: 280px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tl-tooltip .tip-header {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.tl-tooltip .tip-section {
    margin-bottom: 0.375rem;
}

.tl-tooltip .tip-holiday {
    color: #a5b4fc;
}

.tl-tooltip .tip-pto {
    color: #fca5a5;
}

.tl-tooltip .tip-alloc {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0;
}

.tl-tooltip .tip-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.tl-tooltip .tip-dot.existing {
    background: #60a5fa;
}

.tl-tooltip .tip-dot.planned {
    background: #a78bfa;
}

.tl-tooltip .tip-dot.proposed {
    background: #4ade80;
}

.tl-tooltip .tip-proposed {
    color: #86efac;
    font-weight: 500;
}

.tl-tooltip .tip-total {
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    background: none;
}

.tl-tooltip .tip-total.high {
    color: #fcd34d;
    background: none;
}

.tl-tooltip .tip-total.over {
    color: #f87171;
    background: none;
}

.tl-week.current {
    box-shadow: 0 0 0 2px var(--accent);
}

.tl-bar {
    position: absolute;
    inset: 4px 4px;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    background: #e2e8f0;
}

.tl-seg {
    height: 100%;
    transition: flex 0.2s;
}

.tl-seg.proposed {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.tl-seg.allocated {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.tl-seg.planned {
    /* Blue-purple stripes to distinguish from PTO (orange) */
    background: repeating-linear-gradient(
        45deg,
        #6366f1,
        #6366f1 2px,
        #818cf8 2px,
        #818cf8 4px
    );
}

.tl-seg.pto {
    background: repeating-linear-gradient(
        -45deg,
        #f59e0b,
        #f59e0b 3px,
        #fbbf24 3px,
        #fbbf24 6px
    );
}

.tl-seg.holiday {
    background: repeating-linear-gradient(
        -45deg,
        #ec4899,
        #ec4899 3px,
        #f472b6 3px,
        #f472b6 6px
    );
}

.tl-seg.free {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.tl-warn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

/* Week status backgrounds - solid colors for gap dividers to work */
.tl-week.available {
    background: #f0fdf4;
}

.tl-week.partial {
    background: #faf5ff;
}

.tl-week.busy {
    background: #fff7ed;
}

.tl-week.full {
    background: #fef2f2;
}

.tl-week.overbooked {
    background: #fee2e2;
}

.tl-week.off {
    background: #f1f5f9;
}

/* Footer */
.tl-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid var(--border);
}

.tl-legend {
    display: flex;
    gap: 1.25rem;
}

.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tl-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.tl-legend-dot.proposed {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.tl-legend-dot.allocated {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.tl-legend-dot.planned {
    /* Blue-purple stripes to match .tl-seg.planned */
    background: repeating-linear-gradient(
        45deg,
        #6366f1,
        #6366f1 2px,
        #818cf8 2px,
        #818cf8 4px
    );
}

.tl-legend-dot.pto {
    background: repeating-linear-gradient(
        -45deg,
        #f59e0b,
        #f59e0b 2px,
        #fbbf24 2px,
        #fbbf24 4px
    );
}

.tl-legend-dot.holiday {
    background: repeating-linear-gradient(
        -45deg,
        #ec4899,
        #ec4899 2px,
        #f472b6 2px,
        #f472b6 4px
    );
}

.tl-legend-dot.free {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.tl-summary {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .tl-header-label,
    .tl-person {
        flex: 0 0 180px;
    }

    .tl-week {
        flex: 0 0 44px;
        height: 36px;
    }

    .tl-month-cell,
    .tl-day-cell {
        flex: 0 0 44px;
    }
}

/* ========== Gantt Trigger Button ========== */

.gantt-trigger {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gantt-trigger.hidden {
    display: none;
}

.gantt-open-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gantt-open-btn svg {
    flex-shrink: 0;
}

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

/* ========== Fullscreen Gantt Modal ========== */

.gantt-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.gantt-modal.hidden {
    display: none;
}

.gantt-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    height: 100%;
    max-width: 1800px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.gantt-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.gantt-modal-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.gantt-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gantt-modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow: auto;
    background: var(--bg-primary);
}

/* ========== Gantt Editor (Fullscreen) ========== */

.gantt-editor-fullscreen {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 100%;
}

/* Timeline header with week columns */
.gantt-timeline-header {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-role-label-header {
    flex: 0 0 200px;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-right: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.gantt-weeks-header {
    flex: 1;
    position: relative;
    min-width: 0;
}

.gantt-week-col {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    /* Width and left position set via inline style based on numWeeks */
}

.gantt-week-col .week-num {
    font-weight: 600;
    font-size: 0.8rem;
}

.gantt-week-col .week-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}


/* Gantt rows - one per role */
.gantt-rows {
    position: relative;
}

.gantt-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    min-height: 72px;
}

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

.gantt-role-label {
    flex: 0 0 200px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.gantt-role-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-role-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gantt-role-hours {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.gantt-role-hours .allocated-hours {
    font-weight: 600;
    color: var(--text-primary);
}

.gantt-role-hours .budget-hours {
    color: var(--text-muted);
}

.gantt-role-hours .hours-variance {
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.gantt-role-hours .hours-variance.over {
    background: var(--danger-bg);
    color: var(--danger);
}

.gantt-role-hours .hours-variance.under {
    background: var(--warning-bg);
    color: var(--warning);
}

.gantt-role-hours .hours-variance.match {
    background: var(--success-bg);
    color: var(--success);
}

/* Summary row */
.gantt-summary-row {
    background: var(--bg-tertiary);
    border-top: 2px solid var(--border);
}

.gantt-summary-row .gantt-role-label {
    background: var(--bg-tertiary);
}

.gantt-summary-row .gantt-role-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.gantt-summary-row .allocated-hours {
    font-size: 0.875rem;
}

/* The allocation bar area */
.gantt-bar-area {
    flex: 1;
    position: relative;
    padding: 0.75rem 0;
}

/* DOM-based grid lines for pixel-perfect alignment with header columns */
.gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    pointer-events: none;
}

.gantt-grid-line.day-line {
    background: var(--border);
    opacity: 0.3;
}

.gantt-grid-line.week-line {
    background: var(--border);
    opacity: 1;
}

/* Buffer zone overlay (4 weeks beyond project end) */
.gantt-buffer-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        rgba(148, 163, 184, 0.08) 4px,
        rgba(148, 163, 184, 0.08) 8px
    );
    pointer-events: none;
    z-index: 0;
}

/* Buffer zone week column styling */
.gantt-week-col.gantt-buffer-zone {
    background: rgba(148, 163, 184, 0.05);
}

.gantt-week-col.gantt-buffer-zone .week-num {
    color: var(--text-muted);
    font-weight: 400;
}

.gantt-week-col.gantt-buffer-zone .week-date {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Allocation bar (draggable) */
.allocation-bar {
    position: absolute;
    top: 8px;
    bottom: 8px;
    border-radius: 6px;
    cursor: grab;
    transition: box-shadow 0.15s;
    overflow: hidden;
    min-height: 48px;
}

.allocation-bar:hover {
    box-shadow: var(--shadow-md);
}

.allocation-bar:active,
.allocation-bar.dragging {
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Phase chunks within a bar - absolutely positioned */
.phase-chunk {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.25rem 0.5rem;
    overflow: hidden;
    min-width: 32px; /* Ensure tiny phases are still visible/clickable */
}

.phase-chunk:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

/* Phase count badge when multiple phases exist */
.phase-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    z-index: 5;
}

/* Color intensity based on hours/day (1-8) */
.phase-chunk.intensity-1 { background: hsl(142, 50%, 85%); color: #166534; }
.phase-chunk.intensity-2 { background: hsl(142, 50%, 78%); color: #166534; }
.phase-chunk.intensity-3 { background: hsl(142, 50%, 70%); color: #166534; }
.phase-chunk.intensity-4 { background: hsl(142, 50%, 62%); color: #fff; }
.phase-chunk.intensity-5 { background: hsl(142, 50%, 54%); color: #fff; }
.phase-chunk.intensity-6 { background: hsl(142, 50%, 46%); color: #fff; }
.phase-chunk.intensity-7 { background: hsl(142, 50%, 38%); color: #fff; }
.phase-chunk.intensity-8 { background: hsl(142, 50%, 32%); color: #fff; }

.phase-dates {
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.9;
}

.phase-label {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
}

/* Resize handles on bar edges */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    z-index: 10;
    background: rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.allocation-bar:hover .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    background: rgba(0, 0, 0, 0.25);
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
}

.resize-handle.left {
    left: 0;
    border-radius: 4px 0 0 4px;
}

.resize-handle.left::before {
    left: 4px;
}

.resize-handle.right {
    right: 0;
    border-radius: 0 4px 4px 0;
}

.resize-handle.right::before {
    right: 4px;
}

/* Phase boundary handles - between adjacent phases */
.phase-boundary-handle {
    position: absolute;
    right: -6px;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    z-index: 10;
    background: transparent;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.phase-chunk:hover .phase-boundary-handle,
.allocation-bar:hover .phase-boundary-handle {
    opacity: 1;
}

.phase-boundary-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.phase-boundary-handle:hover::before {
    background: rgba(0, 0, 0, 0.5);
    width: 5px;
    height: 28px;
}

/* Total hours display next to bar */
.bar-total {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translate(100%, -50%);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    padding-left: 10px;
}

/* Empty state when no roles defined */
.gantt-empty {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Phase settings popup */
.phase-popup {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1rem;
    z-index: 10001;
    min-width: 180px;
}

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

.phase-popup-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.phase-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
}

.phase-popup-close:hover {
    color: var(--text-primary);
}

.phase-popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.phase-popup-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.phase-popup-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.phase-popup-select {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
}

.phase-popup-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.phase-popup-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
}

.phase-popup-btn.split {
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.phase-popup-btn.split:disabled {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.phase-popup-btn.delete {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* ========== Toast Notifications ========== */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 400px;
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
}

.toast.removing {
    animation: toast-out 0.15s ease-in forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast.success .toast-icon {
    background: var(--success-bg);
    color: var(--success);
}

.toast.error .toast-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: var(--accent-bg);
    color: var(--accent);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    line-height: 1;
}

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

/* ========== Confirm Modal ========== */

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    width: 90%;
    padding: 24px;
    animation: modal-in 0.15s ease-out;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-modal-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.confirm-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.confirm-modal-actions .btn {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* ========== Empty State Messages ========== */

.empty-state {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.empty-state strong {
    color: var(--text-primary);
}

.empty-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ========== Portfolio Timeline ========== */

.portfolio-panel {
    padding: 0;
}

.portfolio-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.portfolio-nav .btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.portfolio-nav .nav-arrow {
    font-size: 1.25rem;
    line-height: 1;
}

.portfolio-date-range {
    flex: 1;
    text-align: center;
}

.portfolio-date-range .range-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.portfolio-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.15s;
    user-select: none;
}

.filter-chip input[type="checkbox"] {
    display: none;
}

.filter-chip:hover {
    background: var(--bg-secondary);
}

.filter-chip.checked {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.filter-chip.checked:hover {
    background: var(--accent);
    opacity: 0.9;
}

.filter-chip[data-status="in_progress"].checked {
    background: var(--success);
    border-color: var(--success);
}

.filter-chip[data-status="not_started"].checked {
    background: var(--accent);
    border-color: var(--accent);
}

.filter-chip[data-status="tentative"].checked {
    background: var(--warning);
    border-color: var(--warning);
}

.filter-chip[data-status="completed"].checked {
    background: var(--text-muted);
    border-color: var(--text-muted);
}

.filter-chip[data-billing="billable"].checked {
    background: #8e44ad;
    border-color: #8e44ad;
}

.filter-chip[data-billing="non_billable"].checked {
    background: #95a5a6;
    border-color: #95a5a6;
}

.filter-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.25rem;
}

#portfolio-today-btn {
    /* margin-left: auto; -- moved to filters */
}

.portfolio-timeline {
    position: relative;
    min-height: 300px;
}

.portfolio-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border);
}

.portfolio-label-header {
    width: 200px;
    min-width: 200px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.portfolio-weeks-header {
    flex: 1;
    display: flex;
}

.portfolio-week-col {
    flex: 1;
    padding: 0.5rem 0.25rem;
    text-align: center;
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
}

.portfolio-week-col:last-child {
    border-right: none;
}

.portfolio-week-col .week-num {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.portfolio-week-col .week-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.portfolio-body {
    position: relative;
}

.portfolio-row {
    display: flex;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.15s;
}

.portfolio-row:hover {
    background: var(--bg-secondary);
}

.portfolio-label {
    width: 200px;
    min-width: 200px;
    padding: 0.875rem 1rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
}

.portfolio-project-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-client {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-bar-container {
    flex: 1;
    position: relative;
    height: 48px;
    background: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(100% / 12 - 1px),
        var(--border) calc(100% / 12 - 1px),
        var(--border) calc(100% / 12)
    );
}

.portfolio-bar {
    position: absolute;
    top: 8px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, box-shadow 0.1s;
}

.portfolio-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.portfolio-bar-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Status colors */
.portfolio-bar.in_progress {
    background: linear-gradient(135deg, var(--success) 0%, #27ae60 100%);
}

.portfolio-bar.not_started {
    background: linear-gradient(135deg, var(--accent) 0%, #2980b9 100%);
}

.portfolio-bar.tentative {
    background: linear-gradient(135deg, var(--warning) 0%, #e67e22 100%);
}

.portfolio-bar.completed {
    background: linear-gradient(135deg, var(--text-muted) 0%, #7f8c8d 100%);
    opacity: 0.6;
}

/* Partial indicators (extends beyond view) */
.portfolio-bar.partial-start {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.portfolio-bar.partial-start::before {
    content: '◂';
    position: absolute;
    left: 2px;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.7);
}

.portfolio-bar.partial-end {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.portfolio-bar.partial-end::after {
    content: '▸';
    position: absolute;
    right: 2px;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Today marker */
.portfolio-today-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 5;
    pointer-events: none;
}

.portfolio-today-marker::before {
    content: 'Today';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--danger);
    white-space: nowrap;
}

/* No dates indicator */
.portfolio-no-dates {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Inferred dates (from allocations) - show with dashed border */
.portfolio-bar.inferred {
    border: 2px dashed rgba(255, 255, 255, 0.5);
}

/* Empty state */
.portfolio-empty {
    padding: 4rem 2rem;
    text-align: center;
}

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

/* ========== Roster/Capacity Timeline ========== */

.roster-panel {
    padding: 1rem;
}

.roster-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.roster-nav .btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.roster-nav .nav-arrow {
    font-size: 1.25rem;
    line-height: 1;
}

.roster-date-range {
    font-weight: 500;
    color: var(--text-primary);
}

.roster-date-range .range-text {
    font-size: 0.875rem;
}

#roster-today-btn {
    margin-left: 0.5rem;
}

#roster-refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

#roster-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#roster-refresh-btn svg {
    flex-shrink: 0;
}

.roster-filters {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.roster-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.roster-filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.roster-filter-group select,
.roster-filter-group input[type="text"] {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    min-width: 140px;
}

.roster-filter-group input[type="text"] {
    min-width: 180px;
}

.roster-filter-roles {
    flex: 1;
    min-width: 200px;
}

.roster-role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    max-height: 60px;
    overflow-y: auto;
}

.roster-role-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.1s;
}

.roster-role-chip:hover {
    border-color: var(--accent);
}

.roster-role-chip.checked {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.roster-role-chip input {
    display: none;
}

.roster-toggle {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.roster-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.roster-toggle .toggle-label input {
    margin: 0;
}

.roster-toggle .toggle-label:has(input:checked) span {
    color: var(--accent);
    font-weight: 500;
}

.roster-timeline {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.roster-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto auto;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.roster-label-header {
    min-width: 200px;
    max-width: 200px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.roster-weeks-header {
    display: flex;
    flex: 1;
}

.roster-avg-label {
    min-width: 200px;
    max-width: 200px;
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
}

.roster-avg-row {
    display: flex;
    flex: 1;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.roster-avg-row .roster-cell {
    flex: 1;
    min-width: 60px;
    border-right: 1px solid var(--border);
}

.roster-avg-row .roster-cell:last-child {
    border-right: none;
}

.roster-avg-row .roster-cell.avg-cell {
    font-weight: 600;
}

.roster-week-col {
    flex: 1;
    min-width: 60px;
    padding: 0.375rem 0.25rem;
    text-align: center;
    border-right: 1px solid var(--border);
    font-size: 0.6875rem;
}

.roster-week-col:last-child {
    border-right: none;
}

.roster-week-col .week-num {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.roster-week-col .week-date {
    color: var(--text-muted);
    font-size: 0.625rem;
}

.roster-body {
    max-height: 60vh;
    overflow-y: auto;
}

.roster-row {
    display: flex;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

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

.roster-row:hover {
    background: var(--bg-hover);
}

.roster-label {
    min-width: 200px;
    max-width: 200px;
    padding: 0.5rem 0.75rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.roster-member-name {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.roster-member-info {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.roster-cells {
    display: flex;
    flex: 1;
}

.roster-cell {
    flex: 1;
    min-width: 60px;
    min-height: 40px;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: default;
    transition: opacity 0.1s;
}

.roster-cell:last-child {
    border-right: none;
}

.roster-cell:hover {
    opacity: 0.85;
}

/* RAG colors for availability (green = available, red = busy) */
.roster-cell.available {
    background: rgba(22, 163, 74, 0.25);
    color: #15803d;
}

.roster-cell.partial {
    background: rgba(202, 138, 4, 0.25);
    color: #a16207;
}

.roster-cell.busy {
    background: rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

.roster-cell .util-pct {
    font-size: 0.625rem;
}

.roster-empty {
    padding: 2rem;
    text-align: center;
}

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

/* Make cells clickable */
.roster-cell.clickable {
    cursor: pointer;
}

.roster-cell.clickable:hover {
    opacity: 0.75;
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* Roster Cell Detail Popup */
.roster-cell-popup {
    position: fixed;
    z-index: 1000;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-width: 320px;
}

.roster-cell-popup.hidden {
    display: none;
}

.roster-cell-popup .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
}

.roster-cell-popup .popup-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.roster-cell-popup .popup-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    margin: -0.25rem;
}

.roster-cell-popup .popup-close:hover {
    color: var(--text-primary);
}

.roster-cell-popup .popup-content {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.roster-cell-popup .popup-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.roster-cell-popup .popup-summary-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.roster-cell-popup .popup-summary-row .value {
    font-weight: 500;
    color: var(--text-primary);
}

.roster-cell-popup .popup-allocations {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.roster-cell-popup .popup-alloc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.roster-cell-popup .alloc-project {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.roster-cell-popup .alloc-project.planned {
    font-style: italic;
    color: var(--accent);
}

.roster-cell-popup .alloc-hours {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.roster-cell-popup .popup-no-allocs {
    color: var(--text-muted);
    font-style: italic;
}

.roster-cell-popup .popup-time-off {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    color: var(--warning);
    font-size: 0.6875rem;
}

/* ========== Candidate Availability Popup ========== */

.avail-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}

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

.avail-popup {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 600px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

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

.avail-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.avail-popup-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.avail-popup-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.avail-popup-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.avail-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.avail-popup-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.avail-popup-body {
    padding: 1.25rem;
}

.avail-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.avail-months {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: 2px;
}

.avail-month-label {
    padding: 0.25rem 0;
}

.avail-weeks-header {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
}

.avail-week-label {
    padding: 0.125rem 0;
}

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

.avail-week {
    position: relative;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    cursor: default;
    transition: transform 0.1s;
}

.avail-week:hover {
    transform: scale(1.05);
    z-index: 1;
}

.avail-week.current {
    box-shadow: 0 0 0 2px var(--accent);
}

.avail-week.available { background: #f0fdf4; }
.avail-week.partial { background: #faf5ff; }
.avail-week.busy { background: #fff7ed; }
.avail-week.full { background: #fef2f2; }
.avail-week.overbooked { background: #fee2e2; }
.avail-week.off { background: #f1f5f9; }

.avail-bar {
    display: flex;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.avail-legend {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    justify-content: center;
}

/* ========== Dark theme overrides for hardcoded colors ========== */

/* --- Structural --- */

[data-theme="dark"] .panel-header {
    background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .confirm-modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .sync-modal,
[data-theme="dark"] .confirm-modal,
[data-theme="dark"] .gantt-modal-content,
[data-theme="dark"] .calendar-popup,
[data-theme="dark"] .roster-cell-popup { background: var(--bg-secondary); }

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg-primary); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--bg-hover); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* --- Status badges --- */
[data-theme="dark"] .status-badge.tentative { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .status-badge.not_started { background: #3b1764; color: #d8b4fe; }
[data-theme="dark"] .status-badge.in_progress { background: #14532d; color: #86efac; }

/* --- Matrix table capability colors --- */
[data-theme="dark"] .role-matrix .cap-cloud { background: #0c2d48; }
[data-theme="dark"] .role-matrix th.cap-cloud { background: #0e3a5e; color: #7dd3fc; }
[data-theme="dark"] .role-matrix .cap-cloud.is-checked { background: #164e73; }

[data-theme="dark"] .role-matrix .cap-data { background: #2e1042; }
[data-theme="dark"] .role-matrix th.cap-data { background: #4a1564; color: #f0abfc; }
[data-theme="dark"] .role-matrix .cap-data.is-checked { background: #6b1d8e; }

[data-theme="dark"] .role-matrix .cap-software { background: #0a2e14; }
[data-theme="dark"] .role-matrix th.cap-software { background: #14532d; color: #86efac; }
[data-theme="dark"] .role-matrix .cap-software.is-checked { background: #166534; }

[data-theme="dark"] .role-matrix .cap-general { background: #1e293b; }
[data-theme="dark"] .role-matrix th.cap-general { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .role-matrix .cap-general.is-checked { background: #475569; }

[data-theme="dark"] .role-matrix .group-first { border-left-color: #0f172a; }
[data-theme="dark"] .role-matrix .group-header { border-left-color: #0f172a; }
[data-theme="dark"] .role-matrix th.member-header { background: var(--bg-secondary); }
[data-theme="dark"] .role-matrix td.member-cell { background: var(--bg-secondary); }
[data-theme="dark"] tr.no-roles { opacity: 0.5; }

/* --- Roster heatmap --- */
[data-theme="dark"] .roster-cell.available {
    background: rgba(22, 163, 74, 0.3);
    color: #86efac;
}
[data-theme="dark"] .roster-cell.partial {
    background: rgba(202, 138, 4, 0.3);
    color: #fcd34d;
}
[data-theme="dark"] .roster-cell.busy {
    background: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

/* --- Candidate availability week cells --- */
[data-theme="dark"] .avail-week.available { background: #14532d; }
[data-theme="dark"] .avail-week.partial { background: #3b1764; }
[data-theme="dark"] .avail-week.busy { background: #431407; }
[data-theme="dark"] .avail-week.full { background: #450a0a; }
[data-theme="dark"] .avail-week.overbooked { background: #7f1d1d; }
[data-theme="dark"] .avail-week.off { background: #1e293b; }

/* --- Timeline week cells --- */
[data-theme="dark"] .tl-week.available { background: #14532d; }
[data-theme="dark"] .tl-week.partial { background: #1e293b; }
[data-theme="dark"] .tl-week.busy { background: #431407; }
[data-theme="dark"] .tl-week.full { background: #450a0a; }
[data-theme="dark"] .tl-week.overbooked { background: #7f1d1d; }
[data-theme="dark"] .tl-week.off { background: #334155; }

/* --- Portfolio bars --- */
[data-theme="dark"] .portfolio-bar.tentative { background: #1e3a5f; }
[data-theme="dark"] .portfolio-bar.not_started { background: #3b1764; }
[data-theme="dark"] .portfolio-bar.in_progress { background: #14532d; }

/* --- Gantt phase chunks --- */
[data-theme="dark"] .phase-chunk.intensity-1 { background: hsl(142, 40%, 25%); color: #86efac; }
[data-theme="dark"] .phase-chunk.intensity-2 { background: hsl(142, 40%, 28%); color: #86efac; }
[data-theme="dark"] .phase-chunk.intensity-3 { background: hsl(142, 40%, 32%); color: #86efac; }
[data-theme="dark"] .phase-chunk.intensity-4 { background: hsl(142, 45%, 35%); color: #fff; }
[data-theme="dark"] .phase-chunk.intensity-5 { background: hsl(142, 45%, 38%); color: #fff; }
[data-theme="dark"] .phase-chunk.intensity-6 { background: hsl(142, 45%, 42%); color: #fff; }
[data-theme="dark"] .phase-chunk.intensity-7 { background: hsl(142, 45%, 32%); color: #fff; }
[data-theme="dark"] .phase-chunk.intensity-8 { background: hsl(142, 45%, 28%); color: #fff; }
[data-theme="dark"] .gantt-buffer-overlay { background: rgba(51, 65, 85, 0.5); }

/* --- Filter chips and tags --- */
[data-theme="dark"] .filter-chip.checked { background: var(--accent-bg); color: var(--accent-light); }
[data-theme="dark"] .reason-tag.positive { color: #86efac; }
[data-theme="dark"] .reason-tag.negative { color: #fca5a5; }

/* --- Score classes --- */
[data-theme="dark"] .score-superscript.high { color: #86efac; }
[data-theme="dark"] .score-superscript.medium { color: #fcd34d; }
[data-theme="dark"] .score-superscript.low { color: #fca5a5; }

/* --- Candidate cards --- */
[data-theme="dark"] .candidate-card:hover { background: var(--bg-tertiary); }

/* --- Timeline dark mode: continuous strip + ghost outline free + emerald proposed --- */
[data-theme="dark"] .tl-weeks {
    background: #1a2536;
    border-radius: 6px;
    padding: 3px 0;
}
[data-theme="dark"] .tl-week {
    background: transparent !important;
}
[data-theme="dark"] .tl-bar {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.15);
}
[data-theme="dark"] .tl-seg.free {
    background: rgba(148, 163, 184, 0.08);
}
[data-theme="dark"] .tl-seg.proposed {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}
[data-theme="dark"] .tl-legend-dot.free {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

/* --- Timeline header/footer gradients --- */
[data-theme="dark"] .tl-header-label {
    background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%);
}
[data-theme="dark"] .tl-months {
    background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%);
}
[data-theme="dark"] .tl-days {
    background: linear-gradient(180deg, #1a2332 0%, #162030 100%);
}
[data-theme="dark"] .tl-footer {
    background: linear-gradient(180deg, #1e293b 0%, #1a2332 100%);
}

/* --- Tooltip (inverted in dark mode) --- */
[data-theme="dark"] .tl-tooltip {
    background: #e2e8f0;
    color: #1e293b;
}
[data-theme="dark"] .tl-tooltip .tip-header {
    border-bottom-color: rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .tl-tooltip .tip-total {
    border-top-color: rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .tl-tooltip .tip-holiday { color: #4338ca; }
[data-theme="dark"] .tl-tooltip .tip-pto { color: #dc2626; }
[data-theme="dark"] .tl-tooltip .tip-proposed { color: #15803d; }
[data-theme="dark"] .tl-tooltip .tip-total.high { color: #a16207; }
[data-theme="dark"] .tl-tooltip .tip-total.over { color: #dc2626; }

/* --- Role header with selection: use accent blue instead of green --- */
[data-theme="dark"] .role-results.has-selection .role-results-header {
    background: var(--accent-bg);
}
[data-theme="dark"] .role-results.has-selection {
    border-color: var(--accent);
}
[data-theme="dark"] .selected-indicator {
    color: var(--accent-light);
    background: rgba(59, 130, 246, 0.15);
}

/* --- Selected candidate card: use accent blue border to distinguish from green header --- */
[data-theme="dark"] .cand.selected {
    background: #0f1d2e;
    border-color: var(--accent);
}

/* --- Budget indicators --- */
[data-theme="dark"] .budget-match.warn { color: var(--warning); }
[data-theme="dark"] .budget-match.ok { color: var(--success); }
