/* KPI Dashboard - Light Theme (Force Override) */

/* Import Rubik font */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap');

/* Apply Rubik font to entire dashboard */
.kpi-dashboard-page,
.kpi-dashboard-page * {
    font-family: 'Rubik', sans-serif !important;
}

/* Force light theme on the entire page content */
.kpi-dashboard-page,
.kpi-dashboard-page .container-fluid,
.kpi-dashboard-page .main-content,
.kpi-dashboard-page .content-wrapper,
.kpi-dashboard-page .page-content,
.kpi-dashboard-page .content,
.kpi-dashboard-page main,
.kpi-dashboard-page [class*="content"] {
    background: #f5f7fa !important;
    background-color: #f5f7fa !important;
    color: #333 !important;
}

/* Override page title and text colors */
.kpi-dashboard-page h1,
.kpi-dashboard-page h2,
.kpi-dashboard-page h3,
.kpi-dashboard-page h4,
.kpi-dashboard-page h5,
.kpi-dashboard-page h6 {
    color: #1a1a2e !important;
}

.kpi-dashboard-page p,
.kpi-dashboard-page span,
.kpi-dashboard-page label,
.kpi-dashboard-page .text-muted {
    color: #666 !important;
}

/* Force light form controls */
.kpi-dashboard-page .form-control,
.kpi-dashboard-page .form-select,
.kpi-dashboard-page input,
.kpi-dashboard-page select,
.kpi-dashboard-page textarea {
    background-color: #fff !important;
    color: #333 !important;
    border-color: #dee2e6 !important;
}

/* Force light Select2 */
.kpi-dashboard-page .select2-container--default .select2-selection--multiple {
    background-color: #fff !important;
    border-color: #dee2e6 !important;
}

.kpi-dashboard-page .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #191C20 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
}

.kpi-dashboard-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff !important;
    margin-right: 4px !important;
}

.kpi-dashboard-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ff6b6b !important;
    background: transparent !important;
}

.kpi-dashboard-page .select2-dropdown {
    background-color: #fff !important;
    border-color: #dee2e6 !important;
}

.kpi-dashboard-page .select2-results__option {
    color: #333 !important;
}

.kpi-dashboard-page .select2-results__option--highlighted {
    background-color: #191C20 !important;
    color: #fff !important;
}

/* Main container styling */
.kpi-dashboard-container {
    background: #fff;
    border-radius: 5px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Project Selector */
.kpi-project-selector {
    background: #fff;
    border-radius: 5px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kpi-project-selector label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

/* Date filter reload button - improved contrast on light background */
.kpi-date-reload-btn {
    border: 1px solid #495057 !important;
    color: #212529 !important;
    background-color: #fff !important;
}

.kpi-date-reload-btn:hover {
    border-color: #191C20 !important;
    color: #fff !important;
    background-color: #191C20 !important;
}

/* KPI Table */
.kpi-table-container {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow-x: auto;
}

.kpi-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.kpi-table thead {
    background: #191C20;
}

.kpi-table thead th {
    color: #fff;
    font-weight: 500;
    padding: 12px 16px;
    text-align: center;
    font-size: 12px;
    border: none;
}

.kpi-table thead th:first-child {
    text-align: left;
    min-width: 200px;
}

.kpi-table thead th:not(:first-child) {
    min-width: 120px;
}

.kpi-table thead th .kpi-header-icon {
    display: block;
    font-size: 18px;
    margin-bottom: 2px;
}

.kpi-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.kpi-table tbody tr:hover {
    background-color: #f8f9ff;
}

.kpi-table tbody tr:last-child {
    border-bottom: none;
}

.kpi-table tbody td {
    padding: 10px 16px;
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
}

.kpi-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: #333;
}

.kpi-table tbody td:not(:first-child) {
    min-width: 120px;
}

/* KPI Value Cell */
.kpi-cell {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    transition: all 0.2s;
    display: inline-block;
    min-width: 60px;
}

.kpi-cell:hover {
    background: #e9eaec;
    transform: scale(1.02);
}

.kpi-cell-value {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: block;
}

.kpi-cell-loading {
    color: #999;
}

/* Project Name Cell */
.project-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-color-indicator {
    display: none;
}

/* Totals Row */
.kpi-table tbody tr.totals-row {
    background: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid #dee2e6;
}

.kpi-table tbody tr.totals-row td {
    color: #333;
}

.kpi-table tbody tr.totals-row .kpi-cell-value {
    color: #191C20;
}

/* Empty State */
.kpi-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.kpi-empty-state .mdi {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

/* Drill-down modal adjustments */
#kpi-drilldown-modal .modal-content {
    background: #fff;
}

#kpi-drilldown-modal .modal-header {
    background: #191C20 !important;
    color: #fff !important;
    border: none !important;
}

