/* ===== GLOBAL RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    color: #1a1a1a;
    line-height: 1.5;
}

/* ===== HEADER & NAVIGATION ===== */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 16px;
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== HELP BUTTON ===== */
.help-btn {
    background: #f5f5f5;
    color: #666666;
    border: 1px solid #e5e5e5;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: #e5e5e5;
    color: #1a1a1a;
}

.help-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.3;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

.help-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

.tooltip-content a {
    color: #60b2ff;
    text-decoration: none;
}

.tooltip-content a:hover {
    text-decoration: underline;
}

/* ===== DROPDOWN ===== */
.dropdown {
    position: relative;
}

.dropdown-btn {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e5e5e5;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.dropdown-btn:hover {
    background: #f5f5f5;
}

.dropdown-icon {
    transition: transform 0.2s ease;
}

.dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    min-width: 180px;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

/* ===== MAIN LAYOUT ===== */
.main-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    min-height: calc(100vh - 56px);
}

.panel-container {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
}

.panel-header {
    background: #ffffff;
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #e5e5e5;
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.panel-content {
    height: calc(100% - 80px);
    overflow-y: auto;
}

.content-slide {
    padding: 16px;
    min-height: 100%;
    display: none;
    animation: slideIn 0.3s ease;
}

.content-slide.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== SWIPE INDICATORS ===== */
.swipe-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin-top: 8px;
}

.swipe-dot {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    background: #e5e5e5;
    transition: all 0.2s ease;
}

.swipe-dot.active {
    background: #1a1a1a;
    transform: scaleX(1.2);
}

/* Navigation arrows for desktop */
.nav-arrow {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #666666;
}

.nav-arrow:hover:not(:disabled) {
    background: #f5f5f5;
    color: #1a1a1a;
    border-color: #1a1a1a;
}

.nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

@media (min-width: 769px) {
    .nav-arrow {
        display: flex;
    }
}

/* ===== TOUCH INTERACTION ===== */
.touch-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    touch-action: pan-y;
}

/* ===== CONTENT CARDS ===== */
.content-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.content-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.card-text {
    color: #666666;
    font-size: 14px;
    line-height: 1.5;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.error-message {
    text-align: center;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    max-width: 100%;
}

.error-message h3 {
    color: #e53e3e;
    margin-bottom: 12px;
    font-size: 18px;
}

.error-message p {
    color: #666666;
    margin-bottom: 16px;
    font-size: 14px;
}

.retry-btn {
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #333333;
}

/* ===== ABOUT CONTENT ===== */
.about-container {
    padding: 0;
}

.about-content {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.6;
}

.about-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.about-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin-top: 24px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;
}

.about-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin-top: 16px;
    margin-bottom: 8px;
}

.about-content p {
    margin-bottom: 12px;
    color: #666666;
}

.about-content strong {
    color: #1a1a1a;
    font-weight: 600;
}

.about-content em {
    color: #333333;
    font-style: italic;
}

.about-content code {
    background: #f5f5f5;
    color: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 13px;
}

.about-content hr {
    border: none;
    height: 1px;
    background: #e5e5e5;
    margin: 24px 0;
}

.about-content li {
    margin-bottom: 8px;
    color: #666666;
    position: relative;
    list-style: none;
    padding-left: 16px;
}

.about-content li:before {
    content: '•';
    color: #1a1a1a;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.about-content a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.about-content a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.about-content a:visited {
    color: #6610f2;
}

/* ===== SEARCH ===== */
.search-container {
    margin-bottom: 16px;
    position: relative;
    z-index: 10;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s ease;
    outline: none;
}

.search-input:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.search-input::placeholder {
    color: #999999;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    background: #ffffff;
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: none;
}

.data-table th {
    background: #f5f5f5;
    color: #1a1a1a;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    overflow-wrap: break-word;
    word-break: break-word;
}

.data-table th:hover {
    background: #e5e5e5;
    border-bottom-color: #1a1a1a;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: top;
    font-size: 14px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.data-table tr:hover {
    background: #fafafa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Frozen headers and first column for tables with >4 columns */
.data-table.freeze-columns th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f5f5f5;
}

.data-table.freeze-columns th:first-child {
    left: 0;
    z-index: 30;
}

.data-table.freeze-columns td:first-child {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.data-table.freeze-columns tr:hover td:first-child {
    background: #fafafa;
}

/* ===== TABLE SORTING ===== */
.sort-indicator {
    font-size: 14px;
    color: #666;
    margin-left: 6px;
    transition: color 0.2s ease;
    font-weight: bold;
    display: inline-block;
    min-width: 12px;
}

.data-table th:hover .sort-indicator {
    color: #1a1a1a;
}

.sort-indicator.active {
    color: #1a1a1a !important;
}

/* ===== MOBILE TABLE  ===== */
.mobile-scrollable-container {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-wide-table {
    min-width: 800px;
    table-layout: auto;
    width: auto;
}

.mobile-wide-table th,
.mobile-wide-table td {
    min-width: 120px;
    white-space: nowrap;
    padding: 12px 16px;
}

.mobile-wide-table td {
    white-space: normal;
    word-wrap: break-word;
    max-width: 200px;
}

.mobile-wide-table th {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.narrow-table {
    table-layout: fixed;
}

.narrow-table[data-columns="2"] th,
.narrow-table[data-columns="2"] td { width: 50%; }

.narrow-table[data-columns="3"] th,
.narrow-table[data-columns="3"] td { width: 33.333%; }

/* ===== SCROLL INDICATORS ===== */
.scroll-indicators {
    position: relative;
    margin-bottom: 8px;
}

.scroll-indicator {
    position: relative;
    background: #f0f0f0;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scroll-indicator.horizontal {
    height: 6px;
    width: 100%;
    margin-bottom: 4px;
}

.scroll-indicator.scrolling {
    opacity: 1;
}

.scroll-thumb {
    position: absolute;
    background: #666;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.horizontal-thumb {
    height: 100%;
    min-width: 20px;
    top: 0;
}

/* ===== UNIFIED SCROLLBAR STYLING ===== */
.table-container::-webkit-scrollbar,
.mobile-scrollable-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track,
.mobile-scrollable-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb,
.mobile-scrollable-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.mobile-scrollable-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== CARDS LAYOUT ===== */
.cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 0;
}

.card-field {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.card-field:last-child {
    margin-bottom: 0;
}

.card-field strong {
    color: #1a1a1a;
    font-weight: 600;
}

/* ===== CHARTS ===== */
.chart-container {
    padding: 16px;
}

.chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
    text-align: center;
}

.chart-wrapper {
    display: flex;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    max-height: 600px;
    position: relative;
}

.chart-y-axis {
    flex: 0 0 140px;
    background: #f8f9fa;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    position: sticky;
    left: 0;
    z-index: 5;
}

.y-axis-label {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    color: #666;
    word-break: break-word;
    line-height: 1.2;
}

.chart-plot-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.chart-bar-row {
    height: 40px;
    display: flex;
    align-items: center;
    position: relative;
    background: #fafafa;
}

.chart-bar-row:nth-child(even) {
    background: #f5f5f5;
}

.chart-bar {
    height: 28px;
    margin: 6px 0;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 30px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.chart-bar-value {
    font-size: 11px;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
}

/* ===== PIE CHARTS ===== */
.pie-chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pie-chart {
    max-width: 100%;
    height: auto;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ===== LINKS ===== */
.cell-link {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
}

.cell-link:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.cell-link:visited {
    color: #6610f2;
}

.cell-link::after {
    content: "↗";
    font-size: 0.8em;
    margin-left: 0.25em;
    opacity: 0.6;