/* ============================================
 * variables.css — Design tokens and CSS custom properties
 * ============================================ */

:root {
    --purple: #7715C0;
    --purple50: #f3eafc;
    --magenta: #CB31AE;
    --teal: #11C2F3;
    --green: #00A651;
    --gradient: linear-gradient(135deg, #7715C0 0%, #CB31AE 100%);
    --gradient-wide: linear-gradient(135deg, #7715C0 0%, #CB31AE 50%, #E84D8A 100%);
    --dark: #1A1A2E;
    --gray50: #F8F9FC;
    --gray100: #EEF0F6;
    --gray500: #6B7194;
    --gray700: #3D4167;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(26,26,46,0.06);
    --shadow-hover: 0 8px 24px rgba(26,26,46,0.12);
}


/* ============================================
 * base.css — Reset, body styles, and base utilities
 * ============================================ */

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

body {
    font-family: 'Nunito Sans', 'Poppins', sans-serif;
    background-color: var(--gray50);
    color: var(--dark);
    line-height: 1.6;
}

h1, h2, h3, h4, .hero-title, .tile-label, .section-header h2 {
    font-family: 'Poppins', 'Nunito Sans', sans-serif;
}

.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray500);
}

.error-message {
    background-color: #FADBD8;
    border-left: 4px solid #E74C3C;
    color: #C0392B;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}


/* ============================================
 * gate.css — Password gate and loading states
 * ============================================ */

#passwordGate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #1A1A2E 0%, #2D1B4E 40%, #4A1A6B 70%, #7715C0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#passwordGate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 20%, rgba(119,21,192,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(203,49,174,0.12) 0%, transparent 50%);
    pointer-events: none;
}

#passwordGate.hidden {
    opacity: 0;
    pointer-events: none;
}

.password-gate-content {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 2.5rem 2.5rem 2rem;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
}

.password-gate-logo {
    width: 180px;
    margin: 0 auto 0.5rem;
    display: block;
}

.password-gate-content h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.password-gate-content p {
    color: var(--gray500);
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
}

.password-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#accessCode {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid var(--gray100);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Nunito Sans', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--gray50);
}

#accessCode:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(119,21,192,0.1);
    background: white;
}

#accessCode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#submitAccessCode {
    padding: 0.8rem 1.5rem;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

#submitAccessCode:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(119,21,192,0.35);
}

#submitAccessCode:active:not(:disabled) {
    transform: translateY(0);
}

#submitAccessCode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.password-gate-error {
    color: #E74C3C;
    font-size: 0.85rem;
    margin-top: 1rem;
    display: none;
}

.password-gate-error.show {
    display: block;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.loading-indicator.hidden {
    display: none;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray100);
    border-top-color: var(--purple);
    border-right-color: var(--magenta);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.9rem;
    color: var(--gray500);
    font-weight: 600;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%  { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}


/* ============================================
 * layout.css — Main dashboard layout
 * ============================================ */

#dashboard {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#dashboard.visible {
    opacity: 1;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.dashboard-topbar {
    background: var(--dark);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.dashboard-topbar-logo {
    height: 28px;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.dashboard-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-topbar-label {
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.5);
}

.dashboard-topbar .diag-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.3);
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin: 0;
    position: static;
    top: auto;
}

.dashboard-topbar .diag-btn:hover {
    border-color: rgba(255,255,255,0.7);
    color: white;
    background: rgba(255,255,255,0.1);
}

.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
}

.section-header::before {
    content: '';
    display: block;
    width: 4px;
    height: 2rem;
    background: var(--gradient);
    border-radius: 2px;
    margin-left: -1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--dark);
    font-weight: 700;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.hero-banner {
    background: var(--gradient);
    color: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.hero-pill {
    background: rgba(255, 255, 255, 0.25);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.hero-countdown {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray500);
    font-size: 0.8rem;
    border-top: 1px solid var(--gray100);
    margin-top: 3rem;
}


/* ============================================
 * tiles.css — Tile grid and metrics
 * ============================================ */

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

.tile {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.tile .tile-label {
    flex-shrink: 0;
}

.tile .tile-value,
.tile .tile-ki-grid {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile .funnel-container {
    flex: 1;
}

.tile .tile-value {
    flex-direction: column;
}

.tile:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.tile-label {
    color: var(--gray500);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.tile-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--purple);
    margin-bottom: 1rem;
}

.tile-stat {
    font-size: 0.95rem;
    color: var(--gray500);
}

.tile-ki-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex: 1;
}

.tile-ki-cell {
    flex: 1;
    text-align: center;
}

.tile-ki-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
    line-height: 1.2;
}

.tile-ki-sublabel {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 0.25rem;
}