#kpi-drilldown-modal .modal-header * {
    color: #fff !important;
}

#kpi-drilldown-modal .modal-title {
    color: #fff !important;
}

#kpi-drilldown-modal .modal-title .mdi {
    color: #fff !important;
}

#kpi-drilldown-modal .btn-close {
    filter: invert(1) !important;
}

#kpi-drilldown-modal #drilldown-header-alert .badge {
    color: #212529 !important;
    font-weight: 500;
}

#kpi-drilldown-modal .modal-body {
    min-height: 550px;
    padding: 0;
}

#drilldown-pivot-container {
    width: 100%;
    height: 100%;
}

/* =============================================================================
   Custom Pivot Table Styles
   ============================================================================= */

.pivot-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
}

.pivot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* Pivot Table Header */
.pivot-table thead {
    background: #191C20;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pivot-table thead th {
    color: #fff;
    font-weight: 500;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    border: none;
    white-space: nowrap;
}

.pivot-header-name {
    min-width: 300px;
}

.pivot-header-count,
.pivot-header-value {
    text-align: right !important;
    min-width: 100px;
}

/* Pivot Table Rows */
.pivot-row {
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
}

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

/* Clickable group rows */
.pivot-row-clickable {
    cursor: pointer;
}

.pivot-row-clickable:hover {
    background-color: #f5f7fa;
}

/* Group rows (expandable) */
.pivot-row-group {
    background-color: #fff;
}

.pivot-row-group:hover {
    background-color: #f0f2f5;
}

/* Leaf rows (raw data) */
.pivot-row-leaf {
    background-color: #fafbfc;
}

.pivot-row-leaf:hover {
    background-color: #f5f7fa;
}

.pivot-row-leaf .pivot-column-label {
    color: #888;
}

/* Total row */
.pivot-row-total {
    background-color: #f0f2f5 !important;
    font-weight: 600;
    border-top: 2px solid #dee2e6;
}

.pivot-row-total:hover {
    background-color: #e8eaed !important;
}

.pivot-total-label {
    font-weight: 600;
    color: #191C20;
}

/* Pivot Table Cells */
.pivot-cell-name {
    text-align: left;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pivot-cell-count,
.pivot-cell-value {
    text-align: right;
    padding: 10px 16px;
    white-space: nowrap;
}

.pivot-cell-value {
    font-weight: 600;
    color: #191C20;
}

.pivot-cell-count {
    color: #666;
}

/* Chevron icon for expand/collapse */
.pivot-chevron {
    font-size: 18px;
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pivot-row-clickable .pivot-chevron {
    color: #191C20;
}

/* Column and value labels */
.pivot-column-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    margin-right: 4px;
}

.pivot-value-label {
    color: #333;
    font-weight: 500;
}

/* Level indentation visual guide */
.pivot-row[data-level="1"] .pivot-cell-name {
    border-left: 3px solid #e0e0e0;
}

.pivot-row[data-level="2"] .pivot-cell-name {
    border-left: 3px solid #d0d0d0;
}

.pivot-row[data-level="3"] .pivot-cell-name {
    border-left: 3px solid #c0c0c0;
}

.pivot-row[data-level="4"] .pivot-cell-name {
    border-left: 3px solid #b0b0b0;
}

/* =============================================================================
   Detail View Styles (when clicking leaf rows)
   ============================================================================= */

.pivot-detail-view {
    padding: 0;
}

.pivot-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.pivot-back-btn {
    flex-shrink: 0;
    border-color: #191C20 !important;
    color: #191C20 !important;
}

.pivot-back-btn:hover {
    background: #191C20 !important;
    color: #fff !important;
}

.pivot-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.breadcrumb-item {
    color: #333;
}

.breadcrumb-item strong {
    color: #191C20;
}

.breadcrumb-separator {
    color: #999;
    font-size: 14px;
}

.pivot-detail-info {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.pivot-detail-count {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Detail table styling */
.pivot-detail-table {
    font-size: 12px;
}

.pivot-detail-table thead th {
    font-size: 11px;
    padding: 10px 12px;
    white-space: nowrap;
}

.pivot-detail-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pivot-row-data:hover {
    background-color: #f8f9fa;
}

.pivot-row-link {
    cursor: pointer;
}

.pivot-row-link:hover {
    background-color: #e8f4fd !important;
}

.pivot-row-link:hover td:first-child {
    color: #0066cc;
    text-decoration: underline;
}

.pivot-row-data td {
    text-align: left;
    color: #333;
}

.pivot-row-data .pivot-cell-value {
    text-align: right;
    font-weight: 600;
}

/* =============================================================================
   Drill-down Modal Tabs
   ============================================================================= */

.drilldown-tabs {
    background: #2a2d32;
    border-bottom: none;
    padding: 0 16px;
    margin: 0;
}

.drilldown-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.6);
    padding: 12px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.drilldown-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.drilldown-tabs .nav-link.active {
    color: #fff;
    border-bottom-color: #fff;
    background: transparent;
}

.drilldown-tabs .nav-link .mdi {
    font-size: 16px;
}

#drilldown-tab-content {
    min-height: 400px;
}

#drilldown-pivot-tab,
#drilldown-chart-tab {
    height: 100%;
}

