.dashboard-page {
    display: grid;
    gap: 20px;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.dashboard-refresh {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--accent);
    background: var(--surface);
    white-space: nowrap;
}

.dashboard-refresh svg {
    width: 16px;
    height: 16px;
}

.dashboard-refresh:hover {
    background: var(--accent-soft);
}

.dashboard-refresh span {
    min-width: 4em;
    text-align: center;
}

.dashboard-refresh:disabled {
    cursor: wait;
    opacity: .65;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-metric {
    --metric-color: #247c83;
    --metric-bg: #e8f5f4;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(125deg, #fff 55%, var(--metric-bg));
    box-shadow: 0 4px 18px rgba(24, 43, 52, .035);
    min-width: 0;
}

.dashboard-metric-devices {
    --metric-color: #4876aa;
    --metric-bg: #edf3fc;
}

.dashboard-metric-active {
    --metric-color: #42856b;
    --metric-bg: #edf7ef;
}

.dashboard-metric-events {
    --metric-color: #ac7b32;
    --metric-bg: #fcf5e9;
}

.dashboard-metric-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

.dashboard-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: var(--metric-color);
    background: var(--metric-bg);
    flex: none;
}

.dashboard-icon svg {
    width: 21px;
    height: 21px;
}

.dashboard-number {
    margin: 10px 0 14px;
    font-family: var(--font-display);
    font-size: clamp(26px, 2.6vw, 38px);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.03em;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.dashboard-metric-detail {
    font-size: 12px;
    color: var(--muted);
}

.dashboard-metric-detail strong {
    font-weight: 600;
    color: var(--metric-color);
}

.dashboard-change {
    color: var(--accent);
    font-weight: 600;
}

.dashboard-panels {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(290px, 1fr);
    gap: 20px;
    align-items: start;
}

.dashboard-panel {
    min-width: 0;
    background: var(--surface);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 4px 18px rgba(24, 43, 52, .035);
}

.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.dashboard-panel h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dashboard-panel-head p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.dashboard-switch {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.dashboard-switch button {
    padding: 6px 11px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.dashboard-switch button[aria-pressed="true"] {
    color: var(--accent);
    background: #fff;
    box-shadow: 0 1px 5px rgba(24, 43, 52, .1);
    font-weight: 600;
}

.dashboard-chart-summary {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--muted);
}

.dashboard-legend {
    width: 8px;
    height: 8px;
    background: var(--accent-2);
    border-radius: 50%;
}

.dashboard-chart-total {
    margin-left: auto;
    font-size: 13px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.dashboard-chart-plot {
    position: relative;
    margin-top: 10px;
}

.dashboard-chart-plot > svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.dashboard-gridline {
    stroke: var(--line);
    stroke-dasharray: 4 5;
    stroke-width: 1;
}

.dashboard-axis {
    fill: var(--muted);
    font-size: 11px;
    font-family: var(--font-ui);
}

.dashboard-chart-line {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.dashboard-point {
    outline: none;
}

.dashboard-point circle {
    fill: #fff;
    stroke: var(--accent-2);
    stroke-width: 2;
    pointer-events: none;
}

.dashboard-tooltip {
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
}

.dashboard-tooltip rect {
    fill: #21464b;
}

.dashboard-tooltip text {
    fill: #fff;
    font-size: 11px;
    font-family: var(--font-ui);
}

.dashboard-point:hover .dashboard-tooltip, .dashboard-point:focus .dashboard-tooltip {
    opacity: 1;
}

.dashboard-point:hover circle, .dashboard-point:focus circle {
    fill: var(--accent-2);
    stroke-width: 3;
}

.dashboard-chart-empty {
    position: absolute;
    inset: 35% 0 auto;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.dashboard-chart-note {
    font-size: 11px;
    color: var(--muted);
    margin: 4px 0 0;
    line-height: 1.7;
}

.dashboard-data {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    font-size: 12px;
}

.dashboard-data summary {
    width: fit-content;
    cursor: pointer;
    color: var(--accent);
}

.dashboard-data th, .dashboard-data td {
    padding: 8px;
    font-size: 12px;
}

.dashboard-text-button {
    color: var(--accent);
    font-size: 12px;
    background: transparent;
    border: 0;
    padding: 5px 0;
    white-space: nowrap;
}

.dashboard-text-button:hover {
    text-decoration: underline;
}

.dashboard-activity {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-activity li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    column-gap: 13px;
    padding: 0 0 21px;
    position: relative;
}

.dashboard-activity li:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: -2px;
    left: 4px;
    border-left: 1px solid var(--line);
}

.dashboard-activity li:last-child {
    padding-bottom: 0;
}

.dashboard-activity-dot {
    width: 9px;
    height: 9px;
    margin-top: 7px;
    background: #9fc5c9;
    border: 2px solid #e9f5f5;
    border-radius: 50%;
}

.dashboard-activity li:first-child .dashboard-activity-dot {
    background: var(--accent-2);
}

.dashboard-activity-title {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.dashboard-activity-title span {
    font-size: 12px;
    color: var(--muted);
    padding-top: 2px;
}

.dashboard-activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.dashboard-activity-empty {
    display: grid;
    place-content: center;
    gap: 9px;
    text-align: center;
    color: var(--muted);
    min-height: 240px;
    font-size: 14px;
}

.dashboard-activity-empty span {
    font-size: 12px;
}

@media (min-width: 1500px) {
    .dashboard-panel {
        padding: 26px;
    }
}

@media (max-width: 1200px) {
    .dashboard-panels {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1050px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .dashboard-page {
        gap: 14px;
    }

    .dashboard-metrics {
        gap: 10px;
    }

    .dashboard-metric {
        padding: 14px;
    }

    .dashboard-icon {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .dashboard-icon svg {
        width: 17px;
        height: 17px;
    }

    .dashboard-metric-top {
        font-size: 12px;
    }

    .dashboard-metric-detail {
        font-size: 11px;
    }

    .dashboard-panel {
        padding: 16px;
    }

    .dashboard-toolbar {
        flex-wrap: wrap;
        font-size: 11px;
    }

    .dashboard-switch {
        margin-left: auto;
    }

    .dashboard-axis {
        font-size: 20px;
    }
}