.tile-ki-divider {
    width: 1px;
    align-self: stretch;
    background: var(--gray100);
    flex-shrink: 0;
}

.tile-clickable {
    cursor: pointer;
    position: relative;
}

.tile-clickable::after {
    content: 'Click for details';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--gray500);
    opacity: 0;
    transition: opacity 0.2s;
}

.tile-clickable:hover::after {
    opacity: 1;
}


/* ============================================
 * charts.css — Progress, funnel, donut, bar, and other charts
 * ============================================ */

.progress-container {
    margin: 1.5rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-label-text {
    color: var(--dark);
    font-weight: 600;
}

.progress-label-value {
    color: var(--purple);
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--gray100);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.funnel-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.funnel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.funnel-label {
    font-size: 0.75rem;
    color: var(--gray700);
    font-weight: 600;
}

.funnel-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dark);
}

.funnel-track {
    width: 100%;
    height: 18px;
    background: var(--gray100);
    border-radius: 4px;
    overflow: hidden;
}

.funnel-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    min-width: 2px;
}

.chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.donut-svg {
    width: 200px;
    height: 200px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

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

.bar-chart {
    margin: 1.5rem 0;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bar-label {
    min-width: 150px;
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 500;
}

.bar-container {
    flex: 1;
    height: 24px;
    background-color: var(--gray100);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
}

.bar-value {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.pi-chart {
    margin: 1rem 0;
}

.pi-row {
    margin-bottom: 1rem;
}

.pi-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.3rem;
}

.pi-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--dark);
    line-height: 1.3;
    flex: 1;
    padding-right: 1rem;
}

.pi-value {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--dark);
    white-space: nowrap;
}

.pi-pct {
    font-weight: 400;
    color: var(--gray500);
}

.pi-track {
    width: 100%;
    height: 20px;
    background: var(--gray100);
    border-radius: 6px;
    overflow: hidden;
}

.pi-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 6px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.badge {
    display: inline-block;
    background: var(--gray100);
    color: var(--purple);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.delta-badge {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    background: var(--gray100);
    color: var(--green);
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.delta-badge.negative {
    color: #E74C3C;
}

.engagement-metrics-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.engagement-metric-card {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 1rem;
    background: var(--gray50);
    border-radius: var(--radius);
}

.engagement-metric-card .metric-big {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--purple);
}

.engagement-metric-card .metric-label {
    font-size: 0.75rem;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.region-chart {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.region-segment {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--gray50);
}

.region-segment .region-pct {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--purple);
}

.region-segment .region-name {
    font-size: 0.75rem;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.patient-reach-callout {
    background: linear-gradient(135deg, #F8F4FF, #EEE8F8);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
    border: 1px solid #E0D4F0;
}

.patient-reach-headline {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
}

.patient-reach-sub {
    font-size: 1rem;
    color: var(--gray700);
    margin-top: 0.25rem;
}

.patient-reach-detail {
    font-size: 0.85rem;
    color: var(--gray500);
    margin-top: 0.75rem;
}


/* ============================================
 * tables.css — Data tables and table styles
 * ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.data-table thead {
    background-color: var(--gray100);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--gray100);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray100);
    color: var(--gray700);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
    padding-right: 1.5rem !important;
}

.sortable-th:hover {
    background: var(--gray50);
}

.sortable-th::after {
    content: '\2195';
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--gray500);
}

.sortable-th.sort-asc::after {
    content: '\25B2';
    color: var(--purple);
}

.sortable-th.sort-desc::after {
    content: '\25BC';
    color: var(--purple);
}

.status-yes {
    display: inline-block;
    background: #E8F8E8;
    color: #27AE60;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-no {
    display: inline-block;
    background: var(--gray100);
    color: var(--gray500);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.state-detail-summary {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.state-detail-stat {
    text-align: center;
}

.state-detail-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--purple);
}

.state-detail-stat .stat-label {
    font-size: 0.75rem;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ============================================
 * cards.css — Card grids and card components
 * ============================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.themed-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--purple);
    transition: box-shadow 0.2s, transform 0.2s;
}

.themed-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.themed-card-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.themed-card-text {
    color: var(--gray700);
    font-size: 0.9rem;
    font-style: italic;
}

.themed-card-meta {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--gray500);
}

.question-block {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.question-block:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.question-text {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.question-comparison {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.comparison-group {
    flex: 1;
    min-width: 200px;
}

.comparison-title {
    font-size: 0.85rem;
    color: var(--gray500);
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comparison-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.comparison-label {
    min-width: 80px;
    color: var(--gray700);
}

.comparison-bar {
    flex: 1;
    height: 20px;
    background-color: var(--gray100);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}

.comparison-fill-pre {
    background: #A0D995;
    height: 100%;
}

.comparison-fill-post {
    background: var(--purple);
    height: 100%;
}

.comparison-value {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
}

.info-box {
    background: linear-gradient(135deg, rgba(119, 21, 192, 0.1), rgba(203, 49, 174, 0.1));
    border-left: 4px solid var(--purple);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    font-size: 0.9rem;
    color: var(--gray700);
}


/* ============================================
 * map.css — State map and legend styles
 * ============================================ */

.state-map-container {
    position: relative;
    width: 100%;
}

.state-map-container svg {
    width: 100%;
    height: auto;
    display: block;
}

.state-map-container path {
    transition: opacity 0.2s;
    cursor: pointer;
    stroke: white;
    stroke-width: 1;
}

.state-map-container path:hover {
    opacity: 0.8;
    stroke-width: 2;
}

.state-tooltip {
    position: absolute;
    background: var(--dark);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    display: none;
}

.state-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--gray500);
}

.state-legend-bar {
    flex: 1;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(to right, #EEF0F6, #D4A8E8, #9B4FD0, #7715C0);
}

.state-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--gray500);
    margin-top: 0.5rem;
}


