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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
}

.fetch-warning-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px 20px;
    font-size: 13px;
    border-radius: 4px;
    margin: 12px 30px 0;
}

.header {
    background: #202344;
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-logo {
    height: 36px;
    flex-shrink: 0;
}

.header h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

.header .subtitle {
    color: #D7D5F0;
    font-size: 13px;
}

.tabs {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    padding: 0 30px;
    overflow-x: auto;
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    color: #7f8c8d;
    font-weight: 500;
    font-size: inherit;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.3s;
}

.tab:hover {
    background: #EFEDFF;
    color: #20205f;
}

.tab.active {
    color: #4A4BB6;
    border-bottom-color: #4A4BB6;
}

.content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 30px;
}

.tab-content {
    display: none;
}

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

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid;
}

.stat-card.red { border-color: #e74c3c; }
.stat-card.orange { border-color: #f39c12; }
.stat-card.green { border-color: #35AA59; }
.stat-card.blue { border-color: #4A4BB6; }
.stat-card.purple { border-color: #6366F1; }

.data-quality-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13px;
}
.data-quality-label { color: #7f8c8d; }
.util-coverage-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
}
.util-coverage-badge.good { background: #d4edda; color: #155724; }
.util-coverage-badge.warn { background: #fff3cd; color: #856404; }
.util-coverage-badge.bad  { background: #f8d7da; color: #721c24; }

.stat-label {
    font-size: 13px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-detail {
    font-size: 13px;
    color: #95a5a6;
    margin-top: 5px;
}

.filters {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

select, input {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

select:focus, input:focus {
    outline: none;
    border-color: #3498db;
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
}

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

th {
    background: #34495e;
    color: white;
    padding: 14px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 10;
}

th:hover {
    background: #2c3e50;
}

th.sortable::after {
    content: ' \2195';
    opacity: 0.5;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

tr:hover {
    background: #f8f9fa;
}

tr.util-problem {
    background: #fff8f0;
}

tr.supply-problem {
    background: #fff5f5;
}

tr.nodata-problem {
    background: #f9f9f9;
}

.badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.util { background: #f39c12; color: white; }
.badge.util::before { content: "\25B2 "; }
.badge.supply { background: #e74c3c; color: white; }
.badge.supply::before { content: "\2716 "; }
.badge.ontrack { background: #27ae60; color: white; }
.badge.ontrack::before { content: "\2714 "; }
.badge.nodata { background: #95a5a6; color: white; }
.badge.nodata::before { content: "? "; }
.badge.lowutil { background: #9b59b6; color: white; }
.badge.lowutil::before { content: "\25BC "; }
.badge.adjusted { background: #3498db; color: white; font-size: 10px; padding: 2px 6px; margin-left: 6px; }
.adj-note { display: block; font-size: 11px; color: #7f8c8d; font-weight: normal; }

.gap-critical { color: #c0392b; font-weight: bold; }
.gap-high { color: #e67e22; font-weight: bold; }
.gap-medium { color: #f39c12; }
.gap-low { color: #27ae60; }

.methodology {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 1200px;
    line-height: 1.7;
}

.methodology h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

.methodology h2 {
    color: #2c3e50;
    margin-top: 35px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 22px;
}

.methodology h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 18px;
}

.methodology p, .methodology li {
    color: #555;
    margin-bottom: 12px;
}

.methodology ul {
    margin-left: 25px;
    margin-bottom: 15px;
}

.methodology code {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e74c3c;
}

.methodology table {
    margin: 15px 0;
    background: #f8f9fa;
}

.methodology table th {
    background: #34495e;
    padding: 10px;
}

.methodology table td {
    padding: 10px;
}

.callout {
    padding: 20px;
    margin: 25px 0;
    border-radius: 6px;
    border-left: 4px solid;
}

.callout.warning {
    background: #fff3cd;
    border-color: #f39c12;
}

.callout.info {
    background: #d1ecf1;
    border-color: #3498db;
}

.callout.success {
    background: #d4edda;
    border-color: #27ae60;
}

.callout.purple {
    background: #f3e8ff;
    border-color: #9b59b6;
}

.callout strong {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
}

.update-time {
    text-align: center;
    color: #95a5a6;
    font-size: 12px;
    margin-top: 30px;
    padding: 20px;
}

.update-time a { color: #4A4BB6; cursor: pointer; text-decoration: none; margin-left: 12px; }
.update-time a:hover { text-decoration: underline; }

.changelog-overlay {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center; align-items: center;
}
.changelog-overlay.active { display: flex; }
.changelog-modal {
    background: white; border-radius: 12px;
    max-width: 680px; width: 90%; max-height: 80vh;
    overflow-y: auto; padding: 35px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}
.changelog-modal h2 { margin-top: 0; margin-bottom: 24px; font-size: 22px; }
.changelog-close {
    position: absolute; top: 15px; right: 20px;
    font-size: 24px; cursor: pointer; color: #7f8c8d;
    background: none; border: none; line-height: 1;
}
.changelog-close:hover { color: #2c3e50; }
.cl-entry { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #ecf0f1; }
.cl-entry:last-child { border-bottom: none; margin-bottom: 0; }
.cl-version {
    font-weight: 700; font-size: 15px; color: #2c3e50;
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.cl-date { font-weight: 400; color: #95a5a6; font-size: 13px; }
.cl-tag {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px; text-transform: uppercase;
}
.cl-tag.feature { background: #d5f5e3; color: #27ae60; }
.cl-tag.fix { background: #fadbd8; color: #e74c3c; }
.cl-tag.improvement { background: #d6eaf8; color: #2980b9; }
.cl-entry ul { margin: 6px 0 0 0; padding-left: 20px; font-size: 13px; line-height: 1.8; color: #34495e; }

.section-header {
    background: white;
    padding: 15px 20px;
    margin: 25px 0 0 0;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border-bottom: 1px solid #ecf0f1;
}

.row-count {
    font-size: 13px;
    color: #7f8c8d;
}

.export-btn {
    padding: 7px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.export-btn:hover {
    background: #2980b9;
}

.bar-chart {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.bar-chart h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 16px;
}

.bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.bar-label {
    width: 180px;
    min-width: 180px;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2c3e50;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: #f0f2f5;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.bar-fill.supply-bar { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.bar-fill.util-bar { background: linear-gradient(90deg, #f39c12, #e67e22); }
.bar-fill.nodata-bar { background: linear-gradient(90deg, #95a5a6, #7f8c8d); }

.bar-value {
    min-width: 140px;
    padding-left: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}
.bar-value .bar-coverage {
    font-weight: 400;
    color: #7f8c8d;
    font-size: 11px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #ecf0f1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #7f8c8d;
}

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

.legend-dot.supply-bar { background: #e74c3c; }
.legend-dot.util-bar { background: #f39c12; }
.legend-dot.nodata-bar { background: #95a5a6; }

.tracker-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.tracker-table-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tracker-table-wrap table th,
.tracker-table-wrap table td {
    text-align: center;
    padding: 10px 8px;
    min-width: 90px;
}

.tracker-table-wrap table th:first-child,
.tracker-table-wrap table td:first-child {
    text-align: left;
    min-width: 180px;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
}

.tracker-table-wrap table tr:hover td:first-child {
    background: #f8f9fa;
}

.month-cell { font-size: 12px; line-height: 1.4; }
.month-cell .mc-target { color: #7f8c8d; }
.month-cell .mc-forecast { color: #8e44ad; font-size: 11px; }
.month-cell .mc-smoothed { color: #2980b9; font-size: 11px; }
.month-cell .mc-actual { font-weight: 700; }
.month-cell .mc-var { font-size: 11px; font-weight: 600; }
.mc-var.positive { color: #27ae60; }
.mc-var.negative { color: #e74c3c; }
.mc-var.zero { color: #95a5a6; }
.month-current { background: #eaf6ff; }
.month-past { background: #f9f9f9; }
.month-in-progress {
    background: #eaf6ff;
    border: 2px dashed #3498db;
    position: relative;
}
.ip-badge {
    display: inline-block; font-size: 9px; font-weight: 700;
    background: #3498db; color: #fff;
    padding: 1px 5px; border-radius: 3px;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-top: 2px;
}
.ip-progress-outer {
    height: 4px; background: #d5e8f7; border-radius: 2px;
    margin-top: 3px; overflow: hidden;
}
.ip-progress-fill {
    height: 100%; background: #3498db; border-radius: 2px;
    transition: width 0.3s;
}

.pace-bar-wrap { width: 80px; display: inline-block; vertical-align: middle; }
.pace-bar-outer { height: 10px; background: #ecf0f1; border-radius: 5px; overflow: hidden; }
.pace-bar-fill { height: 100%; border-radius: 5px; transition: width 0.3s; }
.pace-bar-fill.pace-miss { background: #e74c3c; }
.pace-bar-fill.pace-risk { background: #f39c12; }
.pace-bar-fill.pace-ok { background: #27ae60; }
.pace-label { font-size: 11px; font-weight: 600; margin-top: 2px; text-align: center; }
.pace-label.pace-miss { color: #e74c3c; }
.pace-label.pace-risk { color: #f39c12; }
.pace-label.pace-ok { color: #27ae60; }
tr.row-miss td:first-child { border-left: 3px solid #e74c3c; }
tr.row-risk td:first-child { border-left: 3px solid #f39c12; }

.tooltip-wrap { position: relative; cursor: help; }
.tooltip-wrap .tooltip-text {
    visibility: hidden; opacity: 0;
    position: fixed;
    background: #2c3e50; color: #fff;
    font-size: 12px; font-weight: 400; line-height: 1.5;
    padding: 10px 14px; border-radius: 6px;
    width: 280px; text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: opacity 0.2s; z-index: 1000;
    pointer-events: none;
}
.tooltip-wrap:hover .tooltip-text { visibility: visible; opacity: 1; }

.progress-container {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.progress-bar-outer {
    height: 32px;
    background: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin: 15px 0;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    transition: width 0.6s ease;
}

.progress-bar-fill.on-pace { background: linear-gradient(90deg, #35AA59, #3dc466); }
.progress-bar-fill.behind { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.progress-bar-fill.ahead { background: linear-gradient(90deg, #3498db, #2980b9); }

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #7f8c8d;
}

.upload-zone {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafbfc;
    margin-bottom: 20px;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: #3498db;
    background: #eaf6ff;
}

.upload-zone p { color: #7f8c8d; margin-top: 10px; font-size: 14px; }
.upload-zone .upload-icon { font-size: 36px; color: #bdc3c7; }

.upload-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.upload-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
}

.looker-sync-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #eaf6ec 0%, #e8f4fd 100%);
    border: 1px solid #b8dcc6;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 25px;
}

.looker-sync-icon {
    font-size: 28px;
    color: #27ae60;
    flex-shrink: 0;
}

.looker-sync-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 14px;
    color: #2c3e50;
}

.looker-sync-text strong {
    font-size: 15px;
}

.looker-sync-text span {
    color: #5a6c7d;
}

.advanced-uploads {
    margin-bottom: 25px;
}

.advanced-uploads > summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #7f8c8d;
    padding: 14px 20px;
    background: #f8f9fa;
    border: 1px dashed #bdc3c7;
    border-radius: 8px;
    list-style: none;
    transition: color 0.2s, border-color 0.2s;
}

.advanced-uploads > summary::-webkit-details-marker {
    display: none;
}

.advanced-uploads > summary::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 10px;
    font-size: 11px;
    transition: transform 0.2s;
}

.advanced-uploads[open] > summary::before {
    transform: rotate(90deg);
}

.advanced-uploads > summary:hover {
    color: #2c3e50;
    border-color: #95a5a6;
}

.advanced-uploads[open] > summary {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    margin-bottom: 0;
}

.advanced-uploads-note {
    color: #7f8c8d;
    font-size: 13px;
    padding: 15px 20px;
    margin: 0;
    background: #fdf9f0;
    border: 1px dashed #bdc3c7;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-bottom: 20px;
}

.upload-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.upload-preview {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary { background: #4A4BB6; color: white; }
.btn-primary:hover { background: #3a3b96; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }
.btn-secondary { background: #ecf0f1; color: #2c3e50; }
.btn-secondary:hover { background: #d5dbdb; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.template-link {
    display: inline-block;
    color: #3498db;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 8px;
}

.settings-row {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.settings-row label {
    font-size: 13px;
    font-weight: 600;
    color: #7f8c8d;
}

.settings-row input[type="password"],
.settings-row input[type="text"] {
    flex: 1;
    min-width: 250px;
}

.status-msg {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

.status-msg.success { display: block; background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-msg.error { display: block; background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.status-msg.info { display: block; background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.history-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.history-card-header {
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    color: white;
}

.history-card-header.met { background: #27ae60; }
.history-card-header.missed { background: #e74c3c; }
.history-card-header.partial { background: #f39c12; }

.history-card-body {
    padding: 20px;
}

.history-stat {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.history-stat:last-child { border-bottom: none; }

.history-performers {
    margin-top: 12px;
    font-size: 12px;
    color: #7f8c8d;
}

.history-performers strong {
    display: block;
    margin-bottom: 4px;
    color: #2c3e50;
    font-size: 13px;
}

.upload-log-table {
    width: 100%;
}

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