/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font Variables */
:root {
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Space Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

body {
    font-family: var(--font-body);
    background: #f1f5f9;
    min-height: 100vh;
}

/* Historical Mode Banner */
.historical-banner {
    background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.historical-banner .btn-return {
    background: white;
    color: #7c3aed;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

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

.site-logo {
    height: 40px;
    width: auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #1e293b;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.admin-link:hover {
    background: #334155;
}

h1 {
    font-family: var(--font-mono);
    color: #1e293b;
    font-size: 24px;
    font-weight: 700;
}

/* Date Picker */
.date-picker-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.date-picker-container label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.date-picker-container input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #1e293b;
}

.today-btn {
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.today-btn:hover {
    background: #2563eb;
}

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    text-decoration: none;
}

.filter-btn:hover {
    background: #e2e8f0;
}

.filter-btn.active {
    background: #1e293b;
    color: white;
}

.filter-btn.strategic.active { background: #16a34a; }
.filter-btn.tactical.active { background: #3b82f6; }
.filter-btn.operational.active { background: #64748b; }
.filter-btn.discovery.active { background: #7c3aed; }

/* Summary Bar */
.summary-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.summary-card {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.summary-icon.discovery { background: #f3e8ff; }
.summary-icon.strategic { background: #dcfce7; }
.summary-icon.tactical { background: #eff6ff; }
.summary-icon.operational { background: #f1f5f9; }
.summary-icon.cost { background: #fef3c7; }

.summary-content h4 {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.summary-content p {
    font-size: 12px;
    color: #64748b;
}

/* Roadmap Container */
.roadmap {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Experience Section */
.experience-section {
    border-bottom: 1px solid #e2e8f0;
}

.experience-section:last-child {
    border-bottom: none;
}

.experience-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
}

.experience-header:hover {
    background: #f1f5f9;
}

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

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

.experience-icon.resident { background: #dbeafe; }
.experience-icon.frontoffice { background: #dcfce7; }
.experience-icon.backoffice { background: #fef3c7; }
.experience-icon.board { background: #f3e8ff; }

.experience-info h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.experience-info .description {
    font-size: 12px;
    color: #94a3b8;
}

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

.pm-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #3b82f6;
    font-weight: 500;
}

.budget-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
}

.theme-count {
    font-size: 12px;
    color: #64748b;
}

.expand-icon {
    color: #94a3b8;
    transition: transform 0.2s;
}

.experience-section.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.experience-section.collapsed .experience-content {
    display: none;
}

/* Status Columns Header */
.status-columns-header {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.status-col-header {
    padding: 10px 16px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 1px solid #e2e8f0;
}

.status-col-header:first-child {
    border-left: none;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 100px;
    border-bottom: 1px solid #f1f5f9;
}

.status-column {
    padding: 10px;
    border-left: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 50px;
}

.status-column:first-of-type {
    border-left: none;
}

.status-column.current {
    background: #fafbff;
    border-left: 3px solid #3b82f6;
}

/* Story Card */
.story-card {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    background: white;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.story-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.story-card.strategic {
    border-left: 3px solid #16a34a;
}

.story-card.tactical {
    border-left: 3px solid #3b82f6;
}

.story-card.operational {
    border-left: 3px solid #94a3b8;
}

.story-card.discovery {
    border-left: 3px solid #7c3aed;
}

.story-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
}

.story-title {
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
    flex: 1;
}

.jira-link {
    font-size: 9px;
    color: #3b82f6;
    background: #eff6ff;
    padding: 2px 5px;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.jira-link:hover {
    background: #dbeafe;
    color: #2563eb;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}

.story-tag {
    font-size: 8px;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: lowercase;
}

/* Tier Badge */
.tier-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.tier-badge.strategic { background: #16a34a; color: white; }
.tier-badge.tactical { background: #3b82f6; color: white; }
.tier-badge.operational { background: #94a3b8; color: white; }
.tier-badge.discovery { background: #7c3aed; color: white; }

/* Value Badge */
.value-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.value-badge.revenue { background: #fef3c7; color: #b45309; }
.value-badge.efficiency { background: #e0e7ff; color: #4338ca; }
.value-badge.optimization { background: #cffafe; color: #0e7490; }
.value-badge.retention { background: #fce7f3; color: #be185d; }
.value-badge.compliance { background: #f1f5f9; color: #475569; }
.value-badge.experience { background: #ede9fe; color: #7c3aed; }
.value-badge.growth { background: #d1fae5; color: #047857; }

.card-cost {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: #059669;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.card-sponsor {
    font-size: 9px;
    color: #64748b;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}

/* Legend */
.legend {
    display: flex;
    gap: 24px;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border-left: 3px solid;
}

.legend-color.discovery {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-left-color: #7c3aed;
}

.legend-color.strategic {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #16a34a;
}

.legend-color.tactical {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
}

.legend-color.operational {
    background: #f8fafc;
    border-left-color: #94a3b8;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.modal-title-row h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-left: 16px;
}

.modal-close:hover {
    color: #64748b;
}

.modal-body {
    padding: 20px 24px;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.modal-cost {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: #059669;
    background: #d1fae5;
    padding: 4px 10px;
    border-radius: 6px;
}

.modal-sponsor {
    font-size: 12px;
    color: #64748b;
}

.modal-description {
    font-size: 14px;
    line-height: 1.7;
    color: #475569;
    margin: 0;
}

.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.jira-external-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s;
}

.jira-external-link:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

/* ============================================
   Budget Overview Section
   ============================================ */
.budget-overview-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    overflow: hidden;
}

.budget-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    cursor: pointer;
}

.budget-overview-header h3 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.budget-overview-toggle {
    color: white;
    transition: transform 0.2s;
}

.budget-overview-section.collapsed .budget-overview-toggle {
    transform: rotate(-90deg);
}

.budget-overview-section.collapsed .budget-overview-content {
    display: none;
}

.budget-overview-content {
    padding: 24px;
}

/* Budget Summary Cards */
.budget-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.budget-summary-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.budget-summary-card.positive {
    border-left: 4px solid #16a34a;
}

.budget-summary-card.negative {
    border-left: 4px solid #dc2626;
}

.budget-summary-card .card-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.budget-summary-card .card-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.budget-summary-card.positive .card-value { color: #16a34a; }
.budget-summary-card.negative .card-value { color: #dc2626; }

.budget-summary-card .card-sublabel {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

/* Budget Charts Row */
.budget-charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.budget-chart-container {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.budget-chart-container h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px 0;
}

/* Pie Charts */
.pie-chart-wrapper {
    display: flex;
    align-items: center;
    gap: 24px;
}

.pie-chart {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.pie-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pie-total {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.pie-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pie-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #475569;
}

.pie-legend .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Monthly Comparison Section */
.monthly-comparison-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.monthly-comparison-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px 0;
}

.monthly-bar-chart {
    display: flex;
    justify-content: space-between;
    height: 180px;
    padding: 0 10px;
    align-items: flex-end;
    border-bottom: 1px solid #e2e8f0;
}

.month-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc(100% / 12 - 8px);
}

.stacked-bar {
    display: flex;
    flex-direction: column-reverse;
    height: 150px;
    width: 100%;
    max-width: 40px;
    gap: 1px;
}

.bar-segment {
    border-radius: 2px;
    min-height: 2px;
    transition: opacity 0.2s;
}

.bar-segment:hover {
    opacity: 0.8;
}

.month-label {
    font-size: 10px;
    color: #64748b;
    margin-top: 8px;
    text-transform: uppercase;
}

.bar-chart-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.bar-chart-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #475569;
}

.bar-chart-legend .legend-bar {
    width: 16px;
    height: 10px;
    border-radius: 2px;
}

/* Mini Run Rate Charts in Experience Header */
.mini-runrate-chart {
    display: flex;
    gap: 2px;
    height: 32px;
    align-items: flex-end;
    padding: 4px 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.mini-bar-group {
    display: flex;
    gap: 1px;
    height: 100%;
    align-items: flex-end;
}

.mini-bar {
    width: 4px;
    border-radius: 1px;
    transition: height 0.3s;
}

.mini-bar.budget {
    background: #e2e8f0;
}

.mini-bar.actual {
    background: #3b82f6;
}

.mini-bar.actual.over {
    background: #f97316;
}

/* Budget Badge Variations */
.budget-badge.over-budget {
    background: #fef2f2;
    color: #dc2626;
}

/* Responsive */
@media (max-width: 1200px) {
    .container {
        padding: 16px;
    }

    .budget-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .budget-charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .roadmap {
        overflow-x: auto;
    }

    .items-grid,
    .status-columns-header {
        min-width: 800px;
    }

    .budget-summary-cards {
        grid-template-columns: 1fr;
    }

    .pie-chart-wrapper {
        flex-direction: column;
    }

    .mini-runrate-chart {
        display: none;
    }

    .monthly-bar-chart {
        overflow-x: auto;
        min-width: 600px;
    }
}
