:root {
    --brand-purple: #4b2e83;
    --brand-accent: #ede9fe;
    --brand-gradient: linear-gradient(135deg, rgba(75, 46, 131, 0.92), rgba(99, 102, 241, 0.85));
    --surface: #ffffff;
    --surface-muted: #f5f5fb;
}

body {
    background: linear-gradient(180deg, #f5f5fb 0%, #eef2ff 100%);
    min-height: 100vh;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #111827;
}

.navbar {
    background: var(--brand-purple) !important;
    box-shadow: 0 0.5rem 1rem rgba(16, 24, 40, 0.08);
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    backdrop-filter: blur(6px);
}

.app-navbar-brand {
    display: inline-flex;
    align-items: center;
    font-size: clamp(1rem, 4vw, 1.25rem);
    line-height: 1.2;
}

.app-navbar-collapse {
    align-items: center;
}

.app-navbar-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.app-navbar-links .nav-link {
    color: #f8fafc;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-navbar-links .nav-link:hover,
.app-navbar-links .nav-link.active {
    background: rgba(249, 250, 251, 0.2);
    color: #ffffff;
}

.navbar-toggler {
    padding: 0.35rem 0.6rem;
}

@media (max-width: 991.98px) {
    .app-navbar-collapse {
        background: rgba(15, 23, 42, 0.35);
        border-radius: 1rem;
        padding: 0.75rem 1rem;
        margin-top: 0.75rem;
        backdrop-filter: blur(8px);
    }

    .app-navbar-links {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .app-navbar-links .nav-link {
        width: 100%;
    }
}

.section-title {
    font-weight: 600;
    color: var(--brand-purple);
}

.card {
    border: none;
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: 0 1rem 2.5rem rgba(79, 70, 229, 0.08);
}

.card-body {
    padding: 2rem;
}

.table > :not(caption) > * > * {
    padding: 0.8rem 1rem;
    vertical-align: middle;
}

.table thead th {
    background: var(--brand-accent);
    color: #312e81;
    font-weight: 600;
    border-bottom: none;
}

.stackable-table {
    border-collapse: separate;
    border-spacing: 0;
}

.stackable-mobile-primary-value {
    display: inline;
}

.stackable-mobile-rank-prefix {
    display: none;
}

@media (max-width: 767.98px) {
    .stackable-table thead {
        display: none;
    }

    .stackable-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-radius: 1rem;
        border: 1px solid rgba(79, 70, 229, 0.08);
        box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.06);
        overflow: hidden;
        position: relative;
    }

    .stackable-table tbody td,
    .stackable-table tbody th {
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: left !important;
        gap: 0.35rem;
        width: 100%;
    }

    .stackable-table tbody td[data-label],
    .stackable-table tbody th[data-label] {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }

    .stackable-table tbody td[data-label]:last-child,
    .stackable-table tbody th[data-label]:last-child {
        border-bottom: none;
    }

    .stackable-table tbody td[data-label]::before,
    .stackable-table tbody th[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--brand-purple);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.08em;
    }

    .stackable-table tbody td:not([data-label]),
    .stackable-table tbody th:not([data-label]) {
        padding: 1rem;
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"] {
        cursor: pointer;
        padding-right: 2.5rem;
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"]::after {
        content: "";
        position: absolute;
        right: 1rem;
        top: 1rem;
        width: 0.65rem;
        height: 0.65rem;
        border-right: 2px solid var(--brand-purple);
        border-bottom: 2px solid var(--brand-purple);
        transform: rotate(45deg);
        transition: transform 0.25s ease;
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"][data-expanded="true"] {
        box-shadow: 0 1rem 2.25rem rgba(15, 23, 42, 0.12);
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"][data-expanded="true"]::after {
        transform: rotate(-135deg);
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"] .stackable-mobile-detail-cell {
        display: none;
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"][data-expanded="true"] .stackable-mobile-detail-cell {
        display: flex;
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"] .stackable-mobile-summary-cell {
        background: rgba(79, 70, 229, 0.03);
        font-weight: 600;
    }

    .stackable-table .stackable-mobile-rank-cell {
        display: none;
    }

    .stackable-table .stackable-mobile-primary-cell .stackable-mobile-primary-value {
        display: flex;
        gap: 0.35rem;
        align-items: baseline;
        flex-wrap: wrap;
    }

    .stackable-table .stackable-mobile-primary-cell .stackable-mobile-rank-prefix {
        display: inline;
        color: var(--brand-purple);
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"][data-expanded="true"] .stackable-mobile-summary-cell:last-of-type {
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }

    .stackable-table tbody tr[data-stackable-collapsible="true"][data-expanded="true"] .stackable-mobile-detail-cell:first-of-type {
        margin-top: 0.25rem;
    }
}

.badge {
    width: 3.5rem;
    height: 1.5rem;
    border-radius: 0.75rem;
    display: inline-block;
    box-shadow: 0 0.25rem 0.75rem rgba(17, 24, 39, 0.15);
}

.hero-card {
    background: var(--brand-gradient);
    border-radius: 1.75rem;
    padding: 3rem;
    color: #f9fafb;
    box-shadow: 0 1.25rem 3rem rgba(79, 70, 229, 0.25);
}

