.dashboard-body {
    background: #fff;
}

.dashboard-site-header {
    position: static;
}

.dashboard-page {
    width: min(1520px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.dashboard-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.dashboard-hero h1 {
    max-width: 760px;
    margin-bottom: 10px;
    font-size: 44px;
}

.dashboard-hero p:not(.eyebrow) {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 17px;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
}

.dashboard-controls label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.dashboard-controls select,
.dashboard-controls button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 12px;
}

.dashboard-controls button {
    background: var(--ink);
    color: #fff;
}

.dashboard-auth,
.dashboard-section,
.dashboard-meta {
    margin-top: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.dashboard-auth {
    display: grid;
    gap: 12px;
    max-width: 460px;
    padding: 20px;
}

.dashboard-auth h2,
.dashboard-auth p {
    margin: 0;
}

.dashboard-auth p {
    color: var(--ink-soft);
}

.dashboard-content {
    display: grid;
    gap: 22px;
}

.dashboard-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 720;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.metric-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.metric-card strong {
    display: block;
    margin-bottom: 5px;
    font-size: 30px;
    line-height: 1;
}

.metric-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 820;
    text-transform: uppercase;
}

.dashboard-section {
    padding: 18px;
}

.dashboard-subsection {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.dashboard-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.dashboard-section-heading h2 {
    font-size: 23px;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px;
}

.audience-catalog-section {
    grid-template-columns: minmax(560px, 1fr) minmax(560px, 1fr);
    gap: 34px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.dashboard-section table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.dashboard-section th,
.dashboard-section td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.dashboard-section th {
    color: var(--muted);
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-section tr:last-child td {
    border-bottom: 0;
}

.cell-title {
    display: grid;
    gap: 3px;
}

.cell-title strong {
    line-height: 1.25;
}

.cell-title span,
.muted-cell {
    color: var(--muted);
    font-size: 13px;
}

.numeric-cell {
    font-weight: 850;
}

.visitor-activity-table {
    min-width: 980px;
}

.visitor-ip-cell {
    min-width: 180px;
}

.visitor-ip-cell strong,
.visitor-ip-cell span {
    display: block;
}

.visitor-ip-cell span,
.visitor-location span,
.visitor-event span {
    color: var(--muted);
    font-size: 12px;
}

.visitor-location {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
}

.visitor-location .country-flag {
    width: auto;
    font-size: 1.3em;
}

.visitor-location div {
    display: grid;
    gap: 2px;
}

.visitor-event-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.visitor-event {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.visitor-event strong,
.visitor-event span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
}

.event-type-icon::before,
.event-type-icon::after {
    content: "";
    position: absolute;
    box-sizing: border-box;
}

.event-icon-money {
    background: #e7f5ee;
    color: #18845f;
}

.event-icon-money::before {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.event-icon-money::after {
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: currentColor;
}

.event-icon-audio {
    background: #e8eefc;
    color: #2f63d7;
}

.event-icon-audio::before {
    left: 11px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 10px solid currentColor;
}

.event-icon-search {
    background: #f8eadf;
    color: #d45b33;
}

.event-icon-search::before {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translate(-2px, -2px);
}

.event-icon-search::after {
    width: 8px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(5px, 5px) rotate(45deg);
}

.event-icon-view {
    background: #eee9f8;
    color: #8b5cc8;
}

.event-icon-view::before {
    width: 18px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 999px / 75%;
}

.event-icon-view::after {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.event-icon-save {
    background: #f8f0dd;
    color: #c08a16;
}

.event-icon-save::before {
    width: 16px;
    height: 14px;
    background: currentColor;
    transform: translateY(1px) rotate(-45deg);
    clip-path: polygon(50% 100%, 0 42%, 0 12%, 30% 0, 50% 18%, 70% 0, 100% 12%, 100% 42%);
}

.event-icon-list {
    background: #e3f2f5;
    color: #227b91;
}

.event-icon-list::before {
    width: 15px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.event-icon-list::after {
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.event-icon-account {
    background: #edf0f7;
    color: #5f6f8f;
}

.event-icon-account::before {
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.event-icon-account::after {
    bottom: 6px;
    width: 15px;
    height: 8px;
    border-radius: 999px 999px 0 0;
    background: currentColor;
}

.event-icon-close {
    color: #5f6f8f;
}

.event-icon-close::before,
.event-icon-close::after {
    width: 17px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
}

.event-icon-close::before {
    transform: rotate(45deg);
}

.event-icon-close::after {
    transform: rotate(-45deg);
}

.event-icon-action::before {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.event-icon-action::after {
    width: 6px;
    height: 6px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
}

.visitor-event .event-type-icon {
    border-radius: 0;
    background: transparent;
}

.country-clicks-cell {
    min-width: 150px;
}

.affiliate-country-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.affiliate-country-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 850;
    padding: 4px 9px;
}

.affiliate-country-pill .country-flag {
    width: auto;
    font-size: 1.15em;
}

.affiliate-country-pill small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.rank-list,
.event-list,
.user-grid {
    display: grid;
    gap: 10px;
}

.rank-item {
    display: grid;
    grid-template-columns: minmax(150px, 0.32fr) minmax(260px, 1fr) minmax(42px, auto);
    align-items: center;
    gap: 14px;
}

.rank-row {
    display: contents;
    align-items: center;
    color: var(--ink-soft);
    font-weight: 760;
}

.rank-row strong {
    grid-column: 3;
    justify-self: end;
}

.rank-name {
    grid-column: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.country-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65em;
    font-size: 1.15em;
    line-height: 1;
}

.rank-bar {
    grid-column: 2;
    grid-row: 1;
    height: 15px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-muted);
}

.rank-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
}

.rank-item:nth-child(6n + 1) .rank-bar span {
    background: #18845f;
}

.rank-item:nth-child(6n + 2) .rank-bar span {
    background: #2f63d7;
}

.rank-item:nth-child(6n + 3) .rank-bar span {
    background: #d45b33;
}

.rank-item:nth-child(6n + 4) .rank-bar span {
    background: #8b5cc8;
}

.rank-item:nth-child(6n + 5) .rank-bar span {
    background: #c08a16;
}

.rank-item:nth-child(6n) .rank-bar span {
    background: #227b91;
}

#category-list-dashboard .rank-item:nth-child(6n + 1) .rank-bar span {
    background: #b84f79;
}

#category-list-dashboard .rank-item:nth-child(6n + 2) .rank-bar span {
    background: #5f8a25;
}

#category-list-dashboard .rank-item:nth-child(6n + 3) .rank-bar span {
    background: #b66f1f;
}

#category-list-dashboard .rank-item:nth-child(6n + 4) .rank-bar span {
    background: #4f73a8;
}

#category-list-dashboard .rank-item:nth-child(6n + 5) .rank-bar span {
    background: #8d5b2f;
}

#category-list-dashboard .rank-item:nth-child(6n) .rank-bar span {
    background: #5f6f8f;
}

.trend-bars {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(18px, 1fr);
    align-items: end;
    gap: 6px;
    min-height: 220px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.trend-bar {
    display: grid;
    align-items: end;
    gap: 6px;
    min-width: 0;
    height: 100%;
}

.trend-bar span {
    display: block;
    min-height: 4px;
    border-radius: 8px 8px 0 0;
    background: var(--accent);
}

.trend-bar small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-card,
.event-card {
    display: grid;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.user-card-header,
.event-card-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.user-card h3,
.event-card h3 {
    margin: 0;
    font-size: 16px;
}

.user-card p,
.event-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 820;
    padding: 4px 8px;
}

.playlist-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.playlist-mini span {
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 760;
    padding: 5px 7px;
}

.dashboard-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.dashboard-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1220px) {
    .audience-catalog-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .metric-grid,
    .two-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .dashboard-page {
        width: min(100% - 28px, 1280px);
        padding-top: 24px;
    }

    .dashboard-hero,
    .dashboard-controls,
    .dashboard-meta,
    .user-card-header,
    .event-card-header {
        display: grid;
        align-items: start;
    }

    .dashboard-hero h1 {
        font-size: 34px;
    }

    .audience-catalog-section {
        grid-template-columns: 1fr;
    }

    .rank-item {
        grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr) minmax(34px, auto);
        gap: 10px;
    }

    .country-flag {
        width: 1.5em;
        font-size: 1em;
    }

    .dashboard-site-header .site-nav {
        position: static;
        display: flex;
        width: auto;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .dashboard-site-header .site-nav a,
    .dashboard-site-header .nav-library-button {
        width: auto;
    }

    .metric-grid,
    .two-column {
        grid-template-columns: 1fr;
    }

    .metric-card strong {
        font-size: 26px;
    }
}
