:root {
    --da-blue: #2eafd4;
    --da-dark: #0d2a3a;
    --da-light1: #e8f7fc;
    --da-light2: #f0f7fa;
    --da-gray: #4b5563;
    --da-gray-light: #e5e7eb;
    --da-success: #10b981;
    --da-warning: #f59e0b;
    --da-accent1: #ec4899;
    --da-accent2: #8b5cf6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* SKIP LINK */
.skip-link {
    position: absolute;
    top: -100%;
    left: 8px;
    background: var(--da-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 6px 6px;
    font-weight: 600;
    z-index: 1000;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* FOCUS STYLES */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 3px solid var(--da-blue);
    outline-offset: 2px;
}

/* Definition list reset for KPI cards */
dl { margin: 0; }
dt, dd { margin: 0; }

/* Visually hidden (screen reader only) */
/* LOGO */
.site-logo {
    display: block;
    max-width: 100%;
    height: auto;
}
/* Invert logo colours when on dark sidebar backgrounds */
.dashboard-sidebar .site-logo,
.admin-sidebar .site-logo {
    filter: brightness(0) invert(1);
}
.sidebar-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #f9fafb;
    color: #1f2937;
}

/* GENERAL */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

button {
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
}

button.primary {
    background: var(--da-blue);
    color: white;
}

button.primary:hover {
    background: #2295b8;
}

button.secondary {
    background: transparent;
    color: var(--da-blue);
    border: 1px solid var(--da-blue);
}

button.secondary:hover {
    background: var(--da-light1);
}

button.danger {
    background: #ef4444;
    color: white;
}

button.danger:hover {
    background: #dc2626;
}

input {
    font-family: 'DM Sans', sans-serif;
    padding: 12px 16px;
    border: 1px solid var(--da-gray-light);
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--da-blue);
    box-shadow: 0 0 0 3px rgba(46, 175, 212, 0.1);
}

/* LOGIN */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--da-dark) 0%, #1a3a4a 100%);
    min-height: 100vh;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--da-dark);
    margin-bottom: 8px;
}

.login-logo p {
    font-size: 14px;
    color: var(--da-gray);
    font-weight: 500;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.login-form label {
    font-weight: 600;
    font-size: 14px;
    color: var(--da-dark);
    margin-bottom: 4px;
    display: block;
}

.login-form input {
    width: 100%;
}

.login-button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--da-gray);
    padding-top: 16px;
    border-top: 1px solid var(--da-gray-light);
}

/* CLIENT SELECTOR */
body.client-page {
    display: flex;
    flex-direction: column;
    background: var(--da-light2);
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: white;
    border-bottom: 1px solid var(--da-gray-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.topbar h2 {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    color: var(--da-dark);
    font-weight: 700;
}

.topbar-action button {
    padding: 8px 16px;
    font-size: 14px;
}

.client-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.client-selector-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--da-dark);
    margin-bottom: 24px;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.client-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.client-card.available {
    cursor: pointer;
    border-color: var(--da-blue);
}

.client-card.available:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(46, 175, 212, 0.2);
}

.client-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.client-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--da-dark);
    margin-bottom: 12px;
}

.client-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.client-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--da-gray);
}

.client-meta-item strong {
    color: var(--da-dark);
    font-weight: 600;
}

.client-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
}

.client-status.available {
    background: var(--da-light1);
    color: var(--da-blue);
}

.client-status.coming-soon {
    background: #fee2e2;
    color: #dc2626;
}

/* REPORT LIST */
body.report-page {
    display: flex;
    flex-direction: column;
    background: var(--da-light2);
    min-height: 100vh;
}

.report-header {
    padding: 20px 32px;
    background: white;
    border-bottom: 1px solid var(--da-gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--da-dark);
}

.report-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.report-list-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--da-dark);
    margin-bottom: 24px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.report-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border-left: 4px solid var(--da-blue);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.report-card.available {
    cursor: pointer;
}

.report-card.available:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(46, 175, 212, 0.2);
}

.report-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
    border-left-color: #d1d5db;
}

.report-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--da-dark);
    margin-bottom: 12px;
}

.report-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.report-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--da-gray);
}

.report-meta-item strong {
    color: var(--da-dark);
    font-weight: 600;
}

.report-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
    background: var(--da-light1);
    color: var(--da-blue);
}

.report-status.coming-soon {
    background: #fee2e2;
    color: #dc2626;
}

/* DASHBOARD */
body.dashboard-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.dashboard-sidebar {
    width: 280px;
    background: var(--da-dark);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h1 {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-logo p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    padding: 0 8px;
    font-weight: 700;
}

.nav-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.85);
}

.nav-item:hover {
    opacity: 1;
    background: rgba(46, 175, 212, 0.2);
}

.nav-item.active {
    background: var(--da-blue);
    opacity: 1;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer button {
    width: 100%;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    font-size: 13px;
    padding: 8px;
}

.sidebar-footer button:hover {
    background: #dc2626;
}

.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.dashboard-topbar {
    padding: 20px 32px;
    background: white;
    border-bottom: 1px solid var(--da-gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--da-dark);
}

.dashboard-title p {
    font-size: 13px;
    color: var(--da-gray);
}

.dashboard-topbar-action button {
    margin-left: 12px;
}

.dashboard-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* KPI CARDS */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--da-blue);
}

.kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--da-gray);
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--da-dark);
    font-family: 'Syne', sans-serif;
}

.kpi-subtext {
    font-size: 12px;
    color: var(--da-gray);
    margin-top: 8px;
}

/* CHART SECTIONS */
.chart-section {
    background: white;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--da-dark);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--da-light1);
}

/* BAR CHARTS */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    flex: 0 0 200px;
    font-size: 13px;
    color: var(--da-dark);
    font-weight: 500;
    line-height: 1.4;
}

.bar-container {
    flex: 1;
    background: var(--da-light1);
    border-radius: 4px;
    height: 28px;
    position: relative;
    overflow: hidden;
}

.bar {
    height: 100%;
    background: linear-gradient(90deg, var(--da-blue), #1e8fb8);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
    from {
        width: 0;
    }
}

.bar-value {
    flex: 0 0 80px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--da-dark);
}

/* INTENT PILLS */
.intent-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.intent-pill {
    background: linear-gradient(135deg, var(--da-light1), var(--da-light2));
    border: 1px solid var(--da-blue);
    border-radius: 20px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.intent-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 175, 212, 0.2);
}

.intent-pill-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--da-blue);
    font-family: 'Syne', sans-serif;
}

.intent-pill-label {
    font-size: 12px;
    color: var(--da-gray);
    margin-top: 8px;
}

/* DONUT CHARTS */
.donut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 24px;
}

.donut-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.donut-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--da-dark);
    margin-bottom: 16px;
    text-align: center;
}

canvas {
    max-width: 220px;
    max-height: 220px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    font-size: 12px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.donut-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* VERBATIMS */
.verbatim-item {
    padding: 16px;
    background: var(--da-light1);
    border-left: 3px solid var(--da-blue);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--da-dark);
    font-style: italic;
}

.verbatim-item::before {
    content: '"';
    font-size: 20px;
    color: var(--da-blue);
    margin-right: 4px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .dashboard-sidebar {
        width: 220px;
    }

    .bar-label {
        flex: 0 0 150px;
    }

    .dashboard-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    body.dashboard-page {
        flex-direction: column;
    }

    .dashboard-sidebar {
        width: 100%;
        max-height: 60px;
        flex-direction: row;
        align-items: center;
        padding: 0 16px;
        overflow: visible;
    }

    .sidebar-logo {
        border: none;
        padding: 0;
        margin-right: 24px;
    }

    .sidebar-nav {
        padding: 0;
        display: flex;
        gap: 24px;
        flex: 1;
    }

    .nav-section {
        margin: 0;
    }

    .nav-section-title {
        display: none;
    }

    .nav-item {
        margin: 0;
        padding: 8px;
    }

    .sidebar-footer {
        border: none;
        padding: 0;
        margin-left: auto;
    }

    .sidebar-footer button {
        width: auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .dashboard-main {
        height: auto;
        flex: 1;
    }

    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .bar-label {
        flex: 0 0 100px;
        font-size: 12px;
    }

    .donut-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ── PRINT / PDF EXPORT ───────────────────────────────────────────────────── */
@media print {
    @page {
        size: A4 portrait;
        margin: 16mm 14mm;
    }

    /* Hide chrome that doesn't belong in the PDF */
    .skip-link,
    nav.dashboard-sidebar,
    #backBtn,
    .sidebar-footer,
    .dashboard-topbar .topbar-action { display: none !important; }

    /* Full-width single-column layout */
    body.dashboard-page {
        display: block;
        height: auto;
        background: white;
    }

    .dashboard-main {
        display: block;
        overflow: visible;
    }

    .dashboard-topbar {
        padding: 0 0 12px;
        border-bottom: 2px solid #0d2a3a;
        margin-bottom: 20px;
        box-shadow: none;
    }

    .dashboard-title h1 {
        font-size: 22px;
        color: #0d2a3a;
    }

    .dashboard-title p {
        font-size: 13px;
        color: #4b5563;
    }

    /* Print header: logo line */
    .dashboard-topbar::before {
        content: "CC Data  |  Confidential";
        display: block;
        font-size: 10px;
        color: #4b5563;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        margin-bottom: 8px;
    }

    .dashboard-content {
        padding: 0;
        overflow: visible;
    }

    /* KPI cards — 2 per row on print */
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .kpi-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        padding: 14px;
    }

    .kpi-value { font-size: 26px; }

    /* Chart sections — no box shadow, tighter padding */
    .chart-section {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        padding: 18px;
        margin-bottom: 16px;
        break-inside: avoid;
    }

    /* Avoid splitting a chart across pages */
    .bar-chart,
    .donut-grid,
    .intent-section { break-inside: avoid; }

    /* Donuts — 3 per row on print */
    .donut-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    canvas { max-width: 160px; max-height: 160px; }

    /* Verbatims — allow break between items but not within */
    .verbatim-item { break-inside: avoid; }

    /* Ensure backgrounds print (for bar fills) */
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
