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

:root {
    /* Solid5 Brand Colors */
    --solid5-teal: #2C5F6F;
    --solid5-cyan: #00B8E6;
    --solid5-white: #FFFFFF;
    --solid5-light-gray: #F5F5F5;
    --solid5-medium-gray: #6C757D;
    --solid5-dark-text: #2C3E50;

    /* Application Colors */
    --primary-color: #2C5F6F;
    --accent-color: #00B8E6;
    --secondary-color: #6C757D;
    --bg-color: #F5F5F5;
    --card-bg: #ffffff;
    --user-msg-bg: #2C5F6F;
    --assistant-msg-bg: #f1f5f9;
    --border-color: #e2e8f0;
    --text-color: #2C3E50;
    --text-light: #6C757D;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #00B8E6;

    /* KPI Trend Colors */
    --kpi-trend-up: #22c55e;
    --kpi-trend-down: #ef4444;
    --kpi-trend-stable: #6b7280;

    /* KPI Status Colors */
    --kpi-status-green: #10b981;
    --kpi-status-orange: #f59e0b;
    --kpi-status-red: #ef4444;
    --kpi-status-neutral: #94a3b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.chat-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

/* Context panel replaces map-panel - dynamic: map for geo, dashboard for jeugddata */
.context-panel {
    width: 50%;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Legacy class kept for backward compatibility */
.map-panel {
    width: 50%;
    position: relative;
}

/* ===== HEADER WITH AUTH =====*/
header {
    background: var(--solid5-teal);
    color: white;
    padding: 0.75rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    flex: 1;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 36px;
    width: auto;
}

.header-title-section {
    display: flex;
    flex-direction: column;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.8rem;
}

/* ===== MODULE SWITCHER ===== */
/* Segmented control for switching between Geo and Jeugddata modules */

.module-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.module-btn {
    padding: 0.375rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.module-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.module-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.module-btn.active:hover {
    background: white;
    color: var(--primary-color);
}

/* ===== USER AUTHENTICATION UI ===== */

.login-btn {
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-btn:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.help-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.user-profile {
    position: relative;
}

.user-profile-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
    font-size: 1.125rem;
}

.dropdown-arrow {
    font-size: 0.625rem;
    opacity: 0.8;
    transition: transform 0.2s;
}

.user-profile-btn:hover .dropdown-arrow {
    transform: translateY(2px);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dropdown-header strong {
    color: var(--text-color);
    font-size: 0.95rem;
}

.dropdown-header span {
    color: var(--text-light);
    font-size: 0.875rem;
}

.user-role-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-role-badge.role-admin {
    background: #fee2e2;
    color: #991b1b;
}

.user-role-badge.role-analyst {
    background: #dbeafe;
    color: #1e40af;
}

.user-role-badge.role-viewer {
    background: #f3f4f6;
    color: #374151;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: var(--bg-color);
}

.dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* ===== REST OF STYLES ===== */

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-anchor: auto;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    color: white;
}

.message.user .avatar {
    background: var(--primary-color);
}

.message.assistant .avatar {
    background: var(--solid5-cyan);
}

.content {
    max-width: 90%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user .content {
    max-width: 70%;
    background: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .content {
    background: var(--assistant-msg-bg);
    border-bottom-left-radius: 4px;
}

.content p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.content p:last-child {
    margin-bottom: 0;
}

.content h1, .content h2, .content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.content h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content h2 {
    font-size: 1.25rem;
    color: var(--solid5-cyan);
}

.content h3 {
    font-size: 1.1rem;
    color: #374151;
}

.content strong {
    font-weight: 600;
    color: #1f2937;
}

.content em {
    font-style: italic;
}

.content ul, .content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.content ul {
    list-style-type: disc;
}

.content li {
    margin-bottom: 0.25rem;
}

.content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Improved chat message content styling */
.content hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 2px solid #e2e8f0;
}

.content h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.content li strong {
    color: var(--solid5-teal);
    font-weight: 600;
}

.content a {
    color: var(--solid5-cyan);
    text-decoration: none;
    transition: all 0.2s;
}

.content a:hover {
    color: #0096c7;
    text-decoration: underline;
}

.content p:has(strong:first-child) {
    margin-top: 1rem;
}

/* ===== TOOL CALL INDICATORS ===== */

.tool-call {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-size: 0.875rem;
}

.tool-call strong {
    color: #92400e;
}

/* Tool call streaming indicator with spinner */
.tool-call-streaming {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-call-streaming .tool-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fcd34d;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.tool-call-streaming .tool-name {
    color: #92400e;
    font-weight: 600;
}

.tool-call-streaming .tool-status {
    color: #78350f;
}

/* Tool indicators container for stacking multiple tools */
.tool-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

/* ===== STREAMING MESSAGE STYLES ===== */

.message.streaming .content {
    min-height: 2.5rem;
}

/* Typing indicator cursor */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: var(--primary-color);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Streaming error notice */
.stream-error-notice {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.stream-error-notice .error-message {
    color: #991b1b;
    font-size: 0.875rem;
}

.stream-error-notice .retry-btn {
    padding: 0.375rem 0.75rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.stream-error-notice .retry-btn:hover {
    background: #dc2626;
}

/* ===== LOADING INDICATOR ===== */

.loading {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Message Action Buttons */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-left: 48px; /* Align with message content */
    flex-wrap: wrap;
}

.message.user .message-actions {
    margin-left: 0;
    margin-right: 48px;
    justify-content: flex-end;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.action-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.action-btn.primary:hover {
    background: #245361;
    border-color: #245361;
}

/* ===== SUGGESTION BUTTONS ===== */
/* LLM-suggested actions displayed as clickable buttons below messages */

.suggestion-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-left: 48px; /* Align with message content */
    flex-wrap: wrap;
}

.message.user .suggestion-buttons {
    margin-left: 0;
    margin-right: 48px;
    justify-content: flex-end;
}

.suggestion-btn {
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--accent-color);
    background: rgba(0, 184, 230, 0.08);
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.suggestion-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 184, 230, 0.25);
}

.suggestion-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.suggestion-btn:active {
    transform: translateY(0);
}

/* ===== EXAMPLE QUESTION CHIPS ===== */
/* Suggestion chips for jeugddata welcome message */

.example-question-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Quick Actions Bar */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.quick-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* ===== QUICK ACTION BUTTON DISABLED STATE ===== */
/* Styles for disabled export button when no data is available */

.quick-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e0e0e0;
    border-color: #d0d0d0;
    color: var(--text-light);
}

.quick-action-btn:disabled:hover {
    background-color: #e0e0e0;
    border-color: #d0d0d0;
    color: var(--text-light);
    transform: none;
    box-shadow: none;
}

/* ===== EXPORT DROPDOWN ===== */

.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
}

.export-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.export-dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.export-dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.export-dropdown-item:hover {
    background: var(--bg-color);
}

/* ===== QUESTIONS DROPDOWN ===== */
/* Dropdown for Jeugddata example questions in quick actions bar */

.questions-dropdown {
    position: relative;
    display: inline-block;
}

.questions-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
}

.questions-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.questions-category-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.questions-category-header:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.questions-dropdown-item {
    padding: 0.625rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.questions-dropdown-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.questions-dropdown-item:hover {
    background: rgba(0, 184, 230, 0.08);
    color: var(--primary-color);
}

/* ===== JEUGDDATA DASHBOARD ===== */
/* Dashboard panel for the Jeugddata module, displayed inside .context-panel */

.jeugddata-dashboard {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-color);
    overflow-y: auto;
    overflow-x: hidden;
}

/* KPI Cards Row - horizontal flex, scrollable (LEGACY - kept for backward compatibility) */
.kpi-cards-row {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.kpi-cards-row::-webkit-scrollbar {
    height: 4px;
}

.kpi-cards-row::-webkit-scrollbar-track {
    background: transparent;
}

.kpi-cards-row::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* KPI Cards Grid - responsive CSS Grid layout (NEW) */
.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    flex-shrink: 0;
}

/* Compact mode for >6 KPIs - smaller padding and fonts */
.kpi-cards-grid.compact {
    gap: 0.5rem;
    padding: 0.75rem;
}

.kpi-cards-grid.compact .kpi-card {
    padding: 0.75rem 1rem;
}

.kpi-cards-grid.compact .kpi-value {
    font-size: 1.5rem;
}

.kpi-cards-grid.compact .kpi-label {
    font-size: 0.75rem;
}

.kpi-cards-grid.compact .kpi-trend {
    font-size: 0.7rem;
}

/* Show more button for >6 KPIs */
.kpi-expand-btn {
    grid-column: 1 / -1;
    padding: 0.5rem 1rem;
    border: 1px dashed var(--border-color);
    background: white;
    color: var(--text-light);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.kpi-expand-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Individual KPI Card */
.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 160px;
    max-width: 200px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

/* Override max-width for grid layout */
.kpi-cards-grid .kpi-card {
    max-width: none;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* ===== KPI CARD CLICKABLE (Sprint 2 - TG5) ===== */
/* Clickable KPI cards that trigger drill-down to detail view */

.kpi-card-clickable {
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.kpi-card-clickable:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 16px rgba(0, 184, 230, 0.2);
    transform: translateY(-2px);
}

.kpi-card-clickable:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.kpi-card-clickable:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 184, 230, 0.15);
}

/* KPI Card Header - contains label and status dot */
.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

/* KPI Status Dot - 8px colored indicator */
.kpi-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kpi-status-dot.status-green {
    background-color: var(--kpi-status-green);
}

.kpi-status-dot.status-orange {
    background-color: var(--kpi-status-orange);
}

.kpi-status-dot.status-red {
    background-color: var(--kpi-status-red);
}

.kpi-status-dot.status-neutral {
    background-color: var(--kpi-status-neutral);
}

/* KPI Card Body - contains formatted value */
.kpi-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* KPI Card Footer - contains trend and period comparison */
.kpi-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.kpi-unit {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: lowercase;
}

.kpi-label {
    font-size: 0.8125rem;
    color: var(--text-color);
    font-weight: 500;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.kpi-trend-up {
    color: var(--kpi-trend-up);
}

.kpi-trend-down {
    color: var(--kpi-trend-down);
}

.kpi-trend-stable {
    color: var(--kpi-trend-stable);
}

.kpi-trend-arrow {
    font-size: 0.625rem;
}

.kpi-trend-pct {
    font-size: 0.75rem;
}

/* Period label next to trend */
.kpi-period {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
}

/* ===== CHARTS CONTAINER (Sprint 2 - TG6: Multiple Charts Support) ===== */
/* Grid container for displaying multiple charts side by side */

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    padding: 0.5rem 1rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Single chart takes full width */
.charts-container:has(.chart-wrapper:only-child) {
    grid-template-columns: 1fr;
}

/* Chart Wrapper - individual chart with header and actions */
.chart-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    min-height: 250px;
    max-height: 400px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

/* Table result cards - compact sizing */
.chart-wrapper.table-result-card {
    min-height: auto;
    max-height: none;
    overflow: visible;
}

.chart-wrapper:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Chart Header - title and action buttons */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    flex-shrink: 0;
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 0.5rem;
}

.chart-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.chart-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.875rem;
}

.chart-action-btn:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.chart-action-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.chart-fullscreen-btn:hover {
    background: rgba(0, 184, 230, 0.1);
    color: var(--accent-color);
}

.chart-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Chart Body - canvas container */
.chart-body {
    flex: 1;
    padding: 0.75rem;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

/* ===== CHART FULLSCREEN MODE (Sprint 2 - TG7) ===== */
/* Fullscreen overlay for charts with backdrop */

.chart-fullscreen-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chart-fullscreen-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Fullscreen chart wrapper */
.chart-wrapper.chart-fullscreen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    max-height: 900px;
    z-index: 9999;
    animation: fullscreenSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes fullscreenSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.chart-wrapper.chart-fullscreen .chart-header {
    padding: 1rem 1.5rem;
}

.chart-wrapper.chart-fullscreen .chart-title {
    font-size: 1.125rem;
}

.chart-wrapper.chart-fullscreen .chart-action-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.chart-wrapper.chart-fullscreen .chart-body {
    padding: 1rem 1.5rem;
}

/* Fullscreen button icon change */
.chart-wrapper.chart-fullscreen .chart-fullscreen-btn::before {
    content: "Exit";
}

/* Chart Area (Legacy - kept for backward compatibility) */
.chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem;
    min-height: 200px;
    position: relative;
}

.chart-area canvas {
    width: 100% !important;
    max-height: 100%;
}

/* Context Text Area - scrollable markdown */
.context-text-area {
    flex-shrink: 0;
    max-height: 35%;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-color);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.context-text-area::-webkit-scrollbar {
    width: 6px;
}

.context-text-area::-webkit-scrollbar-track {
    background: transparent;
}

.context-text-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Markdown inside context text area */
.context-text-area h1,
.context-text-area h2,
.context-text-area h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.context-text-area h1 { font-size: 1.25rem; }
.context-text-area h2 { font-size: 1.1rem; }
.context-text-area h3 { font-size: 1rem; }

.context-text-area p {
    margin-bottom: 0.5rem;
}

.context-text-area ul, .context-text-area ol {
    margin-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.context-text-area strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Jeugddata Welcome State */
.jeugddata-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.jeugddata-welcome-content {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.jeugddata-welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.jeugddata-welcome-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.jeugddata-welcome-content p {
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 300px;
    margin: 0 auto;
}

/* ===== CATEGORY CARDS GRID ===== */
/* 2x3 grid of category cards for jeugddata example questions */

.category-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    width: 100%;
    max-width: 600px;
    transition: opacity 300ms ease-out;
}

.category-cards-grid.fade-out {
    opacity: 0;
}

.category-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s, transform 0.2s;
}

.category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.category-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.category-card-questions {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.example-question-link {
    font-size: 0.8125rem;
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    display: block;
    padding: 0.25rem 0;
}

.example-question-link:hover {
    color: #0096c7;
    text-decoration: underline;
}

/* ===== COLLAPSIBLE TABLES ===== */

.collapsible-table-container {
    position: relative;
    margin: 0.75rem 0;
}

.collapsible-table-container table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.collapsible-table-container th,
.collapsible-table-container td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.collapsible-table-container th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.collapsible-table-container td {
    font-size: 0.875rem;
}

/* Hidden rows when collapsed */
.collapsible-table-container tr.collapsed-row {
    display: none;
}

/* Expand/collapse button for tables */
.collapsible-table-container .table-toggle-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.collapsible-table-container .table-toggle-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* Smooth transition for table expansion */
.collapsible-table-container.expanding tr.collapsed-row {
    display: table-row;
    animation: fadeInRow 0.15s ease-out;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== COLLAPSIBLE LISTS ===== */

.collapsible-list-container {
    position: relative;
    margin: 0.75rem 0;
}

.collapsible-list-container ul,
.collapsible-list-container ol {
    margin-bottom: 0;
}

/* Hidden items when collapsed */
.collapsible-list-container li.collapsed-item {
    display: none;
}

/* Preserve numbering for ordered lists when expanded */
.collapsible-list-container ol {
    counter-reset: list-counter;
    list-style: none;
    padding-left: 1.5rem;
}

.collapsible-list-container ol li {
    counter-increment: list-counter;
    position: relative;
}

.collapsible-list-container ol li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: -1.5rem;
    width: 1.25rem;
    text-align: right;
    color: var(--text-light);
}

/* Expand/collapse button for lists */
.collapsible-list-container .list-toggle-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.collapsible-list-container .list-toggle-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* Smooth transition for list expansion */
.collapsible-list-container.expanding li.collapsed-item {
    display: list-item;
    animation: fadeInItem 0.15s ease-out;
}

@keyframes fadeInItem {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 10000;
    animation: contextMenuSlide 0.2s ease-out;
}

@keyframes contextMenuSlide {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: var(--bg-color);
}

.context-menu-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.context-menu-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--info-color);
    z-index: 9999;
    min-width: 250px;
    max-width: 400px;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-out;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--error-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification.info {
    border-left-color: var(--info-color);
}

/* Input Area */
#input-container {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

#chat-form {
    display: flex;
    gap: 0.75rem;
}