.hero-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    opacity: 0.85;
    max-width: 32rem;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.75rem;
}

.hero-pill {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 8rem;
    backdrop-filter: blur(6px);
}

.hero-pill .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.hero-pill .value {
    font-size: 1.4rem;
    font-weight: 600;
}

.hero-highlight {
    background: var(--surface-muted);
    border-radius: 1.25rem;
    padding: 1.5rem;
    color: #111827;
}

.hero-highlight-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.hero-highlight-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--brand-purple);
}

.hero-highlight-pill .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    opacity: 0.8;
    letter-spacing: 0.08em;
}

.hero-highlight-pill .value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    color: var(--brand-purple);
}

.hero-commissioner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: #f9fafb;
}

.hero-commissioner-frame {
    width: min(100%, 340px);
    aspect-ratio: 4 / 5;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.35);
    border: 2px solid rgba(249, 250, 251, 0.35);
}

.hero-commissioner-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chart-card {
    background: var(--surface);
    border-radius: 1.25rem;
    padding: 1rem;
    box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.08);
}

.chart-card + .chart-card {
    margin-top: 1rem;
}

.mobile-chart-ratio {
    --bs-aspect-ratio: 45%;
}

@media (max-width: 575.98px) {
    .chart-card {
        padding: 0.75rem;
    }

    .mobile-chart-ratio {
        --bs-aspect-ratio: 90%;
    }
}

.hero-commissioner-caption {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.highlight-card {
    background: var(--surface);
    border-radius: 1.25rem;
    padding: 1.5rem;
    border: 1px solid rgba(79, 70, 229, 0.08);
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.highlight-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.highlight-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--highlight-accent, var(--brand-purple));
    font-weight: 600;
}

.highlight-score {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--highlight-accent, var(--brand-purple));
}

.highlight-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.highlight-badge {
    width: 60px;
    height: 60px;
    border-radius: 1.1rem;
    overflow: hidden;
    background: var(--placeholder-bg, var(--surface-muted));
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0.75rem 1.5rem rgba(15, 23, 42, 0.2);
}

.highlight-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.highlight-badge span {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.highlight-team {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.highlight-card-footer {
    margin-top: auto;
}

.dashboard-card {
    border-radius: 1.5rem;
    overflow: hidden;
}

.dashboard-card .card-header {
    background: transparent;
}

.nav-tabs .nav-link {
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    color: #4c1d95;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    background: rgba(79, 70, 229, 0.12);
    color: #312e81;
}

.team-overview-card {
    background: var(--surface);
}

.standings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.standings-card {
    border-radius: 1.25rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid rgba(79, 70, 229, 0.08);
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
}

.standings-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--team-primary, #4b2e83), var(--team-secondary, #a5b4fc));
    opacity: 0.06;
    pointer-events: none;
}

.standings-card-header,
.standings-card-body {
    position: relative;
    z-index: 1;
}

.standings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.standings-rank {
    font-weight: 600;
    color: var(--brand-purple);
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.standings-points {
    text-align: right;
}

.standings-points-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.standings-points-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #6b7280;
}

.standings-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.standings-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.standings-badge {
    width: 96px;
    height: 96px;
    border-radius: 1.5rem;
    flex-shrink: 0;
    background: var(--placeholder-bg, #e0e7ff);
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0.75rem 1.5rem rgba(15, 23, 42, 0.15);
    overflow: hidden;
}

.standings-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.standings-badge span {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.standings-team-meta {
    flex: 1;
}

.standings-team-name {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.standings-team-manager {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.standings-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-purple);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.35rem;
    text-decoration: none;
}

.standings-inline-link svg {
    width: 1rem;
    height: 1rem;
}

.standings-inline-link:hover {
    text-decoration: underline;
}

.team-swatch {
    width: 4rem;
    height: 4rem;
    border-radius: 1.2rem;
    background: linear-gradient(135deg, var(--primary, #4b2e83), var(--secondary, #a5b4fc));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 0 0.75rem 1.75rem rgba(79, 70, 229, 0.3);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stat-pill {
    background: var(--surface-muted);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-pill .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
}

.stat-pill .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
}

.team-chart-wrapper {
    min-width: min(100%, 420px);
    height: 320px;
}

.spotlight-select label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
}

.spotlight-select select {
    min-width: 260px;
    box-shadow: 0 0.75rem 1.5rem rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.tab-pane section:last-of-type {
    margin-bottom: 0;
}

footer {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
}

@media (max-width: 767.98px) {
    .hero-card {
        padding: 2rem;
    }

    .team-chart-wrapper {
        height: 260px;
    }
}

.points-chart-container {
    height: 360px;
}

.points-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.weekly-rank-chart-container {
    height: 420px;
}

.weekly-rank-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.insight-chart-container {
    height: 320px;
}

.insight-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.long-chart-container {
    height: 380px;
}

.long-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.distribution-chart-container {
    height: 520px;
}

.distribution-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 767.98px) {
    .points-chart-container {
        height: 260px;
    }

    .weekly-rank-chart-container {
        height: 300px;
    }

    .insight-chart-container {
        height: 260px;
    }

    .long-chart-container {
        height: 320px;
    }

    .distribution-chart-container {
        height: 420px;
    }
}
