* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #1e293b;
    min-height: 100vh;
}

.container {
    display: flow-root;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: bold;
    font-size: 18px;
    color: #2563eb;
}

.search-container {
    padding: 16px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

.nav {
    padding: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #0f172a;
}

.header-subtitle {
    font-size: 14px;
    color: #64748b;
}

.network-btn {
    padding: 10px 18px;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.network-btn:hover {
    background: #1d4ed8;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.metric-card:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.metric-title {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 500;
}

.metric-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #0f172a;
}

.metric-change {
    font-size: 14px;
    font-weight: 500;
}

.metric-change.positive {
    color: #2563eb;
}

.metric-change.negative {
    color: #64748b;
}

.chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.chart-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
}

.chart-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 14px;
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.chart-container {
    height: 320px;
    position: relative;
}

.table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    text-align: left;
    padding: 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

tr:hover {
    background: #f8fafc;
}

.vault-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vault-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    flex-shrink: 0;
}

.vault-info {
    display: flex;
    flex-direction: column;
}

.vault-title {
    font-weight: 600;
    color: #0f172a;
}

.vault-price {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.badge-fixed {
    background: #dbeafe;
    color: #1e40af;
}

.badge-flexible {
    background: #e0e7ff;
    color: #4338ca;
}

.liquidity-bars {
    display: flex;
    gap: 4px;
}

.liquidity-bar {
    width: 14px;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
}

.liquidity-bar.active {
    background: #2563eb;
}

.positive-value {
    color: #2563eb;
    font-weight: 500;
}

.menu-icon {
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
}

.menu-icon:hover {
    color: #2563eb;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .main {
        padding: 16px;
    }

    .header-title {
        font-size: 24px;
    }

    .metric-value {
        font-size: 28px;
    }

    .chart-card {
        padding: 20px;
    }

    .chart-container {
        height: 280px;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .network-btn {
        width: 100%;
    }

    .chart-filters {
        width: 100%;
    }

    .filter-btn {
        flex: 1;
        min-width: 60px;
    }

    .metric-value {
        font-size: 24px;
    }

    th,
    td {
        padding: 12px 8px;
        font-size: 13px;
    }
}

/* Extra small devices - phones */
@media (max-width: 480px) {
    .header-title {
        font-size: 20px;
    }
    .header-subtitle {
        font-size: 13px;
    }
    .metric-card {
        padding: 16px;
    }
    .metric-value {
        font-size: 20px;
    }
    .chart-container {
        height: 220px;
    }
    table {
        min-width: 600px; /* keep some minimum, allow horizontal scroll */
    }
    th, td {
        padding: 10px 6px;
    }
    /* Make header controls full width */
    .header > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
        flex-direction: column;
    }
    .network-btn, .network-btn + select, #selectDataSource {
        width: 100%;
    }
}

/* On very small screens hide all table columns except the suggestions column */
@media (max-width: 480px) {
    /* Hide columns marked as .col-hide */
    table thead th.col-hide,
    table tbody td.col-hide {
        display: none;
    }

    /* Ensure suggestion column is visible */
    table thead th.col-sugerencias,
    table tbody td.col-sugerencias {
        display: table-cell;
    }

    /* Make table adapt: allow horizontal scroll when wide, but keep reasonable minimum */
    table {
        width: 100%;
        min-width: 600px; /* keep a min width so horizontal scroll appears when needed */
        table-layout: fixed;
    }

    .table-wrapper {
        overflow-x: auto; /* allow horizontal scrolling on small screens */
        -webkit-overflow-scrolling: touch;
    }
}

/* Improve table readability on small screens: allow horizontal scroll and sticky header */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Ensure charts and canvases scale smoothly */
canvas {
    max-width: 100% !important;
    height: auto !important;
}