#message-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    padding: 0.875rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#send-button:hover {
    background: #245361;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 95, 111, 0.3);
}

#send-button:active {
    transform: translateY(0);
}

#send-button:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    color: var(--text-light);
    font-size: 0.7rem;
    border-top: 1px solid var(--border-color);
    white-space: nowrap;
}

.footer-separator {
    opacity: 0.4;
}

.git-sha {
    font-family: 'Courier New', monospace;
    opacity: 0.6;
    font-size: 0.65rem;
}

.status {
    font-size: 0.7rem;
}

.status:not(:empty)::before {
    content: '|';
    opacity: 0.4;
    margin-right: 0.5rem;
}

.status.connected {
    color: var(--success-color);
}

.status.error {
    color: var(--error-color);
}

/* Scrollbar styling */
#messages::-webkit-scrollbar {
    width: 8px;
}

#messages::-webkit-scrollbar-track {
    background: var(--bg-color);
}

#messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ===== RESPONSIVE STYLES ===== */

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .chat-panel,
    .context-panel,
    .map-panel {
        width: 100%;
        height: 50vh;
    }

    .chat-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    header {
        flex-direction: column;
        gap: 1rem;
    }

    .header-left {
        text-align: center;
        justify-content: center;
    }

    .header-logo {
        height: 40px;
    }

    .module-switcher {
        order: -1;
    }

    /* KPI Grid responsive - 2 columns on tablet */
    .kpi-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    /* Charts container responsive - stack on tablet */
    .charts-container {
        grid-template-columns: 1fr;
    }

    /* Fullscreen chart responsive */
    .chart-wrapper.chart-fullscreen {
        width: 95vw;
        height: 80vh;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0;
    }

    header {
        padding: 1.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    #chat-container {
        margin: 0;
        border-radius: 0;
    }

    .content {
        max-width: 95%;
    }

    #input-container {
        padding: 1rem;
    }

    #send-button span {
        display: none;
    }

    #send-button::after {
        content: '->';
        font-size: 1.25rem;
    }

    .quick-actions {
        padding: 0.5rem;
        gap: 0.25rem;
        overflow-x: auto;
    }

    .quick-action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .message-actions {
        margin-left: 0;
        margin-right: 0;
    }

    .action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        /* 44px minimum touch target for mobile */
        min-height: 44px;
    }

    .suggestion-buttons {
        margin-left: 0;
        margin-right: 0;
    }

    .suggestion-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        /* 44px minimum touch target for mobile */
        min-height: 44px;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .user-dropdown {
        right: -10px;
    }

    .export-dropdown-menu {
        min-width: 100px;
    }

    /* Questions dropdown responsive */
    .questions-dropdown-menu {
        min-width: 240px;
        max-height: 300px;
    }

    /* Category cards responsive - single column */
    .category-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .category-card {
        padding: 0.75rem;
    }

    /* Mobile collapsible buttons - 44px touch target */
    .collapsible-table-container .table-toggle-btn,
    .collapsible-list-container .list-toggle-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile table horizontal scroll */
    .collapsible-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .collapsible-table-container table {
        min-width: 100%;
    }

    /* Streaming message min-height to prevent layout shifts */
    .message.streaming .content {
        min-height: 3rem;
    }

    /* Retry button touch target */
    .stream-error-notice .retry-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    /* Module switcher responsive */
    .module-switcher {
        padding: 2px;
    }

    .module-btn {
        padding: 0.3rem 0.75rem;
        font-size: 0.75rem;
    }

    /* KPI cards smaller on mobile */
    .kpi-card {
        min-width: 140px;
        padding: 0.75rem 1rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    /* KPI Grid responsive - stack on mobile */
    .kpi-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .kpi-cards-grid.compact {
        gap: 0.375rem;
        padding: 0.5rem;
    }

    /* Chart wrapper mobile adjustments */
    .chart-wrapper {
        min-height: 200px;
        max-height: 300px;
    }

    .chart-header {
        padding: 0.5rem 0.75rem;
    }

    .chart-title {
        font-size: 0.8rem;
    }

    .chart-action-btn {
        width: 32px;
        height: 32px;
        min-height: 44px; /* Touch target */
    }

    /* Fullscreen chart mobile */
    .chart-wrapper.chart-fullscreen {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .chart-wrapper.chart-fullscreen .chart-action-btn {
        width: 44px;
        height: 44px;
    }
}

/* ===== PRINT STYLES FOR FULLSCREEN CHARTS ===== */
@media print {
    .chart-fullscreen-backdrop {
        display: none;
    }

    .chart-wrapper.chart-fullscreen {
        position: static;
        transform: none;
        width: 100%;
        height: auto;
        max-width: none;
        max-height: none;
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .chart-wrapper.chart-fullscreen .chart-actions {
        display: none;
    }

    .chart-wrapper.chart-fullscreen .chart-body {
        min-height: 400px;
    }
}

/* ===== HELP MODAL ===== */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    max-height: 85vh;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), #245361);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(85vh - 90px);
}

