.dashboard-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding: 13px 24px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
}

.topbar-brand,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
}

.topbar-brand strong,
.topbar-brand span {
    display: block;
}

.topbar-brand span,
.user-pill {
    color: var(--muted);
    font-size: 13px;
}

.user-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px;
    background: #fff;
}

.dashboard-main {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 22px 24px 36px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-card span:not(.stat-icon) {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    font-size: clamp(18px, 2vw, 26px);
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-icon {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
}

.stat-blue {
    color: #1d4ed8;
    background: #dbeafe;
}

.stat-green {
    color: #047857;
    background: #d1fae5;
}

.stat-amber {
    color: #b45309;
    background: #fef3c7;
}

.stat-indigo {
    color: #4338ca;
    background: #e0e7ff;
}

.stat-slate {
    color: #334155;
    background: #e2e8f0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.7fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dropzone {
    display: grid;
    place-items: center;
    margin: 20px;
    border: 1px dashed #b8c6d9;
    border-radius: 14px;
    padding: 26px 18px;
    color: var(--muted);
    background: var(--surface-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
    border-color: var(--primary);
    background: #eff6ff;
    transform: translateY(-1px);
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dropzone-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 14px;
    color: var(--primary);
    background: #dbeafe;
    font-weight: 900;
}

.dropzone strong {
    margin-bottom: 4px;
    color: var(--text);
}

.dropzone .btn {
    margin-top: 16px;
}

.file-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 20px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
}

.file-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    height: 8px;
    margin: 0 20px 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 180ms ease;
}

.upload-panel > .btn-full {
    width: calc(100% - 40px);
    margin: 0 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 20px;
}

.filter-grid label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.button-row {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.button-row .btn {
    flex: 1;
}

.table-panel {
    min-width: 0;
}

.range-text {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.table-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-tools label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.table-tools select {
    width: 92px;
}

.table-wrap {
    max-height: 66vh;
    overflow: auto;
}

table {
    width: 100%;
    min-width: 1420px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

thead button {
    color: inherit;
    background: transparent;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
}

thead button::after {
    content: "  ";
}

thead button.is-active.asc::after {
    content: " ↑";
}

thead button.is-active.desc::after {
    content: " ↓";
}

tbody tr:nth-child(even) {
    background: #fbfdff;
}

tbody tr:hover {
    background: #eff6ff;
}

.empty-row td {
    padding: 42px 16px;
    color: var(--muted);
    text-align: center;
}

.skeleton-row td span {
    display: block;
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e2e8f0, #f8fafc, #e2e8f0);
    background-size: 220% 100%;
    animation: shimmer 1.1s infinite linear;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.page-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.legacy-page-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.page-number,
.page-ellipsis {
    display: inline-flex;
    min-width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #334155;
    background: transparent;
    font-weight: 800;
}

.page-number {
    cursor: pointer;
}

.page-number.is-active {
    color: #fff;
    background: var(--primary);
}

@keyframes shimmer {
    to {
        background-position: -220% 0;
    }
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-pill {
        overflow: hidden;
        max-width: calc(100vw - 140px);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dashboard-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pagination-bar {
        flex-wrap: wrap;
    }

    .pagination-bar > .btn {
        flex: 1 1 120px;
    }

    .page-list {
        order: -1;
        flex-basis: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }
}
