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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            /* padding: 20px; */
            padding: 0;
            background: #f5f5f5;
        }

        .container {
            max-width: 100%;
            margin: 0 auto;
            background: white;
            /* border-radius: 4px; */
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }

        .header {
            padding: 15px 20px;
            background: #2c3e50;
            color: white;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 15px;
        }
        

        h1 {
            text-align: center;
            margin-bottom: 15px;
        }
        .header > div {
            box-shadow: 2px .5ex 1ex rgba(0,0,0,0.3);
        }
        .controls {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0; padding: 1ex 1em; outline: 1px solid rgba(255,255,255,0.3); background-color: rgba(0,0,0,0.3); border-radius: 4px;
        }
        .view-info {outline: 1px solid rgba(255,255,255,0.3); max-width: 25em; padding: 1em; border-radius: 4px;}

        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 34px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #16a085;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 26px;
            width: 26px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #e67e22;
        }

        input:checked + .slider:before {
            transform: translateX(26px);
        }

        .view-label {
            font-size: 16px;
            font-weight: 600;
        }

        .view-info {
            font-size: 13px;
            opacity: 0.85;
            flex: 1;
            text-align: center;
            min-width: 200px;
        }

        .weights-button {
            background: #9b59b6;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: background 0.3s;
            margin-top: 10px;
        }

        .weights-button:hover {
            background: #8e44ad;
        }

        .weights-drawer {
            background: #34495e;
            color: white;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease-out;
        }

        .weights-drawer.open {
            max-height: 600px;
            overflow-y: auto;
        }

        .drawer-content {
            padding: 15px;
        }

        .drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .preset-selector {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .preset-selector label {
            font-weight: 600;
            font-size: 13px;
        }

        .preset-selector select {
            padding: 6px 10px;
            border-radius: 5px;
            border: none;
            font-size: 13px;
            cursor: pointer;
        }

        .reset-button {
            background: #e74c3c;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 13px;
            transition: background 0.3s;
        }

        .reset-button:hover {
            background: #c0392b;
        }

        .weight-controls {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 2px;
        }

        .weight-item {
            background: rgba(255,255,255,0.1);
            padding: 5px 8px;
            border-radius: 2px;
            line-height: 1;
            display: grid;
            grid-template-columns: 1fr auto 100px;
            gap: 8px;
            align-items: center;
        }

        .weight-label {
            font-size: 13px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: help;
            position: relative;
        }

        .weight-label[title]:hover {
            text-decoration: underline;
        }

        .weight-value {
            font-weight: 700;
            color: #3498db;
            font-size: 13px;
            text-align: right;
            min-width: 35px;
        }

        .weight-slider {
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: rgba(255,255,255,0.3);
            outline: none;
            -webkit-appearance: none;
        }

        .weight-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #3498db;
            cursor: pointer;
        }

        .weight-slider::-moz-range-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #3498db;
            cursor: pointer;
            border: none;
        }

        .table-wrapper {
            overflow-x: auto;
            /* padding: 20px; */
            padding: 0;
        }

        table {
            width: auto;
            border-collapse: collapse;
            font-size: 14px;
        }

        th, td {
            padding: 4px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
        }

        th {
            background: #34495e;
            color: white;
            font-weight: 600;
            position: sticky;
            top: 0;
            z-index: 10;
            white-space: nowrap;
            cursor: pointer;
            user-select: none;
            max-width: 80px;
            overflow: hidden;
            text-overflow: ellipsis;
            padding: 8px 4px;
        }

        th:hover {
            background: #4a6278;
        }

        th.sortable::after {
            content: ' ⇅';
            opacity: 0.5;
            font-size: 10px;
        }

        th.sort-asc::after {
            content: ' ↑';
            opacity: 1;
        }

        th.sort-desc::after {
            content: ' ↓';
            opacity: 1;
        }

        .city-column {
            font-weight: 600;
            color: #2c3e50;
            width: auto;
            white-space: nowrap;
            position: sticky;
            left: 0;
            background: white;
            z-index: 5;
            padding: 4px 8px !important;
        }
        .city-column strong {
/* letter-spacing: -1px;  */
            font-stretch: condensed;
        }

        th.city-column {
            z-index: 15;
            background: #34495e;
        }

        .score-cell {
            text-align: center;
            font-weight: 500;
            width: 80px;
            max-width: 80px;
            padding: 0 !important;
        }

        .score-bar {
            height: 100%;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 12px;
            font-weight: 600;
            padding: 12px 4px;
            transition: all 0.2s;
        }

        .score-bar:hover {
            filter: brightness(1.1);
        }

        .score-0-10 { background: linear-gradient(135deg, #b71c1c, #c62828); }
        .score-10-20 { background: linear-gradient(135deg, #d32f2f, #e53935); }
        .score-20-30 { background: linear-gradient(135deg, #e64a19, #f4511e); }
        .score-30-40 { background: linear-gradient(135deg, #f57c00, #fb8c00); }
        .score-40-50 { background: linear-gradient(135deg, #ffa726, #ffb74d); }
        .score-50-60 { background: linear-gradient(135deg, #ffd54f, #ffe082); }
        .score-60-70 { background: linear-gradient(135deg, #9ccc65, #aed581); }
        .score-70-80 { background: linear-gradient(135deg, #66bb6a, #81c784); }
        .score-80-90 { background: linear-gradient(135deg, #42a5f5, #64b5f6); }
        .score-90-100 { background: linear-gradient(135deg, #1e88e5, #2196f3); }

        .no-data {
            background: #ecf0f1;
            color: #7f8c8d;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #7f8c8d;
        }

        .error {
            text-align: center;
            padding: 40px;
            color: #e74c3c;
        }

        tr:hover {
            background: #f8f9fa;
        }

        .population {
            font-size: 12px;
            color: #7f8c8d;
            display: block;
        }

        .average-column {
            font-weight: 700;
            width: 80px;
            max-width: 80px;
            padding: 0 !important;
            background: transparent !important;
        }

        th.average-column {
            background: #16a085;
        }

        .weighted-column {
            font-weight: 700;
            width: 80px;
            max-width: 80px;
            padding: 0 !important;
            background: transparent !important;
        }

        th.weighted-column {
            background: #9b59b6;
        }

        /* Ensure row hover doesn't override cell backgrounds */
        tr:hover .average-column,
        tr:hover .weighted-column {
            background: transparent !important;
        }
        .score-cell {outline: 1px solid rgba(255,255,255,.25);}
        /* Tooltip styling */
        .score-cell[title] {
            cursor: help;
            position: relative;
        }

        th[title] {
            cursor: help;
            position: relative;
        }

        /* Custom tooltip for table headers */
        th[title]::after {
            content: attr(title);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: #2c3e50;
            color: white;
            padding: 8px 12px;
            border-radius: 4px;
            font-size: 12px;
            white-space: pre-line;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            z-index: 1000;
            min-width: 180px;
            text-align: left;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
            font-weight: normal;
        }

        th[title]:hover::after {
            opacity: 1;
        }

        th[title]::before {
            content: '';
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%) translateY(6px);
            border: 6px solid transparent;
            border-top-color: #2c3e50;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            z-index: 1000;
        }

        th[title]:hover::before {
            opacity: 1;
        }

        /* Custom tooltip for weight labels */
        .weight-label[title]::after {
            content: attr(title);
            position: absolute;
            bottom: 100%;
            left: 0;
            background: #2c3e50;
            color: white;
            padding: 6px 10px;
            border-radius: 4px;
            font-size: 12px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            z-index: 1000;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }

        .weight-label[title]:hover::after {
            opacity: 1;
        }

        /* Custom tooltip */
        .score-cell[title]::after {
            content: attr(title);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: #2c3e50;
            color: white;
            padding: 8px 12px;
            border-radius: 4px;
            font-size: 12px;
            white-space: pre-line;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            z-index: 1000;
            min-width: 180px;
            text-align: left;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }

        .score-cell[title]:hover::after {
            opacity: 1;
        }

        /* Tooltip arrow */
        .score-cell[title]::before {
            content: '';
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%) translateY(6px);
            border: 6px solid transparent;
            border-top-color: #2c3e50;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
            z-index: 1000;
        }

        .score-cell[title]:hover::before {
            opacity: 1;
        }
        
        th.weighted-column,th.average-column,
        th.score-cell {background: #9b59b6 !important;}
        th.score-cell.sort-desc {background: #9b59a6 !important;}
        th.score-cell.sort-asc {background: #2b99b6 !important;}
        th.city-column {background-color: whitesmoke;}

        /* Highlight active sorted column */
        th.sortable.sort-asc,
        th.sortable.sort-desc {
            box-shadow: inset 0 -4px 0 0 #f39c12;
            font-weight: 700;
        }

        /* Highlight cells in actively sorted column */
        .active-sort-column {
            box-shadow: inset 0 0 0 2px rgba(243, 156, 18, 0.3);
        }

