/* =====================================================
   ASTRA NEXORA — SEO REPORT DASHBOARD (sample)
   Uses the site tokens from style.css.
===================================================== */

:root {
    /* Chart roles (validated: brand blue, aqua, orange — see dataviz check) */
    --series-1: #1729A0;
    --series-2: #1BAF7A;
    --series-3: #EB6834;
    --chart-surface: #FFFFFF;
    --grid: rgba(5, 10, 48, .08);
    --axis-text: #5B6280;
    --good: #12805C;
    --good-bg: #E6F4EE;
    --warn: #A15C00;
    --warn-bg: #FFF3DF;
}

.dash-body {
    background: var(--paper);
}

/* ---------- top bar ---------- */

.dash-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-soft);
}

.dash-topbar-inner {
    width: min(1320px, calc(100% - 32px));
    height: 68px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dash-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--navy);
}

.dash-brand img {
    width: auto;
    height: 32px;
}

.dash-brand .logo-text {
    font-size: 22px;
}

.dash-sample-pill {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 100px;
    background: var(--warn-bg);
    color: var(--warn);
    font-size: 12px;
    font-weight: 600;
}

.dash-sample-pill span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.dash-back {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    white-space: nowrap;
}

.dash-back:hover {
    color: var(--blue-bright);
}

@media (min-width: 701px) {
    .dash-sample-pill {
        display: inline-flex;
    }
}

/* ---------- head ---------- */

.dash-main {
    width: min(1320px, calc(100% - 32px));
    margin: auto;
    padding: 34px 0 70px;
}

.dash-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.dash-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    color: var(--blue-bright);
}

.dash-head h1 {
    margin-top: 8px;
    font-family: var(--font-heading);
    font-size: clamp(30px, 6vw, 46px);
    line-height: 1.05;
    letter-spacing: -.04em;
    color: var(--navy);
}

.dash-client {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.dash-range {
    display: inline-flex;
    padding: 4px;
    border-radius: 100px;
    background: var(--white);
    border: 1px solid var(--border);
}

.dash-range button {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 100px;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
}

.dash-range button[aria-pressed="true"] {
    background: var(--navy);
    color: var(--white);
}

.dash-note {
    max-width: 760px;
    margin: 18px 0 26px;
    padding: 12px 16px;
    border-left: 3px solid var(--warn);
    border-radius: 0 10px 10px 0;
    background: var(--warn-bg);
    color: #5A3A00;
    font-size: 14px;
    line-height: 1.6;
}

/* ---------- KPI tiles ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.kpi {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--white);
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.kpi-value {
    margin-top: 10px;
    font-family: var(--font-heading);
    font-size: clamp(24px, 6vw, 34px);
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.kpi-delta.up {
    background: var(--good-bg);
    color: var(--good);
}

.kpi-delta small {
    margin-left: 4px;
    font-weight: 500;
    color: var(--muted);
}

.kpi-delta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.kpi-context {
    font-size: 12px;
    color: var(--muted);
}

@media (min-width: 901px) {
    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }

    .kpi {
        padding: 22px;
    }
}

/* ---------- cards ---------- */

.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.dash-card {
    min-width: 0;
    padding: 22px 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--chart-surface);
}

.dash-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 18px;
}

.dash-card h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    letter-spacing: -.02em;
    color: var(--navy);
}

.dash-card-sub {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

@media (min-width: 901px) {
    .dash-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-span-2 {
        grid-column: 1 / -1;
    }

    .dash-card {
        padding: 26px 28px;
    }
}

/* ---------- legend ---------- */

.legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 13px;
    color: var(--text);
}

.legend li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* ---------- charts ---------- */

.chart {
    position: relative;
    width: 100%;
    height: 260px;
}

.chart svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart text {
    font-family: var(--font-body);
    font-size: 11px;
    fill: var(--axis-text);
    font-variant-numeric: tabular-nums;
}

.chart .direct-label {
    font-size: 12px;
    font-weight: 600;
    fill: var(--navy);
}

.chart .bar-seg {
    cursor: pointer;
    transition: opacity .15s;
}