.modal-body section {
    margin-bottom: 2rem;
}

.modal-body section:last-child {
    margin-bottom: 0;
}

.modal-body h3 {
    color: var(--primary-color);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.modal-body p {
    margin: 0 0 0.75rem 0;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-body ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-color);
}

.modal-body li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.modal-body li:last-child {
    margin-bottom: 0;
}

.modal-body strong {
    color: var(--primary-color);
    font-weight: 600;
}

.facility-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.facility-tag {
    background: var(--background-light);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.facility-tag:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(44, 95, 111, 0.2);
}

/* Gebruiksdoel table */
.gebruiksdoel-table-wrapper {
    overflow-x: auto;
    margin-top: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.gebruiksdoel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.gebruiksdoel-table thead th {
    background: var(--background-light);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.gebruiksdoel-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.gebruiksdoel-table tbody tr:last-child {
    border-bottom: none;
}

.gebruiksdoel-table tbody tr:hover {
    background: var(--background-light);
}

.gebruiksdoel-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    color: var(--text-secondary);
}

.gebruiksdoel-name {
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
}

.gebruiksdoel-voorbeeld {
    color: #64748b;
    font-style: italic;
}

/* Modal responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1.5rem;
        max-height: calc(90vh - 70px);
    }

    .modal-body h3 {
        font-size: 1rem;
    }

    .help-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        margin-right: 0.5rem;
    }
}

/* ===== STORY ARTICLE RENDERER ===== */
/* Data-nieuwsartikel styling for storytelling renderers */

/* Article container with media format theming */
.story-article {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 0.5rem;
}

/* NOS Style - Bold headlines, blue accents, broadcast news */
.story-article.format-nos {
    --article-accent: #cc0000;
    --article-heading: #1a1a1a;
    --article-text: #333;
    --article-border: #cc0000;
}

.story-article.format-nos .story-headline {
    background: linear-gradient(135deg, #cc0000, #990000);
    color: white;
    padding: 1.5rem;
}

.story-article.format-nos .story-headline h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5rem 0;
}

.story-article.format-nos .story-chapeau {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
}

/* CBS Style - Data-focused, grey/orange, statistical */
.story-article.format-cbs {
    --article-accent: #f26522;
    --article-heading: #003d6a;
    --article-text: #333;
    --article-border: #f26522;
}

.story-article.format-cbs .story-headline {
    background: #003d6a;
    color: white;
    padding: 1.5rem;
}

.story-article.format-cbs .story-headline h2 {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5rem 0;
}

.story-article.format-cbs .story-chapeau {
    font-size: 0.9375rem;
    color: #f26522;
    font-weight: 500;
    margin: 0;
}

/* Binnenlands Bestuur Style - Professional, formal, green accents */
.story-article.format-binnenlands_bestuur {
    --article-accent: #009640;
    --article-heading: #1a1a1a;
    --article-text: #333;
    --article-border: #009640;
}

.story-article.format-binnenlands_bestuur .story-headline {
    background: #009640;
    color: white;
    padding: 1.5rem;
}

.story-article.format-binnenlands_bestuur .story-headline h2 {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5rem 0;
}

.story-article.format-binnenlands_bestuur .story-chapeau {
    font-size: 0.9375rem;
    opacity: 0.9;
    margin: 0;
}

/* Article body content */
.story-body {
    padding: 1.5rem;
}

/* Intro paragraph - lead text, typically bold */
.story-intro {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--article-heading, #1a1a1a);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--article-border, var(--border-color));
}

/* Article sections */
.story-section {
    margin-bottom: 1.5rem;
}

.story-section:last-child {
    margin-bottom: 0;
}

.story-section h3 {
    color: var(--article-heading, #1a1a1a);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.story-section-body {
    color: var(--article-text, #333);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.story-section-body p {
    margin-bottom: 0.75rem;
}

.story-section-body p:last-child {
    margin-bottom: 0;
}

.story-section-body strong {
    color: var(--article-accent, var(--primary-color));
    font-weight: 600;
}

/* Sources section */
.story-sources {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.story-sources-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.story-source-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.story-source-item {
    font-size: 0.8125rem;
    color: var(--text-color);
    padding: 0.25rem 0;
}

.story-source-item a {
    color: var(--accent-color);
    text-decoration: none;
}

.story-source-item a:hover {
    text-decoration: underline;
}

/* Metadata footer */
.story-metadata {
    background: var(--bg-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.story-metadata-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.story-metadata-label {
    font-weight: 500;
}

/* Article actions - copy, print buttons */
.story-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.story-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.story-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.story-action-btn.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* ===== DUIDING PANEL (Explanation Panel) ===== */
/* On-demand context panel for data points */

.duiding-trigger {
    color: var(--accent-color);
    cursor: pointer;
    border-bottom: 1px dashed var(--accent-color);
    transition: all 0.2s;
}

.duiding-trigger:hover {
    color: #0096c7;
    border-bottom-color: #0096c7;
}

.duiding-trigger:after {
    content: '?';
    font-size: 0.6875rem;
    font-weight: 600;
    margin-left: 0.125rem;
    opacity: 0.7;
}

.duiding-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    margin: 0.75rem 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.duiding-panel.collapsed {
    max-height: 0;
    margin: 0;
    border: none;
}

.duiding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    background: rgba(0, 184, 230, 0.08);
    cursor: pointer;
}

.duiding-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.duiding-toggle {
    font-size: 0.75rem;
    color: var(--text-light);
    transition: transform 0.2s;
}

.duiding-panel.collapsed .duiding-toggle {
    transform: rotate(-90deg);
}

.duiding-content {
    padding: 1rem;
}

.duiding-item {
    margin-bottom: 0.75rem;
}

.duiding-item:last-child {
    margin-bottom: 0;
}

.duiding-item-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.duiding-item-value {
    font-size: 0.875rem;
    color: var(--text-color);
    line-height: 1.5;
}

.duiding-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.8125rem;
    font-style: italic;
}

.duiding-loading .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== PRINT STYLES FOR STORY ARTICLES ===== */
@media print {
    .story-article {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .story-actions {
        display: none;
    }

    .story-headline {
        background: none !important;
        color: black !important;
        border-bottom: 2px solid black;
    }

    .story-headline h2 {
        font-size: 1.5rem;
    }

    .story-chapeau {
        color: #666 !important;
    }

    .story-section {
        page-break-inside: avoid;
    }

    .story-metadata {
        border-top: 1px solid #ccc;
        background: none;
    }

    .duiding-panel {
        border: 1px solid #ccc;
        background: #f5f5f5;
    }
}