/* Chart Container */
.drilldown-chart-container {
    padding: 24px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.drilldown-chart-container canvas {
    flex: 1;
    max-height: 450px;
}

.chart-loading,
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #888;
}

.chart-loading .mdi,
.chart-empty .mdi {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ccc;
}

/* =============================================================================
   Historical Drill-Down Banner & Date Range Label
   ============================================================================= */

.drilldown-historical-banner {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(90deg, #fff3cd 0%, #fff8e6 100%);
    border-bottom: 1px solid #ffc107;
    color: #856404;
    font-size: 13px;
    line-height: 1.4;
}

.drilldown-historical-banner .mdi {
    font-size: 20px;
    color: #d4a017;
    flex-shrink: 0;
}

.drilldown-date-range {
    display: inline-block;
    margin-left: 8px;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
}

/* =============================================================================
   Three-Dots Table Menu
   ============================================================================= */

.kpi-table-menu-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #6c757d;
    transition: all 0.2s;
}

.kpi-table-menu-btn:hover,
.kpi-table-menu-btn:focus,
.kpi-table-menu-btn.show {
    background: #e9ecef;
    color: #191C20;
}

.kpi-table-menu-btn .mdi {
    font-size: 22px;
}

.kpi-table-dropdown {
    border-radius: 5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
    border: 1px solid #dee2e6;
    padding: 6px 0;
    min-width: 220px;
    background: #fff;
}

.kpi-table-dropdown .dropdown-item {
    padding: 9px 16px;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    background: transparent;
}

.kpi-table-dropdown .dropdown-item:hover {
    background: #f0f2f5;
    color: #191C20;
}

.kpi-table-dropdown .dropdown-item .mdi {
    font-size: 18px;
    color: #6c757d;
}

.kpi-table-dropdown .dropdown-item:hover .mdi {
    color: #191C20;
}

/* =============================================================================
   Configuration Modal Styles
   ============================================================================= */

#kpi-config-modal .modal-header {
    background: #191C20 !important;
    color: #fff !important;
    border: none !important;
}

#kpi-config-modal .modal-header * {
    color: #fff !important;
}

#kpi-config-modal .modal-body {
    background: #fff;
    padding: 0;
}

#kpi-config-modal .modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Config Tabs */
.kpi-config-tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0 20px;
}

.kpi-config-tabs .nav-link {
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 12px 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.kpi-config-tabs .nav-link:hover {
    color: #333;
    background: transparent;
    border-bottom-color: #ddd;
}

.kpi-config-tabs .nav-link.active {
    color: #191C20;
    background: transparent;
    border-bottom-color: #191C20;
}

.kpi-config-tabs .nav-link .mdi {
    font-size: 16px;
}

/* Tab Content */
.kpi-config-content {
    padding: 20px;
    min-height: 300px;
}

/* Modal body padding for config */
#kpi-config-modal .modal-body {
    padding: 20px 24px;
}

#kpi-config-modal .modal-footer {
    padding: 16px 24px;
    gap: 8px;
}

/* =============================================================================
   KPI Instances List
   ============================================================================= */

.kpi-instances-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    background: #f8f9fa;
    border-radius: 5px;
    border: 2px dashed #dee2e6;
}