.chart:hover .bar-seg {
    opacity: .55;
}

.chart .bar-seg:hover,
.chart .bar-seg:focus {
    opacity: 1;
    outline: none;
}

@media (min-width: 701px) {
    .chart {
        height: 300px;
    }
}

.chart-tooltip {
    position: fixed;
    z-index: 100;
    min-width: 150px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--navy);
    color: var(--white);
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 12px));
    transition: opacity .12s;
    box-shadow: 0 12px 30px rgba(5, 10, 48, .25);
}

.chart-tooltip.show {
    opacity: 1;
}

.chart-tooltip .tt-title {
    margin-bottom: 4px;
    color: rgba(255, 255, 255, .7);
}

.chart-tooltip .tt-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-tooltip .tt-row i {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.chart-tooltip .tt-row strong {
    font-variant-numeric: tabular-nums;
}

/* ---------- tables ---------- */

.dash-table-toggle {
    margin-top: 14px;
}

.dash-table-toggle summary {
    width: fit-content;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
}

.dash-table-toggle .table-wrap {
    margin-top: 12px;
}

.table-wrap {
    overflow-x: auto;
}

.data-table,
.dash-table-toggle table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td,
.dash-table-toggle th,
.dash-table-toggle td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table th,
.dash-table-toggle th {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.data-table td:first-child {
    color: var(--navy);
    font-weight: 500;
}

.data-table .num,
.dash-table-toggle .num {
    text-align: right;
}

.change-up {
    color: var(--good);
    font-weight: 600;
}

.pos-pill {
    display: inline-block;
    min-width: 34px;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--paper);
    color: var(--navy);
    font-weight: 600;
    text-align: center;
}

.pos-pill.top3 {
    background: var(--navy);
    color: var(--white);
}

/* ---------- health ---------- */

.health-list {
    list-style: none;
    display: grid;
    gap: 10px;
}

.health-list li {
    display: grid;
    grid-template-columns: 72px 70px 1fr;
    grid-template-areas: "status name value" "status name note";
    align-items: center;
    gap: 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--paper);
}

.health-list .status {
    grid-area: status;
}

.health-list strong {
    grid-area: name;
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--navy);
}

.health-list li > span:not(.status) {
    grid-area: value;
    font-weight: 600;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.health-list small {
    grid-area: note;
    font-size: 12px;
    color: var(--muted);
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}

.status-good {
    background: var(--good-bg);
    color: var(--good);
}

.status-warn {
    background: var(--warn-bg);
    color: var(--warn);
}

/* ---------- GBP ---------- */

.gbp-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.gbp-list li {
    padding: 16px 12px;
    border-radius: 12px;
    background: var(--paper);
    text-align: center;
}

.gbp-list strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 26px;
    letter-spacing: -.03em;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.gbp-list span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- top pages (bar list) ---------- */

.page-bars {
    list-style: none;
    display: grid;
    gap: 14px;
}

.page-bars li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    font-size: 13px;
}

.page-bars .page-path {
    overflow: hidden;
    color: var(--navy);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-bars .page-value {
    color: var(--navy);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.page-bars .page-track {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 4px;
    background: var(--paper);
    overflow: hidden;
}

.page-bars .page-fill {
    height: 100%;
    border-radius: 0 4px 4px 0;
    background: var(--series-1);
    transition: width .5s var(--ease);
}

/* ---------- work log ---------- */

.worklog h3 {
    margin: 4px 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--blue-bright);
}

.worklog h3 + ul {
    margin-bottom: 18px;
}

.worklog ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.worklog li {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
}

.worklog li::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 1px;
    font-size: 11px;
    color: var(--blue-bright);
}

/* ---------- CTA ---------- */

.dash-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 14px;
    padding: 30px 26px;
    border-radius: 18px;
    background: var(--navy);
    color: var(--white);
}

.dash-cta h2 {
    font-family: var(--font-heading);
    font-size: clamp(22px, 4vw, 30px);
    letter-spacing: -.03em;
}

.dash-cta p {
    margin-top: 6px;
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .page-bars .page-fill,
    .chart-tooltip {
        transition: none;
    }
}
