:root {
    /* Piedmont Color Palette */
    --piedmont-primary: #C84E28;
    --piedmont-red: #C84E28;
    --piedmont-orange: #E87722;
    --piedmont-gold: #F7A828;
    --piedmont-yellow: #FFC857;
    --piedmont-dark: #2c3e50;
    --piedmont-gray: #7f8c8d;
    --piedmont-light-bg: #f5f7fa;
    --piedmont-white: #ffffff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--piedmont-light-bg);
    color: var(--piedmont-dark);
    overflow: hidden;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header Styles */
.top-header {
    background: var(--piedmont-white);
    color: var(--piedmont-dark);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
    border-top: 4px solid;
    border-image: linear-gradient(90deg, #C84E28 0%, #E87722 25%, #F7A828 50%, #FFC857 75%, #FFD700 100%) 1;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.piedmont-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-square {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--piedmont-red) 0%, var(--piedmont-orange) 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-square::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid white;
    border-radius: 3px;
    transform: rotate(45deg);
}

.piedmont-tagline {
    font-family: 'Brush Script MT', cursive;
    font-size: 1.4rem;
    color: var(--piedmont-dark);
    font-style: italic;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.mssp-timeline {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
}

.timeline-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--piedmont-primary);
}

.timeline-dot.active {
    width: 14px;
    height: 14px;
    background: var(--piedmont-primary);
    box-shadow: 0 0 0 3px rgba(200, 78, 40, 0.2);
}

.timeline-dot.future {
    background: #ddd;
}

.timeline-line {
    width: 40px;
    height: 2px;
    background: #ddd;
}

.timeline-label {
    font-weight: 600;
    color: var(--piedmont-dark);
}

.timeline-date {
    color: var(--piedmont-gray);
    font-size: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: var(--piedmont-primary);
}

.nav-item.active {
    background: rgba(102,126,234,0.2);
    border-left-color: var(--piedmont-primary);
    font-weight: 600;
}

/* Dashboard Main Area */
.dashboard-main {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f5f7fa;
    min-width: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.tab-header {
    margin-bottom: 2rem;
}

.tab-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.tab-header p {
    color: #7f8c8d;
    font-size: 1rem;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.kpi-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0.5rem 0;
}

.kpi-change {
    font-size: 0.9rem;
    font-weight: 500;
}

.kpi-change.positive {
    color: #27ae60;
}

.kpi-change.negative {
    color: #e74c3c;
}

/* Chart Section - FIXED */
.chart-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.chart-section h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* CRITICAL FIX for chart height issue */
.chart-wrapper {
    position: relative;
    height: 350px;
    width: 100%;
}

.chart-wrapper canvas {
    max-height: 100% !important;
    max-width: 100% !important;
}

/* Table Section */
.table-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.table-section h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

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

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a6c7d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr.clickable:hover {
    background: #f8f9fa;
    cursor: pointer;
}

.data-table .good {
    color: #27ae60;
    font-weight: 600;
}

.data-table .warning {
    color: #f39c12;
    font-weight: 600;
}

.data-table .bad {
    color: #e74c3c;
    font-weight: 600;
}

.domain-header td {
    background: #ecf0f1;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}

.btn-small {
    background: var(--piedmont-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-small:hover {
    background: #5568d3;
}

/* Alert Box */
.alert-box {
    background: linear-gradient(135deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.alert-box.success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
}

.alert-box.info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.alert-box.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.alert-box h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.alert-box ul {
    margin-left: 1.5rem;
}

.alert-box li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.alert-box p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Projections Controls */
.controls-panel {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.controls-panel h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.control-item {
    display: flex;
    flex-direction: column;
}

.control-item label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.control-item input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
    cursor: pointer;
}

/* Projection Results */
.projection-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.result-card.highlight {
    background: linear-gradient(135deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    color: white;
}

.result-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric .label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.metric .value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric .sub {
    font-size: 0.75rem;
    opacity: 0.8;
}

.metric.success .value {
    color: #a8e063;
}

.confidence-item {
    margin-bottom: 1.5rem;
}

.confidence-item span {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #2c3e50;
}

.bar {
    background: #e9ecef;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bar.danger {
    background: #fee;
}

.fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: width 0.3s ease;
    color: white;
}

.fill.good {
    background: linear-gradient(90deg, #56ab2f, #a8e063);
}

.fill.bad {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* Quality Metrics Styles */
.quality-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.quality-summary-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.quality-score-large {
    font-size: 3rem;
    font-weight: 700;
    color: var(--piedmont-primary);
    margin: 1rem 0;
}

.quality-rating {
    font-size: 1.1rem;
    margin: 0.5rem 0;
    color: #2c3e50;
}

.quality-rating.success {
    color: #27ae60;
}

.quality-rating.trend-up {
    color: #27ae60;
}

.quality-detail {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

/* Total Cost of Care Styles */
.tcoc-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tcoc-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tcoc-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.tcoc-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0.5rem 0;
}

.tcoc-detail {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.tcoc-detail.good {
    color: #27ae60;
    font-weight: 600;
}

.cost-breakdown-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.cost-chart-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cost-details {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cost-category-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cost-category-item {
    padding: 1rem;
    border-left: 4px solid var(--piedmont-primary);
    background: #f8f9fa;
    border-radius: 6px;
}

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

.category-name {
    font-weight: 600;
    color: #2c3e50;
}

.category-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--piedmont-primary);
}

.category-pmpm {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Leakage Styles */
.leakage-filter-bar {
    background: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.leakage-filter-bar label {
    font-weight: 600;
    color: #2c3e50;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--piedmont-primary);
    color: var(--piedmont-primary);
}

.filter-btn.active {
    background: var(--piedmont-primary);
    color: white;
    border-color: var(--piedmont-primary);
}

.leakage-summary-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.leakage-chart-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s;
}

.leakage-chart-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.clickable-hint {
    font-size: 0.75rem;
    color: #7f8c8d;
    font-weight: 400;
}

.leakage-metrics-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.metric-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.metric-item.highlight {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.metric-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.metric-pct {
    font-size: 1.1rem;
    color: #7f8c8d;
}

.metric-note {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

/* Geographic Map */
.geo-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.map-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    min-height: 500px;
}

.map-legend {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.green {
    background: #27ae60;
}

.dot.yellow {
    background: #f39c12;
}

.dot.red {
    background: #e74c3c;
}

/* Sankey Section */
.sankey-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.section-note {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

#sankey-diagram {
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

/* HCC Styles */
.hcc-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.hcc-summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.hcc-summary-card.warning {
    background: #fff3cd;
}

.hcc-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--piedmont-primary);
    margin: 0.5rem 0;
}

.hcc-detail {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

.hcc-trend {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.hcc-trend.good {
    color: #27ae60;
}

.hcc-trend.bad {
    color: #e74c3c;
}

/* Episodes Styles */
.episodes-info-box {
    background: #e8f4fd;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #3498db;
    margin-bottom: 2rem;
}

.episodes-info-box h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.episodes-info-box p {
    color: #5a6c7d;
    line-height: 1.6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.2s;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* Patient Detail Modal Styles */
.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.patient-info {
    flex: 1;
}

.patient-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--piedmont-dark);
    margin-bottom: 0.5rem;
}

.patient-meta {
    display: flex;
    gap: 2rem;
    color: var(--piedmont-gray);
    font-size: 0.9rem;
}

.patient-meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-weight: 600;
    color: var(--piedmont-dark);
}

.care-team-badge {
    background: linear-gradient(135deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.care-team-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.care-team-name {
    font-weight: 600;
    font-size: 1rem;
}

.gaps-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--piedmont-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.priority-badge {
    background: #ff6b6b;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.gap-item {
    background: #f8f9fa;
    border-left: 4px solid var(--piedmont-gray);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.gap-item.primary-gap {
    background: #fff3cd;
    border-left-color: var(--piedmont-primary);
    box-shadow: 0 2px 8px rgba(200, 78, 40, 0.1);
}

.gap-item:hover {
    transform: translateX(4px);
}

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

.gap-measure {
    font-weight: 600;
    color: var(--piedmont-dark);
    font-size: 1rem;
}

.gap-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gap-status.open {
    background: #fee;
    color: #c0392b;
}

.gap-status.closing-soon {
    background: #fff3cd;
    color: #856404;
}

.gap-description {
    color: var(--piedmont-gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.gap-details {
    display: flex;
    gap: 2rem;
    font-size: 0.85rem;
    color: var(--piedmont-gray);
}

.appointment-section {
    background: #e8f4fd;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.appointment-title {
    font-weight: 600;
    color: var(--piedmont-dark);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.appointment-info {
    display: flex;
    gap: 2rem;
}

.appt-detail {
    display: flex;
    flex-direction: column;
}

.appt-label {
    font-size: 0.75rem;
    color: var(--piedmont-gray);
    margin-bottom: 0.25rem;
}

.appt-value {
    font-weight: 600;
    color: var(--piedmont-dark);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #2c3e50;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

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

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

    .cost-breakdown-section {
        grid-template-columns: 1fr;
    }

    .leakage-summary-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 1rem 0;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .header-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .control-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile Header Adjustments */
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .header-left {
        width: 100%;
    }

    .mssp-timeline {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .timeline-step {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.25rem;
    }

    .timeline-line {
        width: 20px;
        display: none;
    }

    .piedmont-tagline {
        font-size: 1.1rem;
    }

    /* Mobile Table Adjustments */
    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Mobile Modal Adjustments */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 1rem;
        max-height: 90vh;
    }

    .patient-header {
        flex-direction: column;
        gap: 1rem;
    }

    .patient-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .patient-name {
        font-size: 1.4rem;
    }

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

    .gap-details {
        flex-direction: column;
        gap: 0.5rem;
    }

    .appointment-info {
        flex-wrap: wrap;
        gap: 1rem;
    }

    /* Mobile Chart Adjustments */
    .chart-wrapper {
        height: 250px;
    }

    .dashboard-main {
        padding: 1rem;
    }

    .tab-header h2 {
        font-size: 1.5rem;
    }

    /* Mobile Navigation */
    .nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Mobile Grid Adjustments */
    .quality-summary-grid,
    .tcoc-summary-grid,
    .hcc-summary-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 0.75rem;
    }

    .logo-square {
        width: 32px;
        height: 32px;
    }

    .logo-square::before {
        width: 20px;
        height: 20px;
        border: 2px solid white;
    }

    .piedmont-tagline {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .kpi-value {
        font-size: 2rem;
    }

    .modal-content {
        width: 98%;
        padding: 0.75rem;
    }

    .close {
        right: 0.75rem;
        top: 0.75rem;
        font-size: 1.5rem;
    }
}

/* Tooltip Styles */
.tooltip-hover {
    position: relative;
    cursor: help;
}

.tooltip-hover:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: normal;
    width: 220px;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    line-height: 1.3;
    text-align: left;
    font-weight: normal;
    pointer-events: none;
    margin-bottom: 8px;
}

.tooltip-hover:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2c3e50;
    margin-bottom: 2px;
    z-index: 99999;
    pointer-events: none;
}

.tooltip-icon {
    color: #3498db;
    font-size: 0.8em;
    margin-left: 4px;
    font-weight: normal;
}

/* Measure Dashboard Styles */
.measure-dashboard {
    max-width: 100%;
}

.measure-header {
    background: linear-gradient(135deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.measure-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.measure-code {
    font-size: 1rem;
    opacity: 0.9;
}

.measure-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.measure-summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.summary-card-label {
    font-size: 0.85rem;
    color: var(--piedmont-gray);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.summary-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--piedmont-primary);
    margin: 0.5rem 0;
}

.summary-card-detail {
    font-size: 0.9rem;
    color: var(--piedmont-gray);
}

.measure-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.measure-chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
}

.measure-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.chart-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--piedmont-dark);
    margin-bottom: 1rem;
}

.provider-ranking-table {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

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

.ranking-table thead {
    background: #f8f9fa;
}

.ranking-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a6c7d;
    text-transform: uppercase;
    border-bottom: 2px solid #e9ecef;
}

.ranking-table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.ranking-table tbody tr {
    transition: background 0.2s;
    cursor: pointer;
}

.ranking-table tbody tr:hover {
    background: #f8f9fa;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
}

.rank-badge.rank-1 {
    background: #ffd700;
    color: #856404;
}

.rank-badge.rank-2 {
    background: #c0c0c0;
    color: #495057;
}

.rank-badge.rank-3 {
    background: #cd7f32;
    color: white;
}

.rank-badge.rank-other {
    background: #e9ecef;
    color: #6c757d;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    transition: width 0.3s ease;
}

.opportunity-badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.opportunity-badge.high {
    background: #fee;
    color: #c0392b;
}

.opportunity-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.opportunity-badge.low {
    background: #d4edda;
    color: #155724;
}

/* Patient List Styles */
.patient-list-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--piedmont-dark);
}

.export-btn {
    background: linear-gradient(135deg, var(--piedmont-primary) 0%, var(--piedmont-orange) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 78, 40, 0.3);
}

.patient-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.patient-list-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.patient-list-table th {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5a6c7d;
    text-transform: uppercase;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.patient-list-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.patient-list-table tbody tr {
    transition: background 0.2s;
}

.patient-list-table tbody tr:hover {
    background: #f8f9fa;
}

.patient-list-table tbody tr.non-compliant {
    background: #fff5f5;
}

.gap-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
}

.gap-indicator.open {
    background: #fee;
    color: #c0392b;
}

.gap-indicator.closed {
    background: #d4edda;
    color: #155724;
}

.gap-date {
    font-size: 0.8rem;
    color: var(--piedmont-gray);
}

.patient-name-cell {
    font-weight: 600;
    color: var(--piedmont-dark);
}

.compliant-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.compliant-badge.yes {
    background: #d4edda;
    color: #155724;
}

.compliant-badge.no {
    background: #fee;
    color: #c0392b;
}

/* Mobile adjustments for measure dashboard */
@media (max-width: 768px) {
    .measure-charts-grid {
        grid-template-columns: 1fr;
    }

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

    .patient-list-table {
        font-size: 0.75rem;
    }

    .patient-list-table th,
    .patient-list-table td {
        padding: 0.5rem;
    }

    .list-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}