.kpi-instances-empty .mdi {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    color: #ccc;
}

.kpi-instance-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 8px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.kpi-instance-item:hover {
    background: #f0f2f5;
    border-color: #dee2e6;
}

.kpi-instance-drag-handle {
    cursor: grab;
    color: #ccc;
    font-size: 18px;
}

.kpi-instance-drag-handle:hover {
    color: #666;
}

.kpi-instance-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #191C20;
    color: #fff;
    border-radius: 5px;
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-instance-info {
    flex: 1;
    min-width: 0;
}

.kpi-instance-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-instance-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.kpi-instance-type {
    color: #888;
}

.kpi-instance-filters {
    color: #666;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-instance-filters .mdi {
    font-size: 12px;
}

.kpi-instance-colors {
    display: flex;
    gap: 4px;
    padding: 0 8px;
}

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

.color-dot.color-red {
    background: #dc3545;
}

.color-dot.color-yellow {
    background: #ffc107;
}

.color-dot.color-green {
    background: #28a745;
}

.kpi-instance-actions {
    display: flex;
    gap: 4px;
}

.kpi-instance-actions .btn {
    padding: 4px 8px;
}

.kpi-instance-actions .btn .mdi {
    font-size: 16px;
}

/* =============================================================================
   KPI Edit Form
   ============================================================================= */

.kpi-edit-header {
    display: flex;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.kpi-edit-section {
    background: #f8f9fa;
    border-radius: 5px;
    padding: 20px;
}

.kpi-edit-section .section-title {
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.kpi-edit-section .section-title .mdi {
    font-size: 18px;
}

/* Fix button icon backgrounds */
#kpi-config-modal .btn .mdi {
    background: transparent !important;
}

#kpi-config-modal .modal-footer .btn {
    min-width: 100px;
}

/* =============================================================================
   Dynamic Filters
   ============================================================================= */

.kpi-dynamic-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.kpi-filter-row select {
    width: 140px;
    flex-shrink: 0;
}

.kpi-filter-row input {
    flex: 1;
}

.kpi-filter-row .btn-remove-filter {
    padding: 4px 8px;
    color: #dc3545;
    border: none;
    background: transparent;
}

.kpi-filter-row .btn-remove-filter:hover {
    background: #fee;
    border-radius: 5px;
}

/* Low-contrast fix: outline-secondary buttons on light background */
#kpi-config-modal .btn-add-filter,
#kpi-config-modal .btn-add-color-range,
#kpi-config-modal #back-to-list-btn,
#kpi-config-modal .kpi-instance-actions .btn-outline-secondary {
    border-color: #6c757d !important;
    color: #495057 !important;
}

#kpi-config-modal .btn-add-filter:hover,
#kpi-config-modal .btn-add-color-range:hover,
#kpi-config-modal #back-to-list-btn:hover,
#kpi-config-modal .kpi-instance-actions .btn-outline-secondary:hover {
    border-color: #495057 !important;
    color: #212529 !important;
    background-color: #e9ecef !important;
}

.btn-add-filter {
    align-self: flex-start;
    margin-top: 4px;
}