/* ============================================
 * insights.css — AI insights and analysis components
 * ============================================ */

.ai-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gradient);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    margin-left: 0.75rem;
    vertical-align: middle;
}

.insights-card {
    background: linear-gradient(135deg, rgba(119, 21, 192, 0.04) 0%, rgba(203, 49, 174, 0.04) 100%);
    border: 1px solid rgba(119, 21, 192, 0.15);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.insights-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.insights-icon {
    width: 20px;
    height: 20px;
    color: var(--purple);
    flex-shrink: 0;
}

.insights-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.insights-body {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--gray700);
}

.oe-card {
    margin-bottom: 1.5rem;
}

.oe-question {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.3rem;
}

.oe-meta {
    font-size: 0.8rem;
    color: var(--gray500);
    margin-bottom: 1rem;
}

.oe-error {
    color: var(--gray500);
    font-style: italic;
    font-size: 0.9rem;
}

.oe-sentiment-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.oe-sentiment-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.oe-sentiment-summary {
    font-size: 0.9rem;
    color: var(--gray700);
}

.oe-takeaway {
    font-size: 0.9rem;
    color: var(--dark);
    background: var(--gray50);
    border-left: 3px solid var(--purple);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1rem;
}

.oe-themes-header, .oe-quotes-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--gray500);
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.oe-themes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oe-theme {
    background: var(--gray50);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.oe-theme-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.oe-theme-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--dark);
}

.oe-theme-prev {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.oe-theme-summary {
    font-size: 0.85rem;
    color: var(--gray700);
    line-height: 1.4;
}

.oe-quotes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oe-quote {
    font-size: 0.85rem;
    color: var(--gray700);
    font-style: italic;
    border-left: 2px solid var(--gray100);
    padding: 0.4rem 0.75rem;
    margin: 0;
    line-height: 1.4;
}

.gap-item {
    background: #FFF8F0;
    border: 1px solid #F0DFC8;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.gap-item .gap-question {
    font-size: 0.9rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.gap-item .gap-stats {
    font-size: 0.85rem;
    color: var(--gray500);
}

.gap-item .gap-pct {
    font-size: 1.1rem;
    font-weight: 700;
    color: #E67E22;
}


/* ============================================
 * modals.css — Modal dialogs and overlays
 * ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26,26,46,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(26,26,46,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray100);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--dark);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray500);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--gray100);
    color: var(--dark);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h4 {
    font-size: 0.9rem;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.modal-section p {
    font-size: 0.9rem;
    color: var(--gray700);
    line-height: 1.7;
}

.modal-formula {
    background: var(--gray50);
    border: 1px solid var(--gray100);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--dark);
    margin: 0.75rem 0;
}

.modal-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0.75rem 0;
}

.modal-data-table th {
    background: var(--gray100);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
}

.modal-data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray100);
    color: var(--gray700);
}

.modal-content.modal-wide {
    max-width: 960px;
}

.diag-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--purple);
    background: white;
    color: var(--purple);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.75rem;
    transition: all 0.2s;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

.diag-btn:hover {
    background: var(--purple);
    color: white;
}

.diag-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.diag-table th {
    background: var(--gray100);
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    position: sticky;
    top: 0;
    z-index: 1;
}

.diag-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--gray100);
    color: var(--gray700);
    vertical-align: top;
}

.diag-table tr:hover td {
    background: var(--gray50);
}

.diag-cat-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin: 1px 2px;
    white-space: nowrap;
}

.diag-cat-knowledge {
    background: #E3F2FD;
    color: #1565C0;
}

.diag-cat-practice {
    background: #E8F5E9;
    color: #2E7D32;
}

.diag-cat-polling {
    background: #FFF3E0;
    color: #E65100;
}

.diag-cat-patient {
    background: #F3E5F5;
    color: #7B1FA2;
}

.diag-cat-yip {
    background: #E0F7FA;
    color: #00695C;
}

.diag-cat-practype {
    background: #FFF8E1;
    color: #F57F17;
}

.diag-cat-eval {
    background: var(--gray100);
    color: var(--gray500);
}

.diag-cat-uncat {
    background: #FFEBEE;
    color: #C62828;
}

.diag-cat-impact {
    background: #EDE7F6;
    color: #4527A0;
}

.diag-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--purple);
    padding: 2px 6px 2px 0;
    vertical-align: middle;
}

.diag-expand-btn:hover {
    color: var(--magenta);
}

.diag-detail-row td {
    padding: 0 !important;
}

.diag-detail-content {
    padding: 1rem 1.5rem;
    background: var(--gray50);
    border-bottom: 2px solid var(--gray100);
    font-size: 0.85rem;
}

.diag-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.diag-detail-table th {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--gray100);
    font-weight: 600;
    color: var(--gray500);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.diag-detail-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--gray50);
}

.kg-detail-table td {
    font-size: 0.82rem;
}

.kg-detail-table th {
    font-size: 0.75rem;
}

.diag-summary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray100);
}

.diag-summary-item {
    text-align: center;
}

.diag-summary-item .diag-sum-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--purple);
}

.diag-summary-item .diag-sum-label {
    font-size: 0.7rem;
    color: var(--gray500);
    text-transform: uppercase;
}

.moore-ladder {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 1rem 0;
}

.moore-rung {
    display: flex;
    align-items: stretch;
    min-height: 80px;
    border-left: 4px solid var(--purple);
    position: relative;
}

.moore-rung:last-child {
    border-left-color: var(--gray100);
}

.moore-level-badge {
    flex-shrink: 0;
    width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.moore-level-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--purple);
}

.moore-level-label {
    font-size: 0.65rem;
    color: var(--gray500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.2;
    margin-top: 2px;
}

.moore-rung-body {
    flex: 1;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray100);
}

.moore-rung-body h4 {
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.moore-metric-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.moore-metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--purple);
    min-width: 60px;
}

.moore-metric-label {
    font-size: 0.85rem;
    color: var(--gray700);
}

.moore-rung.moore-empty .moore-level-num {
    color: var(--gray500);
}

.moore-rung.moore-empty .moore-rung-body {
    opacity: 0.5;
}

.moore-rung.moore-empty {
    border-left-color: var(--gray100);
}


/* ============================================
 * responsive.css — Mobile and responsive styles
 * ============================================ */

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem 0.75rem;
    }

    .dashboard-topbar {
        padding: 0.6rem 1rem;
    }

    .dashboard-topbar-logo {
        height: 22px;
    }

    .hero-banner {
        padding: 1.5rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tiles-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        flex-direction: column;
        gap: 1rem;
    }

    .donut-svg {
        width: 150px;
        height: 150px;
    }

    .bar-label {
        min-width: 100px;
        font-size: 0.85rem;
    }

    .question-comparison {
        flex-direction: column;
        gap: 1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }
}


/* ============================================
 * print.css — Print styles and media queries
 * ============================================ */

@media print {
    #passwordGate {
        display: none !important;
    }

    .dashboard-topbar {
        background: white !important;
        border-bottom: 2px solid var(--gray100);
    }

    .dashboard-topbar-logo {
        filter: none !important;
        opacity: 1 !important;
    }

    .dashboard-topbar-label {
        color: var(--dark) !important;
    }

    body {
        background: white;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card, .tile, .question-block, .themed-card {
        box-shadow: none;
        border: 1px solid var(--gray100);
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .dashboard-container {
        max-width: 100%;
        padding: 0 1rem;
    }

    .section {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }

    .hero-banner {
        break-inside: avoid;
        page-break-inside: avoid;
        background: var(--gradient) !important;
    }

    .state-tooltip {
        display: none !important;
    }

    .state-map-container path:hover {
        opacity: 1;
    }

    .state-legend-bar {
        background: linear-gradient(to right, #EEF0F6, #D4A8E8, #9B4FD0, #7715C0) !important;
    }

    .comparison-fill-pre, .comparison-fill-post, .bar-fill, .progress-fill {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .section-header h2::after {
        display: none;
    }

    .modal-overlay {
        display: none !important;
    }

    .tile-clickable::after {
        display: none;
    }

    .diag-btn {
        display: none;
    }
}