/* Version History expandable */
.kpi-version-history-list {
    background: #f8f9fa;
    border-radius: 5px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.kpi-version-history-list .border-bottom:last-child {
    border-bottom: none !important;
}

.kpi-no-filters {
    color: #888;
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
}

/* Filter Inputs */
.kpi-filter-inputs .form-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.kpi-filter-inputs .form-control {
    border-radius: 5px;
}

.kpi-filter-inputs small {
    font-size: 11px;
}

/* Color Range Rows */
.kpi-color-ranges {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

/* Color Picker Input */
.color-picker-input {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
}

.color-picker-input:hover {
    border-color: #667eea;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.color-picker-input::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

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

.color-range-inputs .form-control-sm {
    width: 60px;
    text-align: center;
}

.color-range-inputs span {
    color: #666;
    font-size: 13px;
}

.btn-remove-color-range {
    padding: 4px 8px;
    color: #dc3545;
    border: none;
    background: transparent;
    cursor: pointer;
}

.btn-remove-color-range:hover {
    background: #fee;
    border-radius: 4px;
}

.btn-add-color-range {
    align-self: flex-start;
}

/* Legacy color indicator (remove these) */
.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.color-indicator.color-red {
    background: #dc3545;
}

.color-indicator.color-yellow {
    background: #ffc107;
}

.color-indicator.color-green {
    background: #28a745;
}

/* Legacy inputs label */
.color-range-inputs label {
    font-weight: 500;
    color: #333;
    min-width: 55px;
    margin: 0;
    font-size: 13px;
}

.legacy-color-range-inputs .form-control-sm {
    width: 55px;
    text-align: center;
}

.legacy-color-range-inputs span {
    color: #666;
    font-size: 13px;
}

/* KPI Value Color Classes */
.kpi-value-red {
    color: #dc3545 !important;
}

.kpi-value-yellow {
    color: #ffc107 !important;
}

.kpi-value-green {
    color: #28a745 !important;
}

.kpi-cell.kpi-cell-red {
    background: rgba(220, 53, 69, 0.1);
}

.kpi-cell.kpi-cell-yellow {
    background: rgba(255, 193, 7, 0.15);
}

.kpi-cell.kpi-cell-green {
    background: rgba(40, 167, 69, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-table-container {
        overflow-x: auto;
    }
    
    .kpi-table thead th,
    .kpi-table tbody td {
        padding: 12px;
    }
    
    .kpi-cell-value {
        font-size: 18px;
    }
    
    .pivot-table-wrapper {
        max-height: 400px;
    }
    
    .pivot-header-name {
        min-width: 200px;
    }
    
    .pivot-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .kpi-toggle-item {
        flex-wrap: wrap;
    }
    
    .kpi-toggle-custom-name {
        width: 100%;
        margin-top: 8px;
    }
    
    .color-range-row {
        flex-wrap: wrap;
    }
}

/* =============================================================================
   Delete Confirmation Modal
   ============================================================================= */

#kpi-delete-confirm-modal .modal-header {
    background: #191C20 !important;
    color: #fff !important;
    border: none !important;
}

#kpi-delete-confirm-modal .modal-header * {
    color: #fff !important;
}

#kpi-delete-confirm-modal .modal-body {
    background: #fff;
    padding: 24px;
}

#kpi-delete-confirm-modal .modal-body p {
    color: #333 !important;
    font-size: 14px;
}

#kpi-delete-confirm-modal .modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    gap: 8px;
}

#kpi-delete-confirm-modal .btn .mdi {
    background: transparent !important;
}

#kpi-color-range-validation-modal .modal-header {
    background: #191C20 !important;
    color: #fff !important;
    border: none !important;
}

#kpi-color-range-validation-modal .modal-header * {
    color: #fff !important;
}

#kpi-color-range-validation-modal .modal-body {
    background: #fff;
    padding: 24px;
}

#kpi-color-range-validation-modal .modal-body p {
    color: #333 !important;
}

#kpi-color-range-validation-modal .modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* =============================================================================
   Drag and Drop
   ============================================================================= */

.kpi-instance-item {
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.kpi-instance-item[draggable="true"] .kpi-instance-drag-handle {
    cursor: grab;
}

.kpi-instance-item[draggable="true"] .kpi-instance-drag-handle:active {
    cursor: grabbing;
}

.kpi-instance-item.dragging {
    opacity: 0.5;
    background: #e3f2fd !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

.kpi-instance-item.drag-over {
    border-top: 2px solid #667eea;
}

/* =============================================================================
   Expandable Project Rows & History
   ============================================================================= */

.project-main-row {
    cursor: default;
}

.btn-expand-history {
    background: transparent;
    border: none;
    padding: 4px;
    margin-right: 8px;
    cursor: pointer;
    color: #666;
    transition: transform 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.btn-expand-history:hover {
    color: #667eea;
    background: #f0f0f0;
}

.btn-expand-history i {
    font-size: 18px;
    transition: transform 0.2s ease;
}

/* History data rows */
.history-data-row {
    background: #f8f9fa;
}

.history-data-row td {
    padding: 8px 16px;
    border-bottom: 1px solid #eee;
}

.history-data-row:hover {
    background: #f0f2f5;
}

.history-loading-row {
    background: #f8f9fa;
}

.history-loading-cell {
    padding: 12px 16px !important;
}

.history-loading,
.history-error,
.history-empty {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 13px;
    padding: 12px 48px;
}

.history-error {
    color: #dc3545;
}

.history-empty {
    color: #888;
    font-style: italic;
}


.history-date-cell {
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    padding-left: 56px !important;
}

.history-date-cell .mdi {
    color: #aaa;
}

/* History KPI Cell - matches main table cell style */
.history-kpi-cell {
    font-size: 13px;
}
